OregonCore  revision fb2a440-git
Your Favourite TBC server
LoginQueryHolder Class Reference
+ Inheritance diagram for LoginQueryHolder:

Public Member Functions

 LoginQueryHolder (uint32 accountId, uint64 guid)
 
uint64 GetGuid () const
 
uint32 GetAccountId () const
 
bool Initialize ()
 
- Public Member Functions inherited from SqlQueryHolder
 SqlQueryHolder ()
 
 ~SqlQueryHolder ()
 
bool SetQuery (size_t index, const char *sql)
 
bool SetPQuery (size_t index, const char *format,...) ATTR_PRINTF(3
 
bool void SetSize (size_t size)
 
QueryResult_AutoPtr GetResult (size_t index)
 
void SetResult (size_t index, QueryResult_AutoPtr result)
 
bool Execute (Oregon::IQueryCallback *callback, SqlDelayThread *thread, SqlResultQueue *queue)
 

Private Attributes

uint32 m_accountId
 
uint64 m_guid
 

Detailed Description

Definition at line 45 of file CharacterHandler.cpp.

Constructor & Destructor Documentation

LoginQueryHolder::LoginQueryHolder ( uint32  accountId,
uint64  guid 
)
inline

Definition at line 51 of file CharacterHandler.cpp.

Referenced by WorldSession::HandlePlayerLoginOpcode().

52  : m_accountId(accountId), m_guid(guid) { }

Member Function Documentation

uint64 LoginQueryHolder::GetGuid ( ) const
inline

Definition at line 53 of file CharacterHandler.cpp.

References m_guid.

Referenced by WorldSession::HandlePlayerLogin().

54  {
55  return m_guid;
56  }
bool LoginQueryHolder::Initialize ( )

Definition at line 64 of file CharacterHandler.cpp.

References CONFIG_DECLINED_NAMES_USED, GetAccountId(), GUID_LOPART, m_guid, MAX_PLAYER_LOGIN_QUERY, PLAYER_LOGIN_QUERY_LOADACTIONS, PLAYER_LOGIN_QUERY_LOADARENAINFO, PLAYER_LOGIN_QUERY_LOADAURAS, PLAYER_LOGIN_QUERY_LOADBGDATA, PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, PLAYER_LOGIN_QUERY_LOADFROM, PLAYER_LOGIN_QUERY_LOADGROUP, PLAYER_LOGIN_QUERY_LOADGUILD, PLAYER_LOGIN_QUERY_LOADHOMEBIND, PLAYER_LOGIN_QUERY_LOADINVENTORY, PLAYER_LOGIN_QUERY_LOADMAILCOUNT, PLAYER_LOGIN_QUERY_LOADMAILDATE, PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, PLAYER_LOGIN_QUERY_LOADREPUTATION, PLAYER_LOGIN_QUERY_LOADSKILLS, PLAYER_LOGIN_QUERY_LOADSOCIALLIST, PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, PLAYER_LOGIN_QUERY_LOADSPELLS, PLAYER_LOGIN_QUERY_LOADTUTORIALS, realmID, SqlQueryHolder::SetPQuery(), SqlQueryHolder::SetSize(), sWorld, and UI64FMTD.

Referenced by GetAccountId(), and WorldSession::HandlePlayerLoginOpcode().

65 {
67 
68  bool res = true;
69 
70  // NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure.
71  // !!! NOTE: including unused `zone`,`online`
73  "SELECT guid, account, data, name, race, class, gender, level, xp, "
74  "money, playerBytes, playerBytes2, playerFlags, position_x, "
75  "position_y, position_z, map, orientation, taximask, cinematic, "
76  "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, "
77  "resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, "
78  "trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
79  "online, death_expire_time, taxi_path, dungeon_difficulty, "
80  "arenaPoints, totalHonorPoints, todayHonorPoints, "
81  "yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, "
82  "chosenTitle, watchedFaction, drunk, health, "
83  "powerMana, powerRage, powerFocus, powerEnergy, powerHappiness, instance_id, grantableLevels "
84  "FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
85  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
86  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));
87  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,item_caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
88  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
89  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));
90  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, "SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
91  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTUTORIALS, "SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u' AND realmid = '%u'", GetAccountId(), realmID);
92  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
93  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT itemEntry,creatorGuid,giftCreatorGuid,count,duration,charges,flags,enchantments,randomPropertyId,durability,itemTextId,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));
94  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
95  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));
96  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid));
97  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
98  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));
99  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));
100  if (sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
101  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'", GUID_LOPART(m_guid));
102  // in other case still be dummy query
103  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
104  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
105  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));
106  res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", GUID_LOPART(m_guid));
107 
108  return res;
109 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
uint32 GetAccountId() const
#define UI64FMTD
Definition: Common.h:149
bool void SetSize(size_t size)
ACE_UINT64 uint64
Definition: Define.h:70
uint32 realmID
Id of the realm.
Definition: Main.cpp:57
#define sWorld
Definition: World.h:860
bool SetPQuery(size_t index, const char *format,...) ATTR_PRINTF(3

Member Data Documentation

uint32 LoginQueryHolder::m_accountId
private

Definition at line 48 of file CharacterHandler.cpp.

Referenced by GetAccountId().

uint64 LoginQueryHolder::m_guid
private

Definition at line 49 of file CharacterHandler.cpp.

Referenced by GetGuid(), and Initialize().


The documentation for this class was generated from the following file: