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