/** * Loads all characters from world DBs * * @access public * @static WoW_Account::LoadCharactersFromWorld() * @category Account Manager Class * @return void **/ private static function LoadCharactersFromWorld() { $db = null; $chars_data = array(); self::$characters_data = array(); $index = 0; $account_ids = array(); $count = count(self::$myGamesList); if ($count == 0) { return false; } for ($i = 0; $i < $count; ++$i) { $account_ids[] = self::$myGamesList[$i]['account_id']; } foreach (WoWConfig::$Realms as $realm_info) { $db = DB::ConnectToDB(DB_CHARACTERS, $realm_info['id']); $chars_data = DB::Characters()->select("\n SELECT\n `characters`.`guid`,\n `characters`.`account`,\n `characters`.`name`,\n `characters`.`class`,\n `characters`.`race`,\n `characters`.`gender`,\n `characters`.`level`,\n `guild_member`.`guildid` AS `guildId`,\n `guild`.`name` AS `guildName`\n FROM `characters` AS `characters`\n LEFT JOIN `guild_member` AS `guild_member` ON `guild_member`.`guid`=`characters`.`guid`\n LEFT JOIN `guild` AS `guild` ON `guild`.`guildid`=`guild_member`.`guildid`\n WHERE `account` IN (%s)", $account_ids); if (!$chars_data) { continue; } foreach ($chars_data as $char) { $status = WoW::GetRealmStatus($realm_info['id']); $tmp_char_data = array('account' => $char['account'], 'index' => $index, 'guid' => $char['guid'], 'name' => $char['name'], 'class' => $char['class'], 'class_text' => WoW_Locale::GetString('character_class_' . $char['class'], $char['gender']), 'class_key' => Data_Classes::$classes[$char['class']]['key'], 'race' => $char['race'], 'race_text' => WoW_Locale::GetString('character_race_' . $char['race'], $char['gender']), 'race_key' => Data_Races::$races[$char['race']]['key'], 'gender' => $char['gender'], 'level' => $char['level'], 'realmName' => $realm_info['name'], 'realmId' => $realm_info['id'], 'isActive' => 0, 'faction' => WoW_Utils::GetFactionId($char['race']), 'faction_text' => WoW_Utils::GetFactionId($char['race']) == FACTION_ALLIANCE ? 'alliance' : 'horde', 'guildId' => $char['guildId'], 'guildName' => $char['guildName'], 'guildUrl' => sprintf('%s/wow/%s/guild/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), urlencode($realm_info['name']), urlencode($char['guildName'])), 'url' => sprintf('%s/wow/%s/character/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), urlencode($realm_info['name']), urlencode($char['name'])), 'realmStatus' => isset($status[0], $status[0]['status']) ? $status[0]['status'] : 'down'); self::$characters_data[] = $tmp_char_data; ++$index; } } }