Merge branch 'master' into 303
[getmangos.git] / src / game / WorldSession.h
blob949af8703ea8b417038a25586ea1096d43363572
1 /*
2 * Copyright (C) 2005-2008 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"
28 class MailItemsInfo;
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 WorldSession;
41 class QueryResult;
42 class LoginQueryHolder;
43 class CharacterHandler;
45 #define CHECK_PACKET_SIZE(P,S) if((P).size() < (S)) return SizeError((P),(S));
47 #define NUM_ACCOUNT_DATA_TYPES 8
49 struct AccountData
51 AccountData() : Time(NULL), Data("") {}
53 time_t Time;
54 std::string Data;
57 enum PartyOperation
59 PARTY_OP_INVITE = 0,
60 PARTY_OP_LEAVE = 2
63 enum PartyResult
65 PARTY_RESULT_OK = 0,
66 PARTY_RESULT_CANT_FIND_TARGET = 1,
67 PARTY_RESULT_NOT_IN_YOUR_PARTY = 2,
68 PARTY_RESULT_NOT_IN_YOUR_INSTANCE = 3,
69 PARTY_RESULT_PARTY_FULL = 4,
70 PARTY_RESULT_ALREADY_IN_GROUP = 5,
71 PARTY_RESULT_YOU_NOT_IN_GROUP = 6,
72 PARTY_RESULT_YOU_NOT_LEADER = 7,
73 PARTY_RESULT_TARGET_UNFRIENDLY = 8,
74 PARTY_RESULT_TARGET_IGNORE_YOU = 9,
75 PARTY_RESULT_INVITE_RESTRICTED = 13
78 /// Player session in the World
79 class MANGOS_DLL_SPEC WorldSession
81 friend class CharacterHandler;
82 public:
83 WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale);
84 ~WorldSession();
86 bool PlayerLoading() const { return m_playerLoading; }
87 bool PlayerLogout() const { return m_playerLogout; }
89 void SizeError(WorldPacket const& packet, uint32 size) const;
91 void SendPacket(WorldPacket const* packet);
92 void SendNotification(const char *format,...) ATTR_PRINTF(2,3);
93 void SendNotification(int32 string_id,...);
94 void SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName);
95 void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type);
96 void SendPartyResult(PartyOperation operation, std::string member, PartyResult res);
97 void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
99 uint32 GetSecurity() const { return _security; }
100 uint32 GetAccountId() const { return _accountId; }
101 Player* GetPlayer() const { return _player; }
102 char const* GetPlayerName() const;
103 void SetSecurity(uint32 security) { _security = security; }
104 std::string& GetRemoteAddress() { return m_Address; }
105 void SetPlayer(Player *plr) { _player = plr; }
106 uint8 Expansion() const { return m_expansion; }
108 /// Is the user engaged in a log out process?
109 bool isLogingOut() const { return _logoutTime || m_playerLogout; }
111 /// Engage the logout process for the user
112 void LogoutRequest(time_t requestTime)
114 _logoutTime = requestTime;
117 /// Is logout cooldown expired?
118 bool ShouldLogOut(time_t currTime) const
120 return (_logoutTime > 0 && currTime >= _logoutTime + 20);
123 void LogoutPlayer(bool Save);
124 void KickPlayer();
126 void QueuePacket(WorldPacket* new_packet);
127 bool Update(uint32 diff);
129 /// Handle the authentication waiting queue (to be completed)
130 void SendAuthWaitQue(uint32 position);
132 //void SendTestCreatureQueryOpcode( uint32 entry, uint64 guid, uint32 testvalue );
133 void SendNameQueryOpcode(Player* p);
134 void SendNameQueryOpcodeFromDB(uint64 guid);
135 static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId);
137 void SendTrainerList( uint64 guid );
138 void SendTrainerList( uint64 guid,std::string strTitle );
139 void SendListInventory( uint64 guid );
140 void SendShowBank( uint64 guid );
141 void SendTabardVendorActivate( uint64 guid );
142 void SendSpiritResurrect();
143 void SendBindPoint(Creature* npc);
144 void SendGMTicketGetTicket(uint32 status, char const* text);
146 void SendAttackStop(Unit const* enemy);
148 void SendBattlegGroundList( uint64 guid, uint32 bgTypeId );
150 void SendTradeStatus(uint32 status);
151 void SendCancelTrade();
153 void SendStablePet(uint64 guid );
154 void SendPetitionQueryOpcode( uint64 petitionguid);
155 void SendUpdateTrade();
157 //pet
158 void SendPetNameQuery(uint64 guid, uint32 petnumber);
160 // Account Data
161 AccountData *GetAccountData(uint32 type) { return &m_accountData[type]; }
162 void SetAccountData(uint32 type, time_t time_, std::string data);
163 void LoadAccountData();
165 //mail
166 //used with item_page table
167 bool SendItemInfo( uint32 itemid, WorldPacket data );
168 static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint32 COD, uint16 mailTemplateId = 0);
169 static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0);
171 //auction
172 void SendAuctionHello( uint64 guid, Creature * unit );
173 void SendAuctionCommandResult( uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
174 void SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
175 void SendAuctionOwnerNotification( AuctionEntry * auction );
176 bool SendAuctionInfo(WorldPacket & data, AuctionEntry* auction);
177 void SendAuctionOutbiddedMail( AuctionEntry * auction, uint32 newPrice );
178 void SendAuctionCancelledToBidderMail( AuctionEntry* auction );
180 //Item Enchantment
181 void SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID);
182 void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,uint32 slot,uint32 Duration);
184 //Taxi
185 void SendTaxiStatus( uint64 guid );
186 void SendTaxiMenu( Creature* unit );
187 void SendDoFlight( uint16 MountId, uint32 path, uint32 pathNode = 0 );
188 bool SendLearnNewTaxiNode( Creature* unit );
190 // Guild/Arena Team
191 void SendGuildCommandResult(uint32 typecmd,std::string str,uint32 cmdresult);
192 void SendArenaTeamCommandResult(uint32 unk1, std::string str1, std::string str2, uint32 unk3);
193 void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, std::string str1, std::string str2, std::string str3);
194 void SendNotInArenaTeamPacket(uint8 type);
195 void SendPetitionShowList( uint64 guid );
196 void SendSaveGuildEmblem( uint32 msg );
198 // Looking For Group
199 // TRUE values set by client sending CMSG_LFG_SET_AUTOJOIN and CMSG_LFM_CLEAR_AUTOFILL before player login
200 bool LookingForGroup_auto_join;
201 bool LookingForGroup_auto_add;
203 void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data);
205 void DoLootRelease( uint64 lguid );
207 // Account mute time
208 time_t m_muteTime;
210 // Locales
211 LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
212 int GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
213 const char *GetMangosString(int32 entry) const;
215 uint32 GetLatency() const { return m_latency; }
216 void SetLatency(uint32 latency) { m_latency = latency; }
217 uint32 getDialogStatus(Player *pPlayer, Object* questgiver, uint32 defstatus);
219 public: // opcodes handlers
221 void Handle_NULL(WorldPacket& recvPacket); // not used
222 void Handle_EarlyProccess( WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead
223 void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client
224 void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client
226 void HandleCharEnumOpcode(WorldPacket& recvPacket);
227 void HandleCharDeleteOpcode(WorldPacket& recvPacket);
228 void HandleCharCreateOpcode(WorldPacket& recvPacket);
229 void HandlePlayerLoginOpcode(WorldPacket& recvPacket);
230 void HandleCharEnum(QueryResult * result);
231 void HandlePlayerLogin(LoginQueryHolder * holder);
233 // played time
234 void HandlePlayedTime(WorldPacket& recvPacket);
236 // new
237 void HandleMoveUnRootAck(WorldPacket& recvPacket);
238 void HandleMoveRootAck(WorldPacket& recvPacket);
239 void HandleLookingForGroup(WorldPacket& recvPacket);
241 // new inspect
242 void HandleInspectOpcode(WorldPacket& recvPacket);
244 // new party stats
245 void HandleInspectHonorStatsOpcode(WorldPacket& recvPacket);
247 void HandleMoveWaterWalkAck(WorldPacket& recvPacket);
248 void HandleFeatherFallAck(WorldPacket &recv_data);
250 void HandleMoveHoverAck( WorldPacket & recv_data );
252 void HandleMountSpecialAnimOpcode(WorldPacket &recvdata);
254 // character view
255 void HandleToggleHelmOpcode(WorldPacket& recv_data);
256 void HandleToggleCloakOpcode(WorldPacket& recv_data);
258 // repair
259 void HandleRepairItemOpcode(WorldPacket& recvPacket);
261 // Knockback
262 void HandleMoveKnockBackAck(WorldPacket& recvPacket);
264 void HandleMoveTeleportAck(WorldPacket& recvPacket);
265 void HandleForceSpeedChangeAck( WorldPacket & recv_data );
267 void HandlePingOpcode(WorldPacket& recvPacket);
268 void HandleAuthSessionOpcode(WorldPacket& recvPacket);
269 void HandleRepopRequestOpcode(WorldPacket& recvPacket);
270 void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket);
271 void HandleLootMoneyOpcode(WorldPacket& recvPacket);
272 void HandleLootOpcode(WorldPacket& recvPacket);
273 void HandleLootReleaseOpcode(WorldPacket& recvPacket);
274 void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
275 void HandleWhoOpcode(WorldPacket& recvPacket);
276 void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
277 void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
278 void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
279 void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket);
280 void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
281 void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket);
283 void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket);
284 void HandleGMTicketUpdateTextOpcode(WorldPacket& recvPacket);
286 void HandleGMSurveySubmit(WorldPacket& recvPacket);
288 void HandleTogglePvP(WorldPacket& recvPacket);
290 void HandleZoneUpdateOpcode(WorldPacket& recvPacket);
291 void HandleSetTargetOpcode(WorldPacket& recvPacket);
292 void HandleSetSelectionOpcode(WorldPacket& recvPacket);
293 void HandleStandStateChangeOpcode(WorldPacket& recvPacket);
294 void HandleEmoteOpcode(WorldPacket& recvPacket);
295 void HandleFriendListOpcode(WorldPacket& recvPacket);
296 void HandleAddFriendOpcode(WorldPacket& recvPacket);
297 static void HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote);
298 void HandleDelFriendOpcode(WorldPacket& recvPacket);
299 void HandleAddIgnoreOpcode(WorldPacket& recvPacket);
300 static void HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 accountId);
301 void HandleDelIgnoreOpcode(WorldPacket& recvPacket);
302 void HandleSetFriendNoteOpcode(WorldPacket& recvPacket);
303 void HandleBugOpcode(WorldPacket& recvPacket);
304 void HandleSetAmmoOpcode(WorldPacket& recvPacket);
305 void HandleItemNameQueryOpcode(WorldPacket& recvPacket);
307 void HandleAreaTriggerOpcode(WorldPacket& recvPacket);
309 void HandleSetFactionAtWar( WorldPacket & recv_data );
310 void HandleSetFactionCheat( WorldPacket & recv_data );
311 void HandleSetWatchedFactionIndexOpcode(WorldPacket & recv_data);
312 void HandleSetWatchedFactionInactiveOpcode(WorldPacket & recv_data);
314 void HandleUpdateAccountData(WorldPacket& recvPacket);
315 void HandleRequestAccountData(WorldPacket& recvPacket);
316 void HandleSetActionButtonOpcode(WorldPacket& recvPacket);
318 void HandleGameObjectUseOpcode(WorldPacket& recPacket);
319 void HandleMeetingStoneInfo(WorldPacket& recPacket);
321 void HandleNameQueryOpcode(WorldPacket& recvPacket);
323 void HandleQueryTimeOpcode(WorldPacket& recvPacket);
325 void HandleCreatureQueryOpcode(WorldPacket& recvPacket);
327 void HandleGameObjectQueryOpcode(WorldPacket& recvPacket);
329 void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
330 void HandleMoveWorldportAckOpcode(); // for server-side calls
332 void HandleMovementOpcodes(WorldPacket& recvPacket);
333 void HandleSetActiveMoverOpcode(WorldPacket &recv_data);
334 void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data);
336 void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );
338 void HandleBattlefieldStatusOpcode(WorldPacket &recv_data);
339 void HandleBattleMasterHelloOpcode(WorldPacket &recv_data);
341 void HandleGroupInviteOpcode(WorldPacket& recvPacket);
342 //void HandleGroupCancelOpcode(WorldPacket& recvPacket);
343 void HandleGroupAcceptOpcode(WorldPacket& recvPacket);
344 void HandleGroupDeclineOpcode(WorldPacket& recvPacket);
345 void HandleGroupUninviteNameOpcode(WorldPacket& recvPacket);
346 void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket);
347 void HandleGroupUninvite(uint64 guid, std::string name);
348 void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket);
349 void HandleGroupLeaveOpcode(WorldPacket& recvPacket);
350 void HandleGroupPassOnLootOpcode( WorldPacket &recv_data );
351 void HandleLootMethodOpcode(WorldPacket& recvPacket);
352 void HandleLootRoll( WorldPacket &recv_data );
353 void HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data );
354 void HandleRaidIconTargetOpcode( WorldPacket & recv_data );
355 void HandleRaidReadyCheckOpcode( WorldPacket & recv_data );
356 void HandleRaidReadyCheckFinishOpcode( WorldPacket & recv_data );
357 void HandleRaidConvertOpcode( WorldPacket & recv_data );
358 void HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data );
359 void HandleGroupAssistantOpcode( WorldPacket & recv_data );
360 void HandleGroupPromoteOpcode( WorldPacket & recv_data );
362 void HandlePetitionBuyOpcode(WorldPacket& recv_data);
363 void HandlePetitionShowSignOpcode(WorldPacket& recv_data);
364 void HandlePetitionQueryOpcode(WorldPacket& recv_data);
365 void HandlePetitionRenameOpcode(WorldPacket& recv_data);
366 void HandlePetitionSignOpcode(WorldPacket& recv_data);
367 void HandlePetitionDeclineOpcode(WorldPacket& recv_data);
368 void HandleOfferPetitionOpcode(WorldPacket& recv_data);
369 void HandleTurnInPetitionOpcode(WorldPacket& recv_data);
371 void HandleGuildQueryOpcode(WorldPacket& recvPacket);
372 void HandleGuildCreateOpcode(WorldPacket& recvPacket);
373 void HandleGuildInviteOpcode(WorldPacket& recvPacket);
374 void HandleGuildRemoveOpcode(WorldPacket& recvPacket);
375 void HandleGuildAcceptOpcode(WorldPacket& recvPacket);
376 void HandleGuildDeclineOpcode(WorldPacket& recvPacket);
377 void HandleGuildInfoOpcode(WorldPacket& recvPacket);
378 void HandleGuildEventLogOpcode(WorldPacket& recvPacket);
379 void HandleGuildRosterOpcode(WorldPacket& recvPacket);
380 void HandleGuildPromoteOpcode(WorldPacket& recvPacket);
381 void HandleGuildDemoteOpcode(WorldPacket& recvPacket);
382 void HandleGuildLeaveOpcode(WorldPacket& recvPacket);
383 void HandleGuildDisbandOpcode(WorldPacket& recvPacket);
384 void HandleGuildLeaderOpcode(WorldPacket& recvPacket);
385 void HandleGuildMOTDOpcode(WorldPacket& recvPacket);
386 void HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket);
387 void HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket);
388 void HandleGuildRankOpcode(WorldPacket& recvPacket);
389 void HandleGuildAddRankOpcode(WorldPacket& recvPacket);
390 void HandleGuildDelRankOpcode(WorldPacket& recvPacket);
391 void HandleGuildChangeInfoOpcode(WorldPacket& recvPacket);
392 void HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket);
394 void HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvPacket);
395 void HandleTaxiQueryAvailableNodes(WorldPacket& recvPacket);
396 void HandleActivateTaxiOpcode(WorldPacket& recvPacket);
397 void HandleActivateTaxiFarOpcode(WorldPacket& recvPacket);
398 void HandleTaxiNextDestinationOpcode(WorldPacket& recvPacket);
400 void HandleTabardVendorActivateOpcode(WorldPacket& recvPacket);
401 void HandleBankerActivateOpcode(WorldPacket& recvPacket);
402 void HandleBuyBankSlotOpcode(WorldPacket& recvPacket);
403 void HandleTrainerListOpcode(WorldPacket& recvPacket);
404 void HandleTrainerBuySpellOpcode(WorldPacket& recvPacket);
405 void HandlePetitionShowListOpcode(WorldPacket& recvPacket);
406 void HandleGossipHelloOpcode(WorldPacket& recvPacket);
407 void HandleGossipSelectOptionOpcode(WorldPacket& recvPacket);
408 void HandleSpiritHealerActivateOpcode(WorldPacket& recvPacket);
409 void HandleNpcTextQueryOpcode(WorldPacket& recvPacket);
410 void HandleBinderActivateOpcode(WorldPacket& recvPacket);
411 void HandleListStabledPetsOpcode(WorldPacket& recvPacket);
412 void HandleStablePet(WorldPacket& recvPacket);
413 void HandleUnstablePet(WorldPacket& recvPacket);
414 void HandleBuyStableSlot(WorldPacket& recvPacket);
415 void HandleStableRevivePet(WorldPacket& recvPacket);
416 void HandleStableSwapPet(WorldPacket& recvPacket);
418 void HandleDuelAcceptedOpcode(WorldPacket& recvPacket);
419 void HandleDuelCancelledOpcode(WorldPacket& recvPacket);
421 void HandleAcceptTradeOpcode(WorldPacket& recvPacket);
422 void HandleBeginTradeOpcode(WorldPacket& recvPacket);
423 void HandleBusyTradeOpcode(WorldPacket& recvPacket);
424 void HandleCancelTradeOpcode(WorldPacket& recvPacket);
425 void HandleClearTradeItemOpcode(WorldPacket& recvPacket);
426 void HandleIgnoreTradeOpcode(WorldPacket& recvPacket);
427 void HandleInitiateTradeOpcode(WorldPacket& recvPacket);
428 void HandleSetTradeGoldOpcode(WorldPacket& recvPacket);
429 void HandleSetTradeItemOpcode(WorldPacket& recvPacket);
430 void HandleUnacceptTradeOpcode(WorldPacket& recvPacket);
432 void HandleAuctionHelloOpcode(WorldPacket& recvPacket);
433 void HandleAuctionListItems( WorldPacket & recv_data );
434 void HandleAuctionListBidderItems( WorldPacket & recv_data );
435 void HandleAuctionSellItem( WorldPacket & recv_data );
436 void HandleAuctionRemoveItem( WorldPacket & recv_data );
437 void HandleAuctionListOwnerItems( WorldPacket & recv_data );
438 void HandleAuctionPlaceBid( WorldPacket & recv_data );
439 void HandleAuctionListPendingSales( WorldPacket & recv_data );
441 void HandleGetMail( WorldPacket & recv_data );
442 void HandleSendMail( WorldPacket & recv_data );
443 void HandleTakeMoney( WorldPacket & recv_data );
444 void HandleTakeItem( WorldPacket & recv_data );
445 void HandleMarkAsRead( WorldPacket & recv_data );
446 void HandleReturnToSender( WorldPacket & recv_data );
447 void HandleMailDelete( WorldPacket & recv_data );
448 void HandleItemTextQuery( WorldPacket & recv_data);
449 void HandleMailCreateTextItem(WorldPacket & recv_data );
450 void HandleMsgQueryNextMailtime(WorldPacket & recv_data );
451 void HandleCancelChanneling(WorldPacket & recv_data );
453 void SendItemPageInfo( ItemPrototype *itemProto );
454 void HandleSplitItemOpcode(WorldPacket& recvPacket);
455 void HandleSwapInvItemOpcode(WorldPacket& recvPacket);
456 void HandleDestroyItemOpcode(WorldPacket& recvPacket);
457 void HandleAutoEquipItemOpcode(WorldPacket& recvPacket);
458 void HandleItemQuerySingleOpcode(WorldPacket& recvPacket);
459 void HandleSellItemOpcode(WorldPacket& recvPacket);
460 void HandleBuyItemInSlotOpcode(WorldPacket& recvPacket);
461 void HandleBuyItemOpcode(WorldPacket& recvPacket);
462 void HandleListInventoryOpcode(WorldPacket& recvPacket);
463 void HandleAutoStoreBagItemOpcode(WorldPacket& recvPacket);
464 void HandleReadItem(WorldPacket& recvPacket);
465 void HandleAutoEquipItemSlotOpcode(WorldPacket & recvPacket);
466 void HandleSwapItem( WorldPacket & recvPacket);
467 void HandleBuybackItem(WorldPacket & recvPacket);
468 void HandleAutoBankItemOpcode(WorldPacket& recvPacket);
469 void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket);
470 void HandleWrapItemOpcode(WorldPacket& recvPacket);
472 void HandleAttackSwingOpcode(WorldPacket& recvPacket);
473 void HandleAttackStopOpcode(WorldPacket& recvPacket);
474 void HandleSetSheathedOpcode(WorldPacket& recvPacket);
476 void HandleUseItemOpcode(WorldPacket& recvPacket);
477 void HandleOpenItemOpcode(WorldPacket& recvPacket);
478 void HandleCastSpellOpcode(WorldPacket& recvPacket);
479 void HandleCancelCastOpcode(WorldPacket& recvPacket);
480 void HandleCancelAuraOpcode(WorldPacket& recvPacket);
481 void HandleCancelGrowthAuraOpcode(WorldPacket& recvPacket);
482 void HandleCancelAutoRepeatSpellOpcode(WorldPacket& recvPacket);
484 void HandleLearnTalentOpcode(WorldPacket& recvPacket);
485 void HandleTalentWipeOpcode(WorldPacket& recvPacket);
486 void HandleUnlearnSkillOpcode(WorldPacket& recvPacket);
488 void HandleQuestgiverStatusQueryOpcode(WorldPacket& recvPacket);
489 void HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& recvPacket);
490 void HandleQuestgiverHelloOpcode(WorldPacket& recvPacket);
491 void HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvPacket);
492 void HandleQuestgiverQuestQueryOpcode(WorldPacket& recvPacket);
493 void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket);
494 void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket);
495 void HandleQuestQueryOpcode(WorldPacket& recvPacket);
496 void HandleQuestgiverCancel(WorldPacket& recv_data );
497 void HandleQuestLogSwapQuest(WorldPacket& recv_data );
498 void HandleQuestLogRemoveQuest(WorldPacket& recv_data);
499 void HandleQuestConfirmAccept(WorldPacket& recv_data);
500 void HandleQuestComplete(WorldPacket& recv_data);
501 void HandleQuestAutoLaunch(WorldPacket& recvPacket);
502 void HandleQuestPushToParty(WorldPacket& recvPacket);
503 void HandleQuestPushResult(WorldPacket& recvPacket);
505 void HandleMessagechatOpcode(WorldPacket& recvPacket);
506 void HandleTextEmoteOpcode(WorldPacket& recvPacket);
507 void HandleChatIgnoredOpcode(WorldPacket& recvPacket);
509 void HandleCorpseReclaimOpcode( WorldPacket& recvPacket );
510 void HandleCorpseQueryOpcode( WorldPacket& recvPacket );
511 void HandleResurrectResponseOpcode(WorldPacket& recvPacket);
512 void HandleSummonResponseOpcode(WorldPacket& recv_data);
514 void HandleChannelJoin(WorldPacket& recvPacket);
515 void HandleChannelLeave(WorldPacket& recvPacket);
516 void HandleChannelList(WorldPacket& recvPacket);
517 void HandleChannelPassword(WorldPacket& recvPacket);
518 void HandleChannelSetOwner(WorldPacket& recvPacket);
519 void HandleChannelOwner(WorldPacket& recvPacket);
520 void HandleChannelModerator(WorldPacket& recvPacket);
521 void HandleChannelUnmoderator(WorldPacket& recvPacket);
522 void HandleChannelMute(WorldPacket& recvPacket);
523 void HandleChannelUnmute(WorldPacket& recvPacket);
524 void HandleChannelInvite(WorldPacket& recvPacket);
525 void HandleChannelKick(WorldPacket& recvPacket);
526 void HandleChannelBan(WorldPacket& recvPacket);
527 void HandleChannelUnban(WorldPacket& recvPacket);
528 void HandleChannelAnnounce(WorldPacket& recvPacket);
529 void HandleChannelModerate(WorldPacket& recvPacket);
530 void HandleChannelRosterQuery(WorldPacket& recvPacket);
531 void HandleChannelInfoQuery(WorldPacket& recvPacket);
532 void HandleChannelJoinNotify(WorldPacket& recvPacket);
534 void HandleCompleteCinema(WorldPacket& recvPacket);
535 void HandleNextCinematicCamera(WorldPacket& recvPacket);
537 void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket);
538 void HandlePageQueryOpcode(WorldPacket& recvPacket);
540 void HandleTutorialFlag ( WorldPacket & recv_data );
541 void HandleTutorialClear( WorldPacket & recv_data );
542 void HandleTutorialReset( WorldPacket & recv_data );
544 //Pet
545 void HandlePetAction( WorldPacket & recv_data );
546 void HandlePetNameQuery( WorldPacket & recv_data );
547 void HandlePetSetAction( WorldPacket & recv_data );
548 void HandlePetAbandon( WorldPacket & recv_data );
549 void HandlePetRename( WorldPacket & recv_data );
550 void HandlePetCancelAuraOpcode( WorldPacket& recvPacket );
551 void HandlePetUnlearnOpcode( WorldPacket& recvPacket );
552 void HandlePetSpellAutocastOpcode( WorldPacket& recvPacket );
553 void HandlePetCastSpellOpcode( WorldPacket& recvPacket );
554 void HandlePetLearnTalent( WorldPacket& recvPacket );;
556 void HandleSetActionBar(WorldPacket& recv_data);
558 void HandleChangePlayerNameOpcode(WorldPacket& recv_data);
559 void HandleDeclinedPlayerNameOpcode(WorldPacket& recv_data);
561 void HandleTotemDestroy(WorldPacket& recv_data);
563 //BattleGround
564 void HandleBattleGroundHelloOpcode(WorldPacket &recv_data);
565 void HandleBattleGroundJoinOpcode(WorldPacket &recv_data);
566 void HandleBattleGroundPlayerPositionsOpcode(WorldPacket& recv_data);
567 void HandleBattleGroundPVPlogdataOpcode( WorldPacket &recv_data );
568 void HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data );
569 void HandleBattleGroundListOpcode( WorldPacket &recv_data );
570 void HandleBattleGroundLeaveOpcode( WorldPacket &recv_data );
571 void HandleBattleGroundArenaJoin( WorldPacket &recv_data );
572 void HandleBattleGroundReportAFK( WorldPacket &recv_data );
574 void HandleWardenDataOpcode(WorldPacket& recv_data);
575 void HandleWorldTeleportOpcode(WorldPacket& recv_data);
576 void HandleMinimapPingOpcode(WorldPacket& recv_data);
577 void HandleRandomRollOpcode(WorldPacket& recv_data);
578 void HandleFarSightOpcode(WorldPacket& recv_data);
579 void HandleSetLfgOpcode(WorldPacket& recv_data);
580 void HandleDungeonDifficultyOpcode(WorldPacket& recv_data);
581 void HandleMoveFlyModeChangeAckOpcode(WorldPacket& recv_data);
582 void HandleLfgAutoJoinOpcode(WorldPacket& recv_data);
583 void HandleLfgCancelAutoJoinOpcode(WorldPacket& recv_data);
584 void HandleLfmAutoAddMembersOpcode(WorldPacket& recv_data);
585 void HandleLfmCancelAutoAddmembersOpcode(WorldPacket& recv_data);
586 void HandleLfgClearOpcode(WorldPacket& recv_data);
587 void HandleLfmSetNoneOpcode(WorldPacket& recv_data);
588 void HandleLfmSetOpcode(WorldPacket& recv_data);
589 void HandleLfgSetCommentOpcode(WorldPacket& recv_data);
590 void HandleNewUnknownOpcode(WorldPacket& recv_data);
591 void HandleChooseTitleOpcode(WorldPacket& recv_data);
592 void HandleRealmStateRequestOpcode(WorldPacket& recv_data);
593 void HandleAllowMoveAckOpcode(WorldPacket& recv_data);
594 void HandleWhoisOpcode(WorldPacket& recv_data);
595 void HandleResetInstancesOpcode(WorldPacket& recv_data);
597 // Arena Team
598 void HandleInspectArenaStatsOpcode(WorldPacket& recv_data);
599 void HandleArenaTeamQueryOpcode(WorldPacket& recv_data);
600 void HandleArenaTeamRosterOpcode(WorldPacket& recv_data);
601 void HandleArenaTeamAddMemberOpcode(WorldPacket& recv_data);
602 void HandleArenaTeamInviteAcceptOpcode(WorldPacket& recv_data);
603 void HandleArenaTeamInviteDeclineOpcode(WorldPacket& recv_data);
604 void HandleArenaTeamLeaveOpcode(WorldPacket& recv_data);
605 void HandleArenaTeamRemoveFromTeamOpcode(WorldPacket& recv_data);
606 void HandleArenaTeamDisbandOpcode(WorldPacket& recv_data);
607 void HandleArenaTeamPromoteToCaptainOpcode(WorldPacket& recv_data);
609 void HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data);
610 void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data);
611 void HandleDismountOpcode(WorldPacket& recv_data);
612 void HandleSelfResOpcode(WorldPacket& recv_data);
613 void HandleReportSpamOpcode(WorldPacket& recv_data);
614 void HandleRequestPetInfoOpcode(WorldPacket& recv_data);
616 // Socket gem
617 void HandleSocketOpcode(WorldPacket& recv_data);
619 void HandleCancelTempItemEnchantmentOpcode(WorldPacket& recv_data);
621 void HandleChannelEnableVoiceOpcode(WorldPacket & recv_data);
622 void HandleVoiceSettingsOpcode(WorldPacket& recv_data);
623 void HandleChannelVoiceChatQuery(WorldPacket& recv_data);
624 void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data);
626 // Guild Bank
627 void HandleGuildBankGetRights(WorldPacket& recv_data);
628 void HandleGuildBankGetMoneyAmount(WorldPacket& recv_data);
629 void HandleGuildBankQuery(WorldPacket& recv_data);
630 void HandleGuildBankTabColon(WorldPacket& recv_data);
631 void HandleGuildBankLog(WorldPacket& recv_data);
632 void HandleGuildBankDeposit(WorldPacket& recv_data);
633 void HandleGuildBankWithdraw(WorldPacket& recv_data);
634 void HandleGuildBankDepositItem(WorldPacket& recv_data);
635 void HandleGuildBankModifyTab(WorldPacket& recv_data);
636 void HandleGuildBankBuyTab(WorldPacket& recv_data);
637 void HandleGuildBankTabText(WorldPacket& recv_data);
638 void HandleGuildBankSetTabText(WorldPacket& recv_data);
640 // Calendar
641 void HandleCalendarGetCalendar(WorldPacket& recv_data);
642 void HandleCalendarGetEvent(WorldPacket& recv_data);
643 void HandleCalendarGuildFilter(WorldPacket& recv_data);
644 void HandleCalendarArenaTeam(WorldPacket& recv_data);
645 void HandleCalendarAddEvent(WorldPacket& recv_data);
646 void HandleCalendarUpdateEvent(WorldPacket& recv_data);
647 void HandleCalendarRemoveEvent(WorldPacket& recv_data);
648 void HandleCalendarCopyEvent(WorldPacket& recv_data);
649 void HandleCalendarEventInvite(WorldPacket& recv_data);
650 void HandleCalendarEventRsvp(WorldPacket& recv_data);
651 void HandleCalendarEventRemoveInvite(WorldPacket& recv_data);
652 void HandleCalendarEventStatus(WorldPacket& recv_data);
653 void HandleCalendarEventModeratorStatus(WorldPacket& recv_data);
654 void HandleCalendarComplain(WorldPacket& recv_data);
656 void HandleSpellClick(WorldPacket& recv_data);
657 void HandleAlterAppearance(WorldPacket& recv_data);
658 void HandleRemoveGlyph(WorldPacket& recv_data);
659 void HandleInspectAchievements(WorldPacket& recv_data);
660 private:
661 // private trade methods
662 void moveItems(Item* myItems[], Item* hisItems[]);
664 // logging helper
665 void logUnexpectedOpcode(WorldPacket *packet, const char * reason);
667 Player *_player;
668 WorldSocket *m_Socket;
669 std::string m_Address;
671 uint32 _security;
672 uint32 _accountId;
673 uint8 m_expansion;
675 time_t _logoutTime;
676 bool m_playerLoading; // code processed in LoginPlayer
677 bool m_playerLogout; // code processed in LogoutPlayer
678 bool m_playerRecentlyLogout;
679 LocaleConstant m_sessionDbcLocale;
680 int m_sessionDbLocaleIndex;
681 uint32 m_latency;
682 AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES];
684 ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> _recvQueue;
686 #endif
687 /// @}