OregonCore  revision 3611e8a-git
Your Favourite TBC server
WorldSession Class Reference

#include <WorldSession.h>

Classes

struct  ProtectedOpcodeStatus
 

Public Member Functions

 WorldSession (uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale)
 
 ~WorldSession ()
 
bool PlayerLoading () const
 
bool PlayerLogout () const
 
bool PlayerLogoutWithSave () const
 
void SizeError (WorldPacket const &packet, uint32 size) const
 
void SendPacket (WorldPacket const *packet)
 
void SendNotification (const char *format,...) ATTR_PRINTF(2
 
void void SendNotification (int32 string_id,...)
 
void SendPetNameInvalid (uint32 error, const std::string &name, DeclinedName *declinedName)
 
void SendLfgResult (uint32 type, uint32 entry, uint8 lfg_type)
 
void SendPartyResult (PartyOperation operation, const std::string &member, PartyResult res)
 
void SendAreaTriggerMessage (const char *Text,...) ATTR_PRINTF(2
 
void uint32 GetSecurity () const
 
uint32 GetAccountId () const
 
PlayerGetPlayer () const
 
char const * GetPlayerName () const
 
void SetSecurity (uint32 security)
 
std::string const & GetRemoteAddress ()
 
void SetPlayer (Player *plr)
 
uint8 Expansion () const
 
void InitWarden (BigNumber *K, std::string os)
 
void SetInQueue (bool state)
 
bool isLogingOut () const
 
void LogoutRequest (time_t requestTime)
 
bool ShouldLogOut (time_t currTime) const
 
void LogoutPlayer (bool Save)
 
void KickPlayer ()
 
void QueuePacket (WorldPacket *new_packet)
 
bool Update (uint32 diff)
 
void SendAuthWaitQue (uint32 position)
 
void SendNameQueryOpcode (Player *p)
 
void SendNameQueryOpcodeFromDB (uint64 guid)
 
void SendTrainerList (uint64 guid)
 
void SendTrainerList (uint64 guid, const std::string &strTitle)
 
void SendListInventory (uint64 guid)
 
void SendShowBank (uint64 guid)
 
void SendTabardVendorActivate (uint64 guid)
 
void SendSpiritResurrect ()
 
void SendBindPoint (Creature *npc)
 
void SendGMTicketGetTicket (uint32 status, char const *text)
 
void SendAttackStop (Unit const *enemy)
 
void SendBattlegGroundList (uint64 guid, uint32 bgTypeId)
 
void SendTradeStatus (uint32 status)
 
void SendCancelTrade ()
 
void SendStablePet (uint64 guid)
 
void SendPetitionQueryOpcode (uint64 petitionguid)
 
void SendUpdateTrade ()
 
void SendPetNameQuery (uint64 guid, uint32 petnumber)
 
bool SendItemInfo (uint32 itemid, WorldPacket data)
 
void SendAuctionHello (uint64 guid, Creature *unit)
 
void SendAuctionCommandResult (uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError=0)
 
void SendAuctionBidderNotification (uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
 
void SendAuctionOwnerNotification (AuctionEntry *auction)
 
void SendAuctionOutbiddedMail (AuctionEntry *auction, uint32 newPrice)
 
void SendAuctionCancelledToBidderMail (AuctionEntry *auction)
 
void SendEnchantmentLog (uint64 Target, uint64 Caster, uint32 ItemID, uint32 SpellID)
 
void SendItemEnchantTimeUpdate (uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration)
 
void SendTaxiStatus (uint64 guid)
 
void SendTaxiMenu (Creature *unit)
 
void SendDoFlight (uint16 MountId, uint32 path, uint32 pathNode=0)
 
bool SendLearnNewTaxiNode (Creature *unit)
 
void SendGuildCommandResult (uint32 typecmd, const std::string &str, uint32 cmdresult)
 
void SendArenaTeamCommandResult (uint32 team_action, const std::string &team, const std::string &player, uint32 error_id)
 
void SendNotInArenaTeamPacket (uint8 type)
 
void SendPetitionShowList (uint64 guid)
 
void SendSaveGuildEmblem (uint32 msg)
 
void SendBattlegroundOrArenaJoinError (uint8 err)
 
void BuildPartyMemberStatsChangedPacket (Player *player, WorldPacket *data)
 
void DoLootRelease (uint64 lguid)
 
LocaleConstant GetSessionDbcLocale () const
 
int GetSessionDbLocaleIndex () const
 
const char * GetOregonString (int32 entry) const
 
uint32 GetLatency () const
 
void SetLatency (uint32 latency)
 
void ResetClientTimeDelay ()
 
uint32 getDialogStatus (Player *pPlayer, Object *questgiver, uint32 defstatus)
 
void UpdateTimeOutTime (uint32 diff)
 
void ResetTimeOutTime ()
 
bool IsConnectionIdle () const
 
void Handle_NULL (WorldPacket &recvPacket)
 
void Handle_EarlyProccess (WorldPacket &recvPacket)
 
void Handle_ServerSide (WorldPacket &recvPacket)
 
void Handle_Deprecated (WorldPacket &recvPacket)
 
void HandleCharEnumOpcode (WorldPacket &recvPacket)
 
void HandleCharDeleteOpcode (WorldPacket &recvPacket)
 
void HandleCharCreateOpcode (WorldPacket &recvPacket)
 
void HandlePlayerLoginOpcode (WorldPacket &recvPacket)
 
void HandleCharEnum (QueryResult_AutoPtr result)
 
void HandlePlayerLogin (LoginQueryHolder *holder)
 
void HandlePlayedTime (WorldPacket &recvPacket)
 
void HandleMoveUnRootAck (WorldPacket &recvPacket)
 
void HandleMoveRootAck (WorldPacket &recvPacket)
 
void HandleLookingForGroup (WorldPacket &recvPacket)
 
void HandleInspectOpcode (WorldPacket &recvPacket)
 
void HandleInspectHonorStatsOpcode (WorldPacket &recvPacket)
 
void HandleMoveWaterWalkAck (WorldPacket &recvPacket)
 
void HandleFeatherFallAck (WorldPacket &recv_data)
 
void HandleMoveHoverAck (WorldPacket &recv_data)
 
void HandleMountSpecialAnimOpcode (WorldPacket &recvdata)
 
void HandleToggleHelmOpcode (WorldPacket &recv_data)
 
void HandleToggleCloakOpcode (WorldPacket &recv_data)
 
void HandleRepairItemOpcode (WorldPacket &recvPacket)
 
void HandleMoveKnockBackAck (WorldPacket &recvPacket)
 
void HandleMoveTeleportAck (WorldPacket &recvPacket)
 
void HandleForceSpeedChangeAck (WorldPacket &recv_data)
 
void HandlePingOpcode (WorldPacket &recvPacket)
 
void HandleAuthSessionOpcode (WorldPacket &recvPacket)
 
void HandleRepopRequestOpcode (WorldPacket &recvPacket)
 
void HandleAutostoreLootItemOpcode (WorldPacket &recvPacket)
 
void HandleLootMoneyOpcode (WorldPacket &recvPacket)
 
void HandleLootOpcode (WorldPacket &recvPacket)
 
void HandleLootReleaseOpcode (WorldPacket &recvPacket)
 
void HandleLootMasterGiveOpcode (WorldPacket &recvPacket)
 
void HandleWhoOpcode (WorldPacket &recvPacket)
 
void HandleLogoutRequestOpcode (WorldPacket &recvPacket)
 
void HandlePlayerLogoutOpcode (WorldPacket &recvPacket)
 
void HandleLogoutCancelOpcode (WorldPacket &recvPacket)
 
void HandleGMTicketCreateOpcode (WorldPacket &recvPacket)
 
void HandleGMTicketUpdateOpcode (WorldPacket &recvPacket)
 
void HandleGMTicketDeleteOpcode (WorldPacket &recvPacket)
 
void HandleGMTicketGetTicketOpcode (WorldPacket &recvPacket)
 
void HandleGMTicketSystemStatusOpcode (WorldPacket &recvPacket)
 
void HandleGMSurveySubmit (WorldPacket &recvPacket)
 
void HandleTogglePvP (WorldPacket &recvPacket)
 
void HandleZoneUpdateOpcode (WorldPacket &recvPacket)
 
void HandleSetTargetOpcode (WorldPacket &recvPacket)
 
void HandleSetSelectionOpcode (WorldPacket &recvPacket)
 
void HandleStandStateChangeOpcode (WorldPacket &recvPacket)
 
void HandleEmoteOpcode (WorldPacket &recvPacket)
 
void HandleFriendListOpcode (WorldPacket &recvPacket)
 
void HandleAddFriendOpcode (WorldPacket &recvPacket)
 
void HandleDelFriendOpcode (WorldPacket &recvPacket)
 
void HandleAddIgnoreOpcode (WorldPacket &recvPacket)
 
void HandleDelIgnoreOpcode (WorldPacket &recvPacket)
 
void HandleSetFriendNoteOpcode (WorldPacket &recvPacket)
 
void HandleBugOpcode (WorldPacket &recvPacket)
 
void HandleSetAmmoOpcode (WorldPacket &recvPacket)
 
void HandleItemNameQueryOpcode (WorldPacket &recvPacket)
 
void HandleAreaTriggerOpcode (WorldPacket &recvPacket)
 
void HandleSetFactionAtWar (WorldPacket &recv_data)
 
void HandleSetFactionCheat (WorldPacket &recv_data)
 
void HandleSetWatchedFactionIndexOpcode (WorldPacket &recv_data)
 
void HandleSetWatchedFactionInactiveOpcode (WorldPacket &recv_data)
 
void HandleUpdateAccountData (WorldPacket &recvPacket)
 
void HandleRequestAccountData (WorldPacket &recvPacket)
 
void HandleSetActionButtonOpcode (WorldPacket &recvPacket)
 
void HandleGameObjectUseOpcode (WorldPacket &recPacket)
 
void HandleMeetingStoneInfo (WorldPacket &recPacket)
 
void HandleNameQueryOpcode (WorldPacket &recvPacket)
 
void HandleQueryTimeOpcode (WorldPacket &recvPacket)
 
void HandleCreatureQueryOpcode (WorldPacket &recvPacket)
 
void HandleGameObjectQueryOpcode (WorldPacket &recvPacket)
 
void HandleMoveWorldportAckOpcode (WorldPacket &recvPacket)
 
void HandleMoveWorldportAckOpcode ()
 
void HandleMovementOpcodes (WorldPacket &recvPacket)
 
void HandleSetActiveMoverOpcode (WorldPacket &recv_data)
 
void HandleMoveNotActiveMoverOpcode (WorldPacket &recv_data)
 
void HandleMoveTimeSkippedOpcode (WorldPacket &recv_data)
 
void HandleRequestRaidInfoOpcode (WorldPacket &recv_data)
 
void HandleBattlefieldStatusOpcode (WorldPacket &recv_data)
 
void HandleBattleMasterHelloOpcode (WorldPacket &recv_data)
 
void HandleGroupInviteOpcode (WorldPacket &recvPacket)
 
void HandleGroupAcceptOpcode (WorldPacket &recvPacket)
 
void HandleGroupDeclineOpcode (WorldPacket &recvPacket)
 
void HandleGroupUninviteNameOpcode (WorldPacket &recvPacket)
 
void HandleGroupUninviteGuidOpcode (WorldPacket &recvPacket)
 
void HandleGroupSetLeaderOpcode (WorldPacket &recvPacket)
 
void HandleGroupLeaveOpcode (WorldPacket &recvPacket)
 
void HandleGroupPassOnLootOpcode (WorldPacket &recv_data)
 
void HandleLootMethodOpcode (WorldPacket &recvPacket)
 
void HandleLootRoll (WorldPacket &recv_data)
 
void HandleRequestPartyMemberStatsOpcode (WorldPacket &recv_data)
 
void HandleRaidIconTargetOpcode (WorldPacket &recv_data)
 
void HandleRaidReadyCheckOpcode (WorldPacket &recv_data)
 
void HandleRaidReadyCheckFinishOpcode (WorldPacket &recv_data)
 
void HandleRaidConvertOpcode (WorldPacket &recv_data)
 
void HandleGroupChangeSubGroupOpcode (WorldPacket &recv_data)
 
void HandleGroupAssistantOpcode (WorldPacket &recv_data)
 
void HandleGroupPromoteOpcode (WorldPacket &recv_data)
 
void HandlePetitionBuyOpcode (WorldPacket &recv_data)
 
void HandlePetitionShowSignOpcode (WorldPacket &recv_data)
 
void HandlePetitionQueryOpcode (WorldPacket &recv_data)
 
void HandlePetitionRenameOpcode (WorldPacket &recv_data)
 
void HandlePetitionSignOpcode (WorldPacket &recv_data)
 
void HandlePetitionDeclineOpcode (WorldPacket &recv_data)
 
void HandleOfferPetitionOpcode (WorldPacket &recv_data)
 
void HandleTurnInPetitionOpcode (WorldPacket &recv_data)
 
void HandleGuildQueryOpcode (WorldPacket &recvPacket)
 
void HandleGuildCreateOpcode (WorldPacket &recvPacket)
 
void HandleGuildInviteOpcode (WorldPacket &recvPacket)
 
void HandleGuildRemoveOpcode (WorldPacket &recvPacket)
 
void HandleGuildAcceptOpcode (WorldPacket &recvPacket)
 
void HandleGuildDeclineOpcode (WorldPacket &recvPacket)
 
void HandleGuildInfoOpcode (WorldPacket &recvPacket)
 
void HandleGuildEventLogOpcode (WorldPacket &recvPacket)
 
void HandleGuildRosterOpcode (WorldPacket &recvPacket)
 
void HandleGuildPromoteOpcode (WorldPacket &recvPacket)
 
void HandleGuildDemoteOpcode (WorldPacket &recvPacket)
 
void HandleGuildLeaveOpcode (WorldPacket &recvPacket)
 
void HandleGuildDisbandOpcode (WorldPacket &recvPacket)
 
void HandleGuildLeaderOpcode (WorldPacket &recvPacket)
 
void HandleGuildMOTDOpcode (WorldPacket &recvPacket)
 
void HandleGuildSetPublicNoteOpcode (WorldPacket &recvPacket)
 
void HandleGuildSetOfficerNoteOpcode (WorldPacket &recvPacket)
 
void HandleGuildRankOpcode (WorldPacket &recvPacket)
 
void HandleGuildAddRankOpcode (WorldPacket &recvPacket)
 
void HandleGuildDelRankOpcode (WorldPacket &recvPacket)
 
void HandleGuildChangeInfoOpcode (WorldPacket &recvPacket)
 
void HandleGuildSaveEmblemOpcode (WorldPacket &recvPacket)
 
void HandleTaxiNodeStatusQueryOpcode (WorldPacket &recvPacket)
 
void HandleTaxiQueryAvailableNodesOpcode (WorldPacket &recvPacket)
 
void HandleActivateTaxiOpcode (WorldPacket &recvPacket)
 
void HandleActivateTaxiFarOpcode (WorldPacket &recvPacket)
 
void HandleTaxiNextDestinationOpcode (WorldPacket &recvPacket)
 
void HandleTabardVendorActivateOpcode (WorldPacket &recvPacket)
 
void HandleBankerActivateOpcode (WorldPacket &recvPacket)
 
void HandleBuyBankSlotOpcode (WorldPacket &recvPacket)
 
void HandleTrainerListOpcode (WorldPacket &recvPacket)
 
void HandleTrainerBuySpellOpcode (WorldPacket &recvPacket)
 
void HandlePetitionShowListOpcode (WorldPacket &recvPacket)
 
void HandleGossipHelloOpcode (WorldPacket &recvPacket)
 
void HandleGossipSelectOptionOpcode (WorldPacket &recvPacket)
 
void HandleSpiritHealerActivateOpcode (WorldPacket &recvPacket)
 
void HandleNpcTextQueryOpcode (WorldPacket &recvPacket)
 
void HandleBinderActivateOpcode (WorldPacket &recvPacket)
 
void HandleListStabledPetsOpcode (WorldPacket &recvPacket)
 
void HandleStablePet (WorldPacket &recvPacket)
 
void HandleUnstablePet (WorldPacket &recvPacket)
 
void HandleBuyStableSlot (WorldPacket &recvPacket)
 
void HandleStableRevivePet (WorldPacket &recvPacket)
 
void HandleStableSwapPet (WorldPacket &recvPacket)
 
void HandleDuelAcceptedOpcode (WorldPacket &recvPacket)
 
void HandleDuelCancelledOpcode (WorldPacket &recvPacket)
 
void HandleAcceptTradeOpcode (WorldPacket &recvPacket)
 
void HandleBeginTradeOpcode (WorldPacket &recvPacket)
 
void HandleBusyTradeOpcode (WorldPacket &recvPacket)
 
void HandleCancelTradeOpcode (WorldPacket &recvPacket)
 
void HandleClearTradeItemOpcode (WorldPacket &recvPacket)
 
void HandleIgnoreTradeOpcode (WorldPacket &recvPacket)
 
void HandleInitiateTradeOpcode (WorldPacket &recvPacket)
 
void HandleSetTradeGoldOpcode (WorldPacket &recvPacket)
 
void HandleSetTradeItemOpcode (WorldPacket &recvPacket)
 
void HandleUnacceptTradeOpcode (WorldPacket &recvPacket)
 
void HandleAuctionHelloOpcode (WorldPacket &recvPacket)
 
void HandleAuctionListItems (WorldPacket &recv_data)
 
void HandleAuctionListBidderItems (WorldPacket &recv_data)
 
void HandleAuctionSellItem (WorldPacket &recv_data)
 
void HandleAuctionRemoveItem (WorldPacket &recv_data)
 
void HandleAuctionListOwnerItems (WorldPacket &recv_data)
 
void HandleAuctionPlaceBid (WorldPacket &recv_data)
 
void HandleGetMail (WorldPacket &recv_data)
 
void HandleSendMail (WorldPacket &recv_data)
 
void HandleTakeMoney (WorldPacket &recv_data)
 
void HandleTakeItem (WorldPacket &recv_data)
 
void HandleMarkAsRead (WorldPacket &recv_data)
 
void HandleReturnToSender (WorldPacket &recv_data)
 
void HandleMailDelete (WorldPacket &recv_data)
 
void HandleItemTextQuery (WorldPacket &recv_data)
 
void HandleMailCreateTextItem (WorldPacket &recv_data)
 
void HandleMsgQueryNextMailtime (WorldPacket &recv_data)
 
void HandleCancelChanneling (WorldPacket &recv_data)
 
void SendItemPageInfo (ItemTemplate *itemProto)
 
void HandleSplitItemOpcode (WorldPacket &recvPacket)
 
void HandleSwapInvItemOpcode (WorldPacket &recvPacket)
 
void HandleDestroyItemOpcode (WorldPacket &recvPacket)
 
void HandleAutoEquipItemOpcode (WorldPacket &recvPacket)
 
void HandleItemQuerySingleOpcode (WorldPacket &recvPacket)
 
void HandleSellItemOpcode (WorldPacket &recvPacket)
 
void HandleBuyItemInSlotOpcode (WorldPacket &recvPacket)
 
void HandleBuyItemOpcode (WorldPacket &recvPacket)
 
void HandleListInventoryOpcode (WorldPacket &recvPacket)
 
void HandleAutoStoreBagItemOpcode (WorldPacket &recvPacket)
 
void HandleReadItem (WorldPacket &recvPacket)
 
void HandleAutoEquipItemSlotOpcode (WorldPacket &recvPacket)
 
void HandleSwapItem (WorldPacket &recvPacket)
 
void HandleBuybackItem (WorldPacket &recvPacket)
 
void HandleAutoBankItemOpcode (WorldPacket &recvPacket)
 
void HandleAutoStoreBankItemOpcode (WorldPacket &recvPacket)
 
void HandleWrapItemOpcode (WorldPacket &recvPacket)
 
void HandleAttackSwingOpcode (WorldPacket &recvPacket)
 
void HandleAttackStopOpcode (WorldPacket &recvPacket)
 
void HandleSetSheathedOpcode (WorldPacket &recvPacket)
 
void HandleUseItemOpcode (WorldPacket &recvPacket)
 
void HandleOpenItemOpcode (WorldPacket &recvPacket)
 
void HandleCastSpellOpcode (WorldPacket &recvPacket)
 
void HandleCancelCastOpcode (WorldPacket &recvPacket)
 
void HandleCancelAuraOpcode (WorldPacket &recvPacket)
 
void HandleCancelGrowthAuraOpcode (WorldPacket &recvPacket)
 
void HandleCancelAutoRepeatSpellOpcode (WorldPacket &recvPacket)
 
void HandleLearnTalentOpcode (WorldPacket &recvPacket)
 
void HandleTalentWipeOpcode (WorldPacket &recvPacket)
 
void HandleUnlearnSkillOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverStatusQueryOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverStatusQueryMultipleOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverHelloOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverAcceptQuestOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverQuestQueryOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverChooseRewardOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverRequestRewardOpcode (WorldPacket &recvPacket)
 
void HandleQuestQueryOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverCancel (WorldPacket &recv_data)
 
void HandleQuestLogSwapQuest (WorldPacket &recv_data)
 
void HandleQuestLogRemoveQuest (WorldPacket &recv_data)
 
void HandleQuestConfirmAccept (WorldPacket &recv_data)
 
void HandleQuestComplete (WorldPacket &recv_data)
 
void HandleQuestAutoLaunch (WorldPacket &recvPacket)
 
void HandleQuestPushToParty (WorldPacket &recvPacket)
 
void HandleQuestPushResult (WorldPacket &recvPacket)
 
bool processChatmessageFurtherAfterSecurityChecks (std::string &, uint32)
 
void HandleMessagechatOpcode (WorldPacket &recvPacket)
 
void SendPlayerNotFoundNotice (std::string name)
 
void SendWrongFactionNotice ()
 
void HandleTextEmoteOpcode (WorldPacket &recvPacket)
 
void HandleChatIgnoredOpcode (WorldPacket &recvPacket)
 
void HandleCorpseReclaimOpcode (WorldPacket &recvPacket)
 
void HandleCorpseQueryOpcode (WorldPacket &recvPacket)
 
void HandleResurrectResponseOpcode (WorldPacket &recvPacket)
 
void HandleSummonResponseOpcode (WorldPacket &recv_data)
 
void HandleChannelJoin (WorldPacket &recvPacket)
 
void HandleChannelLeave (WorldPacket &recvPacket)
 
void HandleChannelList (WorldPacket &recvPacket)
 
void HandleChannelPassword (WorldPacket &recvPacket)
 
void HandleChannelSetOwner (WorldPacket &recvPacket)
 
void HandleChannelOwner (WorldPacket &recvPacket)
 
void HandleChannelModerator (WorldPacket &recvPacket)
 
void HandleChannelUnmoderator (WorldPacket &recvPacket)
 
void HandleChannelMute (WorldPacket &recvPacket)
 
void HandleChannelUnmute (WorldPacket &recvPacket)
 
void HandleChannelInvite (WorldPacket &recvPacket)
 
void HandleChannelKick (WorldPacket &recvPacket)
 
void HandleChannelBan (WorldPacket &recvPacket)
 
void HandleChannelUnban (WorldPacket &recvPacket)
 
void HandleChannelAnnounce (WorldPacket &recvPacket)
 
void HandleChannelModerate (WorldPacket &recvPacket)
 
void HandleChannelRosterQuery (WorldPacket &recvPacket)
 
void HandleChannelInfoQuery (WorldPacket &recvPacket)
 
void HandleChannelJoinNotify (WorldPacket &recvPacket)
 
void HandleCompleteCinema (WorldPacket &recvPacket)
 
void HandleNextCinematicCamera (WorldPacket &recvPacket)
 
void HandlePageQuerySkippedOpcode (WorldPacket &recvPacket)
 
void HandlePageQueryOpcode (WorldPacket &recvPacket)
 
void HandleTutorialFlag (WorldPacket &recv_data)
 
void HandleTutorialClear (WorldPacket &recv_data)
 
void HandleTutorialReset (WorldPacket &recv_data)
 
void HandlePetAction (WorldPacket &recv_data)
 
void HandlePetActionHelper (Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2)
 
void HandlePetNameQuery (WorldPacket &recv_data)
 
void HandlePetSetAction (WorldPacket &recv_data)
 
void HandlePetAbandon (WorldPacket &recv_data)
 
void HandlePetRename (WorldPacket &recv_data)
 
void HandlePetCancelAuraOpcode (WorldPacket &recvPacket)
 
void HandlePetUnlearnOpcode (WorldPacket &recvPacket)
 
void HandlePetSpellAutocastOpcode (WorldPacket &recvPacket)
 
void HandlePetCastSpellOpcode (WorldPacket &recvPacket)
 
void HandleSetActionBar (WorldPacket &recv_data)
 
void HandleChangePlayerNameOpcode (WorldPacket &recv_data)
 
void HandleDeclinedPlayerNameOpcode (WorldPacket &recv_data)
 
void HandleTotemDestroy (WorldPacket &recv_data)
 
void HandleBattlegroundHelloOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundJoinOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundPlayerPositionsOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundPVPlogdataOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundPlayerPortOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundListOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundLeaveOpcode (WorldPacket &recv_data)
 
void HandleBattlegroundArenaJoin (WorldPacket &recv_data)
 
void HandleBattlegroundReportAFK (WorldPacket &recv_data)
 
void HandleWardenDataOpcode (WorldPacket &recv_data)
 
void HandleWorldTeleportOpcode (WorldPacket &recv_data)
 
void HandleMinimapPingOpcode (WorldPacket &recv_data)
 
void HandleRandomRollOpcode (WorldPacket &recv_data)
 
void HandleFarSightOpcode (WorldPacket &recv_data)
 
void HandleSetLfgOpcode (WorldPacket &recv_data)
 
void HandleDungeonDifficultyOpcode (WorldPacket &recv_data)
 
void HandleMoveFlyModeChangeAckOpcode (WorldPacket &recv_data)
 
void HandleLfgAutoJoinOpcode (WorldPacket &recv_data)
 
void HandleLfgCancelAutoJoinOpcode (WorldPacket &recv_data)
 
void HandleLfmAutoAddMembersOpcode (WorldPacket &recv_data)
 
void HandleLfmCancelAutoAddmembersOpcode (WorldPacket &recv_data)
 
void HandleLfgClearOpcode (WorldPacket &recv_data)
 
void HandleLfmSetNoneOpcode (WorldPacket &recv_data)
 
void HandleLfmSetOpcode (WorldPacket &recv_data)
 
void HandleLfgSetCommentOpcode (WorldPacket &recv_data)
 
void HandleChooseTitleOpcode (WorldPacket &recv_data)
 
void HandleRealmStateRequestOpcode (WorldPacket &recv_data)
 
void HandleTimeSyncResp (WorldPacket &recv_data)
 
void HandleWhoisOpcode (WorldPacket &recv_data)
 
void HandleResetInstancesOpcode (WorldPacket &recv_data)
 
void HandleInspectArenaStatsOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamQueryOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamRosterOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamAddMemberOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamInviteAcceptOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamInviteDeclineOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamLeaveOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamRemoveFromTeamOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamDisbandOpcode (WorldPacket &recv_data)
 
void HandleArenaTeamPromoteToCaptainOpcode (WorldPacket &recv_data)
 
void HandleAreaSpiritHealerQueryOpcode (WorldPacket &recv_data)
 
void HandleAreaSpiritHealerQueueOpcode (WorldPacket &recv_data)
 
void HandleDismountOpcode (WorldPacket &recv_data)
 
void HandleSelfResOpcode (WorldPacket &recv_data)
 
void HandleReportSpamOpcode (WorldPacket &recv_data)
 
void HandleRequestPetInfoOpcode (WorldPacket &recv_data)
 
void HandleSocketOpcode (WorldPacket &recv_data)
 
void HandleCancelTempItemEnchantmentOpcode (WorldPacket &recv_data)
 
void HandleChannelEnableVoiceOpcode (WorldPacket &recv_data)
 
void HandleVoiceSettingsOpcode (WorldPacket &recv_data)
 
void HandleChannelVoiceChatQuery (WorldPacket &recv_data)
 
void HandleSetTaxiBenchmarkOpcode (WorldPacket &recv_data)
 
void HandleGuildBankGetRights (WorldPacket &recv_data)
 
void HandleGuildBankGetMoneyAmount (WorldPacket &recv_data)
 
void HandleGuildBankQuery (WorldPacket &recv_data)
 
void HandleGuildBankTabColon (WorldPacket &recv_data)
 
void HandleGuildBankLog (WorldPacket &recv_data)
 
void HandleGuildBankDeposit (WorldPacket &recv_data)
 
void HandleGuildBankWithdraw (WorldPacket &recv_data)
 
void HandleGuildBankDepositItem (WorldPacket &recv_data)
 
void HandleGuildBankModifyTab (WorldPacket &recv_data)
 
void HandleGuildBankBuyTab (WorldPacket &recv_data)
 
void HandleGuildBankTabText (WorldPacket &recv_data)
 
void HandleGuildBankSetTabText (WorldPacket &recv_data)
 
void HandleSetGrantableLevels (WorldPacket &recv_data)
 
void HandleGrantLevel (WorldPacket &recv_data)
 
void HandleAcceptGrantLevel (WorldPacket &recv_data)
 
void HandleReferAFriend (WorldPacket &recv_data)
 
void HandleMirrorImageDataRequest (WorldPacket &recvData)
 
void HandleSpellClick (WorldPacket &recvData)
 

Static Public Member Functions

static void SendNameQueryOpcodeFromDBCallBack (QueryResult_AutoPtr result, uint32 accountId)
 
static void SendExternalMails ()
 
static void HandleAddFriendOpcodeCallBack (QueryResult_AutoPtr result, uint32 accountId, std::string friendNote)
 
static void HandleAddIgnoreOpcodeCallBack (QueryResult_AutoPtr result, uint32 accountId)
 
static void HandleChangePlayerNameOpcodeCallBack (QueryResult_AutoPtr result, uint32 accountId, std::string newname)
 

Public Attributes

bool LookingForGroup_auto_join
 
bool LookingForGroup_auto_add
 
time_t m_muteTime
 
uint32 m_timeOutTime
 

Private Types

typedef UNORDERED_MAP< uint32, ProtectedOpcodeStatusProtectedOpcodeMap
 

Private Member Functions

void moveItems (Item *myItems[], Item *hisItems[])
 
void ExecuteOpcode (OpcodeHandler const &opHandle, WorldPacket *packet)
 
void LogUnexpectedOpcode (WorldPacket *packet, const char *reason)
 
void LogUnprocessedTail (WorldPacket *packet)
 
bool CharCanLogin (uint32 lowGUID)
 

Private Attributes

std::set< uint32_allowedCharsToLogin
 
Player_player
 
WorldSocketm_Socket
 
std::string m_Address
 
uint32 _security
 
uint32 _accountId
 
uint8 m_expansion
 
WardenBasem_Warden
 
bool m_inQueue
 
bool m_playerLoading
 
bool m_playerLogout
 
bool m_playerRecentlyLogout
 
bool m_playerSave
 
LocaleConstant m_sessionDbcLocale
 
int m_sessionDbLocaleIndex
 
time_t _logoutTime
 
uint32 m_latency
 
uint32 m_clientTimeDelay
 
ProtectedOpcodeMap _protectedOpcodes
 
ACE_Based::LockedQueue< WorldPacket *, ACE_Thread_Mutex > _recvQueue
 

Friends

class CharacterHandler
 

Detailed Description

Definition at line 66 of file WorldSession.h.

Member Typedef Documentation

Constructor & Destructor Documentation

WorldSession::WorldSession ( uint32  id,
WorldSocket sock,
uint32  sec,
uint8  expansion,
time_t  mute_time,
LocaleConstant  locale 
)

Definition at line 39 of file WorldSession.cpp.

References WorldSocket::AddReference(), GetAccountId(), WorldSocket::GetRemoteAddress(), LoginDatabase, m_Address, Database::PExecute(), and ResetTimeOutTime().

39  :
41  _player(NULL), m_Socket(sock), _security(sec), _accountId(id), m_expansion(expansion), m_Warden(NULL),
42  m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_playerSave(false),
43  m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)),
45 {
46  if (sock)
47  {
48  m_Address = sock->GetRemoteAddress();
49  sock->AddReference();
51  LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId());
52  }
53 }
long AddReference(void)
LocaleConstant m_sessionDbcLocale
Definition: WorldSession.h:745
time_t _logoutTime
Definition: WorldSession.h:747
bool LookingForGroup_auto_add
Definition: WorldSession.h:223
uint32 _security
Definition: WorldSession.h:733
bool m_playerLogout
Definition: WorldSession.h:742
uint32 m_clientTimeDelay
Definition: WorldSession.h:749
void ResetTimeOutTime()
Definition: WorldSession.h:265
uint32 GetAccountId() const
Definition: WorldSession.h:100
uint8 m_expansion
Definition: WorldSession.h:735
#define sObjectMgr
Definition: ObjectMgr.h:1285
time_t m_muteTime
Definition: WorldSession.h:230
DatabaseType LoginDatabase
Accessor to the realm/login database.
Definition: Main.cpp:55
WorldSocket * m_Socket
Definition: WorldSession.h:730
uint32 m_timeOutTime
Definition: WorldSession.h:257
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
bool m_playerRecentlyLogout
Definition: WorldSession.h:743
bool LookingForGroup_auto_join
Definition: WorldSession.h:222
uint32 _accountId
Definition: WorldSession.h:734
std::string m_Address
Definition: WorldSession.h:731
Player * _player
Definition: WorldSession.h:729
uint32 m_latency
Definition: WorldSession.h:748
#define sWorld
Definition: World.h:860
const std::string & GetRemoteAddress(void) const
bool m_playerLoading
Definition: WorldSession.h:741
int m_sessionDbLocaleIndex
Definition: WorldSession.h:746
WardenBase * m_Warden
Definition: WorldSession.h:738
WorldSession::~WorldSession ( )

Definition at line 56 of file WorldSession.cpp.

References _player, _recvQueue, CharacterDatabase, WorldSocket::CloseSocket(), GetAccountId(), LoginDatabase, LogoutPlayer(), m_Socket, m_Warden, ACE_Based::LockedQueue< T, LockType, StorageType >::next(), Database::PExecute(), and WorldSocket::RemoveReference().

57 {
58  // unload player if not unloaded
59  if (_player)
60  LogoutPlayer(true);
61 
62  // If have unclosed socket, close it
63  if (m_Socket)
64  {
67  m_Socket = NULL;
68  }
69 
70  if (m_Warden)
71  delete m_Warden;
72 
73  // empty incoming packet queue
74  WorldPacket* packet;
75  while (_recvQueue.next(packet))
76  delete packet;
77 
78  LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId());
79  CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = %u;", GetAccountId());
80 }
ACE_Based::LockedQueue< WorldPacket *, ACE_Thread_Mutex > _recvQueue
Definition: WorldSession.h:760
bool next(T &result)
Definition: LockedQueue.h:68
uint32 GetAccountId() const
Definition: WorldSession.h:100
void LogoutPlayer(bool Save)
DatabaseType LoginDatabase
Accessor to the realm/login database.
Definition: Main.cpp:55
WorldSocket * m_Socket
Definition: WorldSession.h:730
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
Player * _player
Definition: WorldSession.h:729
void CloseSocket(void)
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
long RemoveReference(void)
WardenBase * m_Warden
Definition: WorldSession.h:738

Member Function Documentation

void WorldSession::BuildPartyMemberStatsChangedPacket ( Player player,
WorldPacket data 
)

Definition at line 661 of file GroupHandler.cpp.

References _player, Pet::GetAuraUpdateMask(), Player::GetAuraUpdateMask(), Unit::GetDisplayId(), Player::GetGroupUpdateFlag(), Object::GetGUID(), Unit::GetHealth(), Unit::getLevel(), Unit::GetMaxHealth(), Unit::GetMaxPower(), WorldObject::GetName(), Object::GetPackGUID(), Player::GetPet(), Position::GetPositionX(), Position::GetPositionY(), Unit::GetPower(), Unit::getPowerType(), Object::GetUInt32Value(), WorldObject::GetZoneId(), GROUP_UPDATE_FLAG_AURAS, GROUP_UPDATE_FLAG_CUR_HP, GROUP_UPDATE_FLAG_CUR_POWER, GROUP_UPDATE_FLAG_LEVEL, GROUP_UPDATE_FLAG_MAX_HP, GROUP_UPDATE_FLAG_MAX_POWER, GROUP_UPDATE_FLAG_PET_AURAS, GROUP_UPDATE_FLAG_PET_CUR_HP, GROUP_UPDATE_FLAG_PET_CUR_POWER, GROUP_UPDATE_FLAG_PET_GUID, GROUP_UPDATE_FLAG_PET_MAX_HP, GROUP_UPDATE_FLAG_PET_MAX_POWER, GROUP_UPDATE_FLAG_PET_MODEL_ID, GROUP_UPDATE_FLAG_PET_NAME, GROUP_UPDATE_FLAG_PET_POWER_TYPE, GROUP_UPDATE_FLAG_POSITION, GROUP_UPDATE_FLAG_POWER_TYPE, GROUP_UPDATE_FLAG_STATUS, GROUP_UPDATE_FLAG_ZONE, GROUP_UPDATE_FLAGS_COUNT, WorldPacket::Initialize(), Unit::IsPvP(), MAX_AURAS, MEMBER_STATUS_ONLINE, MEMBER_STATUS_PVP, MEMBER_STATUS_RAF_BUDDY, RAF_LINK_NONE, SMSG_PARTY_MEMBER_STATS, sObjectMgr, and UNIT_FIELD_AURA.

Referenced by HandleRequestPartyMemberStatsOpcode(), and Group::UpdatePlayerOutOfRange().

662 {
663  uint32 mask = player->GetGroupUpdateFlag();
664 
665  if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
667 
668  if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
670 
671  uint32 byteCount = 0;
672  for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i)
673  if (mask & (1 << i))
674  byteCount += GroupUpdateLength[i];
675 
676  data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
677  *data << player->GetPackGUID();
678  *data << uint32(mask);
679 
680  if (mask & GROUP_UPDATE_FLAG_STATUS)
681  {
682  if (player)
683  {
684  uint16 flag;
685  if (player->IsPvP())
687  else
689 
690  if (sObjectMgr.GetRAFLinkStatus(_player, player) != RAF_LINK_NONE)
691  flag |= MEMBER_STATUS_RAF_BUDDY;
692 
693  *data << flag;
694  }
695  }
696 
697  if (mask & GROUP_UPDATE_FLAG_CUR_HP)
698  *data << (uint16) player->GetHealth();
699 
700  if (mask & GROUP_UPDATE_FLAG_MAX_HP)
701  *data << (uint16) player->GetMaxHealth();
702 
703  Powers powerType = player->getPowerType();
704  if (mask & GROUP_UPDATE_FLAG_POWER_TYPE)
705  *data << (uint8) powerType;
706 
707  if (mask & GROUP_UPDATE_FLAG_CUR_POWER)
708  *data << (uint16) player->GetPower(powerType);
709 
710  if (mask & GROUP_UPDATE_FLAG_MAX_POWER)
711  *data << (uint16) player->GetMaxPower(powerType);
712 
713  if (mask & GROUP_UPDATE_FLAG_LEVEL)
714  *data << (uint16) player->getLevel();
715 
716  if (mask & GROUP_UPDATE_FLAG_ZONE)
717  *data << (uint16) player->GetZoneId();
718 
719  if (mask & GROUP_UPDATE_FLAG_POSITION)
720  *data << (uint16) player->GetPositionX() << (uint16) player->GetPositionY();
721 
722  if (mask & GROUP_UPDATE_FLAG_AURAS)
723  {
724  uint64 auramask = player->GetAuraUpdateMask();
725  *data << uint64(auramask);
726  for (uint32 i = 0; i < MAX_AURAS; ++i)
727  {
728  if (auramask & (uint64(1) << i))
729  {
730  *data << uint16(player->GetUInt32Value(UNIT_FIELD_AURA + i));
731  *data << uint8(1);
732  }
733  }
734  }
735 
736  Pet* pet = player->GetPet();
737  if (mask & GROUP_UPDATE_FLAG_PET_GUID)
738  *data << uint64(pet ? pet->GetGUID() : 0);
739 
740  if (mask & GROUP_UPDATE_FLAG_PET_NAME)
741  {
742  if (pet)
743  *data << pet->GetName();
744  else
745  *data << (uint8) 0;
746  }
747 
749  {
750  if (pet)
751  *data << (uint16) pet->GetDisplayId();
752  else
753  *data << (uint16) 0;
754  }
755 
756  if (mask & GROUP_UPDATE_FLAG_PET_CUR_HP)
757  {
758  if (pet)
759  *data << (uint16) pet->GetHealth();
760  else
761  *data << (uint16) 0;
762  }
763 
764  if (mask & GROUP_UPDATE_FLAG_PET_MAX_HP)
765  {
766  if (pet)
767  *data << (uint16) pet->GetMaxHealth();
768  else
769  *data << (uint16) 0;
770  }
771 
772  if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE)
773  {
774  if (pet)
775  *data << (uint8) pet->getPowerType();
776  else
777  *data << (uint8) 0;
778  }
779 
781  {
782  if (pet)
783  *data << (uint16) pet->GetPower(pet->getPowerType());
784  else
785  *data << (uint16) 0;
786  }
787 
789  {
790  if (pet)
791  *data << (uint16) pet->GetMaxPower(pet->getPowerType());
792  else
793  *data << (uint16) 0;
794  }
795 
796  if (mask & GROUP_UPDATE_FLAG_PET_AURAS)
797  {
798  if (pet)
799  {
800  uint64 auramask = pet->GetAuraUpdateMask();
801  *data << uint64(auramask);
802  for (uint32 i = 0; i < MAX_AURAS; ++i)
803  {
804  if (auramask & (uint64(1) << i))
805  {
806  *data << uint16(pet->GetUInt32Value(UNIT_FIELD_AURA + i));
807  *data << uint8(1);
808  }
809  }
810  }
811  else
812  *data << (uint64) 0;
813  }
814 }
const uint32 & GetUInt32Value(uint16 index) const
Definition: Object.h:228
uint32 GetMaxHealth() const
Definition: Unit.h:1052
bool IsPvP() const
Definition: Unit.h:1140
uint32 GetGroupUpdateFlag()
Definition: Player.h:2606
uint32 GetZoneId() const
Definition: Object.cpp:1176
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:37
#define sObjectMgr
Definition: ObjectMgr.h:1285
uint32 GetPower(Powers power) const
Definition: Unit.h:1076
Powers getPowerType() const
Definition: Unit.h:1071
ACE_UINT8 uint8
Definition: Define.h:73
Powers
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1080
uint32 GetDisplayId()
Definition: Unit.h:1891
uint64 GetAuraUpdateMask()
Definition: Pet.h:268
float GetPositionY() const
Definition: Position.h:98
PackedGuid const & GetPackGUID() const
Definition: Object.h:172
#define GROUP_UPDATE_FLAGS_COUNT
Definition: Group.h:106
const char * GetName() const
Definition: Object.h:692
ACE_UINT64 uint64
Definition: Define.h:70
Player * _player
Definition: WorldSession.h:729
uint64 GetAuraUpdateMask()
Definition: Player.h:2614
ACE_UINT16 uint16
Definition: Define.h:72
ACE_UINT32 uint32
Definition: Define.h:71
#define MAX_AURAS
float GetPositionX() const
Definition: Position.h:97
uint32 GetHealth() const
Definition: Unit.h:1051
Pet * GetPet() const
Definition: Player.cpp:17104
uint32 getLevel() const
Definition: Unit.h:1029
Definition: Pet.h:146
const uint64 & GetGUID() const
Definition: Object.h:156
bool WorldSession::CharCanLogin ( uint32  lowGUID)
inlineprivate

Definition at line 721 of file WorldSession.h.

References _allowedCharsToLogin.

722  {
723  return _allowedCharsToLogin.find(lowGUID) != _allowedCharsToLogin.end();
724  }
std::set< uint32 > _allowedCharsToLogin
Definition: WorldSession.h:727
void WorldSession::DoLootRelease ( uint64  lguid)

Definition at line 288 of file LootHandler.cpp.

References _player, GameObject::AddUse(), Creature::AllLootRemovedFromCorpse(), GameObjectInfo::chest, CLASS_ROGUE, Loot::clear(), CORPSE_DYNFLAG_LOOTABLE, CORPSE_FIELD_DYNAMIC_FLAGS, Player::DestroyItem(), Player::DestroyItemCount(), GameObjectInfo::fishinghole, ItemTemplate::Flags, Object::ForceValuesUpdateAtIndex(), GAMEOBJECT_TYPE_CHEST, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_FISHINGHOLE, GAMEOBJECT_TYPE_FISHINGNODE, Item::GetBagSlot(), Unit::getClass(), ObjectAccessor::GetCorpse(), Item::GetCount(), Map::GetCreature(), Map::GetGameObject(), GameObject::GetGOInfo(), GameObject::GetGoType(), Player::GetGroup(), Object::GetGUID(), Player::GetItemByGuid(), WorldObject::GetMap(), GameObject::GetOwnerGUID(), GetPlayer(), Item::GetProto(), Player::GetSkillValue(), Item::GetSlot(), GameObject::GetUseCount(), GO_ACTIVATED, GO_JUST_DEACTIVATED, GO_READY, INTERACTION_DISTANCE, irand(), IS_CORPSE_GUID, IS_GAMEOBJECT_GUID, IS_ITEM_GUID, Unit::IsAlive(), Object::IsInWorld(), Loot::isLooted(), WorldObject::IsWithinDistInMap(), ITEM_PROTO_FLAG_PROSPECTABLE, Corpse::loot, Item::loot, Creature::loot, GameObject::loot, LOOT_PICKPOCKETING, Loot::loot_type, Item::m_lootGenerated, RATE_MINING_AMOUNT, RATE_MINING_NEXT, Object::RemoveFlag(), Loot::RemoveLooter(), LockEntry::requiredminingskill, roll_chance_f(), Loot::roundRobinPlayer, Player::SendLootRelease(), Player::SetLootGUID(), GameObject::SetLootState(), SKILL_MINING, sLockStore, sWorld, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING, and GameObject::UseDoorOrButton().

Referenced by HandleLogoutRequestOpcode(), HandleLootReleaseOpcode(), LogoutPlayer(), Player::SendLoot(), and Player::SwapItem().

289 {
290  Player* player = GetPlayer();
291  Loot* loot;
292 
293  player->SetLootGUID(0);
294  player->SendLootRelease(lguid);
295 
297 
298  if (!player->IsInWorld())
299  return;
300 
301  if (IS_GAMEOBJECT_GUID(lguid))
302  {
303  GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
304 
305  // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
307  return;
308 
309  loot = &go->loot;
310 
311  if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR)
312  {
313  // locked doors are opened with spelleffect openlock, prevent remove its as looted
314  go->UseDoorOrButton();
315  }
316  else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
317  {
318  // GO is mineral vein? so it is not removed after its looted
319  if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
320  {
321  uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
322  uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
323 
324  // only vein pass this check
325  if (go_min != 0 && go_max > go_min)
326  {
327  float amount_rate = sWorld.getRate(RATE_MINING_AMOUNT);
328  float min_amount = go_min * amount_rate;
329  float max_amount = go_max * amount_rate;
330 
331  go->AddUse();
332  float uses = float(go->GetUseCount());
333 
334  if (uses < max_amount)
335  {
336  if (uses >= min_amount)
337  {
338  float chance_rate = sWorld.getRate(RATE_MINING_NEXT);
339 
340  int32 ReqValue = 175;
341  LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
342  if (lockInfo)
343  ReqValue = lockInfo->requiredminingskill;
344  float skill = float(player->GetSkillValue(SKILL_MINING)) / (ReqValue + 25);
345  double chance = pow(0.8 * chance_rate, 4 * (1 / double(max_amount)) * double(uses));
346  if (roll_chance_f(100 * chance + skill))
347  go->SetLootState(GO_READY);
348  else // not have more uses
350  }
351  else // 100% chance until min uses
352  go->SetLootState(GO_READY);
353  }
354  else // max uses already
356  }
357  else // not vein
359  }
360  else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
361  {
362  // The fishing hole used once more
363  go->AddUse(); // if the max usage is reached, will be despawned in next tick
364  if (int32(go->GetUseCount()) >= irand(go->GetGOInfo()->fishinghole.minSuccessOpens, go->GetGOInfo()->fishinghole.maxSuccessOpens))
366  else
367  go->SetLootState(GO_READY);
368  }
369  else // not chest (or vein/herb/etc)
371 
372  loot->clear();
373  }
374  else
375  {
376  // not fully looted object
377  go->SetLootState(GO_ACTIVATED, player);
378 
379  if (player->GetGUID() == loot->roundRobinPlayer)
380  loot->roundRobinPlayer = 0;
381  }
382  }
383  else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
384  {
385  Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
386  if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
387  return;
388 
389  loot = &corpse->loot;
390 
391  if (loot->isLooted())
392  {
393  loot->clear();
395  }
396  }
397  else if (IS_ITEM_GUID(lguid))
398  {
399  Item* pItem = player->GetItemByGuid(lguid);
400  if (!pItem)
401  return;
402 
404  {
405  pItem->m_lootGenerated = false;
406  pItem->loot.clear();
407 
408  uint32 count = pItem->GetCount();
409 
410  // >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
411  if (count > 5)
412  count = 5;
413 
414  player->DestroyItemCount(pItem, count, true);
415  }
416  else
417  // FIXME: item must not be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or cheating possible.
418  player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
419  return; // item can be looted only single player
420  }
421  else
422  {
423  Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
424 
425  bool ok_loot = pCreature && pCreature->IsAlive() == (player->getClass() == CLASS_ROGUE && pCreature->loot.loot_type == LOOT_PICKPOCKETING);
426  if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
427  return;
428 
429  loot = &pCreature->loot;
430 
431  if (loot->isLooted())
432  {
434 
435  // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
436  if (!pCreature->IsAlive())
437  pCreature->AllLootRemovedFromCorpse();
438 
439  loot->clear();
440  }
441  else
442  {
443  // if the round robin player release, reset it.
444  if (player->GetGUID() == loot->roundRobinPlayer)
445  {
446  loot->roundRobinPlayer = 0;
447 
448  if (Group* group = player->GetGroup())
449  group->SendLooter(pCreature, NULL);
450  }
451  // force update of dynamic flags, otherwise other group's players still not able to loot.
453  }
454  }
455 
456  //Player is not looking at loot list, he doesn't need to see updates on the loot list
457  loot->RemoveLooter(player->GetGUID());
458 }
#define INTERACTION_DISTANCE
Definition: Object.h:35
uint32 GetCount() const
Definition: Item.h:251
ItemTemplate const * GetProto() const
Definition: Item.cpp:460
Group * GetGroup()
Definition: Player.h:2589
Definition: Corpse.h:48
Map * GetMap() const
Definition: Object.h:829
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: Player.cpp:10789
struct GameObjectInfo::@59::@64 chest
uint64 GetOwnerGUID() const
Definition: GameObject.h:662
Loot loot
Definition: Creature.h:662
bool m_lootGenerated
Definition: Item.h:340
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
int32 irand(int32 min, int32 max)
Definition: Util.cpp:66
bool roll_chance_f(float chance)
Definition: Util.h:67
ACE_INT32 int32
Definition: Define.h:67
Player * GetPlayer() const
Definition: WorldSession.h:104
void AllLootRemovedFromCorpse()
Definition: Creature.cpp:2334
void clear()
Definition: LootMgr.h:327
void SetLootGUID(const uint64 &guid)
Definition: Player.h:1952
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:762
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:10724
#define IS_ITEM_GUID(Guid)
Definition: ObjectGuid.h:72
void SetLootState(LootState s, Unit *unit=NULL)
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2632
const bool & IsInWorld() const
Definition: Object.h:129
Definition: LootMgr.h:290
bool IsAlive() const
Definition: Unit.h:1433
Definition: Item.h:196
uint64 roundRobinPlayer
Definition: LootMgr.h:311
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5545
struct GameObjectInfo::@59::@82 fishinghole
void SendLootRelease(uint64 guid)
Definition: Player.cpp:7348
#define IS_GAMEOBJECT_GUID(Guid)
Definition: ObjectGuid.h:73
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=NULL)
Definition: GameObject.cpp:950
uint8 GetSlot() const
Definition: Item.h:266
void ForceValuesUpdateAtIndex(uint32)
Definition: Object.cpp:1797
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1006
GameobjectTypes GetGoType() const
Definition: GameObject.h:718
bool isLooted() const
Definition: LootMgr.h:355
Player * _player
Definition: WorldSession.h:729
void AddUse()
Definition: GameObject.h:768
LootType loot_type
Definition: LootMgr.h:312
GameObjectInfo const * GetGOInfo() const
Definition: GameObject.h:591
unsupported by client, sending LOOT_SKINNING instead
Definition: LootMgr.h:62
uint8 getClass() const
Definition: Unit.h:1039
void RemoveLooter(uint64 GUID)
Definition: LootMgr.h:367
Loot loot
Definition: Corpse.h:93
uint32 requiredminingskill
Definition: DBCStructure.h:499
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
#define IS_CORPSE_GUID(Guid)
Definition: ObjectGuid.h:74
GameObject * GetGameObject(uint64 guid)
Definition: Map.cpp:2638
static Corpse * GetCorpse(WorldObject const &u, uint64 guid)
uint8 GetBagSlot() const
Definition: Item.cpp:728
Definition: Player.h:922
Loot loot
Definition: Item.h:339
Definition: Group.h:154
Item * GetItemByGuid(uint64 guid) const
Definition: Player.cpp:8583
const uint64 & GetGUID() const
Definition: Object.h:156
uint32 GetUseCount() const
Definition: GameObject.h:773
void WorldSession::ExecuteOpcode ( OpcodeHandler const &  opHandle,
WorldPacket packet 
)
private

Definition at line 602 of file WorldSession.cpp.

References _player, OpcodeHandler::handler, Player::IsHasDelayedTeleport(), LogUnprocessedTail(), Player::m_teleport_dest, Player::m_teleport_options, ByteBuffer::rpos(), Player::SetCanDelayTeleport(), Player::TeleportTo(), and ByteBuffer::wpos().

Referenced by IsConnectionIdle(), and Update().

603 {
604  // need prevent do internal far teleports in handlers because some handlers do lot steps
605  // or call code that can do far teleports in some conditions unexpectedly for generic way work code
606  if (_player)
608 
609  (this->*opHandle.handler)(*packet);
610 
611  if (_player)
612  {
613  // can be not set in fact for login opcode, but this not create porblems.
615 
616  //we should execute delayed teleports only for alive(!) players
617  //because we don't want player's ghost teleported from graveyard
620  }
621 
622  if (packet->rpos() < packet->wpos())
623  LogUnprocessedTail(packet);
624 }
bool IsHasDelayedTeleport() const
Definition: Player.h:2932
size_t wpos() const
Definition: ByteBuffer.h:264
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition: Player.cpp:1556
WorldLocation m_teleport_dest
Definition: Player.h:2959
uint32 m_teleport_options
Definition: Player.h:2960
void SetCanDelayTeleport(bool setting)
Definition: Player.h:2928
Player * _player
Definition: WorldSession.h:729
void LogUnprocessedTail(WorldPacket *packet)
size_t rpos() const
Definition: ByteBuffer.h:253
uint8 WorldSession::Expansion ( ) const
inline

