[9290] Some cleanups in realmd, no functional changes
[getmangos.git] / src / game / WorldSession.h
blobb74f224f44ff032a728b38100dd90772f12c9ada
1 /*
2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 /// \addtogroup u2w
20 /// @{
21 /// \file
23 #ifndef __WORLDSESSION_H
24 #define __WORLDSESSION_H
26 #include "Common.h"
27 #include "SharedDefines.h"
29 struct ItemPrototype;
30 struct AuctionEntry;
31 struct DeclinedName;
33 class Creature;
34 class Item;
35 class Object;
36 class Player;
37 class Unit;
38 class WorldPacket;
39 class WorldSocket;
40 class QueryResult;
41 class LoginQueryHolder;
42 class CharacterHandler;
43 class GMTicket;
45 enum AccountDataType
47 GLOBAL_CONFIG_CACHE = 0, // 0x01 g
48 PER_CHARACTER_CONFIG_CACHE = 1, // 0x02 p
49 GLOBAL_BINDINGS_CACHE = 2, // 0x04 g
50 PER_CHARACTER_BINDINGS_CACHE = 3, // 0x08 p
51 GLOBAL_MACROS_CACHE = 4, // 0x10 g
52 PER_CHARACTER_MACROS_CACHE = 5, // 0x20 p
53 PER_CHARACTER_LAYOUT_CACHE = 6, // 0x40 p
54 PER_CHARACTER_CHAT_CACHE = 7, // 0x80 p
55 NUM_ACCOUNT_DATA_TYPES = 8
58 #define GLOBAL_CACHE_MASK 0x15
59 #define PER_CHARACTER_CACHE_MASK 0xEA
61 struct AccountData
63 AccountData() : Time(0), Data("") {}
65 time_t Time;
66 std::string Data;
69 struct AddonInfo
71 AddonInfo(const std::string& name, uint8 enabled, uint32 crc)
73 Name = name;
74 Enabled = enabled;
75 CRC = crc;
78 std::string Name;
79 uint8 Enabled;
80 uint32 CRC;
83 typedef std::list<AddonInfo> AddonsList;
85 enum PartyOperation
87 PARTY_OP_INVITE = 0,
88 PARTY_OP_LEAVE = 2
91 enum PartyResult
93 PARTY_RESULT_OK = 0,
94 PARTY_RESULT_CANT_FIND_TARGET = 1,
95 PARTY_RESULT_NOT_IN_YOUR_PARTY = 2,
96 PARTY_RESULT_NOT_IN_YOUR_INSTANCE = 3,
97 PARTY_RESULT_PARTY_FULL = 4,
98 PARTY_RESULT_ALREADY_IN_GROUP = 5,
99 PARTY_RESULT_YOU_NOT_IN_GROUP = 6,
100 PARTY_RESULT_YOU_NOT_LEADER = 7,
101 PARTY_RESULT_TARGET_UNFRIENDLY = 8,
102 PARTY_RESULT_TARGET_IGNORE_YOU = 9,
103 PARTY_RESULT_INVITE_RESTRICTED = 13
106 /// Player session in the World
107 class MANGOS_DLL_SPEC WorldSession
109 friend class CharacterHandler;
110 public:
111 WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale);
112 ~WorldSession();
114 bool PlayerLoading() const { return m_playerLoading; }
115 bool PlayerLogout() const { return m_playerLogout; }
116 bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
119 void SizeError(WorldPacket const& packet, uint32 size) const;
121 void ReadAddonsInfo(WorldPacket &data);
122 void SendAddonsInfo();
124 void SendPacket(WorldPacket const* packet);
125 void SendNotification(const char *format,...) ATTR_PRINTF(2,3);
126 void SendNotification(int32 string_id,...);
127 void SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName);
128 void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type);
129 void SendLfgUpdate(uint8 unk1, uint8 unk2, uint8 unk3);
130 void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res);
131 void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
132 void SendSetPhaseShift(uint32 phaseShift);
133 void SendQueryTimeResponse();
135 AccountTypes GetSecurity() const { return _security; }
136 uint32 GetAccountId() const { return _accountId; }
137 Player* GetPlayer() const { return _player; }
138 char const* GetPlayerName() const;
139 void SetSecurity(AccountTypes security) { _security = security; }
140 std::string const& GetRemoteAddress() { return m_Address; }
141 void SetPlayer(Player *plr);
142 uint8 Expansion() const { return m_expansion; }
144 /// Session in auth.queue currently
145 void SetInQueue(bool state) { m_inQueue = state; }
147 /// Is the user engaged in a log out process?
148 bool isLogingOut() const { return _logoutTime || m_playerLogout; }
150 /// Engage the logout process for the user
151 void LogoutRequest(time_t requestTime)
153 _logoutTime = requestTime;
156 /// Is logout cooldown expired?
157 bool ShouldLogOut(time_t currTime) const
159 return (_logoutTime > 0 && currTime >= _logoutTime + 20);
162 void LogoutPlayer(bool Save);
163 void KickPlayer();
165 void QueuePacket(WorldPacket* new_packet);
166 bool Update(uint32 diff);
168 /// Handle the authentication waiting queue (to be completed)
169 void SendAuthWaitQue(uint32 position);
171 //void SendTestCreatureQueryOpcode( uint32 entry, uint64 guid, uint32 testvalue );
172 void SendNameQueryOpcode(Player* p);
173 void SendNameQueryOpcodeFromDB(uint64 guid);
174 static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId);
176 void SendTrainerList( uint64 guid );
177 void SendTrainerList( uint64 guid, const std::string& strTitle );
178 void SendListInventory( uint64 guid );
179 void SendShowBank( uint64 guid );
180 void SendTabardVendorActivate( uint64 guid );
181 void SendSpiritResurrect();
182 void SendBindPoint(Creature* npc);
183 void SendGMTicketGetTicket(uint32 status, char const* text);
184 void SendGMResponse(GMTicket *ticket);
186 void SendAttackStop(Unit const* enemy);
188 void SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId );
190 void SendTradeStatus(uint32 status);
191 void SendCancelTrade();
193 void SendStablePet(uint64 guid );
194 void SendPetitionQueryOpcode( uint64 petitionguid);
195 void SendUpdateTrade();
197 //pet
198 void SendPetNameQuery(uint64 guid, uint32 petnumber);
200 // Account Data
201 AccountData *GetAccountData(AccountDataType type) { return &m_accountData[type]; }
202 void SetAccountData(AccountDataType type, time_t time_, std::string data);
203 void SendAccountDataTimes(uint32 mask);
204 void LoadGlobalAccountData();
205 void LoadAccountData(QueryResult* result, uint32 mask);
206 void LoadTutorialsData();
207 void SendTutorialsData();
208 void SaveTutorialsData();
209 uint32 GetTutorialInt(uint32 intId )
211 return m_Tutorials[intId];
214 void SetTutorialInt(uint32 intId, uint32 value)
216 if(m_Tutorials[intId] != value)
218 m_Tutorials[intId] = value;
219 m_TutorialsChanged = true;
222 //used with item_page table
223 bool SendItemInfo( uint32 itemid, WorldPacket data );
225 //auction
226 void SendAuctionHello( uint64 guid, Creature * unit );
227 void SendAuctionCommandResult( uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
228 void SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
229 void SendAuctionOwnerNotification( AuctionEntry * auction );
230 void SendAuctionOutbiddedMail( AuctionEntry * auction, uint32 newPrice );
231 void SendAuctionCancelledToBidderMail( AuctionEntry* auction );
233 //Item Enchantment
234 void SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID);
235 void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,uint32 slot,uint32 Duration);
237 //Taxi
238 void SendTaxiStatus( uint64 guid );
239 void SendTaxiMenu( Creature* unit );
240 void SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 pathNode = 0 );
241 bool SendLearnNewTaxiNode( Creature* unit );
243 // Guild/Arena Team
244 void SendGuildCommandResult(uint32 typecmd, const std::string& str, uint32 cmdresult);
245 void SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id);
246 void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3);
247 void SendNotInArenaTeamPacket(uint8 type);
248 void SendPetitionShowList( uint64 guid );
249 void SendSaveGuildEmblem( uint32 msg );
250 void SendBattleGroundOrArenaJoinError(uint8 err);
252 // Looking For Group
253 // TRUE values set by client sending CMSG_LFG_SET_AUTOJOIN and CMSG_LFM_CLEAR_AUTOFILL before player login
254 bool LookingForGroup_auto_join;
255 bool LookingForGroup_auto_add;
257 void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data);
259 void DoLootRelease( uint64 lguid );
261 // Account mute time
262 time_t m_muteTime;
264 // Locales
265 LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
266 int GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
267 const char *GetMangosString(int32 entry) const;
269 uint32 GetLatency() const { return m_latency; }
270 void SetLatency(uint32 latency) { m_latency = latency; }
271 uint32 getDialogStatus(Player *pPlayer, Object* questgiver, uint32 defstatus);
273 public: // opcodes handlers
275 void Handle_NULL(WorldPacket& recvPacket); // not used
276 void Handle_EarlyProccess( WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead
277 void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client
278 void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client
280 void HandleCharEnumOpcode(WorldPacket& recvPacket);
281 void HandleCharDeleteOpcode(WorldPacket& recvPacket);
282 void HandleCharCreateOpcode(WorldPacket& recvPacket);
283 void HandlePlayerLoginOpcode(WorldPacket& recvPacket);
284 void HandleCharEnum(QueryResult * result);
285 void HandlePlayerLogin(LoginQueryHolder * holder);
287 // played time
288 void HandlePlayedTime(WorldPacket& recvPacket);
290 // new
291 void HandleMoveUnRootAck(WorldPacket& recvPacket);
292 void HandleMoveRootAck(WorldPacket& recvPacket);
293 void HandleLookingForGroup(WorldPacket& recvPacket);
295 // new inspect
296 void HandleInspectOpcode(WorldPacket& recvPacket);
298 // new party stats
299 void HandleInspectHonorStatsOpcode(WorldPacket& recvPacket);
301 void HandleMoveWaterWalkAck(WorldPacket& recvPacket);
302 void HandleFeatherFallAck(WorldPacket &recv_data);
304 void HandleMoveHoverAck( WorldPacket & recv_data );
306 void HandleMountSpecialAnimOpcode(WorldPacket &recvdata);
308 // character view
309 void HandleShowingHelmOpcode(WorldPacket& recv_data);
310 void HandleShowingCloakOpcode(WorldPacket& recv_data);
312 // repair
313 void HandleRepairItemOpcode(WorldPacket& recvPacket);
315 // Knockback
316 void HandleMoveKnockBackAck(WorldPacket& recvPacket);
318 void HandleMoveTeleportAck(WorldPacket& recvPacket);
319 void HandleForceSpeedChangeAck( WorldPacket & recv_data );
321 void HandlePingOpcode(WorldPacket& recvPacket);
322 void HandleAuthSessionOpcode(WorldPacket& recvPacket);
323 void HandleRepopRequestOpcode(WorldPacket& recvPacket);
324 void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket);
325 void HandleLootMoneyOpcode(WorldPacket& recvPacket);
326 void HandleLootOpcode(WorldPacket& recvPacket);
327 void HandleLootReleaseOpcode(WorldPacket& recvPacket);
328 void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
329 void HandleWhoOpcode(WorldPacket& recvPacket);
330 void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
331 void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
332 void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
333 void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket);
334 void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
335 void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket);
337 void HandleGMTicketDeleteTicketOpcode(WorldPacket& recvPacket);
338 void HandleGMTicketUpdateTextOpcode(WorldPacket& recvPacket);
340 void HandleGMSurveySubmit(WorldPacket& recvPacket);
341 void HandleGMResponseResolve(WorldPacket& recv_data);
343 void HandleTogglePvP(WorldPacket& recvPacket);
345 void HandleZoneUpdateOpcode(WorldPacket& recvPacket);
346 void HandleSetTargetOpcode(WorldPacket& recvPacket);
347 void HandleSetSelectionOpcode(WorldPacket& recvPacket);
348 void HandleStandStateChangeOpcode(WorldPacket& recvPacket);
349 void HandleEmoteOpcode(WorldPacket& recvPacket);
350 void HandleContactListOpcode(WorldPacket& recvPacket);
351 void HandleAddFriendOpcode(WorldPacket& recvPacket);
352 static void HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote);
353 void HandleDelFriendOpcode(WorldPacket& recvPacket);
354 void HandleAddIgnoreOpcode(WorldPacket& recvPacket);
355 static void HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 accountId);
356 void HandleDelIgnoreOpcode(WorldPacket& recvPacket);
357 void HandleSetContactNotesOpcode(WorldPacket& recvPacket);
358 void HandleBugOpcode(WorldPacket& recvPacket);
359 void HandleSetAmmoOpcode(WorldPacket& recvPacket);
360 void HandleItemNameQueryOpcode(WorldPacket& recvPacket);
362 void HandleAreaTriggerOpcode(WorldPacket& recvPacket);
364 void HandleSetFactionAtWar( WorldPacket & recv_data );
365 void HandleSetFactionCheat( WorldPacket & recv_data );
366 void HandleSetWatchedFactionOpcode(WorldPacket & recv_data);
367 void HandleSetFactionInactiveOpcode(WorldPacket & recv_data);
369 void HandleUpdateAccountData(WorldPacket& recvPacket);
370 void HandleRequestAccountData(WorldPacket& recvPacket);
371 void HandleSetActionButtonOpcode(WorldPacket& recvPacket);
373 void HandleGameObjectUseOpcode(WorldPacket& recPacket);
374 void HandleMeetingStoneInfo(WorldPacket& recPacket);
375 void HandleGameobjectReportUse(WorldPacket& recvPacket);
377 void HandleNameQueryOpcode(WorldPacket& recvPacket);
379 void HandleQueryTimeOpcode(WorldPacket& recvPacket);
381 void HandleCreatureQueryOpcode(WorldPacket& recvPacket);
383 void HandleGameObjectQueryOpcode(WorldPacket& recvPacket);
385 void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
386 void HandleMoveWorldportAckOpcode(); // for server-side calls
388 void HandleMovementOpcodes(WorldPacket& recvPacket);
389 void HandleSetActiveMoverOpcode(WorldPacket &recv_data);
390 void HandleMoveNotActiveMover(WorldPacket &recv_data);
391 void HandleDismissControlledVehicle(WorldPacket &recv_data);
392 void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data);
394 void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );
396 void HandleBattlefieldStatusOpcode(WorldPacket &recv_data);
397 void HandleBattleMasterHelloOpcode(WorldPacket &recv_data);
399 void HandleGroupInviteOpcode(WorldPacket& recvPacket);
400 //void HandleGroupCancelOpcode(WorldPacket& recvPacket);
401 void HandleGroupAcceptOpcode(WorldPacket& recvPacket);
402 void HandleGroupDeclineOpcode(WorldPacket& recvPacket);
403 void HandleGroupUninviteOpcode(WorldPacket& recvPacket);
404 void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket);
405 void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket);
406 void HandleGroupDisbandOpcode(WorldPacket& recvPacket);
407 void HandleOptOutOfLootOpcode( WorldPacket &recv_data );
408 void HandleLootMethodOpcode(WorldPacket& recvPacket);
409 void HandleLootRoll( WorldPacket &recv_data );
410 void HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data );
411 void HandleRaidTargetUpdateOpcode( WorldPacket & recv_data );
412 void HandleRaidReadyCheckOpcode( WorldPacket & recv_data );
413 void HandleRaidReadyCheckFinishedOpcode( WorldPacket & recv_data );
414 void HandleGroupRaidConvertOpcode( WorldPacket & recv_data );
415 void HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data );
416 void HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data );
417 void HandlePartyAssignmentOpcode( WorldPacket & recv_data );
419 void HandlePetitionBuyOpcode(WorldPacket& recv_data);
420 void HandlePetitionShowSignOpcode(WorldPacket& recv_data);
421 void HandlePetitionQueryOpcode(WorldPacket& recv_data);
422 void HandlePetitionRenameOpcode(WorldPacket& recv_data);
423 void HandlePetitionSignOpcode(WorldPacket& recv_data);
424 void HandlePetitionDeclineOpcode(WorldPacket& recv_data);
425 void HandleOfferPetitionOpcode(WorldPacket& recv_data);
426 void HandleTurnInPetitionOpcode(WorldPacket& recv_data);
428 void HandleGuildQueryOpcode(WorldPacket& recvPacket);
429 void HandleGuildCreateOpcode(WorldPacket& recvPacket);
430 void HandleGuildInviteOpcode(WorldPacket& recvPacket);
431 void HandleGuildRemoveOpcode(WorldPacket& recvPacket);
432 void HandleGuildAcceptOpcode(WorldPacket& recvPacket);
433 void HandleGuildDeclineOpcode(WorldPacket& recvPacket);
434 void HandleGuildInfoOpcode(WorldPacket& recvPacket);
435 void HandleGuildEventLogQueryOpcode(WorldPacket& recvPacket);
436 void HandleGuildRosterOpcode(WorldPacket& recvPacket);
437 void HandleGuildPromoteOpcode(WorldPacket& recvPacket);
438 void HandleGuildDemoteOpcode(WorldPacket& recvPacket);
439 void HandleGuildLeaveOpcode(WorldPacket& recvPacket);
440 void HandleGuildDisbandOpcode(WorldPacket& recvPacket);
441 void HandleGuildLeaderOpcode(WorldPacket& recvPacket);
442 void HandleGuildMOTDOpcode(WorldPacket& recvPacket);
443 void HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket);
444 void HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket);
445 void HandleGuildRankOpcode(WorldPacket& recvPacket);
446 void HandleGuildAddRankOpcode(WorldPacket& recvPacket);
447 void HandleGuildDelRankOpcode(WorldPacket& recvPacket);
448 void HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket);
449 void HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket);
451 void HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvPacket);
452 void HandleTaxiQueryAvailableNodes(WorldPacket& recvPacket);
453 void HandleActivateTaxiOpcode(WorldPacket& recvPacket);
454 void HandleActivateTaxiExpressOpcode(WorldPacket& recvPacket);
455 void HandleMoveSplineDoneOpcode(WorldPacket& recvPacket);
457 void HandleTabardVendorActivateOpcode(WorldPacket& recvPacket);
458 void HandleBankerActivateOpcode(WorldPacket& recvPacket);
459 void HandleBuyBankSlotOpcode(WorldPacket& recvPacket);
460 void HandleTrainerListOpcode(WorldPacket& recvPacket);
461 void HandleTrainerBuySpellOpcode(WorldPacket& recvPacket);
462 void HandlePetitionShowListOpcode(WorldPacket& recvPacket);
463 void HandleGossipHelloOpcode(WorldPacket& recvPacket);
464 void HandleGossipSelectOptionOpcode(WorldPacket& recvPacket);
465 void HandleSpiritHealerActivateOpcode(WorldPacket& recvPacket);
466 void HandleNpcTextQueryOpcode(WorldPacket& recvPacket);
467 void HandleBinderActivateOpcode(WorldPacket& recvPacket);
468 void HandleListStabledPetsOpcode(WorldPacket& recvPacket);
469 void HandleStablePet(WorldPacket& recvPacket);
470 void HandleUnstablePet(WorldPacket& recvPacket);
471 void HandleBuyStableSlot(WorldPacket& recvPacket);
472 void HandleStableRevivePet(WorldPacket& recvPacket);
473 void HandleStableSwapPet(WorldPacket& recvPacket);
475 void HandleDuelAcceptedOpcode(WorldPacket& recvPacket);
476 void HandleDuelCancelledOpcode(WorldPacket& recvPacket);
478 void HandleAcceptTradeOpcode(WorldPacket& recvPacket);
479 void HandleBeginTradeOpcode(WorldPacket& recvPacket);
480 void HandleBusyTradeOpcode(WorldPacket& recvPacket);
481 void HandleCancelTradeOpcode(WorldPacket& recvPacket);
482 void HandleClearTradeItemOpcode(WorldPacket& recvPacket);
483 void HandleIgnoreTradeOpcode(WorldPacket& recvPacket);
484 void HandleInitiateTradeOpcode(WorldPacket& recvPacket);
485 void HandleSetTradeGoldOpcode(WorldPacket& recvPacket);
486 void HandleSetTradeItemOpcode(WorldPacket& recvPacket);
487 void HandleUnacceptTradeOpcode(WorldPacket& recvPacket);
489 void HandleAuctionHelloOpcode(WorldPacket& recvPacket);
490 void HandleAuctionListItems( WorldPacket & recv_data );
491 void HandleAuctionListBidderItems( WorldPacket & recv_data );
492 void HandleAuctionSellItem( WorldPacket & recv_data );
493 void HandleAuctionRemoveItem( WorldPacket & recv_data );
494 void HandleAuctionListOwnerItems( WorldPacket & recv_data );
495 void HandleAuctionPlaceBid( WorldPacket & recv_data );
496 void HandleAuctionListPendingSales( WorldPacket & recv_data );
498 void HandleGetMailList( WorldPacket & recv_data );
499 void HandleSendMail( WorldPacket & recv_data );
500 void HandleMailTakeMoney( WorldPacket & recv_data );
501 void HandleMailTakeItem( WorldPacket & recv_data );
502 void HandleMailMarkAsRead( WorldPacket & recv_data );
503 void HandleMailReturnToSender( WorldPacket & recv_data );
504 void HandleMailDelete( WorldPacket & recv_data );
505 void HandleItemTextQuery( WorldPacket & recv_data);
506 void HandleMailCreateTextItem(WorldPacket & recv_data );
507 void HandleQueryNextMailTime(WorldPacket & recv_data );
508 void HandleCancelChanneling(WorldPacket & recv_data );
510 void SendItemPageInfo( ItemPrototype *itemProto );
511 void HandleSplitItemOpcode(WorldPacket& recvPacket);
512 void HandleSwapInvItemOpcode(WorldPacket& recvPacket);
513 void HandleDestroyItemOpcode(WorldPacket& recvPacket);
514 void HandleAutoEquipItemOpcode(WorldPacket& recvPacket);
515 void HandleItemQuerySingleOpcode(WorldPacket& recvPacket);
516 void HandleSellItemOpcode(WorldPacket& recvPacket);
517 void HandleBuyItemInSlotOpcode(WorldPacket& recvPacket);
518 void HandleBuyItemOpcode(WorldPacket& recvPacket);
519 void HandleListInventoryOpcode(WorldPacket& recvPacket);
520 void HandleAutoStoreBagItemOpcode(WorldPacket& recvPacket);
521 void HandleReadItem(WorldPacket& recvPacket);
522 void HandleAutoEquipItemSlotOpcode(WorldPacket & recvPacket);
523 void HandleSwapItem( WorldPacket & recvPacket);
524 void HandleBuybackItem(WorldPacket & recvPacket);
525 void HandleAutoBankItemOpcode(WorldPacket& recvPacket);
526 void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket);
527 void HandleWrapItemOpcode(WorldPacket& recvPacket);
529 void HandleAttackSwingOpcode(WorldPacket& recvPacket);
530 void HandleAttackStopOpcode(WorldPacket& recvPacket);
531 void HandleSetSheathedOpcode(WorldPacket& recvPacket);
533 void HandleUseItemOpcode(WorldPacket& recvPacket);
534 void HandleOpenItemOpcode(WorldPacket& recvPacket);
535 void HandleCastSpellOpcode(WorldPacket& recvPacket);
536 void HandleCancelCastOpcode(WorldPacket& recvPacket);
537 void HandleCancelAuraOpcode(WorldPacket& recvPacket);
538 void HandleCancelGrowthAuraOpcode(WorldPacket& recvPacket);
539 void HandleCancelAutoRepeatSpellOpcode(WorldPacket& recvPacket);
541 void HandleLearnTalentOpcode(WorldPacket& recvPacket);
542 void HandleLearnPreviewTalents(WorldPacket& recvPacket);
543 void HandleTalentWipeConfirmOpcode(WorldPacket& recvPacket);
544 void HandleUnlearnSkillOpcode(WorldPacket& recvPacket);
546 void HandleQuestgiverStatusQueryOpcode(WorldPacket& recvPacket);
547 void HandleQuestgiverStatusMultipleQuery(WorldPacket& recvPacket);
548 void HandleQuestgiverHelloOpcode(WorldPacket& recvPacket);
549 void HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvPacket);
550 void HandleQuestgiverQueryQuestOpcode(WorldPacket& recvPacket);
551 void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket);
552 void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket);
553 void HandleQuestQueryOpcode(WorldPacket& recvPacket);
554 void HandleQuestgiverCancel(WorldPacket& recv_data );
555 void HandleQuestLogSwapQuest(WorldPacket& recv_data );
556 void HandleQuestLogRemoveQuest(WorldPacket& recv_data);
557 void HandleQuestConfirmAccept(WorldPacket& recv_data);
558 void HandleQuestgiverCompleteQuest(WorldPacket& recv_data);
559 void HandleQuestgiverQuestAutoLaunch(WorldPacket& recvPacket);
560 void HandlePushQuestToParty(WorldPacket& recvPacket);
561 void HandleQuestPushResult(WorldPacket& recvPacket);
563 bool processChatmessageFurtherAfterSecurityChecks(std::string&, uint32);
564 void SendPlayerNotFoundNotice(std::string name);
565 void HandleMessagechatOpcode(WorldPacket& recvPacket);
566 void HandleTextEmoteOpcode(WorldPacket& recvPacket);
567 void HandleChatIgnoredOpcode(WorldPacket& recvPacket);
569 void HandleReclaimCorpseOpcode( WorldPacket& recvPacket );
570 void HandleCorpseQueryOpcode( WorldPacket& recvPacket );
571 void HandleCorpseMapPositionQuery( WorldPacket& recvPacket );
572 void HandleResurrectResponseOpcode(WorldPacket& recvPacket);
573 void HandleSummonResponseOpcode(WorldPacket& recv_data);
575 void HandleJoinChannel(WorldPacket& recvPacket);
576 void HandleLeaveChannel(WorldPacket& recvPacket);
577 void HandleChannelList(WorldPacket& recvPacket);
578 void HandleChannelPassword(WorldPacket& recvPacket);
579 void HandleChannelSetOwner(WorldPacket& recvPacket);
580 void HandleChannelOwner(WorldPacket& recvPacket);
581 void HandleChannelModerator(WorldPacket& recvPacket);
582 void HandleChannelUnmoderator(WorldPacket& recvPacket);
583 void HandleChannelMute(WorldPacket& recvPacket);
584 void HandleChannelUnmute(WorldPacket& recvPacket);
585 void HandleChannelInvite(WorldPacket& recvPacket);
586 void HandleChannelKick(WorldPacket& recvPacket);
587 void HandleChannelBan(WorldPacket& recvPacket);
588 void HandleChannelUnban(WorldPacket& recvPacket);
589 void HandleChannelAnnouncements(WorldPacket& recvPacket);
590 void HandleChannelModerate(WorldPacket& recvPacket);
591 void HandleChannelDisplayListQuery(WorldPacket& recvPacket);
592 void HandleGetChannelMemberCount(WorldPacket& recvPacket);
593 void HandleSetChannelWatch(WorldPacket& recvPacket);
595 void HandleCompleteCinematic(WorldPacket& recvPacket);
596 void HandleNextCinematicCamera(WorldPacket& recvPacket);
598 void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket);
599 void HandlePageTextQueryOpcode(WorldPacket& recvPacket);
601 void HandleTutorialFlag ( WorldPacket & recv_data );
602 void HandleTutorialClear( WorldPacket & recv_data );
603 void HandleTutorialReset( WorldPacket & recv_data );
605 //Pet
606 void HandlePetAction( WorldPacket & recv_data );
607 void HandlePetNameQuery( WorldPacket & recv_data );
608 void HandlePetSetAction( WorldPacket & recv_data );
609 void HandlePetAbandon( WorldPacket & recv_data );
610 void HandlePetRename( WorldPacket & recv_data );
611 void HandlePetCancelAuraOpcode( WorldPacket& recvPacket );
612 void HandlePetUnlearnOpcode( WorldPacket& recvPacket );
613 void HandlePetSpellAutocastOpcode( WorldPacket& recvPacket );
614 void HandlePetCastSpellOpcode( WorldPacket& recvPacket );
615 void HandlePetLearnTalent( WorldPacket& recvPacket );
616 void HandleLearnPreviewTalentsPet( WorldPacket& recvPacket );
618 void HandleSetActionBarToggles(WorldPacket& recv_data);
620 void HandleCharRenameOpcode(WorldPacket& recv_data);
621 static void HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uint32 accountId, std::string newname);
622 void HandleSetPlayerDeclinedNames(WorldPacket& recv_data);
624 void HandleTotemDestroyed(WorldPacket& recv_data);
626 //BattleGround
627 void HandleBattlemasterHelloOpcode(WorldPacket &recv_data);
628 void HandleBattlemasterJoinOpcode(WorldPacket &recv_data);
629 void HandleBattleGroundPlayerPositionsOpcode(WorldPacket& recv_data);
630 void HandlePVPLogDataOpcode( WorldPacket &recv_data );
631 void HandleBattleFieldPortOpcode( WorldPacket &recv_data );
632 void HandleBattlefieldListOpcode( WorldPacket &recv_data );
633 void HandleLeaveBattlefieldOpcode( WorldPacket &recv_data );
634 void HandleBattlemasterJoinArena( WorldPacket &recv_data );
635 void HandleReportPvPAFK( WorldPacket &recv_data );
637 void HandleWardenDataOpcode(WorldPacket& recv_data);
638 void HandleWorldTeleportOpcode(WorldPacket& recv_data);
639 void HandleMinimapPingOpcode(WorldPacket& recv_data);
640 void HandleRandomRollOpcode(WorldPacket& recv_data);
641 void HandleFarSightOpcode(WorldPacket& recv_data);
642 void HandleSetLfgOpcode(WorldPacket& recv_data);
643 void HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data);
644 void HandleSetRaidDifficultyOpcode(WorldPacket& recv_data);
645 void HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data);
646 void HandleLfgSetAutoJoinOpcode(WorldPacket& recv_data);
647 void HandleLfgClearAutoJoinOpcode(WorldPacket& recv_data);
648 void HandleLfmSetAutoFillOpcode(WorldPacket& recv_data);
649 void HandleLfmClearAutoFillOpcode(WorldPacket& recv_data);
650 void HandleLfgClearOpcode(WorldPacket& recv_data);
651 void HandleLfmClearOpcode(WorldPacket& recv_data);
652 void HandleSetLfmOpcode(WorldPacket& recv_data);
653 void HandleSetLfgCommentOpcode(WorldPacket& recv_data);
654 void HandleLfgSetRoles(WorldPacket& recv_data);
655 void HandleSetTitleOpcode(WorldPacket& recv_data);
656 void HandleRealmSplitOpcode(WorldPacket& recv_data);
657 void HandleTimeSyncResp(WorldPacket& recv_data);
658 void HandleWhoisOpcode(WorldPacket& recv_data);
659 void HandleResetInstancesOpcode(WorldPacket& recv_data);
661 // Arena Team
662 void HandleInspectArenaTeamsOpcode(WorldPacket& recv_data);
663 void HandleArenaTeamQueryOpcode(WorldPacket& recv_data);
664 void HandleArenaTeamRosterOpcode(WorldPacket& recv_data);
665 void HandleArenaTeamInviteOpcode(WorldPacket& recv_data);
666 void HandleArenaTeamAcceptOpcode(WorldPacket& recv_data);
667 void HandleArenaTeamDeclineOpcode(WorldPacket& recv_data);
668 void HandleArenaTeamLeaveOpcode(WorldPacket& recv_data);
669 void HandleArenaTeamRemoveOpcode(WorldPacket& recv_data);
670 void HandleArenaTeamDisbandOpcode(WorldPacket& recv_data);
671 void HandleArenaTeamLeaderOpcode(WorldPacket& recv_data);
673 void HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data);
674 void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data);
675 void HandleCancelMountAuraOpcode(WorldPacket& recv_data);
676 void HandleSelfResOpcode(WorldPacket& recv_data);
677 void HandleComplainOpcode(WorldPacket& recv_data);
678 void HandleRequestPetInfoOpcode(WorldPacket& recv_data);
680 // Socket gem
681 void HandleSocketOpcode(WorldPacket& recv_data);
683 void HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data);
684 void HandleItemRefundInfoRequest(WorldPacket& recv_data);
686 void HandleChannelVoiceOnOpcode(WorldPacket & recv_data);
687 void HandleVoiceSessionEnableOpcode(WorldPacket& recv_data);
688 void HandleSetActiveVoiceChannel(WorldPacket& recv_data);
689 void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data);
691 // Guild Bank
692 void HandleGuildPermissions(WorldPacket& recv_data);
693 void HandleGuildBankMoneyWithdrawn(WorldPacket& recv_data);
694 void HandleGuildBankerActivate(WorldPacket& recv_data);
695 void HandleGuildBankQueryTab(WorldPacket& recv_data);
696 void HandleGuildBankLogQuery(WorldPacket& recv_data);
697 void HandleGuildBankDepositMoney(WorldPacket& recv_data);
698 void HandleGuildBankWithdrawMoney(WorldPacket& recv_data);
699 void HandleGuildBankSwapItems(WorldPacket& recv_data);
701 void HandleGuildBankUpdateTab(WorldPacket& recv_data);
702 void HandleGuildBankBuyTab(WorldPacket& recv_data);
703 void HandleQueryGuildBankTabText(WorldPacket& recv_data);
704 void HandleSetGuildBankTabText(WorldPacket& recv_data);
706 // Calendar
707 void HandleCalendarGetCalendar(WorldPacket& recv_data);
708 void HandleCalendarGetEvent(WorldPacket& recv_data);
709 void HandleCalendarGuildFilter(WorldPacket& recv_data);
710 void HandleCalendarArenaTeam(WorldPacket& recv_data);
711 void HandleCalendarAddEvent(WorldPacket& recv_data);
712 void HandleCalendarUpdateEvent(WorldPacket& recv_data);
713 void HandleCalendarRemoveEvent(WorldPacket& recv_data);
714 void HandleCalendarCopyEvent(WorldPacket& recv_data);
715 void HandleCalendarEventInvite(WorldPacket& recv_data);
716 void HandleCalendarEventRsvp(WorldPacket& recv_data);
717 void HandleCalendarEventRemoveInvite(WorldPacket& recv_data);
718 void HandleCalendarEventStatus(WorldPacket& recv_data);
719 void HandleCalendarEventModeratorStatus(WorldPacket& recv_data);
720 void HandleCalendarComplain(WorldPacket& recv_data);
721 void HandleCalendarGetNumPending(WorldPacket& recv_data);
723 void HandleSpellClick(WorldPacket& recv_data);
724 void HandleAlterAppearance(WorldPacket& recv_data);
725 void HandleRemoveGlyph(WorldPacket& recv_data);
726 void HandleCharCustomize(WorldPacket& recv_data);
727 void HandleQueryInspectAchievements(WorldPacket& recv_data);
728 void HandleEquipmentSetSave(WorldPacket& recv_data);
729 void HandleEquipmentSetDelete(WorldPacket& recv_data);
730 void HandleEquipmentSetUse(WorldPacket& recv_data);
731 void HandleWorldStateUITimerUpdate(WorldPacket& recv_data);
732 void HandleReadyForAccountDataTimes(WorldPacket& recv_data);
733 void HandleQueryQuestsCompleted(WorldPacket& recv_data);
734 void HandleQuestPOIQuery(WorldPacket& recv_data);
735 private:
736 // private trade methods
737 void moveItems(Item* myItems[], Item* hisItems[]);
739 // logging helper
740 void LogUnexpectedOpcode(WorldPacket *packet, const char * reason);
741 void LogUnprocessedTail(WorldPacket *packet);
743 uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)
744 Player *_player;
745 WorldSocket *m_Socket;
746 std::string m_Address;
748 AccountTypes _security;
749 uint32 _accountId;
750 uint8 m_expansion;
752 time_t _logoutTime;
753 bool m_inQueue; // session wait in auth.queue
754 bool m_playerLoading; // code processed in LoginPlayer
755 bool m_playerLogout; // code processed in LogoutPlayer
756 bool m_playerRecentlyLogout;
757 bool m_playerSave; // code processed in LogoutPlayer with save request
758 LocaleConstant m_sessionDbcLocale;
759 int m_sessionDbLocaleIndex;
760 uint32 m_latency;
761 AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES];
762 uint32 m_Tutorials[8];
763 bool m_TutorialsChanged;
764 AddonsList m_addonsList;
765 ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
767 #endif
768 /// @}