|
|
|
@@ -62,45 +62,132 @@ bool LoginQueryHolder::Initialize()
|
|
|
|
|
SetSize(MAX_PLAYER_LOGIN_QUERY);
|
|
|
|
|
|
|
|
|
|
bool res = true;
|
|
|
|
|
uint32 lowGuid = GUID_LOPART(m_guid);
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADFROM, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_GROUP);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGROUP, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_BOUNDINSTANCES);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_AURAS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADAURAS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_SPELLS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_QUESTSTATUS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_DAILYQUESTSTATUS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_WEKLYQUESTSTATUS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_REPUTATION);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_INVENTORY);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ACTIONS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_MAILCOUNT);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
stmt->setUInt64(1, uint64(time(NULL)));
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_MAILDATE);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_SOCIALLIST);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_HOMEBIND);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_SPELLCOOLDOWNS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, stmt);
|
|
|
|
|
|
|
|
|
|
// NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure.
|
|
|
|
|
// !!! NOTE: including unused `zone`,`online`
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags,"
|
|
|
|
|
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost,"
|
|
|
|
|
"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask,"
|
|
|
|
|
"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk,"
|
|
|
|
|
"health, power1, power2, power3, power4, power5, power6, power7, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT guid FROM group_member WHERE memberGuid =%u", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS,"SELECT quest FROM character_queststatus_weekly WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT creatorGuid,giftCreatorGuid,count,duration,charges,flags,enchantments,randomPropertyId,durability,playedTime,text,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT a.button,a.action,a.type FROM character_action as a, characters as c WHERE a.guid = c.guid AND a.spec = c.activespec AND a.guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
if (sWorld.getBoolConfig(CONFIG_DECLINED_NAMES_USED))
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
|
|
|
|
|
// in other case still be dummy query
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, "SELECT instance_id, team, join_x, join_y, join_z, join_o, join_map, taxi_start, taxi_end, mount_spell FROM character_battleground_data WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT spec, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 FROM character_glyphs WHERE guid='%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT spell, spec FROM character_talent WHERE guid='%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, "SELECT type, time, data FROM character_account_data WHERE guid='%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADRANDOMBG, "SELECT guid FROM character_battleground_random WHERE guid = '%u'", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENASTATS, "SELECT slot, personal_rating, matchmaker_rating FROM character_arena_stats WHERE guid = '%u' ORDER BY slot ASC", GUID_LOPART(m_guid));
|
|
|
|
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBANNED, "SELECT guid FROM character_banned WHERE guid = %u AND active = 1", GUID_LOPART(m_guid));
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_DECLINEDNAMES);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_GUILD);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGUILD, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ARENAINFO);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ACHIEVEMENTS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_CRITERIAPROGRESS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_EQUIPMENTSETS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_BGDATA);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_GLYPHS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_TALENTS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ACCOUNTDATA);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_SKILLS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_RANDOMBG);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADRANDOMBG, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ARENASTATS);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADARENASTATS, stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_BANNED);
|
|
|
|
|
stmt->setUInt32(0, lowGuid);
|
|
|
|
|
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBANNED, stmt);
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
@@ -605,7 +692,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|
|
|
|
SendPacket(&data);
|
|
|
|
|
|
|
|
|
|
// load player specific part before send times
|
|
|
|
|
LoadAccountData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA),PER_CHARACTER_CACHE_MASK);
|
|
|
|
|
LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA), PER_CHARACTER_CACHE_MASK);
|
|
|
|
|
SendAccountDataTimes(PER_CHARACTER_CACHE_MASK);
|
|
|
|
|
|
|
|
|
|
data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
|
|
|
|
@@ -652,13 +739,10 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
|
|
|
|
|
QueryResult resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
|
|
|
|
|
|
|
|
|
|
if (resultGuild)
|
|
|
|
|
if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGUILD))
|
|
|
|
|
{
|
|
|
|
|
Field *fields = resultGuild->Fetch();
|
|
|
|
|
pCurrChar->SetInGuild(fields[0].GetUInt32());
|
|
|
|
|
pCurrChar->SetRank(fields[1].GetUInt32());
|
|
|
|
|
pCurrChar->SetInGuild(resultGuild->GetUInt32(0));
|
|
|
|
|
pCurrChar->SetRank(resultGuild->GetUInt32(1));
|
|
|
|
|
}
|
|
|
|
|
else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
|
|
|
|
|
{
|
|
|
|
|