Definition at line 121 of file WorldSession.h.

References InitWarden(), and m_expansion.

Referenced by World::AddQueuedPlayer(), World::AddSession_(), and Player::LoadFromDB().

122  {
123  return m_expansion;
124  }
uint8 m_expansion
Definition: WorldSession.h:735
uint32 WorldSession::getDialogStatus ( Player pPlayer,
Object questgiver,
uint32  defstatus 
)

Definition at line 572 of file QuestHandler.cpp.

References Player::CanSeeStartQuest(), Player::CanTakeQuest(), CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, DIALOG_STATUS_AVAILABLE, DIALOG_STATUS_AVAILABLE_REP, DIALOG_STATUS_CHAT, DIALOG_STATUS_INCOMPLETE, DIALOG_STATUS_NONE, DIALOG_STATUS_REWARD, DIALOG_STATUS_REWARD_REP, DIALOG_STATUS_UNAVAILABLE, Object::GetEntry(), Unit::getLevel(), Quest::GetQuestId(), Player::GetQuestLevelForPlayer(), Player::GetQuestRewardStatus(), Player::GetQuestStatus(), Player::getQuestStatusMap(), Object::GetTypeId(), Quest::HasFlag(), Quest::IsAutoComplete(), Quest::IsRepeatable(), QUEST_FLAGS_DAILY, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, Player::SatisfyQuestLevel(), sConditionMgr, sLog, sObjectMgr, sWorld, TYPEID_GAMEOBJECT, and TYPEID_UNIT.

Referenced by HandleQuestgiverStatusQueryMultipleOpcode(), HandleQuestgiverStatusQueryOpcode(), and ResetClientTimeDelay().

573 {
574  uint32 result = defstatus;
575 
576  QuestRelations const* qir;
577  QuestRelations const* qr;
578 
579  switch (questgiver->GetTypeId())
580  {
581  case TYPEID_GAMEOBJECT:
582  {
583  qir = &sObjectMgr.mGOQuestInvolvedRelations;
584  qr = &sObjectMgr.mGOQuestRelations;
585  break;
586  }
587  case TYPEID_UNIT:
588  {
589  qir = &sObjectMgr.mCreatureQuestInvolvedRelations;
590  qr = &sObjectMgr.mCreatureQuestRelations;
591  break;
592  }
593  default:
594  //its imposible, but check ^)
595  sLog.outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
596  return DIALOG_STATUS_NONE;
597  }
598 
599  for (QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i)
600  {
601  uint32 result2 = 0;
602  uint32 quest_id = i->second;
603  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
604  if (!pQuest) continue;
605 
606  ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
607  if (!sConditionMgr.IsObjectMeetToConditions(pPlayer, conditions))
608  continue;
609 
610  QuestStatus status = pPlayer->GetQuestStatus(quest_id);
611  if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) ||
612  (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)))
613  {
614  if (pQuest->IsAutoComplete() && pQuest->IsRepeatable())
615  result2 = DIALOG_STATUS_REWARD_REP;
616  else
617  result2 = DIALOG_STATUS_REWARD;
618  }
619  else if (status == QUEST_STATUS_INCOMPLETE)
620  result2 = DIALOG_STATUS_INCOMPLETE;
621 
622  if (result2 > result)
623  result = result2;
624  }
625 
626  for (QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i)
627  {
628  uint32 result2 = 0;
629  uint32 quest_id = i->second;
630  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
631  if (!pQuest)
632  continue;
633 
634  ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
635  if (!sConditionMgr.IsObjectMeetToConditions(pPlayer, conditions))
636  continue;
637 
638  QuestStatus status = pPlayer->GetQuestStatus(quest_id);
639  if (status == QUEST_STATUS_NONE)
640  {
641  if (pPlayer->CanSeeStartQuest(pQuest))
642  {
643  if (pPlayer->SatisfyQuestLevel(pQuest, false))
644  {
645  auto questStatusItr = pPlayer->getQuestStatusMap().find(quest_id);
646  bool rewarded = (questStatusItr != pPlayer->getQuestStatusMap().end()) ? questStatusItr->second.m_rewarded : false;
647 
648  if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && rewarded))
649  {
650  result2 = DIALOG_STATUS_REWARD_REP;
651  }
652  else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))
653  {
654  if (pQuest->HasFlag(QUEST_FLAGS_DAILY))
655  result2 = DIALOG_STATUS_AVAILABLE_REP;
656  else
657  result2 = DIALOG_STATUS_AVAILABLE;
658  }
659  else
660  result2 = DIALOG_STATUS_CHAT;
661  }
662  else
663  result2 = DIALOG_STATUS_UNAVAILABLE;
664  }
665  }
666 
667  if (result2 > result)
668  result = result2;
669  }
670 
671  return result;
672 }
bool IsAutoComplete() const
Definition: QuestDef.h:370
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:13641
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:223
bool CanSeeStartQuest(Quest const *pQuest)
Definition: Player.cpp:12728
QuestStatus
Definition: QuestDef.h:89
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
uint8 GetTypeId() const
Definition: Object.h:204
bool IsRepeatable() const
Definition: QuestDef.h:368
uint32 GetQuestLevelForPlayer(Quest const *pQuest) const
Definition: Player.h:1318
std::multimap< uint32, uint32 > QuestRelations
Definition: ObjectMgr.h:390
uint32 GetQuestId() const
Definition: QuestDef.h:186
#define sConditionMgr
Definition: ConditionMgr.h:312
bool SatisfyQuestLevel(Quest const *qInfo, bool msg)
Definition: Player.cpp:13225
bool CanTakeQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12740
bool HasFlag(uint32 flag) const
Definition: QuestDef.h:179
uint32 GetEntry() const
Definition: Object.h:186
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
uint32 getLevel() const
Definition: Unit.h:1029
QuestStatusMap & getQuestStatusMap()
Definition: Player.h:1561
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: Player.cpp:13625
uint32 WorldSession::GetLatency ( ) const
inline

Definition at line 243 of file WorldSession.h.

References m_latency.

Referenced by ChatHandler::HandlePInfoCommand(), HandleTimeSyncResp(), and Player::SaveToDB().

244  {
245  return m_latency;
246  }
uint32 m_latency
Definition: WorldSession.h:748
Player* WorldSession::GetPlayer ( ) const
inline

Definition at line 104 of file WorldSession.h.

References _player, and GetPlayerName().

Referenced by Guild::BroadcastToGuild(), Guild::BroadcastToOfficers(), ArenaTeam::Disband(), Guild::DisplayGuildBankContent(), DoLootRelease(), ChatHandler::ExecuteCommandInTable(), ChatHandler::FillMessageData(), ChatHandler::GetName(), ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(), ChatHandler::GetPlayerGroupAndGUIDByName(), GetPlayerName(), ChatHandler::getSelectedCreature(), ChatHandler::getSelectedPlayer(), ChatHandler::getSelectedPlayerOrSelf(), ChatHandler::getSelectedUnit(), HandleAcceptGrantLevel(), HandleAcceptTradeOpcode(), ChatHandler::HandleAccountSetGmLevelCommand(), ChatHandler::HandleActivateObjectCommand(), HandleActivateTaxiFarOpcode(), HandleActivateTaxiOpcode(), HandleAddFriendOpcode(), HandleAddFriendOpcodeCallBack(), HandleAddIgnoreOpcode(), HandleAddIgnoreOpcodeCallBack(), ChatHandler::HandleAddItemCommand(), ChatHandler::HandleAddItemSetCommand(), ChatHandler::HandleAddTeleCommand(), ChatHandler::HandleAddVendorItemCommand(), ChatHandler::HandleAnimCommand(), HandleAreaSpiritHealerQueryOpcode(), HandleAreaSpiritHealerQueueOpcode(), HandleAreaTriggerOpcode(), HandleArenaTeamAddMemberOpcode(), HandleArenaTeamDisbandOpcode(), HandleAttackStopOpcode(), HandleAuctionHelloOpcode(), HandleAuctionListBidderItems(), HandleAuctionListItems(), HandleAuctionListOwnerItems(), HandleAuctionPlaceBid(), HandleAuctionRemoveItem(), HandleAuctionSellItem(), HandleAutostoreLootItemOpcode(), ChatHandler::HandleBankCommand(), HandleBankerActivateOpcode(), HandleBattlegroundArenaJoin(), HandleBattlegroundHelloOpcode(), HandleBattlegroundJoinOpcode(), HandleBinderActivateOpcode(), ChatHandler::HandleBindSightCommand(), HandleBuybackItem(), ChatHandler::HandleBuyErrorCommand(), HandleBuyItemInSlotOpcode(), HandleBuyItemOpcode(), HandleBuyStableSlot(), HandleCancelTempItemEnchantmentOpcode(), ChatHandler::HandleCastBackCommand(), ChatHandler::HandleCastCommand(), ChatHandler::HandleCastDistCommand(), ChatHandler::HandleCastSelfCommand(), ChatHandler::HandleCastTargetCommand(), ChatHandler::HandleCasttimeCheatCommand(), ChatHandler::HandleChangeWeather(), HandleChatIgnoredOpcode(), HandleChooseTitleOpcode(), ChatHandler::HandleCombatStopCommand(), ChatHandler::HandleComeToMeCommand(), HandleCompleteCinema(), ChatHandler::HandleCoolDownCheatCommand(), ChatHandler::HandleCooldownCommand(), HandleCorpseQueryOpcode(), HandleCorpseReclaimOpcode(), ChatHandler::HandleCreatePetCommand(), ChatHandler::HandleDamageCommand(), ChatHandler::HandleDebugAnimationCommand(), ChatHandler::HandleDebugHostilRefList(), ChatHandler::HandleDebugPlayCinematicCommand(), ChatHandler::HandleDebugPlaySoundCommand(), HandleDelFriendOpcode(), HandleDelIgnoreOpcode(), ChatHandler::HandleDelObjectCommand(), ChatHandler::HandleDeMorphCommand(), ChatHandler::HandleDieCommand(), ChatHandler::HandleDismountCommand(), ChatHandler::HandleDrunkCommand(), HandleDuelAcceptedOpcode(), HandleDuelCancelledOpcode(), HandleEmoteOpcode(), ChatHandler::HandleEquipErrorCommand(), ChatHandler::HandleExploreCheatCommand(), HandleFarSightOpcode(), ChatHandler::HandleFlyModeCommand(), HandleForceSpeedChangeAck(), ChatHandler::HandleFreezeCommand(), ChatHandler::HandleGameObjectCommand(), HandleGameObjectUseOpcode(), ChatHandler::HandleGetDistanceCommand(), ChatHandler::HandleGetInstanceDataCommand(), ChatHandler::HandleGetItemState(), HandleGetMail(), ChatHandler::HandleGMChatCommand(), ChatHandler::HandleGMListIngameCommand(), ChatHandler::HandleGMmodeCommand(), ChatHandler::HandleGMNameAnnounceCommand(), ChatHandler::HandleGMTicketAssignToCommand(), ChatHandler::HandleGMTicketCloseByIdCommand(), ChatHandler::HandleGMTicketCommentCommand(), HandleGMTicketCreateOpcode(), ChatHandler::HandleGMTicketDeleteByIdCommand(), HandleGMTicketDeleteOpcode(), HandleGMTicketGetTicketOpcode(), ChatHandler::HandleGMTicketUnAssignCommand(), HandleGMTicketUpdateOpcode(), ChatHandler::HandleGoCreatureCommand(), ChatHandler::HandleGodModeCheatCommand(), ChatHandler::HandleGoGraveyardCommand(), ChatHandler::HandleGoGridCommand(), ChatHandler::HandleGonameCommand(), ChatHandler::HandleGoObjectCommand(), HandleGossipHelloOpcode(), HandleGossipSelectOptionOpcode(), ChatHandler::HandleGoTicketCommand(), ChatHandler::HandleGoTriggerCommand(), ChatHandler::HandleGoXYCommand(), ChatHandler::HandleGoXYZCommand(), ChatHandler::HandleGoZoneXYCommand(), HandleGrantLevel(), HandleGroupAcceptOpcode(), HandleGroupAssistantOpcode(), HandleGroupChangeSubGroupOpcode(), HandleGroupDeclineOpcode(), ChatHandler::HandleGroupgoCommand(), HandleGroupInviteOpcode(), HandleGroupLeaveOpcode(), HandleGroupPassOnLootOpcode(), HandleGroupPromoteOpcode(), HandleGroupSetLeaderOpcode(), HandleGroupUninviteGuidOpcode(), HandleGroupUninviteNameOpcode(), ChatHandler::HandleGUIDCommand(), HandleGuildAcceptOpcode(), HandleGuildAddRankOpcode(), HandleGuildBankBuyTab(), HandleGuildBankDeposit(), HandleGuildBankDepositItem(), HandleGuildBankGetMoneyAmount(), HandleGuildBankGetRights(), HandleGuildBankLog(), HandleGuildBankModifyTab(), HandleGuildBankQuery(), HandleGuildBankSetTabText(), HandleGuildBankTabColon(), HandleGuildBankTabText(), HandleGuildBankWithdraw(), HandleGuildChangeInfoOpcode(), HandleGuildCreateOpcode(), HandleGuildDeclineOpcode(), HandleGuildDelRankOpcode(), HandleGuildDemoteOpcode(), HandleGuildDisbandOpcode(), HandleGuildEventLogOpcode(), HandleGuildInfoOpcode(), HandleGuildInviteOpcode(), HandleGuildLeaderOpcode(), HandleGuildMOTDOpcode(), HandleGuildPromoteOpcode(), HandleGuildRankOpcode(), HandleGuildRemoveOpcode(), HandleGuildRosterOpcode(), HandleGuildSaveEmblemOpcode(), HandleGuildSetOfficerNoteOpcode(), HandleGuildSetPublicNoteOpcode(), ChatHandler::HandleHonorAddKillCommand(), ChatHandler::HandleHoverCommand(), HandleInitiateTradeOpcode(), HandleInspectArenaStatsOpcode(), HandleInspectHonorStatsOpcode(), HandleInspectOpcode(), ChatHandler::HandleInstanceListBindsCommand(), ChatHandler::HandleInstanceSaveDataCommand(), ChatHandler::HandleInstanceUnbindCommand(), ChatHandler::HandleItemMoveCommand(), ChatHandler::HandleKickPlayerCommand(), ChatHandler::HandleLearnAllCommand(), ChatHandler::HandleLearnAllCraftsCommand(), ChatHandler::HandleLearnAllGMCommand(), ChatHandler::HandleLearnAllLangCommand(), ChatHandler::HandleLearnAllMySpellsCommand(), ChatHandler::HandleLearnAllMyTalentsCommand(), ChatHandler::HandleLearnAllRecipesCommand(), ChatHandler::HandleLearnCommand(), HandleLearnTalentOpcode(), ChatHandler::HandleLevelUpCommand(), ChatHandler::HandleLinkGraveCommand(), ChatHandler::HandleListCreatureCommand(), HandleListInventoryOpcode(), ChatHandler::HandleListObjectCommand(), HandleListStabledPetsOpcode(), HandleLogoutCancelOpcode(), HandleLogoutRequestOpcode(), HandleLootMasterGiveOpcode(), HandleLootMethodOpcode(), HandleLootMoneyOpcode(), HandleLootOpcode(), HandleLootReleaseOpcode(), HandleLootRoll(), HandleMailCreateTextItem(), HandleMailDelete(), HandleMarkAsRead(), HandleMessagechatOpcode(), HandleMinimapPingOpcode(), ChatHandler::HandleMod32Value(), ChatHandler::HandleMorphCommand(), HandleMountSpecialAnimOpcode(), HandleMoveFlyModeChangeAckOpcode(), HandleMoveKnockBackAck(), HandleMoveNotActiveMoverOpcode(), ChatHandler::HandleMoveObjectCommand(), HandleMoveWorldportAckOpcode(), ChatHandler::HandleNameAnnounceCommand(), ChatHandler::HandleNamegoCommand(), ChatHandler::HandleNearGraveCommand(), ChatHandler::HandleNearObjectCommand(), HandleNextCinematicCamera(), ChatHandler::HandleNpcAddCommand(), ChatHandler::HandleNpcDeleteCommand(), ChatHandler::HandleNpcFollowCommand(), ChatHandler::HandleNpcMoveCommand(), HandleNpcTextQueryOpcode(), ChatHandler::HandleNpcUnFollowCommand(), ChatHandler::HandleNpcWhisperCommand(), HandleOfferPetitionOpcode(), HandlePetAction(), HandlePetActionHelper(), HandlePetCancelAuraOpcode(), HandlePetCastSpellOpcode(), HandlePetitionBuyOpcode(), HandlePetitionSignOpcode(), ChatHandler::HandlePetLearnCommand(), HandlePetSpellAutocastOpcode(), ChatHandler::HandlePetTpCommand(), ChatHandler::HandlePetUnlearnCommand(), HandlePetUnlearnOpcode(), ChatHandler::HandlePlayAllCommand(), ChatHandler::HandlePossessCommand(), ChatHandler::HandlePowerCheatCommand(), HandleQuestgiverAcceptQuestOpcode(), HandleQuestgiverChooseRewardOpcode(), HandleQuestgiverHelloOpcode(), HandleQuestgiverRequestRewardOpcode(), HandleQuestgiverStatusQueryMultipleOpcode(), HandleQuestLogSwapQuest(), ChatHandler::HandleRAFGrantLevelCommand(), ChatHandler::HandleRAFSummonCommand(), HandleRaidConvertOpcode(), HandleRaidIconTargetOpcode(), HandleRaidReadyCheckOpcode(), HandleRandomRollOpcode(), HandleRepairItemOpcode(), HandleRepopRequestOpcode(), ChatHandler::HandleResetSpellsCommand(), ChatHandler::HandleResetTalentsCommand(), ChatHandler::HandleRespawnCommand(), HandleResurrectResponseOpcode(), HandleReturnToSender(), ChatHandler::HandleSaveCommand(), ChatHandler::HandleSellErrorCommand(), HandleSellItemOpcode(), ChatHandler::HandleSendChatMsgCommand(), ChatHandler::HandleSendItemsCommand(), HandleSendMail(), ChatHandler::HandleSendMailCommand(), ChatHandler::HandleSendMoneyCommand(), ChatHandler::HandleSendOpcodeCommand(), ChatHandler::HandleSendQuestInvalidMsgCommand(), ChatHandler::HandleSendQuestPartyMsgCommand(), ChatHandler::HandleSet32Bit(), HandleSetActionBar(), HandleSetActionButtonOpcode(), HandleSetActiveMoverOpcode(), HandleSetAmmoOpcode(), ChatHandler::HandleSetInstanceDataCommand(), ChatHandler::HandleSetPoiCommand(), HandleSetSheathedOpcode(), HandleSocketOpcode(), ChatHandler::HandleSpellCrashTestCommand(), HandleSpiritHealerActivateOpcode(), HandleStablePet(), HandleStableSwapPet(), ChatHandler::HandleStandStateCommand(), ChatHandler::HandleStartCommand(), HandleSummonResponseOpcode(), HandleTabardVendorActivateOpcode(), HandleTakeItem(), HandleTakeMoney(), HandleTalentWipeOpcode(), ChatHandler::HandleTargetObjectCommand(), HandleTaxiNextDestinationOpcode(), HandleTaxiQueryAvailableNodesOpcode(), ChatHandler::HandleTeleCommand(), ChatHandler::HandleTempAddSpwCommand(), ChatHandler::HandleTempGameObjectCommand(), HandleTextEmoteOpcode(), HandleTogglePvP(), HandleTotemDestroy(), HandleTrainerBuySpellOpcode(), ChatHandler::HandleTurnObjectCommand(), HandleUnacceptTradeOpcode(), ChatHandler::HandleUnbindSightCommand(), HandleUnlearnSkillOpcode(), ChatHandler::HandleUnPossessCommand(), HandleUnstablePet(), ChatHandler::HandleUpdateWorldStateCommand(), ChatHandler::HandleVisibleCommand(), ChatHandler::HandleWhispersCommand(), HandleWhoisOpcode(), HandleWorldTeleportOpcode(), ChatHandler::HandleWpAddCommand(), ChatHandler::HandleWpModifyCommand(), ChatHandler::HandleWpShowCommand(), HandleZoneUpdateOpcode(), LogoutPlayer(), ChatHandler::needReportToTarget(), processChatmessageFurtherAfterSecurityChecks(), SendAttackStop(), SendBindPoint(), SendDoFlight(), SendLearnNewTaxiNode(), SendListInventory(), SendPetitionShowList(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestQueryResponse(), SendStablePet(), SendTaxiMenu(), SendTaxiStatus(), and SendTrainerList().

105  {
106  return _player;
107  }
Player * _player
Definition: WorldSession.h:729
char const * WorldSession::GetPlayerName ( ) const

Definition at line 89 of file WorldSession.cpp.

References WorldObject::GetName(), and GetPlayer().

Referenced by ArenaTeam::Disband(), GetPlayer(), HandleAuctionSellItem(), ChatHandler::HandleBanHelper(), HandleSendMail(), and HandleTakeItem().

90 {
91  return GetPlayer() ? GetPlayer()->GetName() : "<none>";
92 }
Player * GetPlayer() const
Definition: WorldSession.h:104
const char * GetName() const
Definition: Object.h:692
std::string const& WorldSession::GetRemoteAddress ( )
inline

Definition at line 113 of file WorldSession.h.

References m_Address.

Referenced by HandleChangePlayerNameOpcodeCallBack(), and Update().

114  {
115  return m_Address;
116  }
std::string m_Address
Definition: WorldSession.h:731
void uint32 WorldSession::GetSecurity ( ) const
inline

Definition at line 96 of file WorldSession.h.

References _security.

Referenced by World::AddSession_(), Channel::Announce(), SocialMgr::BroadcastToFriendListers(), Spell::EffectEnchantItemPerm(), Spell::EffectEnchantItemTmp(), SocialMgr::GetFriendInfo(), HandleAcceptTradeOpcode(), ChatHandler::HandleAccountCommand(), ChatHandler::HandleAccountDeleteCommand(), ChatHandler::HandleAccountSetGmLevelCommand(), ChatHandler::HandleAccountSetPasswordCommand(), HandleAddFriendOpcodeCallBack(), HandleAuctionSellItem(), ChatHandler::HandleGMTicketUnAssignCommand(), HandleGuildBankDeposit(), HandleGuildBankDepositItem(), ChatHandler::HandleKickPlayerCommand(), HandleLfgClearOpcode(), HandleLogoutRequestOpcode(), HandleMessagechatOpcode(), ChatHandler::HandleMuteCommand(), ChatHandler::HandlePInfoCommand(), WorldSocket::HandlePing(), ChatHandler::HandleReviveCommand(), ChatHandler::HandleSaveCommand(), HandleSendMail(), HandleTakeItem(), ChatHandler::HandleUnmuteCommand(), HandleWhoisOpcode(), HandleWhoOpcode(), HandleWorldTeleportOpcode(), Player::InitTalentForLevel(), ChatHandler::isAvailable(), Player::IsVisibleGloballyFor(), Channel::Join(), Channel::KickOrBan(), Channel::Leave(), Channel::List(), Channel::Moderate(), moveItems(), ChatHandler::ParseCommands(), Channel::Password(), processChatmessageFurtherAfterSecurityChecks(), Channel::Say(), AuctionHouseMgr::SendAuctionWonMail(), Channel::SetMode(), Channel::SetOwner(), and Channel::UnBan().

97  {
98  return _security;
99  }
uint32 _security
Definition: WorldSession.h:733
void WorldSession::Handle_Deprecated ( WorldPacket recvPacket)

Definition at line 568 of file WorldSession.cpp.

References WorldPacket::GetOpcode(), LookupOpcodeName(), and sLog.

Referenced by IsConnectionIdle().

569 {
570  sLog.outError("SESSION: received deprecated opcode %s (0x%.4X)",
571  LookupOpcodeName(recvPacket.GetOpcode()),
572  recvPacket.GetOpcode());
573 }
uint16 GetOpcode() const
Definition: WorldPacket.h:44
#define sLog
Log class singleton.
Definition: Log.h:187
const char * LookupOpcodeName(uint16 id)
Definition: Opcodes.h:1119
void WorldSession::Handle_EarlyProccess ( WorldPacket recvPacket)

Definition at line 554 of file WorldSession.cpp.

References WorldPacket::GetOpcode(), LookupOpcodeName(), and sLog.

Referenced by IsConnectionIdle().

555 {
556  sLog.outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead",
557  LookupOpcodeName(recvPacket.GetOpcode()),
558  recvPacket.GetOpcode());
559 }
uint16 GetOpcode() const
Definition: WorldPacket.h:44
#define sLog
Log class singleton.
Definition: Log.h:187
const char * LookupOpcodeName(uint16 id)
Definition: Opcodes.h:1119
void WorldSession::Handle_NULL ( WorldPacket recvPacket)

