OregonCore  revision 3611e8a-git
Your Favourite TBC server
CharacterHandler.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "Common.h"
19 #include "ObjectAccessor.h"
20 #include "ObjectMgr.h"
21 #include "World.h"
22 #include "WorldPacket.h"
23 #include "WorldSession.h"
24 #include "Auth/md5.h"
25 #include "Database/DatabaseEnv.h"
26 #include "Database/DatabaseImpl.h"
27 
28 #include "ArenaTeam.h"
29 #include "Chat.h"
30 #include "Group.h"
31 #include "Guild.h"
32 #include "Language.h"
33 #include "Log.h"
34 #include "Opcodes.h"
35 #include "Player.h"
36 #include "PlayerDump.h"
37 #include "SharedDefines.h"
38 #include "SocialMgr.h"
39 #include "UpdateMask.h"
40 #include "Util.h"
41 #include "MapManager.h"
42 #include "SystemConfig.h"
43 #include "ScriptMgr.h"
44 
46 {
47  private:
50  public:
51  LoginQueryHolder(uint32 accountId, uint64 guid)
52  : m_accountId(accountId), m_guid(guid) { }
53  uint64 GetGuid() const
54  {
55  return m_guid;
56  }
58  {
59  return m_accountId;
60  }
61  bool Initialize();
62 };
63 
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 }
110 
111 // don't call WorldSession directly
112 // it may get deleted before the query callbacks get executed
113 // instead pass an account id to this handler
115 {
116  public:
118  {
119  WorldSession* session = sWorld.FindSession(account);
120  if (!session)
121  return;
122  session->HandleCharEnum(result);
123  }
125  {
126  if (!holder) return;
127  WorldSession* session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
128  if (!session)
129  {
130  delete holder;
131  return;
132  }
133  session->HandlePlayerLogin((LoginQueryHolder*)holder);
134  }
135 } chrHandler;
136 
138 {
139  WorldPacket data(SMSG_CHAR_ENUM, 100); // we guess size
140 
141  uint8 num = 0;
142 
143  data << num;
144 
145  _allowedCharsToLogin.clear();
146  if (result)
147  {
148  do
149  {
150  uint32 guidlow = (*result)[0].GetUInt32();
151  sLog.outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId());
152  if (Player::BuildEnumData(result, &data))
153  {
154  _allowedCharsToLogin.insert(guidlow);
155  ++num;
156  }
157  }
158  while (result->NextRow());
159  }
160 
161  data.put<uint8>(0, num);
162 
163  SendPacket(&data);
164 }
165 
167 {
168  // get all the data necessary for loading all characters (along with their pets) on the account
170  !sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) ?
171  // ------- Query Without Declined Names --------
172  // 0 1 2 3 4 5 6 7
173  "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.playerBytes, characters.playerBytes2, characters.level, "
174  // 8 9 10 11 12 13 14
175  "characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z, guild_member.guildid, characters.playerFlags, "
176  // 15 16 17 18 19
177  "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.data "
178  "FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='0' "
179  "LEFT JOIN guild_member ON characters.guid = guild_member.guid "
180  "WHERE characters.account = '%u' ORDER BY characters.guid"
181  :
182  // --------- Query With Declined Names ---------
183  // 0 1 2 3 4 5 6 7
184  "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.playerBytes, characters.playerBytes2, characters.level, "
185  // 8 9 10 11 12 13 14
186  "characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z, guild_member.guildid, characters.playerFlags, "
187  // 15 16 17 18 19 20
188  "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.data, character_declinedname.genitive "
189  "FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='0' "
190  "LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid "
191  "LEFT JOIN guild_member ON characters.guid = guild_member.guid "
192  "WHERE characters.account = '%u' ORDER BY characters.guid",
193  GetAccountId());
194 }
195 
197 {
198  std::string name;
199  uint8 race_, class_;
200 
201  recv_data >> name;
202 
203  recv_data >> race_;
204  recv_data >> class_;
205 
206  WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
207 
208  if (GetSecurity() == SEC_PLAYER)
209  {
210  if (uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
211  {
212  bool disabled = false;
213 
214  uint32 team = Player::TeamForRace(race_);
215  switch (team)
216  {
217  case ALLIANCE:
218  disabled = mask & (1 << 0);
219  break;
220  case HORDE:
221  disabled = mask & (1 << 1);
222  break;
223  }
224 
225  if (disabled)
226  {
227  data << (uint8)CHAR_CREATE_DISABLED;
228  SendPacket(&data);
229  return;
230  }
231  }
232  }
233 
234  ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
235  ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
236 
237  if (!classEntry || !raceEntry)
238  {
239  data << (uint8)CHAR_CREATE_FAILED;
240  SendPacket(&data);
241  sLog.outError("Class: %u or Race %u not found in DBC (Wrong DBC files?) or Cheater?", class_, race_);
242  return;
243  }
244 
245  // prevent character creating Expansion race without Expansion account
246  if (raceEntry->addon > Expansion())
247  {
248  data << (uint8)CHAR_CREATE_EXPANSION;
249  sLog.outError("Not Expansion 1 account:[%d] but tried to Create character with expansion 1 race (%u)", GetAccountId(), race_);
250  SendPacket(&data);
251  return;
252  }
253 
254  // prevent character creating with invalid name
255  if (!normalizePlayerName(name))
256  {
258  SendPacket(&data);
259  sLog.outError("Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
260  return;
261  }
262 
263  // check name limitations
264  if (!ObjectMgr::IsValidName(name, true))
265  {
267  SendPacket(&data);
268  return;
269  }
270 
271  if (GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(name))
272  {
273  data << (uint8)CHAR_NAME_RESERVED;
274  SendPacket(&data);
275  return;
276  }
277 
278  if (sObjectMgr.GetPlayerGUIDByName(name))
279  {
281  SendPacket(&data);
282  return;
283  }
284 
285  QueryResult_AutoPtr resultacct = LoginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%d'", GetAccountId());
286  if (resultacct)
287  {
288  Field* fields = resultacct->Fetch();
289  uint32 acctcharcount = fields[0].GetUInt32();
290 
291  if (acctcharcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_ACCOUNT))
292  {
294  SendPacket(&data);
295  return;
296  }
297  }
298 
299  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId());
300  uint8 charcount = 0;
301  if (result)
302  {
303  Field* fields = result->Fetch();
304  charcount = fields[0].GetUInt8();
305 
306  if (charcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_REALM))
307  {
309  SendPacket(&data);
310  return;
311  }
312  }
313 
314  bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
315  uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS);
316 
317  bool have_same_race = false;
318  if (!AllowTwoSideAccounts || skipCinematics == 1)
319  {
320  QueryResult_AutoPtr result2 = CharacterDatabase.PQuery("SELECT DISTINCT race FROM characters WHERE account = '%u' %s", GetAccountId(), skipCinematics == 1 ? "" : "LIMIT 1");
321  if (result2)
322  {
323  uint32 team_ = Player::TeamForRace(race_);
324 
325  Field* field = result2->Fetch();
326  uint8 race = field[0].GetUInt32();
327 
328  // need to check team only for first character
329  // @todo what to if account already has characters of both races?
330  if (!AllowTwoSideAccounts)
331  {
332  uint32 team = 0;
333  if (race > 0)
334  team = Player::TeamForRace(race);
335 
336  if (team != team_)
337  {
339  SendPacket(&data);
340  return;
341  }
342  }
343 
344  if (skipCinematics == 1)
345  {
346  // @todo check if cinematic already shown? (already logged in?; cinematic field)
347  while (race_ != race && result2->NextRow())
348  {
349  field = result2->Fetch();
350  race = field[0].GetUInt32();
351  }
352  have_same_race = race_ == race;
353  }
354  }
355  }
356 
357  // extract other data required for player creating
358  uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
359  recv_data >> gender >> skin >> face;
360  recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
361 
362  Player* pNewChar = new Player(this);
363  if (!pNewChar->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId))
364  {
365  // Player not create (race/class problem?)
366  delete pNewChar;
367 
368  data << (uint8)CHAR_CREATE_ERROR;
369  SendPacket(&data);
370 
371  return;
372  }
373 
374  if ((have_same_race && skipCinematics == 1) || skipCinematics == 2)
375  pNewChar->setCinematic(1); // not show intro
376 
377  // Player created, save it now
378  pNewChar->SaveToDB();
379  charcount += 1;
380 
381  LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID);
382  LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID);
383 
384  data << (uint8)CHAR_CREATE_SUCCESS;
385  SendPacket(&data);
386 
387  std::string IP_str = GetRemoteAddress();
388  sLog.outBasic("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());
389  sLog.outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());
390  delete pNewChar; // created only to call SaveToDB()
391 
392 }
393 
395 {
396  uint64 guid;
397  recv_data >> guid;
398 
399  // can't delete loaded character
400  if (sObjectMgr.GetPlayer(guid))
401  return;
402 
403  uint32 accountId = 0;
404  std::string name;
405 
406  // is guild leader
407  if (sObjectMgr.GetGuildByLeader(guid))
408  {
409  WorldPacket data(SMSG_CHAR_DELETE, 1);
411  SendPacket(&data);
412  return;
413  }
414 
415  // is arena team captain
416  if (sObjectMgr.GetArenaTeamByCaptain(guid))
417  {
418  WorldPacket data(SMSG_CHAR_DELETE, 1);
420  SendPacket(&data);
421  return;
422  }
423 
424  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid));
425  if (result)
426  {
427  Field* fields = result->Fetch();
428  accountId = fields[0].GetUInt32();
429  name = fields[1].GetCppString();
430  }
431 
432  // prevent deleting other players' characters using cheating tools
433  if (accountId != GetAccountId())
434  return;
435 
436  std::string IP_str = GetRemoteAddress();
437  sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
438  sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
439 
440  if (sLog.IsLogTypeEnabled(LOG_TYPE_CHAR)) // optimize GetPlayerDump call
441  {
442  std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid));
443  sLog.outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
444  }
445 
447 
448  WorldPacket data(SMSG_CHAR_DELETE, 1);
449  data << (uint8)CHAR_DELETE_SUCCESS;
450  SendPacket(&data);
451 }
452 
454 {
455  if (PlayerLoading() || GetPlayer() != NULL)
456  {
457  sLog.outError("Player tries to login again, AccountId = %d", GetAccountId());
458  KickPlayer();
459  return;
460  }
461 
462  m_playerLoading = true;
463  uint64 playerGuid = 0;
464 
465  DEBUG_LOG("WORLD: Recvd Player Logon Message");
466 
467  recv_data >> playerGuid;
468 
469  if (!CharCanLogin(GUID_LOPART(playerGuid)))
470  {
471  sLog.outError("Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
472  KickPlayer();
473  return;
474  }
475 
476  if (!CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE guid='%d' AND account='%d'", GUID_LOPART(playerGuid), GetAccountId()))
477  KickPlayer();
478 
479  LoginQueryHolder* holder = new LoginQueryHolder(GetAccountId(), playerGuid);
480  if (!holder->Initialize())
481  {
482  delete holder; // delete all unprocessed queries
483  m_playerLoading = false;
484  return;
485  }
486 
488 }
489 
491 {
492  uint64 playerGuid = holder->GetGuid();
493 
494  Player* pCurrChar = new Player(this);
495  // for send server info and strings (config)
496  ChatHandler chH = ChatHandler(pCurrChar);
497 
498  // "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
499  if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
500  {
501  KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
502  delete pCurrChar; // delete it manually
503  delete holder; // delete all unprocessed queries
504  m_playerLoading = false;
505  return;
506  }
507 
508  pCurrChar->GetMotionMaster()->Initialize();
509 
510  SetPlayer(pCurrChar);
511 
512  pCurrChar->SendDungeonDifficulty(false);
513 
515  data << pCurrChar->GetMapId();
516  data << pCurrChar->GetPositionX();
517  data << pCurrChar->GetPositionY();
518  data << pCurrChar->GetPositionZ();
519  data << pCurrChar->GetOrientation();
520  SendPacket(&data);
521 
523  for (int i = 0; i < 32; i++)
524  data << uint32(0);
525  SendPacket(&data);
526 
527  data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
528  data << uint8(2); // unknown value
529  data << uint8(0); // enable(1)/disable(0) voice chat interface in client
530  SendPacket(&data);
531 
532  // Send MOTD
533  {
534  data.Initialize(SMSG_MOTD, 50); // new in 2.0.1
535  data << (uint32)0;
536 
537  uint32 linecount = 0;
538  std::string str_motd = sWorld.GetMotd();
539  std::string::size_type pos, nextpos;
540 
541  pos = 0;
542  while ((nextpos = str_motd.find('@', pos)) != std::string::npos)
543  {
544  if (nextpos != pos)
545  {
546  data << str_motd.substr(pos, nextpos - pos);
547  ++linecount;
548  }
549  pos = nextpos + 1;
550  }
551 
552  if (pos < str_motd.length())
553  {
554  data << str_motd.substr(pos);
555  ++linecount;
556  }
557 
558  data.put(0, linecount);
559 
560  SendPacket(&data);
561  DEBUG_LOG("WORLD: Sent motd (SMSG_MOTD)");
562 
563  // send server info
564  if (sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
566 
567  DEBUG_LOG("WORLD: Sent server info");
568  }
569 
571 
572  if (resultGuild)
573  {
574  Field* fields = resultGuild->Fetch();
575  pCurrChar->SetInGuild(fields[0].GetUInt32());
576  pCurrChar->SetRank(fields[1].GetUInt32());
577  }
578  else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
579  {
580  pCurrChar->SetInGuild(0);
581  pCurrChar->SetRank(0);
582  }
583 
584  if (!pCurrChar->IsAlive())
585  pCurrChar->SendCorpseReclaimDelay(true);
586 
588 
589  //Show cinematic at the first time that player login
590  if (!pCurrChar->getCinematic())
591  {
592  pCurrChar->setCinematic(1);
593 
594  if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace()))
595  {
596  pCurrChar->SendCinematicStart(rEntry->CinematicSequence);
597 
598  // send new char string if not empty
599  if (!sWorld.GetNewCharString().empty())
600  chH.PSendSysMessage("%s", sWorld.GetNewCharString().c_str());
601  }
602  }
603 
604  if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar))
605  {
606  // normal delayed teleport protection not applied (and this correct) for this case (Player object just created)
607  AreaTrigger const* at = sObjectMgr.GetGoBackTrigger(pCurrChar->GetMapId());
608  if (at)
609  pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation());
610  else
611  pCurrChar->TeleportToHomebind();
612  }
613 
614  ObjectAccessor::Instance().AddObject(pCurrChar);
615  //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName());
616 
617  if (pCurrChar->GetGuildId() != 0)
618  {
619  Guild* guild = sObjectMgr.GetGuildById(pCurrChar->GetGuildId());
620  if (guild)
621  {
622  data.Initialize(SMSG_GUILD_EVENT, (1 + 1 + guild->GetMOTD().size() + 1));
623  data << uint8(GE_MOTD);
624  data << uint8(1);
625  data << guild->GetMOTD();
626  SendPacket(&data);
627  DEBUG_LOG("WORLD: Sent guild-motd (SMSG_GUILD_EVENT)");
628 
629  data.Initialize(SMSG_GUILD_EVENT, (5 + 10)); // we guess size
630  data << (uint8)GE_SIGNED_ON;
631  data << (uint8)1;
632  data << pCurrChar->GetName();
633  data << pCurrChar->GetGUID();
634  guild->BroadcastPacket(&data);
635  DEBUG_LOG("WORLD: Sent guild-signed-on (SMSG_GUILD_EVENT)");
636 
637  // Increment online members of the guild
638  guild->IncOnlineMemberCount();
639  }
640  else
641  {
642  // remove wrong guild data
643  sLog.outError("Player %s (GUID: %u) marked as member of invalid guild (id: %u), removing guild membership for player.", pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
644  pCurrChar->SetInGuild(0);
645  }
646  }
647 
648  pCurrChar->GetSocial()->SendSocialList();
649 
650  pCurrChar->SendInitialPacketsAfterAddToMap();
651 
652  CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow());
653  LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = '%u'", GetAccountId());
654  pCurrChar->SetInGameTime(getMSTime());
655 
656  // friend status
657  sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true);
658 
659  // Place character in world (and load zone) before some object loading
660  pCurrChar->LoadCorpse();
661 
662  // setting Ghost+speed if dead
663  if (pCurrChar->m_deathState != ALIVE)
664  {
665  // not blizz like, we must correctly save and load player instead...
666  if (pCurrChar->getRace() == RACE_NIGHTELF)
667  {
668  pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
669  }
670 
671  pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
672 
673  pCurrChar->SetWaterWalking(true);
674  }
675 
676  pCurrChar->ContinueTaxiFlight();
677 
678  // Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
679  pCurrChar->LoadPet();
680 
681  // Set FFA PvP for non GM in non-rest mode
682  if (sWorld.IsFFAPvPRealm() && !pCurrChar->IsGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING))
683  pCurrChar->SetFFAPvP(true);
684 
686  pCurrChar->SetContestedPvP();
687 
688  // Apply at_login requests
689  if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
690  {
691  pCurrChar->ResetSpells();
692  SendNotification(LANG_RESET_SPELLS);
693  }
694 
695  if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
696  {
697  pCurrChar->ResetTalents(true);
698  SendNotification(LANG_RESET_TALENTS);
699  }
700 
701  // announce group about member online (must be after add to player list to receive announce to self)
702  if (Group* group = pCurrChar->GetGroup())
703  group->SendUpdate();
704 
705  // show time before shutdown if shutdown planned.
706  if (sWorld.IsShuttingDown())
707  sWorld.ShutdownMsg(true, pCurrChar);
708 
709  // ImpConfig - Max weapon skill when logging in
710  if (sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL))
711  pCurrChar->UpdateSkillsToMaxSkillsForLevel();
712 
713  if (sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
714  pCurrChar->SetTaxiCheater(true);
715 
716  //Reputations if "StartAllReputation" is enabled
717  if (sWorld.getConfig(CONFIG_START_ALL_REP))
718  {
719  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(942), 42999);
720  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(935), 42999);
721  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(936), 42999);
722  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1011), 42999);
723  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(970), 42999);
724  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(967), 42999);
725  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(989), 42999);
726  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(932), 42999);
727  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(934), 42999);
728  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1038), 42999);
729  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1077), 42999);
730  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(990), 42999);
731 
732  // Factions depending on team, like cities and some more stuff
733  switch (pCurrChar->GetTeam())
734  {
735  case ALLIANCE:
736  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(72), 42999);
737  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(47), 42999);
738  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(69), 42999);
739  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(930), 42999);
740  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(730), 42999);
741  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(978), 42999);
742  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(54), 42999);
743  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(946), 42999);
744  break;
745  case HORDE:
746  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(76), 42999);
747  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(68), 42999);
748  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(81), 42999);
749  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(911), 42999);
750  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(729), 42999);
751  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(941), 42999);
752  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(530), 42999);
753  pCurrChar->GetReputationMgr().SetReputation(sFactionStore.LookupEntry(947), 42999);
754  break;
755  default:
756  break;
757  }
758  }
759 
760  if (pCurrChar->IsGameMaster())
761  SendNotification(LANG_GM_ON);
762 
763  if (!pCurrChar->isGMVisible())
764  {
765  pCurrChar->AddAura(SPELL_INVISIBILITY, pCurrChar);
766  SendNotification(LANG_INVISIBLE_INVISIBLE);
767  }
768 
769  std::string IP_str = GetRemoteAddress();
770  sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid: %u)",
771  GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow());
772 
773  m_playerLoading = false;
774 
775  //Hook for OnLogin Event
776  sScriptMgr.OnLogin(pCurrChar);
777 
778  delete holder;
779 }
780 
782 {
783  DEBUG_LOG("WORLD: Received CMSG_SET_FACTION_ATWAR");
784 
785  uint32 repListID;
786  uint8 flag;
787 
788  recv_data >> repListID;
789  recv_data >> flag;
790 
791  GetPlayer()->GetReputationMgr().SetAtWar(repListID, flag != 0);
792 }
793 
795 {
796  DEBUG_LOG("WORLD: Received CMSG_MEETING_STONE_INFO");
797 
799  data << uint32(0) << uint8(6);
800  SendPacket(&data);
801 }
802 
804 {
805  uint32 iFlag;
806  recv_data >> iFlag;
807 
808  uint32 wInt = (iFlag / 32);
809  if (wInt >= 8)
810  {
811  //sLog.outError("CHEATER? Account:[%d] Guid[%u] tried to send wrong CMSG_TUTORIAL_FLAG", GetAccountId(),GetGUID());
812  return;
813  }
814  uint32 rInt = (iFlag % 32);
815 
816  uint32 tutflag = GetPlayer()->GetTutorialInt(wInt);
817  tutflag |= (1 << rInt);
818  GetPlayer()->SetTutorialInt(wInt, tutflag);
819 
820  //sLog.outDebug("Received Tutorial Flag Set {%u}.", iFlag);
821 }
822 
824 {
825  for (uint8 i = 0; i < 8; ++i)
826  GetPlayer()->SetTutorialInt(i, 0xFFFFFFFF);
827 }
828 
830 {
831  for (uint8 i = 0; i < 8; ++i)
832  GetPlayer()->SetTutorialInt(i, 0x00000000);
833 }
834 
836 {
837  DEBUG_LOG("WORLD: Received CMSG_SET_WATCHED_FACTION");
838  int32 repId;
839  recv_data >> repId;
840  GetPlayer()->SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, repId);
841 }
842 
844 {
845  DEBUG_LOG("WORLD: Received CMSG_SET_FACTION_INACTIVE");
846  uint32 replistid;
847  uint8 inactive;
848  recv_data >> replistid >> inactive;
849 
850 
851  _player->GetReputationMgr().SetInactive(replistid, inactive != 0);
852 }
853 
855 {
856  DEBUG_LOG("CMSG_TOGGLE_HELM for %s", _player->GetName());
857  _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
858 }
859 
861 {
862  DEBUG_LOG("CMSG_TOGGLE_CLOAK for %s", _player->GetName());
863  _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
864 }
865 
867 {
868  uint64 guid;
869  std::string newname;
870 
871  recv_data >> guid;
872  recv_data >> newname;
873 
874  // prevent character rename to invalid name
875  if (!normalizePlayerName(newname))
876  {
877  WorldPacket data(SMSG_CHAR_RENAME, 1);
878  data << uint8(CHAR_NAME_NO_NAME);
879  SendPacket(&data);
880  return;
881  }
882 
883  if (!ObjectMgr::IsValidName(newname, true))
884  {
885  WorldPacket data(SMSG_CHAR_RENAME, 1);
887  SendPacket(&data);
888  return;
889  }
890 
891  // check name limitations
892  if (GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(newname))
893  {
894  WorldPacket data(SMSG_CHAR_RENAME, 1);
895  data << uint8(CHAR_NAME_RESERVED);
896  SendPacket(&data);
897  return;
898  }
899 
900  std::string escaped_newname = newname;
901  CharacterDatabase.escape_string(escaped_newname);
902 
903  // make sure that the character belongs to the current account, that rename at login is enabled
904  // and that there is no character with the desired new name
906  GetAccountId(), newname,
907  "SELECT guid, name FROM characters WHERE guid = %d AND account = %d AND (at_login & %d) = %d AND NOT EXISTS (SELECT NULL FROM characters WHERE name = '%s')",
908  GUID_LOPART(guid), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str()
909  );
910 }
911 
913 {
914  WorldSession* session = sWorld.FindSession(accountId);
915  if (!session)
916  return;
917 
918  if (!result)
919  {
920  WorldPacket data(SMSG_CHAR_RENAME, 1);
921  data << uint8(CHAR_CREATE_ERROR);
922  session->SendPacket(&data);
923  return;
924  }
925 
926  uint32 guidLow = result->Fetch()[0].GetUInt32();
927  uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
928  std::string oldname = result->Fetch()[1].GetCppString();
929 
930  CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_RENAME), guidLow);
931  CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid ='%u'", guidLow);
932 
933  sLog.outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", session->GetAccountId(), session->GetRemoteAddress().c_str(), oldname.c_str(), guidLow, newname.c_str());
934 
935  WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + (newname.size() + 1));
936  data << uint8(RESPONSE_SUCCESS);
937  data << uint64(guid);
938  data << newname;
939  session->SendPacket(&data);
940 }
941 
943 {
944  uint64 guid;
945 
946  recv_data >> guid;
947 
948  // not accept declined names for unsupported languages
949  std::string name;
950  if (!sObjectMgr.GetPlayerNameByGUID(guid, name))
951  {
953  data << uint32(1);
954  data << uint64(guid);
955  SendPacket(&data);
956  return;
957  }
958 
959  std::wstring wname;
960  if (!Utf8toWStr(name, wname))
961  {
963  data << uint32(1);
964  data << uint64(guid);
965  SendPacket(&data);
966  return;
967  }
968 
969  if (!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
970  {
972  data << uint32(1);
973  data << uint64(guid);
974  SendPacket(&data);
975  return;
976  }
977 
978  std::string name2;
979  DeclinedName declinedname;
980 
981  recv_data >> name2;
982 
983  if (name2 != name) // character have different name
984  {
986  data << uint32(1);
987  data << uint64(guid);
988  SendPacket(&data);
989  return;
990  }
991 
992  for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
993  {
994  recv_data >> declinedname.name[i];
995  if (!normalizePlayerName(declinedname.name[i]))
996  {
998  data << uint32(1);
999  data << uint64(guid);
1000  SendPacket(&data);
1001  return;
1002  }
1003  }
1004 
1005  if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
1006  {
1008  data << uint32(1);
1009  data << uint64(guid);
1010  SendPacket(&data);
1011  return;
1012  }
1013 
1014  for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
1015  CharacterDatabase.escape_string(declinedname.name[i]);
1016 
1018  CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", GUID_LOPART(guid));
1019  CharacterDatabase.PExecute("INSERT INTO character_declinedname (guid, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%s','%s','%s','%s','%s')",
1020  GUID_LOPART(guid), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str());
1022 
1024  data << uint32(0); // OK
1025  data << uint64(guid);
1026  SendPacket(&data);
1027 }
1028 
LoginQueryHolder(uint32 accountId, uint64 guid)
Group * GetGroup()
Definition: Player.h:2589
void SetContestedPvP(Player *attackedPlayer=NULL)
Definition: Unit.cpp:12225
static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars=true, bool deleteFinally=false)
Definition: Player.cpp:3893
void IncOnlineMemberCount()
Definition: Guild.h:455
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
void LoadCorpse()
Definition: Player.cpp:15211
static bool BuildEnumData(QueryResult_AutoPtr result, WorldPacket *data)
Definition: Player.cpp:1398
class CharacterHandler chrHandler
void SaveToDB()
Definition: Player.cpp:16219
uint32 GetAccountId() const
Definition: Guild.h:105
void HandleCharEnumOpcode(WorldPacket &recvPacket)
NULL Dbg ErrDB Arena Chat LOG_TYPE_CHAR
Definition: Log.cpp:547
void HandleSetWatchedFactionInactiveOpcode(WorldPacket &recv_data)
Map * GetMap() const
Definition: Object.h:829
void SetInGuild(uint32 GuildId)
Definition: Player.h:1825
void HandleTutorialFlag(WorldPacket &recv_data)
bool BeginTransaction()
Definition: Database.cpp:533
bool ResetTalents(bool no_cost=false)
Definition: Player.cpp:3523
void SendSocialList()
Definition: SocialMgr.cpp:119
void HandleToggleHelmOpcode(WorldPacket &recv_data)
void HandleToggleCloakOpcode(WorldPacket &recv_data)
bool isCyrillicCharacter(wchar_t wchar)
Definition: Util.h:172
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
bool isGMVisible() const
Definition: Player.h:1032
static void HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname)
std::string const & GetRemoteAddress()
Definition: WorldSession.h:113
Definition: Field.h:24
std::string const & GetMOTD() const
Definition: Guild.h:290
void HandleDeclinedPlayerNameOpcode(WorldPacket &recv_data)
MotionMaster * GetMotionMaster()
Definition: Unit.h:2001
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
Definition: Util.cpp:380
uint32 getMSTime()
Definition: Timer.h:32
void HandleSetFactionAtWar(WorldPacket &recv_data)
Definition: Unit.h:413
void SendDungeonDifficulty(bool IsInGroup)
Definition: Player.cpp:16958
void AddObject(T *object)
#define sLog
Log class singleton.
Definition: Log.h:187
void ResetSpells()
Definition: Player.cpp:19176
void HandleTutorialReset(WorldPacket &recv_data)
ACE_INT32 int32
Definition: Define.h:67
void SendInitialPacketsBeforeAddToMap()
Definition: Player.cpp:18984
unsigned long escape_string(char *to, const char *from, unsigned long length)
Definition: Database.cpp:212
void setCinematic(int cine)
Definition: Player.h:1764
bool LoadFromDB(uint32 guid, SqlQueryHolder *holder)
Definition: Player.cpp:14413
void HandlePlayerLoginOpcode(WorldPacket &recvPacket)
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:37
void ContinueTaxiFlight()
Definition: Player.cpp:17901
void HandleSetWatchedFactionIndexOpcode(WorldPacket &recv_data)
uint32 GetAccountId() const
Definition: WorldSession.h:100
bool IsGameMaster() const
Definition: Player.h:1009
bool SetWaterWalking(bool enable, bool packetOnly=false) override
Definition: Player.cpp:20785
uint32 GetGUIDLow() const
Definition: Object.h:160
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:704
void AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:13382
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:294
#define sObjectMgr
Definition: ObjectMgr.h:1285
void SendPacket(WorldPacket const *packet)
static bool IsValidName(const std::string &name, bool create=false)
Definition: ObjectMgr.cpp:6586
bool CommitTransaction()
Definition: Database.cpp:551
bool TeleportToHomebind(uint32 options=0)
Definition: Player.h:2462
void SendInitialPacketsAfterAddToMap()
Definition: Player.cpp:19032
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesEntryfmt)
void SetRank(uint32 rankId)
Definition: Player.h:1829
uint32 target_mapId
Definition: ObjectMgr.h:344
void HandleCharDeleteOpcode(WorldPacket &recvPacket)
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition: Player.cpp:1556
ACE_UINT8 uint8
Definition: Define.h:73
float GetOrientation() const
Definition: Position.h:100
#define UI64FMTD
Definition: Common.h:149
PlayerSocial * GetSocial()
Definition: Player.h:985
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
std::string GetCppString() const
Definition: Field.h:52
static uint32 TeamForRace(uint8 race)
Definition: Player.cpp:5885
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition: Chat.cpp:855
DatabaseType LoginDatabase
Accessor to the realm/login database.
Definition: Main.cpp:55
void SendCinematicStart(uint32 CinematicSequenceId)
Definition: Player.cpp:5788
bool IsAlive() const
Definition: Unit.h:1433
float GetPositionY() const
Definition: Position.h:98
DeathState m_deathState
Definition: Unit.h:2133
void put(size_t pos, T value)
Definition: ByteBuffer.h:79
#define MAKE_NEW_GUID(l, e, h)
Definition: ObjectGuid.h:80
void CastSpell(Unit *Victim, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
Definition: Unit.cpp:1174
int getCinematic()
Definition: Player.h:1760
void BroadcastPacket(WorldPacket *packet)
Definition: Guild.cpp:611
void LoadPet()
Definition: Player.cpp:15486
float GetPositionZ() const
Definition: Position.h:99
#define DEBUG_LOG(...)
Definition: Log.h:194
void SetFFAPvP(bool state)
Definition: Player.cpp:17079
bool AsyncPQuery(Class *object, void(Class::*method)(QueryResult_AutoPtr), const char *format,...) ATTR_PRINTF(4
Definition: DatabaseImpl.h:128
void HandleMeetingStoneInfo(WorldPacket &recPacket)
uint32 GetMapId() const
Definition: Object.h:585
bool void SetSize(size_t size)
void HandleTutorialClear(WorldPacket &recv_data)
virtual bool AddPlayerToMap(Player *)
Definition: Map.cpp:393
void SendCorpseReclaimDelay(uint32 delay)
Definition: Player.cpp:20129
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
#define _FULLVERSION
Definition: SystemConfig.h:40
#define sSocialMgr
Definition: SocialMgr.h:166
void HandlePlayerLoginCallback(QueryResult_AutoPtr, SqlQueryHolder *holder)
uint32 GetGuildId()
Definition: Player.h:1837
bool Create(uint32 guidlow, const std::string &name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId)
Definition: Player.cpp:498
const char * GetName() const
Definition: Object.h:692
ReputationMgr & GetReputationMgr()
Definition: Player.h:2091
bool HasAtLoginFlag(AtLoginFlags f) const
Definition: Player.h:2489
ACE_UINT64 uint64
Definition: Define.h:70
void HandleCharEnumCallback(QueryResult_AutoPtr result, uint32 account)
uint8 getRace() const
Definition: Unit.h:1037
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
uint32 realmID
Id of the realm.
Definition: Main.cpp:57
float target_X
Definition: ObjectMgr.h:345
bool bool bool bool bool bool bool bool DelayQueryHolder(Class *object, void(Class::*method)(QueryResult_AutoPtr, SqlQueryHolder *), SqlQueryHolder *holder)
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const &names)
Definition: ObjectMgr.cpp:6906
uint64 GetGuid() const
uint32 GetTeam() const
Definition: Player.h:2075
QueryResult_AutoPtr GetResult(size_t index)
#define sScriptMgr
Definition: Group.h:526
float target_Y
Definition: ObjectMgr.h:346
#define sWorld
Definition: World.h:860
void UpdateSkillsToMaxSkillsForLevel()
Definition: Player.cpp:5404
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:299
ACE_UINT32 uint32
Definition: Define.h:71
void Initialize()
float GetPositionX() const
Definition: Position.h:97
Definition: Guild.h:265
bool SetReputation(FactionEntry const *factionEntry, int32 standing)
void SetInGameTime(uint32 time)
Definition: Player.h:1458
std::string name[MAX_DECLINED_NAME_CASES]
Definition: Unit.h:708
Definition: Player.h:922
void HandleChangePlayerNameOpcode(WorldPacket &recv_data)
void clear()
Definition: ByteBuffer.h:73
float target_Z
Definition: ObjectMgr.h:347
void HandlePlayerLogin(LoginQueryHolder *holder)
bool SetPQuery(size_t index, const char *format,...) ATTR_PRINTF(3
void HandleCharEnum(QueryResult_AutoPtr result)
Definition: Group.h:154
void HandleCharCreateOpcode(WorldPacket &recvPacket)
std::string GetDump(uint32 guid)
Definition: PlayerDump.cpp:367
void SetTaxiCheater(bool on)
Definition: Player.h:1027
const uint64 & GetGUID() const
Definition: Object.h:156