Definition at line 547 of file WorldSession.cpp.

References WorldPacket::GetOpcode(), LookupOpcodeName(), and sLog.

Referenced by IsConnectionIdle().

548 {
549  sLog.outError("SESSION: received unhandled opcode %s (0x%.4X)",
550  LookupOpcodeName(recvPacket.GetOpcode()),
551  recvPacket.GetOpcode());
552 }
uint16 GetOpcode() const
Definition: WorldPacket.h:44
#define sLog
Log class singleton.
Definition: Log.h:187
const char * LookupOpcodeName(uint16 id)
Definition: Opcodes.h:1119
void WorldSession::Handle_ServerSide ( WorldPacket recvPacket)

Definition at line 561 of file WorldSession.cpp.

References WorldPacket::GetOpcode(), LookupOpcodeName(), and sLog.

Referenced by IsConnectionIdle().

562 {
563  sLog.outError("SESSION: received server-side opcode %s (0x%.4X)",
564  LookupOpcodeName(recvPacket.GetOpcode()),
565  recvPacket.GetOpcode());
566 }
uint16 GetOpcode() const
Definition: WorldPacket.h:44
#define sLog
Log class singleton.
Definition: Log.h:187
const char * LookupOpcodeName(uint16 id)
Definition: Opcodes.h:1119
void WorldSession::HandleAcceptGrantLevel ( WorldPacket recv_data)

Definition at line 1583 of file MiscHandler.cpp.

References CONFIG_MAX_PLAYER_LEVEL, CONFIG_RAF_LEVEL_LIMIT, DEBUG_LOG, WorldObject::GetDistance(), Player::GetFullGrantableLevels(), Player::GetGrantableLevels(), Unit::getLevel(), WorldObject::GetName(), GetPlayer(), Player::GiveLevel(), Unit::IsInPartyWith(), Object::IsInWorld(), RAF_ERR_NOT_IN_PARTY, RAF_ERR_NOT_RIGHT_NOW, RAF_ERR_TOO_FAR_AWAY, RAF_LINK_REFERRER, ByteBuffer::readPackGUID(), Player::SendReferFriendError(), Player::SetGrantableLevels(), sObjectMgr, and sWorld.

Referenced by IsConnectionIdle().

1584 {
1585  DEBUG_LOG("WORLD: CMSG_ACCEPT_GRANT_LEVEL");
1586 
1587  uint64 guid = recv_data.readPackGUID();
1588 
1589  Player* buddy = sObjectMgr.GetPlayer(guid);
1590  if (!buddy || !buddy->IsInWorld())
1591  {
1593  return;
1594  }
1595  else if (sObjectMgr.GetRAFLinkStatus(GetPlayer(), buddy) != RAF_LINK_REFERRER)
1596  return;
1597  else if (GetPlayer()->getLevel() >= sWorld.getConfig(CONFIG_RAF_LEVEL_LIMIT))
1598  return;
1599  else if (!buddy->IsInPartyWith(GetPlayer()))
1600  {
1602  return;
1603  }
1604  else if (buddy->GetDistance(GetPlayer()) > 90.f)
1605  {
1607  return;
1608  }
1609  else if (GetPlayer()->getLevel() >= buddy->getLevel())
1610  return;
1611 
1612  // We allow opposite faction grant levels, based on setting in configs,
1613  // player cannot invite opposite faction so we just need to check for the same group
1614 
1615  else if (buddy->GetFullGrantableLevels() == 0)
1616  return;
1617 
1618  if (GetPlayer()->getLevel() >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
1619  return;
1620 
1621  buddy->SetGrantableLevels(buddy->GetGrantableLevels() - 1.f);
1622  GetPlayer()->GiveLevel(GetPlayer()->getLevel() + 1.f, true);
1623 }
uint32 GetFullGrantableLevels() const
Definition: Player.h:1280
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:13257
Player * GetPlayer() const
Definition: WorldSession.h:104
#define sObjectMgr
Definition: ObjectMgr.h:1285
const bool & IsInWorld() const
Definition: Object.h:129
float GetDistance(const WorldObject *obj) const
Definition: Object.h:706
#define DEBUG_LOG(...)
Definition: Log.h:194
const char * GetName() const
Definition: Object.h:692
ACE_UINT64 uint64
Definition: Define.h:70
float GetGrantableLevels() const
Definition: Player.h:1284
void SendReferFriendError(ReferFriendError err, const char *name=0)
Definition: Player.cpp:11621
void GiveLevel(uint32 level, bool ignoreRAF=false)
Definition: Player.cpp:2508
#define sWorld
Definition: World.h:860
uint64 readPackGUID()
Definition: ByteBuffer.h:312
void SetGrantableLevels(float amount)
Definition: Player.h:1288
uint32 getLevel() const
Definition: Unit.h:1029
Definition: Player.h:922
void WorldSession::HandleAcceptTradeOpcode ( WorldPacket recvPacket)

Definition at line 251 of file TradeHandler.cpp.

References _player, Player::acceptTrade, Database::BeginTransaction(), Player::CanStoreItems(), CharacterDatabase, Player::ClearTrade(), Database::CommitTransaction(), CONFIG_GM_LOG_TRADE, EQUIP_ERR_OK, GetAccountId(), Item::GetBagSlot(), Object::GetGUID(), Player::GetItemByGuid(), Player::GetMoney(), WorldObject::GetName(), GetPlayer(), GetSecurity(), Player::GetSession(), Item::GetSlot(), ITEM_FIELD_GIFTCREATOR, LANG_NOT_ENOUGH_GOLD, LANG_NOT_FREE_TRADE_SLOTS, LANG_NOT_PARTNER_FREE_TRADE_SLOTS, Player::ModifyMoney(), Player::MoveItemFromInventory(), moveItems(), Player::pTrader, ByteBuffer::read_skip(), Player::SaveInventoryAndGoldToDB(), SEC_PLAYER, SendNotification(), SendTradeStatus(), Item::SetInTrade(), Object::SetUInt64Value(), sLog, sWorld, TRADE_SLOT_TRADED_COUNT, TRADE_STATUS_BACK_TO_TRADE, TRADE_STATUS_TRADE_ACCEPT, TRADE_STATUS_TRADE_CANCELED, TRADE_STATUS_TRADE_COMPLETE, Player::tradeGold, and Player::tradeItems.

Referenced by IsConnectionIdle().

252 {
253  recvPacket.read_skip<uint32>();
254 
255  Item* myItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL };
256  Item* hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL };
257  bool myCanCompleteTrade = true, hisCanCompleteTrade = true;
258 
259  if (!GetPlayer()->pTrader)
260  return;
261 
262  // not accept case incorrect money amount
263  if (_player->tradeGold > _player->GetMoney())
264  {
267  _player->acceptTrade = false;
268  return;
269  }
270 
271  // not accept case incorrect money amount
273  {
276  _player->pTrader->acceptTrade = false;
277  return;
278  }
279 
280  // not accept if some items now can't be trade (cheating)
281  for (int i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
282  {
283  if (_player->tradeItems[i] != 0)
284  {
285  if (Item* item = _player->GetItemByGuid(_player->tradeItems[i]))
286  {
287  if (!item->CanBeTraded())
288  {
290  return;
291  }
292  }
293  }
294  if (_player->pTrader->tradeItems[i] != 0)
295  {
297  {
298  if (!item->CanBeTraded())
299  {
301  return;
302  }
303  }
304  }
305  }
306 
307  _player->acceptTrade = true;
309  {
310  // inform partner client
312 
313  // store items in local list and set 'in-trade' flag
314  for (int i = 0; i < TRADE_SLOT_TRADED_COUNT; i++)
315  {
316  if (_player->tradeItems[i] != 0 )
317  {
318  //Can return NULL
319  myItems[i] = _player->GetItemByGuid( _player->tradeItems[i] );
320  if (myItems[i])
321  {
322  myItems[i]->SetInTrade();
323  sLog.outDebug("Player trade item bag: %u slot: %u", myItems[i]->GetBagSlot(), myItems[i]->GetSlot());
324  }
325  }
326  if (_player->pTrader->tradeItems[i] != 0)
327  {
328  //Can return NULL
329  hisItems[i] = _player->pTrader->GetItemByGuid(_player->pTrader->tradeItems[i]);
330  if (hisItems[i])
331  {
332  hisItems[i]->SetInTrade();
333  sLog.outDebug("Player trade item bag: %u slot: %u", hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot());
334  }
335  }
336  }
337 
338  // test if item will fit in each inventory
339  hisCanCompleteTrade = (_player->pTrader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
340  myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
341 
342  // clear 'in-trade' flag
343  for (int i = 0; i < TRADE_SLOT_TRADED_COUNT; i++)
344  {
345  if (myItems[i]) myItems[i]->SetInTrade(false);
346  if (hisItems[i]) hisItems[i]->SetInTrade(false);
347  }
348 
349  // in case of missing space report error
350  if (!myCanCompleteTrade)
351  {
356  return;
357  }
358  else if (!hisCanCompleteTrade)
359  {
364  return;
365  }
366 
367  // execute trade: 1. remove
368  for (int i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
369  {
370  Item* iPtr = NULL;
371  if (myItems[i])
372  {
375  _player->MoveItemFromInventory(iPtr->GetBagSlot(), iPtr->GetSlot(), true);
376  }
377  if (hisItems[i])
378  {
381  _player->pTrader->MoveItemFromInventory(iPtr->GetBagSlot(), iPtr->GetSlot(), true);
382  }
383  }
384 
385  // execute trade: 2. store
386  moveItems(myItems, hisItems);
387 
388  // logging money
389  if (sWorld.getConfig(CONFIG_GM_LOG_TRADE))
390  {
392  {
393  sLog.outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
397  }
399  {
400  sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
404  }
405  }
406 
407  // update money
412 
413  _player->ClearTrade();
415 
416  // desynchronized with the other saves here (SaveInventoryAndGoldToDB() not have own transaction guards)
421 
424 
425  _player->pTrader->pTrader = NULL;
426  _player->pTrader = NULL;
427  }
428  else
430 }
void SendNotification(const char *format,...) ATTR_PRINTF(2
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:10687
void read_skip()
Definition: ByteBuffer.h:276
uint64 tradeItems[TRADE_SLOT_COUNT]
Definition: Player.h:2839
bool BeginTransaction()
Definition: Database.cpp:533
void SetInTrade(bool b=true)
Definition: Item.h:238
#define sLog
Log class singleton.
Definition: Log.h:187
ACE_INT32 int32
Definition: Define.h:67
uint32 GetAccountId() const
Definition: WorldSession.h:100
Player * GetPlayer() const
Definition: WorldSession.h:104
uint8 CanStoreItems(Item **pItem, int count) const
Definition: Player.cpp:9530
bool CommitTransaction()
Definition: Database.cpp:551
void ClearTrade()
Definition: Player.cpp:11630
Definition: Item.h:196
void SendTradeStatus(uint32 status)
bool acceptTrade
Definition: Player.h:2838
void SetUInt64Value(uint16 index, const uint64 &value)
Definition: Object.cpp:798
uint8 GetSlot() const
Definition: Item.h:266
const char * GetName() const
Definition: Object.h:692
void moveItems(Item *myItems[], Item *hisItems[])
Player * _player
Definition: WorldSession.h:729
uint32 GetMoney()
Definition: Player.h:1524
void SaveInventoryAndGoldToDB()
Definition: Player.cpp:16417
uint32 tradeGold
Definition: Player.h:2840
WorldSession * GetSession() const
Definition: Player.h:1959
#define sWorld
Definition: World.h:860
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
void uint32 GetSecurity() const
Definition: WorldSession.h:96
void ModifyMoney(int32 d)
Definition: Player.h:1528
Player * pTrader
Definition: Player.h:2837
ACE_UINT32 uint32
Definition: Define.h:71
uint8 GetBagSlot() const
Definition: Item.cpp:728
Item * GetItemByGuid(uint64 guid) const
Definition: Player.cpp:8583
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleActivateTaxiFarOpcode ( WorldPacket recvPacket)

Definition at line 148 of file TaxiHandler.cpp.

References Player::ActivateTaxiPathTo(), DEBUG_LOG, Player::GetNPCIfCanInteractWith(), GetPlayer(), GUID_LOPART, sLog, and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by IsConnectionIdle().

149 {
150  DEBUG_LOG("WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
151 
152  uint64 guid;
153  uint32 node_count, _totalcost;
154 
155  recv_data >> guid >> _totalcost >> node_count;
156 
158  if (!npc)
159  {
160  sLog.outDebug("WORLD: HandleActivateTaxiFarOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
161  return;
162  }
163  std::vector<uint32> nodes;
164 
165  for (uint32 i = 0; i < node_count; ++i)
166  {
167  uint32 node;
168  recv_data >> node;
169  nodes.push_back(node);
170  }
171 
172  if (nodes.empty())
173  return;
174 
175  DEBUG_LOG("WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d" , nodes.front(), nodes.back());
176 
177  GetPlayer()->ActivateTaxiPathTo(nodes, 0, npc);
178 }
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, uint32 mount_id=0, Creature *npc=NULL)
Definition: Player.cpp:17717
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
#define DEBUG_LOG(...)
Definition: Log.h:194
ACE_UINT64 uint64
Definition: Define.h:70
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
ACE_UINT32 uint32
Definition: Define.h:71
void WorldSession::HandleActivateTaxiOpcode ( WorldPacket recvPacket)

Definition at line 235 of file TaxiHandler.cpp.

References Player::ActivateTaxiPathTo(), DEBUG_LOG, Player::GetNPCIfCanInteractWith(), GetPlayer(), GUID_LOPART, sLog, and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by IsConnectionIdle().

236 {
237  DEBUG_LOG("WORLD: Received CMSG_ACTIVATETAXI");
238 
239  uint64 guid;
240  std::vector<uint32> nodes;
241  nodes.resize(2);
242 
243  recv_data >> guid >> nodes[0] >> nodes[1];
244  DEBUG_LOG("WORLD: Received CMSG_ACTIVATETAXI from %d to %d" , nodes[0], nodes[1]);
246  if (!npc)
247  {
248  sLog.outDebug("WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
249  return;
250  }
251 
252  GetPlayer()->ActivateTaxiPathTo(nodes, 0, npc);
253 }
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, uint32 mount_id=0, Creature *npc=NULL)
Definition: Player.cpp:17717
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
#define DEBUG_LOG(...)
Definition: Log.h:194
ACE_UINT64 uint64
Definition: Define.h:70
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
ACE_UINT32 uint32
Definition: Define.h:71
void WorldSession::HandleAddFriendOpcode ( WorldPacket recvPacket)

Definition at line 522 of file MiscHandler.cpp.

References Database::AsyncPQuery(), CharacterDatabase, DEBUG_LOG, Database::escape_string(), GetAccountId(), GetOregonString(), GetPlayer(), HandleAddFriendOpcodeCallBack(), LANG_FRIEND_IGNORE_UNKNOWN, and normalizePlayerName().

Referenced by IsConnectionIdle().

523 {
524  DEBUG_LOG("WORLD: Received CMSG_ADD_FRIEND");
525 
526  std::string friendName = GetOregonString(LANG_FRIEND_IGNORE_UNKNOWN);
527  std::string friendNote;
528 
529  recv_data >> friendName;
530 
531  recv_data >> friendNote;
532 
533  if (!normalizePlayerName(friendName))
534  return;
535 
536  CharacterDatabase.escape_string(friendName); // prevent SQL injection - normal name don't must changed by this call
537 
538  DEBUG_LOG("WORLD: %s asked to add friend : '%s'",
539  GetPlayer()->GetName(), friendName.c_str());
540 
541  CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT guid, race, account FROM characters WHERE name = '%s'", friendName.c_str());
542 }
static void HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string friendNote)
unsigned long escape_string(char *to, const char *from, unsigned long length)
Definition: Database.cpp:212
uint32 GetAccountId() const
Definition: WorldSession.h:100
Player * GetPlayer() const
Definition: WorldSession.h:104
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
#define DEBUG_LOG(...)
Definition: Log.h:194
bool AsyncPQuery(Class *object, void(Class::*method)(QueryResult_AutoPtr), const char *format,...) ATTR_PRINTF(4
Definition: DatabaseImpl.h:128
const char * GetOregonString(int32 entry) const
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
void WorldSession::HandleAddFriendOpcodeCallBack ( QueryResult_AutoPtr  result,
uint32  accountId,
std::string  friendNote 
)
static

Definition at line 544 of file MiscHandler.cpp.

References PlayerSocial::AddToSocialList(), CONFIG_ALLOW_GM_FRIEND, CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND, DEBUG_LOG, ObjectAccessor::FindPlayer(), FRIEND_ADDED_OFFLINE, FRIEND_ADDED_ONLINE, FRIEND_ALREADY, FRIEND_ENEMY, FRIEND_LIST_FULL, FRIEND_NOT_FOUND, FRIEND_SELF, Object::GetGUID(), WorldObject::GetName(), GetPlayer(), GetSecurity(), Player::GetSocial(), Player::GetTeam(), GUID_LOPART, PlayerSocial::HasFriend(), HIGHGUID_PLAYER, Player::IsVisibleGloballyFor(), MAKE_NEW_GUID, realmID, sAccountMgr, SEC_MODERATOR, PlayerSocial::SetFriendNote(), sLog, sSocialMgr, sWorld, and Player::TeamForRace().

Referenced by HandleAddFriendOpcode(), and IsConnectionIdle().

545 {
546  uint64 friendGuid;
547  uint64 friendAccountId;
548  uint32 team;
549  FriendsResult friendResult;
550 
551  WorldSession* session = sWorld.FindSession(accountId);
552 
553  if (!session || !session->GetPlayer())
554  return;
555 
556  friendResult = FRIEND_NOT_FOUND;
557  friendGuid = 0;
558 
559  if (result)
560  {
561  friendGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
562  team = Player::TeamForRace((*result)[1].GetUInt8());
563  friendAccountId = (*result)[2].GetUInt32();
564 
565  if (session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || sAccountMgr->GetSecurity(friendAccountId, realmID) < SEC_MODERATOR)
566  {
567  if (friendGuid)
568  {
569  if (friendGuid == session->GetPlayer()->GetGUID())
570  friendResult = FRIEND_SELF;
571  else if (session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
572  friendResult = FRIEND_ENEMY;
573  else if (session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
574  friendResult = FRIEND_ALREADY;
575  else
576  {
577  Player* pFriend = ObjectAccessor::FindPlayer(friendGuid);
578  if (pFriend && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
579  friendResult = FRIEND_ADDED_ONLINE;
580  else
581  friendResult = FRIEND_ADDED_OFFLINE;
582  if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
583  {
584  friendResult = FRIEND_LIST_FULL;
585  sLog.outDebug("WORLD: %s's friend list is full.", session->GetPlayer()->GetName());
586  }
587  }
588  session->GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote);
589  }
590  }
591  }
592 
593  sSocialMgr.SendFriendStatus(session->GetPlayer(), friendResult, GUID_LOPART(friendGuid), false);
594 
595  DEBUG_LOG("WORLD: Sent (SMSG_FRIEND_STATUS)");
596 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
bool AddToSocialList(uint32 friend_guid, bool ignore)
Definition: SocialMgr.cpp:52
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
bool HasFriend(uint32 friend_guid)
Definition: SocialMgr.cpp:154
PlayerSocial * GetSocial()
Definition: Player.h:985
bool IsVisibleGloballyFor(Player *pl) const
Definition: Player.cpp:18711
static uint32 TeamForRace(uint8 race)
Definition: Player.cpp:5885
FriendsResult
Definition: SocialMgr.h:81
#define MAKE_NEW_GUID(l, e, h)
Definition: ObjectGuid.h:80
static Player * FindPlayer(uint64, bool force=false)
#define DEBUG_LOG(...)
Definition: Log.h:194
#define sAccountMgr
Definition: AccountMgr.h:60
#define sSocialMgr
Definition: SocialMgr.h:166
const char * GetName() const
Definition: Object.h:692
ACE_UINT64 uint64
Definition: Define.h:70
uint32 realmID
Id of the realm.
Definition: Main.cpp:57
uint32 GetTeam() const
Definition: Player.h:2075
#define sWorld
Definition: World.h:860
void SetFriendNote(uint32 friend_guid, std::string note)
Definition: SocialMgr.cpp:106
void uint32 GetSecurity() const
Definition: WorldSession.h:96
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Player.h:922
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleAddIgnoreOpcode ( WorldPacket recvPacket)

Definition at line 613 of file MiscHandler.cpp.

References Database::AsyncPQuery(), CharacterDatabase, DEBUG_LOG, Database::escape_string(), GetAccountId(), GetOregonString(), GetPlayer(), HandleAddIgnoreOpcodeCallBack(), LANG_FRIEND_IGNORE_UNKNOWN, and normalizePlayerName().

Referenced by IsConnectionIdle().

614 {
615  DEBUG_LOG("WORLD: Received CMSG_ADD_IGNORE");
616 
617  std::string IgnoreName = GetOregonString(LANG_FRIEND_IGNORE_UNKNOWN);
618 
619  recv_data >> IgnoreName;
620 
621  if (!normalizePlayerName(IgnoreName))
622  return;
623 
624  CharacterDatabase.escape_string(IgnoreName); // prevent SQL injection - normal name don't must changed by this call
625 
626  DEBUG_LOG("WORLD: %s asked to Ignore: '%s'",
627  GetPlayer()->GetName(), IgnoreName.c_str());
628 
629  CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddIgnoreOpcodeCallBack, GetAccountId(), "SELECT guid FROM characters WHERE name = '%s'", IgnoreName.c_str());
630 }
unsigned long escape_string(char *to, const char *from, unsigned long length)
Definition: Database.cpp:212
uint32 GetAccountId() const
Definition: WorldSession.h:100
Player * GetPlayer() const
Definition: WorldSession.h:104
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
static void HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId)
#define DEBUG_LOG(...)
Definition: Log.h:194
bool AsyncPQuery(Class *object, void(Class::*method)(QueryResult_AutoPtr), const char *format,...) ATTR_PRINTF(4
Definition: DatabaseImpl.h:128
const char * GetOregonString(int32 entry) const
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
void WorldSession::HandleAddIgnoreOpcodeCallBack ( QueryResult_AutoPtr  result,
uint32  accountId 
)
static

Definition at line 632 of file MiscHandler.cpp.

References PlayerSocial::AddToSocialList(), DEBUG_LOG, FRIEND_IGNORE_ADDED, FRIEND_IGNORE_ALREADY, FRIEND_IGNORE_FULL, FRIEND_IGNORE_NOT_FOUND, FRIEND_IGNORE_SELF, Object::GetGUID(), GetPlayer(), Player::GetSocial(), GUID_LOPART, PlayerSocial::HasIgnore(), HIGHGUID_PLAYER, MAKE_NEW_GUID, sSocialMgr, and sWorld.

Referenced by HandleAddIgnoreOpcode(), and IsConnectionIdle().

633 {
634  uint64 IgnoreGuid;
635  FriendsResult ignoreResult;
636 
637  WorldSession* session = sWorld.FindSession(accountId);
638 
639  if (!session || !session->GetPlayer())
640  return;
641 
642  ignoreResult = FRIEND_IGNORE_NOT_FOUND;
643  IgnoreGuid = 0;
644 
645  if (result)
646  {
647  IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
648 
649  if (IgnoreGuid)
650  {
651  if (IgnoreGuid == session->GetPlayer()->GetGUID()) //not add yourself
652  ignoreResult = FRIEND_IGNORE_SELF;
653  else if (session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)))
654  ignoreResult = FRIEND_IGNORE_ALREADY;
655  else
656  {
657  ignoreResult = FRIEND_IGNORE_ADDED;
658 
659  // ignore list full
660  if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
661  ignoreResult = FRIEND_IGNORE_FULL;
662  }
663  }
664  }
665 
666  sSocialMgr.SendFriendStatus(session->GetPlayer(), ignoreResult, GUID_LOPART(IgnoreGuid), false);
667 
668  DEBUG_LOG("WORLD: Sent (SMSG_FRIEND_STATUS)");
669 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
bool HasIgnore(uint32 ignore_guid)
Definition: SocialMgr.cpp:162
bool AddToSocialList(uint32 friend_guid, bool ignore)
Definition: SocialMgr.cpp:52
Player * GetPlayer() const
Definition: WorldSession.h:104
PlayerSocial * GetSocial()
Definition: Player.h:985
FriendsResult
Definition: SocialMgr.h:81
#define MAKE_NEW_GUID(l, e, h)
Definition: ObjectGuid.h:80
#define DEBUG_LOG(...)
Definition: Log.h:194
#define sSocialMgr
Definition: SocialMgr.h:166
ACE_UINT64 uint64
Definition: Define.h:70
#define sWorld
Definition: World.h:860
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleAreaSpiritHealerQueryOpcode ( WorldPacket recv_data)

Definition at line 629 of file BattlegroundHandler.cpp.

References _player, Player::GetBattleground(), Map::GetCreature(), WorldObject::GetMap(), GetPlayer(), Unit::isSpiritService(), sBattlegroundMgr, and sLog.

Referenced by IsConnectionIdle().

630 {
631  sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
632 
634  if (!bg)
635  return;
636 
637  uint64 guid;
638  recv_data >> guid;
639 
640  Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
641  if (!unit)
642  return;
643 
644  if (!unit->isSpiritService()) // it's not spirit service
645  return;
646 
647  sBattlegroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
648 }
Battleground * GetBattleground() const
Definition: Player.cpp:19386
Map * GetMap() const
Definition: Object.h:829
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2632
ACE_UINT64 uint64
Definition: Define.h:70
bool isSpiritService() const
Definition: Unit.h:1296
Player * _player
Definition: WorldSession.h:729
#define sBattlegroundMgr
void WorldSession::HandleAreaSpiritHealerQueueOpcode ( WorldPacket recv_data)

Definition at line 650 of file BattlegroundHandler.cpp.

References _player, Battleground::AddPlayerToResurrectQueue(), Player::GetBattleground(), Map::GetCreature(), Object::GetGUID(), WorldObject::GetMap(), GetPlayer(), Unit::isSpiritService(), and sLog.

Referenced by IsConnectionIdle().

651 {
652  sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
653 
655  if (!bg)
656  return;
657 
658  uint64 guid;
659  recv_data >> guid;
660 
661  Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
662  if (!unit)
663  return;
664 
665  if (!unit->isSpiritService()) // it's not spirit service
666  return;
667 
669 }
Battleground * GetBattleground() const
Definition: Player.cpp:19386
Map * GetMap() const
Definition: Object.h:829
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2632
ACE_UINT64 uint64
Definition: Define.h:70
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
bool isSpiritService() const
Definition: Unit.h:1296
Player * _player
Definition: WorldSession.h:729
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleAreaTriggerOpcode ( WorldPacket recvPacket)

Definition at line 775 of file MiscHandler.cpp.

References _player, AreaTrigger::access_id, Player::AreaExploredOrEventHappens(), Map::CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE, Map::CANNOT_ENTER_DIFFICULTY_UNAVAILABLE, Map::CANNOT_ENTER_INSTANCE_BIND_MISMATCH, Map::CANNOT_ENTER_MAX_PLAYERS, Map::CANNOT_ENTER_NO_ENTRY, Map::CANNOT_ENTER_NOT_IN_RAID, Map::CANNOT_ENTER_TOO_MANY_INSTANCES, Map::CANNOT_ENTER_UNINSTANCED_DUNGEON, Map::CANNOT_ENTER_ZONE_IN_COMBAT, DEBUG_LOG, GetOregonString(), GetPlayer(), Player::GetQuestStatus(), Player::GetSession(), GetSessionDbcLocale(), AreaTriggerEntry::id, Oregon::Singleton< MapManager, Oregon::ClassLevelLockable< MapManager, ACE_Thread_Mutex > >::Instance(), Unit::IsAlive(), LANG_INSTANCE_BIND_MISMATCH, InstanceTemplate::parent, MapManager::PlayerCannotEnter(), ChatHandler::PSendSysMessage(), QUEST_STATUS_INCOMPLETE, REST_FLAG_IN_TAVERN, Player::ResurrectPlayer(), sAreaTriggerStore, Player::Satisfy(), SendPacket(), Player::SendTransferAborted(), Player::SetFFAPvP(), Player::SetRestFlag(), sLog, sMapStore, SMSG_RAID_GROUP_ONLY, sObjectMgr, Player::SpawnCorpseBones(), sScriptMgr, STATUS_IN_PROGRESS, sWorld, AreaTrigger::target_mapId, AreaTrigger::target_Orientation, AreaTrigger::target_X, AreaTrigger::target_Y, AreaTrigger::target_Z, TELE_TO_NOT_LEAVE_TRANSPORT, Player::TeleportTo(), TRANSFER_ABORT_DIFFICULTY2, TRANSFER_ABORT_MAX_PLAYERS, TRANSFER_ABORT_TOO_MANY_INSTANCES, and TRANSFER_ABORT_ZONE_IN_COMBAT.

Referenced by IsConnectionIdle().

776 {
777  DEBUG_LOG("WORLD: Received CMSG_AREATRIGGER");
778 
779  uint32 triggerId;
780  recv_data >> triggerId;
781 
782  DEBUG_LOG("Trigger ID:%u", triggerId);
783 
784  if (GetPlayer()->isInFlight())
785  {
786  DEBUG_LOG("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), triggerId);
787  return;
788  }
789 
790  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId);
791  if (!atEntry)
792  {
793  DEBUG_LOG("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), triggerId);
794  return;
795  }
796 
797  if (!GetPlayer()->IsInAreaTriggerRadius(atEntry))
798  {
799  DEBUG_LOG("Player '%s' (GUID: %u) too far, ignore Area Trigger ID: %u",
800  GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), triggerId);
801  return;
802  }
803 
804  if (sScriptMgr.AreaTrigger(GetPlayer(), atEntry))
805  return;
806 
807  if (GetPlayer()->IsAlive())
808  if (uint32 questId = sObjectMgr.GetQuestForAreaTrigger(triggerId))
811 
812  if (sObjectMgr.IsTavernAreaTrigger(triggerId))
813  {
814  // set resting flag we are in the inn
816 
817  if (sWorld.IsFFAPvPRealm())
818  GetPlayer()->SetFFAPvP(false);
819 
820  return;
821  }
822 
823  if (Battleground* bg = GetPlayer()->GetBattleground())
824  if (bg->GetStatus() == STATUS_IN_PROGRESS)
825  bg->HandleAreaTrigger(GetPlayer(), triggerId);
826 
827  if (OutdoorPvP* pvp = GetPlayer()->GetOutdoorPvP())
828  if (pvp->HandleAreaTrigger(_player, triggerId))
829  return;
830 
831  AreaTrigger const* at = sObjectMgr.GetAreaTrigger(triggerId);
832  if (!at)
833  return;
834 
835  uint32 testTwo = 1;
836  bool teleported = false;
837  if (GetPlayer()->GetMapId() != at->target_mapId)
838  {
839  if (at->access_id)
840  if (AccessRequirement const* arEntry = sObjectMgr.GetAccessRequirement(at->access_id))
841  if (!GetPlayer()->Satisfy(arEntry, at->target_mapId, true))
842  return;
843 
845  {
846  bool reviveAtTrigger = false; // should we revive the player if he is trying to enter the correct instance?
847  switch (denyReason)
848  {
850  sLog.outDebug("MAP: Player '%s' attempted to enter map with id %d which has no entry", GetPlayer()->GetName(), at->target_mapId);
851  break;
853  sLog.outDebug("MAP: Player '%s' attempted to enter dungeon map %d but no instance template was found", GetPlayer()->GetName(), at->target_mapId);
854  break;
856  sLog.outDebug("MAP: Player '%s' attempted to enter instance map %d but the requested difficulty was not found", GetPlayer()->GetName(), at->target_mapId);
857  if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
859  break;
861  {
862  WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4);
863  data << uint32(0);
864  data << uint32(1); // You must be in a raid group to enter this instance.
865  GetPlayer()->GetSession()->SendPacket(&data);
866  sLog.outDebug("MAP: Player '%s' must be in a raid group to enter instance map %d", GetPlayer()->GetName(), at->target_mapId);
867  reviveAtTrigger = true;
868  break;
869  }
871  {
872  sLog.outDebug("MAP: Player '%s' does not have a corpse in instance map %d and cannot enter", GetPlayer()->GetName(), at->target_mapId);
873  break;
874  }
876  if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
877  {
878  char const* mapName = entry->name[GetPlayer()->GetSession()->GetSessionDbcLocale()];
879  sLog.outDebug("MAP: Player '%s' cannot enter instance map '%s' because their permanent bind is incompatible with their groups.", GetPlayer()->GetName(), mapName);
880  // @todo figure out how to get player localized difficulty string (e.g. "10 player", "Heroic" etc)
881  ChatHandler(GetPlayer()->GetSession()).PSendSysMessage(GetPlayer()->GetSession()->GetOregonString(LANG_INSTANCE_BIND_MISMATCH), mapName);
882  }
883  reviveAtTrigger = true;
884  break;
887  sLog.outDebug("MAP: Player '%s' cannot enter instance map %d because he has exceeded the maximum number of instances per hour.", GetPlayer()->GetName(), at->target_mapId);
888  reviveAtTrigger = true;
889  break;
892  reviveAtTrigger = true;
893  break;
896  reviveAtTrigger = true;
897  break;
898  default:
899  break;
900  }
901 
902  // check if the player is touching the areatrigger leading to the map his corpse is on
903  if (reviveAtTrigger)
904  {
905  if (!GetPlayer()->IsAlive())
906  {
907  if (Corpse* corpse = GetPlayer()->GetCorpse())
908  {
909  uint32 instance_map = corpse->GetMapId();
910  do
911  {
912  if (instance_map == at->target_mapId)
913  break;
914 
915  InstanceTemplate const* instance = sObjectMgr.GetInstanceTemplate(instance_map);
916  instance_map = instance ? instance->parent : 0;
917  } while (instance_map);
918 
919  if (instance_map)
920  {
921  GetPlayer()->ResurrectPlayer(0.5f, false);
923  }
924  }
925  }
926  }
927 
928  return;
929  }
930  }
931 
932  if (!teleported)
934 }
Definition: Corpse.h:48
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:13641
Map::EnterState PlayerCannotEnter(uint32 mapid, Player *player, bool loginCheck=false)
Definition: MapManager.cpp:153
void SendTransferAborted(uint32 mapid, uint16 reason)
Definition: Player.cpp:19122
#define sLog
Log class singleton.
Definition: Log.h:187
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
Player * GetPlayer() const
Definition: WorldSession.h:104
void SpawnCorpseBones()
Definition: Player.cpp:4380
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:233
#define sObjectMgr
Definition: ObjectMgr.h:1285
void SendPacket(WorldPacket const *packet)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
uint32 target_mapId
Definition: ObjectMgr.h:344
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition: Player.cpp:1556
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition: Chat.cpp:855
bool IsAlive() const
Definition: Unit.h:1433
#define DEBUG_LOG(...)
Definition: Log.h:194
void SetFFAPvP(bool state)
Definition: Player.cpp:17079
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4209
const char * GetOregonString(int32 entry) const
uint32 parent
Definition: Map.h:233
float target_Orientation
Definition: ObjectMgr.h:348
Player * _player
Definition: WorldSession.h:729
float target_X
Definition: ObjectMgr.h:345
bool Satisfy(AccessRequirement const *, uint32 target_map, bool report=false)
Definition: Player.cpp:16034
uint32 access_id
Definition: ObjectMgr.h:343
void AreaExploredOrEventHappens(uint32 questId)
Definition: Player.cpp:13731
#define sScriptMgr
Definition: Group.h:526
float target_Y
Definition: ObjectMgr.h:346
EnterState
Definition: Map.h:399
WorldSession * GetSession() const
Definition: Player.h:1959
#define sWorld
Definition: World.h:860
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition: Player.cpp:20802
ACE_UINT32 uint32
Definition: Define.h:71
float target_Z
Definition: ObjectMgr.h:347
void WorldSession::HandleArenaTeamAddMemberOpcode ( WorldPacket recv_data)

Definition at line 81 of file ArenaTeamHandler.cpp.

References CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD, CONFIG_MAX_PLAYER_LEVEL, DEBUG_LOG, ERR_ALREADY_IN_ARENA_TEAM_S, ERR_ALREADY_INVITED_TO_ARENA_TEAM_S, ERR_ARENA_TEAM_CREATE_S, ERR_ARENA_TEAM_INVITE_SS, ERR_ARENA_TEAM_NOT_ALLIED, ERR_ARENA_TEAM_PERMISSIONS, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S, ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM, ERR_ARENA_TEAM_TARGET_TOO_LOW_S, ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S, ObjectAccessor::FindPlayerByName(), Player::GetArenaTeamId(), Player::GetArenaTeamIdInvited(), ArenaTeam::GetId(), Unit::getLevel(), ArenaTeam::GetMembersSize(), ArenaTeam::GetName(), WorldObject::GetName(), GetPlayer(), Player::GetSession(), ArenaTeam::GetSlot(), Player::GetSocial(), Player::GetTeam(), ArenaTeam::GetType(), PlayerSocial::HasIgnore(), Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), normalizePlayerName(), SendArenaTeamCommandResult(), SendPacket(), Player::SetArenaTeamIdInvited(), sLog, SMSG_ARENA_TEAM_INVITE, sObjectMgr, and sWorld.

Referenced by IsConnectionIdle().

82 {
83  sLog.outDebug("CMSG_ARENA_TEAM_ADD_MEMBER");
84 
85  uint32 arenaTeamId; // arena team id
86  std::string invitedName;
87 
88  Player* player = NULL;
89 
90  recv_data >> arenaTeamId >> invitedName;
91 
92  if (!invitedName.empty())
93  {
94  if (!normalizePlayerName(invitedName))
95  return;
96 
97  player = ObjectAccessor::Instance().FindPlayerByName(invitedName.c_str());
98  }
99 
100  if (!player)
101  {
103  return;
104  }
105 
106  if (player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
107  {
109  return;
110  }
111 
112  ArenaTeam* arenaTeam = sObjectMgr.GetArenaTeamById(arenaTeamId);
113  if (!arenaTeam)
114  {
116  return;
117  }
118 
119  if (GetPlayer()->GetArenaTeamId(arenaTeam->GetSlot()) != arenaTeamId)
120  {
122  return;
123  }
124 
125  // OK result but not send invite
126  if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
127  return;
128 
129  if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
130  {
132  return;
133  }
134 
135  if (player->GetArenaTeamId(arenaTeam->GetSlot()))
136  {
138  return;
139  }
140 
141  if (player->GetArenaTeamIdInvited())
142  {
144  return;
145  }
146 
147  if (arenaTeam->GetMembersSize() >= arenaTeam->GetType() * 2)
148  {
150  return;
151  }
152 
153  sLog.outDebug("Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName(), invitedName.c_str());
154 
155  player->SetArenaTeamIdInvited(arenaTeam->GetId());
156 
157  WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8 + 10));
158  data << GetPlayer()->GetName();
159  data << arenaTeam->GetName();
160  player->GetSession()->SendPacket(&data);
161 
162  DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_INVITE");
163 }
size_t GetMembersSize() const
Definition: ArenaTeam.h:182
uint32 GetType() const
Definition: ArenaTeam.h:128
bool HasIgnore(uint32 ignore_guid)
Definition: SocialMgr.cpp:162
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
#define sObjectMgr
Definition: ObjectMgr.h:1285
void SendPacket(WorldPacket const *packet)
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
PlayerSocial * GetSocial()
Definition: Player.h:985
uint32 GetId() const
Definition: ArenaTeam.h:124
void SetArenaTeamIdInvited(uint32 ArenaTeamId)
Definition: Player.h:1871
#define DEBUG_LOG(...)
Definition: Log.h:194
const char * GetName() const
Definition: Object.h:692
void SendArenaTeamCommandResult(uint32 team_action, const std::string &team, const std::string &player, uint32 error_id)
std::string GetName() const
Definition: ArenaTeam.h:141
uint32 GetArenaTeamId(uint8 slot)
Definition: Player.h:1862
uint32 GetArenaTeamIdInvited()
Definition: Player.h:1875
uint32 GetTeam() const
Definition: Player.h:2075
uint8 GetSlot() const
Definition: ArenaTeam.h:132
WorldSession * GetSession() const
Definition: Player.h:1959
#define sWorld
Definition: World.h:860
Player * FindPlayerByName(const char *name, bool force=false)
ACE_UINT32 uint32
Definition: Define.h:71
uint32 getLevel() const
Definition: Unit.h:1029
Definition: Player.h:922
void WorldSession::HandleArenaTeamDisbandOpcode ( WorldPacket recv_data)

Definition at line 254 of file ArenaTeamHandler.cpp.

References _player, Object::GetGUID(), GetPlayer(), sLog, and sObjectMgr.

Referenced by IsConnectionIdle().

255 {
256  sLog.outDebug("CMSG_ARENA_TEAM_DISBAND");
257 
258  uint32 arenaTeamId; // arena team id
259  recv_data >> arenaTeamId;
260 
261  if (GetPlayer()->InArena() || GetPlayer()->InBattlegroundQueue())
262  return;
263 
264  if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(arenaTeamId))
265  {
266  if (at->GetCaptain() != _player->GetGUID())
267  return;
268 
269  if (at->IsFighting())
270  return;
271 
272  at->Disband(this);
273  delete at;
274  }
275 }
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
#define sObjectMgr
Definition: ObjectMgr.h:1285
Player * _player
Definition: WorldSession.h:729
ACE_UINT32 uint32
Definition: Define.h:71
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleArenaTeamInviteAcceptOpcode ( WorldPacket recv_data)

Definition at line 165 of file ArenaTeamHandler.cpp.

References _player, ArenaTeam::AddMember(), ArenaTeam::BroadcastEvent(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD, ERR_ALREADY_IN_ARENA_TEAM, ERR_ARENA_TEAM_CREATE_S, ERR_ARENA_TEAM_INTERNAL, ERR_ARENA_TEAM_JOIN_SS, ERR_ARENA_TEAM_NOT_ALLIED, Player::GetArenaTeamId(), Player::GetArenaTeamIdInvited(), ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetName(), WorldObject::GetName(), ArenaTeam::GetSlot(), Player::GetTeam(), SendArenaTeamCommandResult(), sLog, sObjectMgr, and sWorld.

Referenced by IsConnectionIdle().

166 {
167  sLog.outDebug("CMSG_ARENA_TEAM_INVITE_ACCEPT"); // empty opcode
168 
169  ArenaTeam* at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
170  if (!at)
171  return;
172 
173  if (_player->GetArenaTeamId(at->GetSlot()))
174  {
175  // already in arena team that size
177  return;
178  }
179 
180  if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptain()))
181  {
182  // not let enemies sign petition
184  return;
185  }
186 
187  if (!at->AddMember(_player->GetGUID()))
188  {
189  // arena team not found
191  return;
192  }
193 
194  // event
196 }
bool AddMember(const uint64 &playerGuid)
Definition: ArenaTeam.cpp:90
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, char const *str1=NULL, char const *str2=NULL, char const *str3=NULL)
Definition: ArenaTeam.cpp:472
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
const char * GetName() const
Definition: Object.h:692
void SendArenaTeamCommandResult(uint32 team_action, const std::string &team, const std::string &player, uint32 error_id)
std::string GetName() const
Definition: ArenaTeam.h:141
uint32 GetArenaTeamId(uint8 slot)
Definition: Player.h:1862
Player * _player
Definition: WorldSession.h:729
const uint64 & GetCaptain() const
Definition: ArenaTeam.h:137
uint32 GetArenaTeamIdInvited()
Definition: Player.h:1875
uint32 GetTeam() const
Definition: Player.h:2075
uint8 GetSlot() const
Definition: ArenaTeam.h:132
#define sWorld
Definition: World.h:860
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleArenaTeamInviteDeclineOpcode ( WorldPacket recv_data)

Definition at line 198 of file ArenaTeamHandler.cpp.

References _player, Player::SetArenaTeamIdInvited(), and sLog.

Referenced by IsConnectionIdle().

199 {
200  sLog.outDebug("CMSG_ARENA_TEAM_INVITE_DECLINE"); // empty opcode
201 
202  _player->SetArenaTeamIdInvited(0); // no more invited
203 }
#define sLog
Log class singleton.
Definition: Log.h:187
void SetArenaTeamIdInvited(uint32 ArenaTeamId)
Definition: Player.h:1871
Player * _player
Definition: WorldSession.h:729
void WorldSession::HandleArenaTeamLeaveOpcode ( WorldPacket recv_data)

Definition at line 205 of file ArenaTeamHandler.cpp.

References _player, ArenaTeam::BroadcastEvent(), ArenaTeam::DelMember(), ArenaTeam::Disband(), ERR_ARENA_TEAM_INTERNAL, ERR_ARENA_TEAM_LEADER_LEAVE_S, ERR_ARENA_TEAM_LEAVE_SS, ERR_ARENA_TEAM_QUIT_S, ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMembersSize(), ArenaTeam::GetName(), WorldObject::GetName(), Player::InArena(), Player::InBattlegroundQueue(), SendArenaTeamCommandResult(), sLog, and sObjectMgr.

Referenced by IsConnectionIdle().

206 {
207  sLog.outDebug("CMSG_ARENA_TEAM_LEAVE");
208 
209  uint32 arenaTeamId; // arena team id
210  recv_data >> arenaTeamId;
211 
212  ArenaTeam* at = sObjectMgr.GetArenaTeamById(arenaTeamId);
213  if (!at)
214  return;
215 
216  // Prevent leaving team while in arena queue
218  {
220  return;
221  }
222 
223  // Disallow leave team while in arena
224  if (_player->InArena())
225  {
227  return;
228  }
229 
230  if (_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
231  {
232  // check for correctness
234  return;
235  }
236 
237  // arena team has only one member (=captain)
238  if (_player->GetGUID() == at->GetCaptain())
239  {
240  at->Disband(this);
241  delete at;
242  return;
243  }
244 
245  at->DelMember(_player->GetGUID());
246 
247  // event
249 
250  // send you are no longer member of team
252 }
size_t GetMembersSize() const
Definition: ArenaTeam.h:182
void DelMember(uint64 guid)
Definition: ArenaTeam.cpp:269
void Disband(WorldSession *session)
Definition: ArenaTeam.cpp:307
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, char const *str1=NULL, char const *str2=NULL, char const *str3=NULL)
Definition: ArenaTeam.cpp:472
bool InArena() const
Definition: Player.cpp:19394
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
const char * GetName() const
Definition: Object.h:692
void SendArenaTeamCommandResult(uint32 team_action, const std::string &team, const std::string &player, uint32 error_id)
bool InBattlegroundQueue() const
Definition: Player.h:2222
std::string GetName() const
Definition: ArenaTeam.h:141
Player * _player
Definition: WorldSession.h:729
const uint64 & GetCaptain() const
Definition: ArenaTeam.h:137
ACE_UINT32 uint32
Definition: Define.h:71
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleArenaTeamPromoteToCaptainOpcode ( WorldPacket recv_data)

Definition at line 323 of file ArenaTeamHandler.cpp.

References _player, ArenaTeam::BroadcastEvent(), ERR_ARENA_TEAM_CREATE_S, ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ERR_ARENA_TEAM_PERMISSIONS, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S, ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMember(), ArenaTeam::GetName(), WorldObject::GetName(), ArenaTeamMember::guid, normalizePlayerName(), SendArenaTeamCommandResult(), ArenaTeam::SetCaptain(), sLog, and sObjectMgr.

Referenced by IsConnectionIdle().

324 {
325  sLog.outDebug("CMSG_ARENA_TEAM_PROMOTE_TO_CAPTAIN");
326 
327  uint32 arenaTeamId;
328  std::string name;
329 
330  recv_data >> arenaTeamId;
331  recv_data >> name;
332 
333  ArenaTeam* at = sObjectMgr.GetArenaTeamById(arenaTeamId);
334  if (!at) // arena team not found
335  return;
336 
337  if (at->GetCaptain() != _player->GetGUID())
338  {
340  return;
341  }
342 
343  if (!normalizePlayerName(name))
344  return;
345 
346  ArenaTeamMember* member = at->GetMember(name);
347  if (!member) // member not found
348  {
350  return;
351  }
352 
353  if (at->GetCaptain() == member->guid) // target player already captain
354  return;
355 
356  at->SetCaptain(member->guid);
357 
358  // event
359  at->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, _player->GetName(), name.c_str(), at->GetName().c_str());
360 }
void SetCaptain(const uint64 &guid)
Definition: ArenaTeam.cpp:248
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, char const *str1=NULL, char const *str2=NULL, char const *str3=NULL)
Definition: ArenaTeam.cpp:472
#define sLog
Log class singleton.
Definition: Log.h:187
ArenaTeamMember * GetMember(const uint64 &guid)
Definition: ArenaTeam.h:200
#define sObjectMgr
Definition: ObjectMgr.h:1285
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
const char * GetName() const
Definition: Object.h:692
void SendArenaTeamCommandResult(uint32 team_action, const std::string &team, const std::string &player, uint32 error_id)
std::string GetName() const
Definition: ArenaTeam.h:141
Player * _player
Definition: WorldSession.h:729
const uint64 & GetCaptain() const
Definition: ArenaTeam.h:137
ACE_UINT32 uint32
Definition: Define.h:71
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleArenaTeamQueryOpcode ( WorldPacket recv_data)

Definition at line 56 of file ArenaTeamHandler.cpp.

References sLog, and sObjectMgr.

Referenced by IsConnectionIdle().

57 {
58  sLog.outDebug("WORLD: Received CMSG_ARENA_TEAM_QUERY");
59 
60  uint32 arenaTeamId;
61  recv_data >> arenaTeamId;
62 
63  if (ArenaTeam* arenaTeam = sObjectMgr.GetArenaTeamById(arenaTeamId))
64  {
65  arenaTeam->Query(this);
66  arenaTeam->Stats(this);
67  }
68 }
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
ACE_UINT32 uint32
Definition: Define.h:71
void WorldSession::HandleArenaTeamRemoveFromTeamOpcode ( WorldPacket recv_data)

Definition at line 277 of file ArenaTeamHandler.cpp.

References _player, ArenaTeam::BroadcastEvent(), ArenaTeam::DelMember(), ERR_ARENA_TEAM_CREATE_S, ERR_ARENA_TEAM_LEADER_LEAVE_S, ERR_ARENA_TEAM_PERMISSIONS, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S, ERR_ARENA_TEAM_QUIT_S, ERR_ARENA_TEAM_REMOVE_SSS, ObjectAccessor::FindPlayer(), ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMember(), ArenaTeam::GetName(), WorldObject::GetName(), ArenaTeamMember::guid, Player::InArena(), normalizePlayerName(), SendArenaTeamCommandResult(), sLog, and sObjectMgr.

Referenced by IsConnectionIdle().

278 {
279  sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");
280 
281  uint32 arenaTeamId;
282  std::string name;
283 
284  recv_data >> arenaTeamId;
285  recv_data >> name;
286 
287  ArenaTeam* at = sObjectMgr.GetArenaTeamById(arenaTeamId);
288  if (!at) // arena team not found
289  return;
290 
291  if (at->GetCaptain() != _player->GetGUID())
292  {
294  return;
295  }
296 
297  if (!normalizePlayerName(name))
298  return;
299 
300  ArenaTeamMember* member = at->GetMember(name);
301  if (!member) // member not found
302  {
304  return;
305  }
306 
307  if (at->GetCaptain() == member->guid)
308  {
310  return;
311  }
312 
313  Player* player = ObjectAccessor::FindPlayer(member->guid);
314  if (player && player->InArena())
315  return;
316 
317  at->DelMember(member->guid);
318 
319  // event
320  at->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, name.c_str(), at->GetName().c_str(), _player->GetName());
321 }
void DelMember(uint64 guid)
Definition: ArenaTeam.cpp:269
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, char const *str1=NULL, char const *str2=NULL, char const *str3=NULL)
Definition: ArenaTeam.cpp:472
bool InArena() const
Definition: Player.cpp:19394
#define sLog
Log class singleton.
Definition: Log.h:187
ArenaTeamMember * GetMember(const uint64 &guid)
Definition: ArenaTeam.h:200
#define sObjectMgr
Definition: ObjectMgr.h:1285
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
static Player * FindPlayer(uint64, bool force=false)
const char * GetName() const
Definition: Object.h:692
void SendArenaTeamCommandResult(uint32 team_action, const std::string &team, const std::string &player, uint32 error_id)
std::string GetName() const
Definition: ArenaTeam.h:141
Player * _player
Definition: WorldSession.h:729
const uint64 & GetCaptain() const
Definition: ArenaTeam.h:137
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Player.h:922
const uint64 & GetGUID() const
Definition: Object.h:156
void WorldSession::HandleArenaTeamRosterOpcode ( WorldPacket recv_data)

Definition at line 70 of file ArenaTeamHandler.cpp.

References sLog, and sObjectMgr.

Referenced by IsConnectionIdle().

71 {
72  sLog.outDebug("WORLD: Received CMSG_ARENA_TEAM_ROSTER");
73 
74  uint32 arenaTeamId; // arena team id
75  recv_data >> arenaTeamId;
76 
77  if (ArenaTeam* arenaTeam = sObjectMgr.GetArenaTeamById(arenaTeamId))
78  arenaTeam->Roster(this);
79 }
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
ACE_UINT32 uint32
Definition: Define.h:71
void WorldSession::HandleAttackStopOpcode ( WorldPacket recvPacket)

Definition at line 57 of file CombatHandler.cpp.

References Unit::AttackStop(), and GetPlayer().

Referenced by IsConnectionIdle().

58 {
59  GetPlayer()->AttackStop();
60 }
bool AttackStop()
Definition: Unit.cpp:7408
Player * GetPlayer() const
Definition: WorldSession.h:104
void WorldSession::HandleAttackSwingOpcode ( WorldPacket recvPacket)

Definition at line 26 of file CombatHandler.cpp.

References _player, Unit::Attack(), DEBUG_LOG, ObjectAccessor::GetUnit(), Unit::IsValidAttackTarget(), SendAttackStop(), and sLog.

Referenced by IsConnectionIdle().

27 {
28  ObjectGuid guid;
29  recv_data >> guid;
30 
31  DEBUG_LOG("WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());
32 
33  Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid.GetRawValue());
34 
35  if (!pEnemy)
36  {
37  if (!guid.IsUnit())
38  sLog.outError("WORLD: %s isn't player, pet or creature", guid.GetString().c_str());
39  else
40  sLog.outError("WORLD: Enemy %s not found", guid.GetString().c_str());
41 
42  // stop attack state at client
43  SendAttackStop(NULL);
44  return;
45  }
46 
47  if (!_player->IsValidAttackTarget(pEnemy))
48  {
49  // stop attack state at client
50  SendAttackStop(pEnemy);
51  return;
52  }
53 
54  _player->Attack(pEnemy, true);
55 }
void SendAttackStop(Unit const *enemy)
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:7315
bool IsValidAttackTarget(Unit const *target) const
Definition: Unit.cpp:9433
#define sLog
Log class singleton.
Definition: Log.h:187
#define DEBUG_LOG(...)
Definition: Log.h:194
Player * _player
Definition: WorldSession.h:729
static Unit * GetUnit(WorldObject const &, uint64 guid)
Definition: Unit.h:884
void WorldSession::HandleAuctionHelloOpcode ( WorldPacket recvPacket)

Definition at line 35 of file AuctionHouseHandler.cpp.

References Player::GetNPCIfCanInteractWith(), GetPlayer(), GUID_LOPART, Unit::RemoveSpellsCausingAura(), SendAuctionHello(), sLog, SPELL_AURA_FEIGN_DEATH, UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by IsConnectionIdle().

36 {
37  uint64 guid; // NPC guid
38  recv_data >> guid;
39 
41  if (!unit)
42  {
43  sLog.outDebug("WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
44  return;
45  }
46 
47  // remove fake death
48  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
50 
51  SendAuctionHello(guid, unit);
52 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
void RemoveSpellsCausingAura(AuraType auraType)
Definition: Unit.cpp:648
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
ACE_UINT64 uint64
Definition: Define.h:70
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
ACE_UINT32 uint32
Definition: Define.h:71
void SendAuctionHello(uint64 guid, Creature *unit)
void WorldSession::HandleAuctionListBidderItems ( WorldPacket recv_data)

Definition at line 483 of file AuctionHouseHandler.cpp.

References AuctionEntry::BuildAuctionInfo(), AuctionHouseObject::BuildListBidderItems(), AuctionHouseObject::GetAuction(), Unit::getFaction(), Player::GetNPCIfCanInteractWith(), GetPlayer(), GUID_LOPART, ByteBuffer::put(), Unit::RemoveSpellsCausingAura(), sAuctionMgr, SendPacket(), ByteBuffer::size(), sLog, SMSG_AUCTION_BIDDER_LIST_RESULT, SPELL_AURA_FEIGN_DEATH, UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by IsConnectionIdle().

484 {
485  uint64 guid; //NPC guid
486  uint32 listfrom; //page of auctions
487  uint32 outbiddedCount; //count of outbidded auctions
488 
489  recv_data >> guid;
490  recv_data >> listfrom; // not used in fact (this list not have page control in client)
491  recv_data >> outbiddedCount;
492  if (recv_data.size() != (16 + outbiddedCount * 4))
493  {
494  sLog.outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4));
495  outbiddedCount = 0;
496  }
497 
499  if (!pCreature)
500  {
501  sLog.outDebug("WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
502  return;
503  }
504 
505  // remove fake death
506  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
508 
509  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
510 
511  WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4));
512  Player* pl = GetPlayer();
513  data << uint32(0); // add 0 as count
514  uint32 count = 0;
515  uint32 totalcount = 0;
516  while (outbiddedCount > 0) //add all data, which client requires
517  {
518  --outbiddedCount;
519  uint32 outbiddedAuctionId;
520  recv_data >> outbiddedAuctionId;
521  AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
522  if (auction && auction->BuildAuctionInfo(data))
523  {
524  ++totalcount;
525  ++count;
526  }
527  }
528 
529  auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
530  data.put<uint32>(0, count); // add count to placeholder
531  data << uint32(totalcount);
532  data << uint32(300); //unk 2.3.0
533  SendPacket(&data);
534 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
bool BuildAuctionInfo(WorldPacket &data) const
uint32 getFaction() const
Definition: Unit.h:1111
void BuildListBidderItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
AuctionEntry * GetAuction(uint32 id) const
void RemoveSpellsCausingAura(AuraType auraType)
Definition: Unit.cpp:648
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
void SendPacket(WorldPacket const *packet)
size_t size() const
Definition: ByteBuffer.h:336
ACE_UINT64 uint64
Definition: Define.h:70
#define sAuctionMgr
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Player.h:922
void WorldSession::HandleAuctionListItems ( WorldPacket recv_data)

Definition at line 572 of file AuctionHouseHandler.cpp.

References _player, AuctionHouseObject::BuildListAuctionItems(), Player::GetNPCIfCanInteractWith(), GetPlayer(), GUID_LOPART, ByteBuffer::put(), ByteBuffer::read_skip(), Unit::RemoveSpellsCausingAura(), sAuctionMgr, SendPacket(), sLog, SMSG_AUCTION_LIST_RESULT, SPELL_AURA_FEIGN_DEATH, UNIT_NPC_FLAG_AUCTIONEER, UNIT_STATE_DIED, Utf8toWStr(), and wstrToLower().

Referenced by IsConnectionIdle().

573 {
574  std::string searchedname;
575  uint8 levelmin, levelmax, usable;
576  uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
577  uint64 guid;
578 
579  recv_data >> guid;
580  recv_data >> listfrom; // start, used for page control listing by 50 elements
581  recv_data >> searchedname;
582 
583  recv_data >> levelmin >> levelmax;
584  recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
585  recv_data >> quality >> usable;
586 
587  recv_data.read_skip<uint8>(); // unk
588 
589  // this block looks like it uses some lame byte packing or similar...
590  uint8 unkCnt;
591  recv_data >> unkCnt;
592  for (uint8 i = 0; i < unkCnt; i++)
593  {
594  recv_data.read_skip<uint8>();
595  recv_data.read_skip<uint8>();
596  }
597 
599  if (!pCreature)
600  {
601  sLog.outDebug("WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
602  return;
603  }
604 
605  // remove fake death
606  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
608 
609  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
610 
611  //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
612 
613  WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4));
614  uint32 count = 0;
615  uint32 totalcount = 0;
616  data << uint32(0);
617 
618  // converting string that we try to find to lower case
619  std::wstring wsearchedname;
620  if (!Utf8toWStr(searchedname, wsearchedname))
621  return;
622 
623  wstrToLower(wsearchedname);
624 
625  auctionHouse->BuildListAuctionItems(data, _player,
626  wsearchedname, listfrom, levelmin, levelmax, usable,
627  auctionSlotID, auctionMainCategory, auctionSubCategory, quality,
628  count, totalcount);
629 
630  data.put<uint32>(0, count);
631  data << uint32(totalcount);
632  data << uint32(300); // 2.3.0 delay for next list request?
633  SendPacket(&data);
634 }
void read_skip()
Definition: ByteBuffer.h:276
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
void BuildListAuctionItems(WorldPacket &data, Player *player, std::wstring const &searchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32 &count, uint32 &totalcount)
void RemoveSpellsCausingAura(AuraType auraType)
Definition: Unit.cpp:648
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:294
void wstrToLower(std::wstring &str)
Definition: Util.h:314
void SendPacket(WorldPacket const *packet)
ACE_UINT8 uint8
Definition: Define.h:73
ACE_UINT64 uint64
Definition: Define.h:70
Player * _player
Definition: WorldSession.h:729
#define sAuctionMgr
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
ACE_UINT32 uint32
Definition: Define.h:71
void WorldSession::HandleAuctionListOwnerItems ( WorldPacket recv_data)

Definition at line 537 of file AuctionHouseHandler.cpp.

References _player, AuctionHouseObject::BuildListOwnerItems(), Unit::getFaction(), Player::GetNPCIfCanInteractWith(), GetPlayer(), GUID_LOPART, ByteBuffer::put(), Unit::RemoveSpellsCausingAura(), sAuctionMgr, SendPacket(), sLog, SMSG_AUCTION_OWNER_LIST_RESULT, SPELL_AURA_FEIGN_DEATH, UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by IsConnectionIdle().

538 {
539  uint32 listfrom;
540  uint64 guid;
541 
542  recv_data >> guid;
543  recv_data >> listfrom; // not used in fact (this list not have page control in client)
544 
546  if (!pCreature)
547  {
548  sLog.outDebug("WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
549  return;
550  }
551 
552  // remove fake death
553  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
555 
556  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
557 
558  WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4 + 4 + 4));
559  data << (uint32) 0; // amount place holder
560 
561  uint32 count = 0;
562  uint32 totalcount = 0;
563 
564  auctionHouse->BuildListOwnerItems(data, _player, count, totalcount);
565  data.put<uint32>(0, count);
566  data << uint32(totalcount);
567  data << uint32(0); // 2.3.0 delay for next list request?
568  SendPacket(&data);
569 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
void BuildListOwnerItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
uint32 getFaction() const
Definition: Unit.h:1111
void RemoveSpellsCausingAura(AuraType auraType)
Definition: Unit.cpp:648
#define sLog
Log class singleton.
Definition: Log.h:187
Player * GetPlayer() const
Definition: WorldSession.h:104
void SendPacket(WorldPacket const *packet)
ACE_UINT64 uint64
Definition: Define.h:70
Player * _player
Definition: WorldSession.h:729
#define sAuctionMgr
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
ACE_UINT32 uint32
Definition: Define.h:71
void WorldSession::HandleAuctionPlaceBid ( WorldPacket recv_data)

Definition at line 289 of file AuctionHouseHandler.cpp.

References AUCTION_OK, AUCTION_PLACE_BID, Database::BeginTransaction(), AuctionEntry::bid, AuctionEntry::bidder, AuctionEntry::buyout, CANNOT_BID_YOUR_AUCTION_ERROR, CharacterDatabase, Database::CommitTransaction(), AuctionEntry::DeleteFromDB(), GetAccountId(), AuctionHouseObject::GetAuction(), AuctionEntry::GetAuctionOutBid(), Unit::getFaction(), Object::GetGUIDLow(), Player::GetMoney(), Player::GetNPCIfCanInteractWith(), GetPlayer(), Player::GetSession(), GUID_LOPART, HIGHGUID_PLAYER, AuctionEntry::Id, AuctionEntry::item_guidlow, AuctionEntry::item_template, MAKE_NEW_GUID, Player::ModifyMoney(), AuctionEntry::owner, Database::PExecute(), AuctionHouseObject::RemoveAuction(), Unit::RemoveSpellsCausingAura(), sAuctionMgr, Player::SaveInventoryAndGoldToDB(), SendAuctionCommandResult(), SendAuctionOutbiddedMail(), sLog, sObjectMgr, SPELL_AURA_FEIGN_DEATH, UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by IsConnectionIdle().

290 {
291  uint64 auctioneer;
292  uint32 auctionId;
293  uint32 price;
294  recv_data >> auctioneer;
295  recv_data >> auctionId >> price;
296 
297  if (!auctionId || !price)
298  return; // check for cheaters
299 
301  if (!pCreature)
302  {
303  sLog.outDebug("WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
304  return;
305  }
306 
307  // remove fake death
308  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
310 
311  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
312 
313  AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
314  Player* pl = GetPlayer();
315 
316  if (!auction || auction->owner == pl->GetGUIDLow())
317  {
318  // you cannot bid your own auction:
320  return;
321  }
322 
323  // impossible have online own another character (use this for speedup check in case online owner)
324  Player* auction_owner = sObjectMgr.GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
325  if (!auction_owner && sObjectMgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
326  {
327  // you cannot bid your another character auction:
329  return;
330  }
331 
332  // cheating
333  if (price <= auction->bid || price < auction->startbid)
334  return;
335 
336  // price too low for next bid if not buyout
337  if ((price < auction->buyout || auction->buyout == 0) &&
338  price < auction->bid + auction->GetAuctionOutBid())
339  {
340  // auction has already higher bid, client tests it!
341  return;
342  }
343 
344  if (price > pl->GetMoney())
345  {
346  // you don't have enought money!, client tests!
347  // SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
348  return;
349  }
350 
351  if (price < auction->buyout || auction->buyout == 0)
352  {
353  if (auction->bidder > 0)
354  {
355  if (auction->bidder == pl->GetGUIDLow())
356  pl->ModifyMoney(-int32(price - auction->bid));
357  else
358  {
359  // mail to last bidder and return money
360  SendAuctionOutbiddedMail(auction, price);
361  pl->ModifyMoney(-int32(price));
362  }
363  }
364  else
365  pl->ModifyMoney(-int32(price));
366 
367  auction->bidder = pl->GetGUIDLow();
368  auction->bid = price;
369 
370  // after this update we should save player's money ...
372  CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id);
373 
375  }
376  else
377  {
378  // buyout:
379  if (pl->GetGUIDLow() == auction->bidder)
380  pl->ModifyMoney(-int32(auction->buyout - auction->bid));
381  else
382  {
383  pl->ModifyMoney(-int32(auction->buyout));