AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldSession Class Reference

Player session in the World. More...

#include "WorldSession.h"

Classes

class  DosProtection
 

Public Member Functions

 WorldSession (uint32 id, std::string &&name, std::shared_ptr< WorldSocket > sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter, bool skipQueue, uint32 TotalTime)
 WorldSession constructor.
 
 ~WorldSession ()
 WorldSession destructor.
 
bool IsGMAccount () const
 
bool PlayerLoading () const
 
bool PlayerLogout () const
 
bool PlayerRecentlyLoggedOut () const
 
bool PlayerLogoutWithSave () const
 
void ReadAddonsInfo (ByteBuffer &data)
 
void SendAddonsInfo ()
 
void ReadMovementInfo (WorldPacket &data, MovementInfo *mi)
 
void WriteMovementInfo (WorldPacket *data, MovementInfo *mi)
 
void SendPacket (WorldPacket const *packet)
 Send a packet to the client.
 
void SendNotification (const char *format,...) ATTR_PRINTF(2
 
void void SendNotification (uint32 string_id,...)
 
void SendPetNameInvalid (uint32 error, std::string const &name, DeclinedName *declinedName)
 
void SendPartyResult (PartyOperation operation, std::string const &member, PartyResult res, uint32 val=0)
 
void SendAreaTriggerMessage (const char *Text,...) ATTR_PRINTF(2
 
void void SendAreaTriggerMessage (uint32 entry,...)
 
void SendSetPhaseShift (uint32 phaseShift)
 
void SendQueryTimeResponse ()
 
void SendAuthResponse (uint8 code, bool shortForm, uint32 queuePos=0)
 
void SendClientCacheVersion (uint32 version)
 
AccountTypes GetSecurity () const
 
bool CanSkipQueue () const
 
uint32 GetAccountId () const
 
PlayerGetPlayer () const
 
std::string const & GetPlayerName () const
 
std::string GetPlayerInfo () const
 
uint32 GetCurrentVendor () const
 
void SetCurrentVendor (uint32 vendorEntry)
 
ObjectGuid::LowType GetGuidLow () const
 Get player guid if available. Use for logging purposes only.
 
void SetSecurity (AccountTypes security)
 
std::string const & GetRemoteAddress ()
 
void SetPlayer (Player *player)
 
uint8 Expansion () const
 
void SetTotalTime (uint32 TotalTime)
 
uint32 GetTotalTime () const
 
void InitWarden (SessionKey const &, std::string const &os)
 
WardenGetWarden ()
 
void SetInQueue (bool state)
 Session in auth.queue currently.
 
bool isLogingOut () const
 Is the user engaged in a log out process?
 
void SetLogoutStartTime (time_t requestTime)
 Engage the logout process for the user.
 
bool ShouldLogOut (time_t currTime) const
 Is logout cooldown expired?
 
void LogoutPlayer (bool save)
 Log the player out
 
void KickPlayer (bool setKicked=true)
 
void KickPlayer (std::string const &reason, bool setKicked=true)
 Kick a player out of the World.
 
bool ValidateHyperlinksAndMaybeKick (std::string_view str)
 
bool DisallowHyperlinksAndMaybeKick (std::string_view str)
 
void QueuePacket (WorldPacket *new_packet)
 Add an incoming packet to the queue.
 
bool Update (uint32 diff, PacketFilter &updater)
 Update the WorldSession (triggered by World update)
 
void SendAuthWaitQueue (uint32 position)
 Handle the authentication waiting queue (to be completed)
 
void SendNameQueryOpcode (ObjectGuid guid)
 
void SendTrainerList (ObjectGuid guid)
 
void SendTrainerList (ObjectGuid guid, std::string const &strTitle)
 
void SendListInventory (ObjectGuid guid, uint32 vendorEntry=0)
 
void SendShowBank (ObjectGuid guid)
 
bool CanOpenMailBox (ObjectGuid guid)
 
void SendShowMailBox (ObjectGuid guid)
 
void SendTabardVendorActivate (ObjectGuid guid)
 
void SendSpiritResurrect ()
 
void SendBindPoint (Creature *npc)
 
void SendAttackStop (Unit const *enemy)
 
void SendBattleGroundList (ObjectGuid guid, BattlegroundTypeId bgTypeId=BATTLEGROUND_RB)
 
void SendTradeStatus (TradeStatus status)
 
void SendUpdateTrade (bool trader_data=true)
 
void SendCancelTrade ()
 
void SendPetitionQueryOpcode (ObjectGuid petitionguid)
 
void HandleClientCastFlags (WorldPacket &recvPacket, uint8 castFlags, SpellCastTargets &targets)
 
void SendPetNameQuery (ObjectGuid guid, uint32 petnumber)
 
void SendStablePet (ObjectGuid guid)
 
void SendStablePetCallback (ObjectGuid guid, PreparedQueryResult result)
 
void SendStableResult (uint8 guid)
 
bool CheckStableMaster (ObjectGuid guid)
 
AccountDataGetAccountData (AccountDataType type)
 
void SetAccountData (AccountDataType type, time_t tm, std::string const &data)
 
void SendAccountDataTimes (uint32 mask)
 
void LoadAccountData (PreparedQueryResult result, uint32 mask)
 
void LoadTutorialsData (PreparedQueryResult result)
 
void SendTutorialsData ()
 
void SaveTutorialsData (CharacterDatabaseTransaction trans)
 
uint32 GetTutorialInt (uint8 index) const
 
void SetTutorialInt (uint8 index, uint32 value)
 
void SendAuctionHello (ObjectGuid guid, Creature *unit)
 
void SendAuctionCommandResult (uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError=0)
 
void SendAuctionBidderNotification (uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template)
 
void SendAuctionOwnerNotification (AuctionEntry *auction)
 
void SendEnchantmentLog (ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
 
void SendItemEnchantTimeUpdate (ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
 
void SendTaxiStatus (ObjectGuid guid)
 
void SendTaxiMenu (Creature *unit)
 
void SendDoFlight (uint32 mountDisplayId, uint32 path, uint32 pathNode=0)
 
bool SendLearnNewTaxiNode (Creature *unit)
 
void SendDiscoverNewTaxiNode (uint32 nodeid)
 
void SendArenaTeamCommandResult (uint32 team_action, std::string const &team, std::string const &player, uint32 error_id=0)
 
void SendNotInArenaTeamPacket (uint8 type)
 
void SendPetitionShowList (ObjectGuid guid)
 
void BuildPartyMemberStatsChangedPacket (Player *player, WorldPacket *data)
 
void DoLootRelease (ObjectGuid lguid)
 
LocaleConstant GetSessionDbcLocale () const
 
LocaleConstant GetSessionDbLocaleIndex () const
 
char const * GetAcoreString (uint32 entry) const
 
uint32 GetLatency () const
 
void SetLatency (uint32 latency)
 
void UpdateTimeOutTime (uint32 diff)
 
void ResetTimeOutTime (bool onlyActive)
 
bool IsConnectionIdle () const
 
uint32 GetRecruiterId () const
 
bool IsARecruiter () const
 
time_t GetCalendarEventCreationCooldown () const
 
void SetCalendarEventCreationCooldown (time_t cooldown)
 
void ResetTimeSync ()
 
void SendTimeSync ()
 
void Handle_NULL (WorldPacket &null)
 
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 (PreparedQueryResult result)
 
void HandlePlayerLoginFromDB (LoginQueryHolder const &holder)
 
void HandlePlayerLoginToCharInWorld (Player *pCurrChar)
 
void HandlePlayerLoginToCharOutOfWorld (Player *pCurrChar)
 
void HandleCharFactionOrRaceChange (WorldPacket &recvData)
 
void HandleCharFactionOrRaceChangeCallback (std::shared_ptr< CharacterFactionChangeInfo > factionChangeInfo, PreparedQueryResult result)
 
void SendCharCreate (ResponseCodes result)
 
void SendCharDelete (ResponseCodes result)
 
void SendCharRename (ResponseCodes result, CharacterRenameInfo const *renameInfo)
 
void SendCharCustomize (ResponseCodes result, CharacterCustomizeInfo const *customizeInfo)
 
void SendCharFactionChange (ResponseCodes result, CharacterFactionChangeInfo const *factionChangeInfo)
 
void SendSetPlayerDeclinedNamesResult (DeclinedNameResult result, ObjectGuid guid)
 
void HandlePlayedTime (WorldPackets::Character::PlayedTimeClient &packet)
 
void HandleMoveUnRootAck (WorldPacket &recvPacket)
 
void HandleMoveRootAck (WorldPacket &recvPacket)
 
void HandleInspectOpcode (WorldPacket &recvPacket)
 
void HandleInspectHonorStatsOpcode (WorldPacket &recvPacket)
 
void HandleMoveWaterWalkAck (WorldPacket &recvPacket)
 
void HandleFeatherFallAck (WorldPacket &recvData)
 
void HandleMoveHoverAck (WorldPacket &recvData)
 
void HandleMountSpecialAnimOpcode (WorldPacket &recvdata)
 
void HandleShowingHelmOpcode (WorldPackets::Character::ShowingHelm &packet)
 
void HandleShowingCloakOpcode (WorldPackets::Character::ShowingCloak &packet)
 
void HandleRepairItemOpcode (WorldPacket &recvPacket)
 
void HandleMoveKnockBackAck (WorldPacket &recvPacket)
 
void HandleMoveTeleportAck (WorldPacket &recvPacket)
 
void HandleForceSpeedChangeAck (WorldPacket &recvData)
 
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 (WorldPackets::Character::LogoutRequest &logoutRequest)
 
void HandlePlayerLogoutOpcode (WorldPackets::Character::PlayerLogout &playerLogout)
 
void HandleLogoutCancelOpcode (WorldPackets::Character::LogoutCancel &logoutCancel)
 
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 HandleReportLag (WorldPacket &recvPacket)
 
void HandleGMResponseResolve (WorldPacket &recvPacket)
 
void HandleTogglePvP (WorldPacket &recvPacket)
 
void HandleZoneUpdateOpcode (WorldPacket &recvPacket)
 
void HandleSetSelectionOpcode (WorldPacket &recvPacket)
 
void HandleStandStateChangeOpcode (WorldPacket &recvPacket)
 
void HandleEmoteOpcode (WorldPackets::Chat::EmoteClient &packet)
 
void HandleContactListOpcode (WorldPacket &recvPacket)
 
void HandleAddFriendOpcode (WorldPacket &recvPacket)
 
void HandleDelFriendOpcode (WorldPacket &recvPacket)
 
void HandleAddIgnoreOpcode (WorldPacket &recvPacket)
 
void HandleDelIgnoreOpcode (WorldPacket &recvPacket)
 
void HandleSetContactNotesOpcode (WorldPacket &recvPacket)
 
void HandleBugOpcode (WorldPacket &recvPacket)
 
void HandleSetAmmoOpcode (WorldPacket &recvPacket)
 
void HandleItemNameQueryOpcode (WorldPacket &recvPacket)
 
void HandleAreaTriggerOpcode (WorldPacket &recvPacket)
 
void HandleSetFactionAtWar (WorldPacket &recvData)
 
void HandleSetFactionCheat (WorldPacket &recvData)
 
void HandleSetWatchedFactionOpcode (WorldPacket &recvData)
 
void HandleSetFactionInactiveOpcode (WorldPacket &recvData)
 
void HandleUpdateAccountData (WorldPacket &recvPacket)
 
void HandleRequestAccountData (WorldPacket &recvPacket)
 
void HandleSetActionButtonOpcode (WorldPacket &recvPacket)
 
void HandleGameObjectUseOpcode (WorldPacket &recPacket)
 
void HandleGameobjectReportUse (WorldPacket &recvPacket)
 
void HandleNameQueryOpcode (WorldPacket &recvPacket)
 
void HandleQueryTimeOpcode (WorldPacket &recvPacket)
 
void HandleCreatureQueryOpcode (WorldPacket &recvPacket)
 Only static data is sent in this packet !!!
 
void HandleGameObjectQueryOpcode (WorldPacket &recvPacket)
 Only static data is sent in this packet !!!
 
void HandleMoveWorldportAckOpcode (WorldPacket &recvPacket)
 
void HandleMoveWorldportAck ()
 
void HandleMovementOpcodes (WorldPacket &recvPacket)
 
void HandleSetActiveMoverOpcode (WorldPacket &recvData)
 
void HandleMoveNotActiveMover (WorldPacket &recvData)
 
void HandleDismissControlledVehicle (WorldPacket &recvData)
 
void HandleRequestVehicleExit (WorldPacket &recvData)
 
void HandleChangeSeatsOnControlledVehicle (WorldPacket &recvData)
 
void HandleMoveTimeSkippedOpcode (WorldPacket &recvData)
 
void HandleRequestRaidInfoOpcode (WorldPacket &recvData)
 
void HandleBattlefieldStatusOpcode (WorldPacket &recvData)
 
void HandleGroupInviteOpcode (WorldPacket &recvPacket)
 
void HandleGroupAcceptOpcode (WorldPacket &recvPacket)
 
void HandleGroupDeclineOpcode (WorldPacket &recvPacket)
 
void HandleGroupUninviteOpcode (WorldPacket &recvPacket)
 
void HandleGroupUninviteGuidOpcode (WorldPacket &recvPacket)
 
void HandleGroupSetLeaderOpcode (WorldPacket &recvPacket)
 
void HandleGroupDisbandOpcode (WorldPacket &recvPacket)
 
void HandleOptOutOfLootOpcode (WorldPacket &recvData)
 
void HandleLootMethodOpcode (WorldPacket &recvPacket)
 
void HandleLootRoll (WorldPacket &recvData)
 
void HandleRequestPartyMemberStatsOpcode (WorldPacket &recvData)
 
void HandleGroupSwapSubGroupOpcode (WorldPacket &recvData)
 
void HandleRaidTargetUpdateOpcode (WorldPacket &recvData)
 
void HandleRaidReadyCheckOpcode (WorldPacket &recvData)
 
void HandleRaidReadyCheckFinishedOpcode (WorldPacket &recvData)
 
void HandleGroupRaidConvertOpcode (WorldPacket &recvData)
 
void HandleGroupChangeSubGroupOpcode (WorldPacket &recvData)
 
void HandleGroupAssistantLeaderOpcode (WorldPacket &recvData)
 
void HandlePartyAssignmentOpcode (WorldPacket &recvData)
 
void HandlePetitionBuyOpcode (WorldPacket &recvData)
 
void HandlePetitionShowSignOpcode (WorldPacket &recvData)
 
void HandlePetitionQueryOpcode (WorldPacket &recvData)
 
void HandlePetitionRenameOpcode (WorldPacket &recvData)
 
void HandlePetitionSignOpcode (WorldPacket &recvData)
 
void HandlePetitionDeclineOpcode (WorldPacket &recvData)
 
void HandleOfferPetitionOpcode (WorldPacket &recvData)
 
void HandleTurnInPetitionOpcode (WorldPacket &recvData)
 
void HandleGuildQueryOpcode (WorldPackets::Guild::QueryGuildInfo &query)
 
void HandleGuildCreateOpcode (WorldPackets::Guild::GuildCreate &packet)
 
void HandleGuildInviteOpcode (WorldPackets::Guild::GuildInviteByName &packet)
 
void HandleGuildRemoveOpcode (WorldPackets::Guild::GuildOfficerRemoveMember &packet)
 
void HandleGuildAcceptOpcode (WorldPackets::Guild::AcceptGuildInvite &invite)
 
void HandleGuildDeclineOpcode (WorldPackets::Guild::GuildDeclineInvitation &decline)
 
void HandleGuildInfoOpcode (WorldPackets::Guild::GuildGetInfo &packet)
 
void HandleGuildEventLogQueryOpcode (WorldPackets::Guild::GuildEventLogQuery &packet)
 
void HandleGuildRosterOpcode (WorldPackets::Guild::GuildGetRoster &packet)
 
void HandleGuildPromoteOpcode (WorldPackets::Guild::GuildPromoteMember &promote)
 
void HandleGuildDemoteOpcode (WorldPackets::Guild::GuildDemoteMember &demote)
 
void HandleGuildLeaveOpcode (WorldPackets::Guild::GuildLeave &leave)
 
void HandleGuildDisbandOpcode (WorldPackets::Guild::GuildDelete &packet)
 
void HandleGuildLeaderOpcode (WorldPackets::Guild::GuildSetGuildMaster &packet)
 
void HandleGuildMOTDOpcode (WorldPackets::Guild::GuildUpdateMotdText &packet)
 
void HandleGuildSetPublicNoteOpcode (WorldPackets::Guild::GuildSetMemberNote &packet)
 
void HandleGuildSetOfficerNoteOpcode (WorldPackets::Guild::GuildSetMemberNote &packet)
 
void HandleGuildRankOpcode (WorldPackets::Guild::GuildSetRankPermissions &packet)
 
void HandleGuildAddRankOpcode (WorldPackets::Guild::GuildAddRank &packet)
 
void HandleGuildDelRankOpcode (WorldPackets::Guild::GuildDeleteRank &packet)
 
void HandleGuildChangeInfoTextOpcode (WorldPackets::Guild::GuildUpdateInfoText &packet)
 
void HandleSaveGuildEmblemOpcode (WorldPackets::Guild::SaveGuildEmblem &packet)
 
void HandleTaxiNodeStatusQueryOpcode (WorldPacket &recvPacket)
 
void HandleTaxiQueryAvailableNodes (WorldPacket &recvPacket)
 
void HandleActivateTaxiOpcode (WorldPacket &recvPacket)
 
void HandleActivateTaxiExpressOpcode (WorldPacket &recvPacket)
 
void HandleMoveSplineDoneOpcode (WorldPacket &recvPacket)
 
void SendActivateTaxiReply (ActivateTaxiReply reply)
 
void HandleTabardVendorActivateOpcode (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 HandleOpenWrappedItemCallback (uint8 bagIndex, uint8 slot, ObjectGuid::LowType itemLowGUID, PreparedQueryResult result)
 
void HandleLoadActionsSwitchSpec (PreparedQueryResult result)
 
void HandleCharacterAuraFrozen (PreparedQueryResult result)
 
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 &recvData)
 
void HandleAuctionListBidderItems (WorldPacket &recvData)
 
void HandleAuctionSellItem (WorldPacket &recvData)
 
void HandleAuctionRemoveItem (WorldPacket &recvData)
 
void HandleAuctionListOwnerItems (WorldPacket &recvData)
 
void HandleAuctionListOwnerItemsEvent (ObjectGuid creatureGuid)
 
void HandleAuctionPlaceBid (WorldPacket &recvData)
 
void HandleAuctionListPendingSales (WorldPacket &recvData)
 
void HandleBankerActivateOpcode (WorldPacket &recvData)
 
void HandleAutoBankItemOpcode (WorldPackets::Bank::AutoBankItem &packet)
 
void HandleAutoStoreBankItemOpcode (WorldPackets::Bank::AutoStoreBankItem &packet)
 
void HandleBuyBankSlotOpcode (WorldPackets::Bank::BuyBankSlot &buyBankSlot)
 
void HandleGetMailList (WorldPacket &recvData)
 
void HandleSendMail (WorldPacket &recvData)
 
void HandleMailTakeMoney (WorldPacket &recvData)
 
void HandleMailTakeItem (WorldPacket &recvData)
 
void HandleMailMarkAsRead (WorldPacket &recvData)
 
void HandleMailReturnToSender (WorldPacket &recvData)
 
void HandleMailDelete (WorldPacket &recvData)
 
void HandleItemTextQuery (WorldPacket &recvData)
 
void HandleMailCreateTextItem (WorldPacket &recvData)
 
void HandleQueryNextMailTime (WorldPacket &recvData)
 
void HandleCancelChanneling (WorldPacket &recvData)
 
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 HandleWrapItemOpcode (WorldPacket &recvPacket)
 
void HandleAttackSwingOpcode (WorldPacket &recvPacket)
 
void HandleAttackStopOpcode (WorldPacket &recvPacket)
 
void HandleSetSheathedOpcode (WorldPackets::Combat::SetSheathed &packet)
 
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 HandleLearnPreviewTalents (WorldPacket &recvPacket)
 
void HandleTalentWipeConfirmOpcode (WorldPacket &recvPacket)
 
void HandleUnlearnSkillOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverStatusQueryOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverStatusMultipleQuery (WorldPacket &recvPacket)
 
void HandleQuestgiverHelloOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverAcceptQuestOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverQueryQuestOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverChooseRewardOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverRequestRewardOpcode (WorldPacket &recvPacket)
 
void HandleQuestQueryOpcode (WorldPacket &recvPacket)
 
void HandleQuestgiverCancel (WorldPacket &recvData)
 
void HandleQuestLogSwapQuest (WorldPacket &recvData)
 
void HandleQuestLogRemoveQuest (WorldPacket &recvData)
 
void HandleQuestConfirmAccept (WorldPacket &recvData)
 
void HandleQuestgiverCompleteQuest (WorldPacket &recvData)
 
void HandleQuestgiverQuestAutoLaunch (WorldPacket &recvPacket)
 
void HandlePushQuestToParty (WorldPacket &recvPacket)
 
void HandleQuestPushResult (WorldPacket &recvPacket)
 
void HandleMessagechatOpcode (WorldPacket &recvPacket)
 
void SendPlayerNotFoundNotice (std::string const &name)
 
void SendPlayerAmbiguousNotice (std::string const &name)
 
void SendWrongFactionNotice ()
 
void SendChatRestrictedNotice (ChatRestrictionType restriction)
 
void HandleTextEmoteOpcode (WorldPacket &recvPacket)
 
void HandleChatIgnoredOpcode (WorldPacket &recvPacket)
 
void HandleReclaimCorpseOpcode (WorldPacket &recvPacket)
 
void HandleCorpseQueryOpcode (WorldPacket &recvPacket)
 
void HandleCorpseMapPositionQuery (WorldPacket &recvPacket)
 
void HandleResurrectResponseOpcode (WorldPacket &recvPacket)
 
void HandleSummonResponseOpcode (WorldPacket &recvData)
 
void HandleJoinChannel (WorldPacket &recvPacket)
 
void HandleLeaveChannel (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 HandleChannelAnnouncements (WorldPacket &recvPacket)
 
void HandleChannelModerateOpcode (WorldPacket &recvPacket)
 
void HandleChannelDeclineInvite (WorldPacket &recvPacket)
 
void HandleChannelDisplayListQuery (WorldPacket &recvPacket)
 
void HandleGetChannelMemberCount (WorldPacket &recvPacket)
 
void HandleSetChannelWatch (WorldPacket &recvPacket)
 
void HandleClearChannelWatch (WorldPacket &recvPacket)
 
void HandleCompleteCinematic (WorldPacket &recvPacket)
 
void HandleNextCinematicCamera (WorldPacket &recvPacket)
 
void HandlePageTextQueryOpcode (WorldPacket &recvPacket)
 Only static data is sent in this packet !!!
 
void HandleTutorialFlag (WorldPacket &recvData)
 
void HandleTutorialClear (WorldPacket &recvData)
 
void HandleTutorialReset (WorldPacket &recvData)
 
void HandlePetAction (WorldPacket &recvData)
 
void HandlePetStopAttack (WorldPackets::Pet::PetStopAttack &packet)
 
void HandlePetActionHelper (Unit *pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2)
 
void HandlePetNameQuery (WorldPacket &recvData)
 
void HandlePetSetAction (WorldPacket &recvData)
 
void HandlePetAbandon (WorldPackets::Pet::PetAbandon &packet)
 
void HandlePetRename (WorldPacket &recvData)
 
void HandlePetCancelAuraOpcode (WorldPacket &recvPacket)
 
void HandlePetSpellAutocastOpcode (WorldPackets::Pet::PetSpellAutocast &packet)
 
void HandlePetCastSpellOpcode (WorldPacket &recvPacket)
 
void HandlePetLearnTalent (WorldPacket &recvPacket)
 
void HandleLearnPreviewTalentsPet (WorldPacket &recvPacket)
 
void HandleSetActionBarToggles (WorldPacket &recvData)
 
void HandleCharRenameOpcode (WorldPacket &recvData)
 
void HandleCharRenameCallBack (std::shared_ptr< CharacterRenameInfo > renameInfo, PreparedQueryResult result)
 
void HandleSetPlayerDeclinedNames (WorldPacket &recvData)
 
void HandleTotemDestroyed (WorldPackets::Totem::TotemDestroyed &totemDestroyed)
 
void HandleDismissCritter (WorldPackets::Pet::DismissCritter &dismissCritter)
 
void HandleBattlemasterHelloOpcode (WorldPacket &recvData)
 
void HandleBattlemasterJoinOpcode (WorldPacket &recvData)
 
void HandleBattlegroundPlayerPositionsOpcode (WorldPacket &recvData)
 
void HandlePVPLogDataOpcode (WorldPacket &recvData)
 
void HandleBattleFieldPortOpcode (WorldPacket &recvData)
 
void HandleBattlefieldListOpcode (WorldPacket &recvData)
 
void HandleBattlefieldLeaveOpcode (WorldPacket &recvData)
 
void HandleBattlemasterJoinArena (WorldPacket &recvData)
 
void HandleReportPvPAFK (WorldPacket &recvData)
 
void HandleWardenDataOpcode (WorldPacket &recvData)
 
void HandleWorldTeleportOpcode (WorldPacket &recvData)
 
void HandleMinimapPingOpcode (WorldPacket &recvData)
 
void HandleRandomRollOpcode (WorldPackets::Misc::RandomRollClient &packet)
 
void HandleFarSightOpcode (WorldPacket &recvData)
 
void HandleSetDungeonDifficultyOpcode (WorldPacket &recvData)
 
void HandleSetRaidDifficultyOpcode (WorldPacket &recvData)
 
void HandleMoveSetCanFlyAckOpcode (WorldPacket &recvData)
 
void HandleSetTitleOpcode (WorldPacket &recvData)
 
void HandleRealmSplitOpcode (WorldPacket &recvData)
 
void HandleTimeSyncResp (WorldPacket &recvData)
 
void HandleWhoisOpcode (WorldPacket &recvData)
 
void HandleResetInstancesOpcode (WorldPacket &recvData)
 
void HandleHearthAndResurrect (WorldPacket &recvData)
 
void HandleInstanceLockResponse (WorldPacket &recvPacket)
 
void HandleUpdateMissileTrajectory (WorldPacket &recvPacket)
 
void SendBfInvitePlayerToWar (uint32 battleId, uint32 zoneId, uint32 time)
 
void SendBfInvitePlayerToQueue (uint32 battleId)
 
void SendBfQueueInviteResponse (uint32 battleId, uint32 zoneId, bool canQueue=true, bool full=false)
 
void SendBfEntered (uint32 battleId)
 
void SendBfLeaveMessage (uint32 battleId, BFLeaveReason reason=BF_LEAVE_REASON_EXITED)
 
void HandleBfQueueInviteResponse (WorldPacket &recvData)
 
void HandleBfEntryInviteResponse (WorldPacket &recvData)
 
void HandleBfExitRequest (WorldPacket &recvData)
 
void HandleLfgSetCommentOpcode (WorldPacket &recvData)
 
void HandleLfgPlayerLockInfoRequestOpcode (WorldPacket &recvData)
 
void HandleLfgPartyLockInfoRequestOpcode (WorldPacket &recvData)
 
void HandleLfgJoinOpcode (WorldPackets::LFG::LFGJoin &lfgJoin)
 
void HandleLfgLeaveOpcode (WorldPackets::LFG::LFGLeave &lfgleave)
 
void HandleLfgSetRolesOpcode (WorldPacket &recvData)
 
void HandleLfgProposalResultOpcode (WorldPacket &recvData)
 
void HandleLfgSetBootVoteOpcode (WorldPacket &recvData)
 
void HandleLfgTeleportOpcode (WorldPacket &recvData)
 
void HandleLfrSearchJoinOpcode (WorldPacket &recvData)
 
void HandleLfrSearchLeaveOpcode (WorldPacket &recvData)
 
void HandleLfgGetStatus (WorldPacket &recvData)
 
void SendLfgUpdatePlayer (lfg::LfgUpdateData const &updateData)
 
void SendLfgUpdateParty (lfg::LfgUpdateData const &updateData)
 
void SendLfgRoleChosen (ObjectGuid guid, uint8 roles)
 
void SendLfgRoleCheckUpdate (lfg::LfgRoleCheck const &pRoleCheck)
 
void SendLfgLfrList (bool update)
 
void SendLfgJoinResult (lfg::LfgJoinResultData const &joinData)
 
void SendLfgQueueStatus (lfg::LfgQueueStatusData const &queueData)
 
void SendLfgPlayerReward (lfg::LfgPlayerRewardData const &lfgPlayerRewardData)
 
void SendLfgBootProposalUpdate (lfg::LfgPlayerBoot const &boot)
 
void SendLfgUpdateProposal (lfg::LfgProposal const &proposal)
 
void SendLfgDisabled ()
 
void SendLfgOfferContinue (uint32 dungeonEntry)
 
void SendLfgTeleportError (uint8 err)
 
void HandleInspectArenaTeamsOpcode (WorldPacket &recvData)
 
void HandleArenaTeamQueryOpcode (WorldPacket &recvData)
 
void HandleArenaTeamRosterOpcode (WorldPacket &recvData)
 
void HandleArenaTeamInviteOpcode (WorldPacket &recvData)
 
void HandleArenaTeamAcceptOpcode (WorldPacket &recvData)
 
void HandleArenaTeamDeclineOpcode (WorldPacket &recvData)
 
void HandleArenaTeamLeaveOpcode (WorldPacket &recvData)
 
void HandleArenaTeamRemoveOpcode (WorldPacket &recvData)
 
void HandleArenaTeamDisbandOpcode (WorldPacket &recvData)
 
void HandleArenaTeamLeaderOpcode (WorldPacket &recvData)
 
void HandleAreaSpiritHealerQueryOpcode (WorldPacket &recvData)
 
void HandleAreaSpiritHealerQueueOpcode (WorldPacket &recvData)
 
void HandleCancelMountAuraOpcode (WorldPacket &recvData)
 
void HandleSelfResOpcode (WorldPacket &recvData)
 
void HandleComplainOpcode (WorldPacket &recvData)
 
void HandleRequestPetInfo (WorldPackets::Pet::RequestPetInfo &packet)
 
void HandleSocketOpcode (WorldPacket &recvData)
 
void HandleCancelTempEnchantmentOpcode (WorldPacket &recvData)
 
void HandleItemRefundInfoRequest (WorldPacket &recvData)
 
void HandleItemRefund (WorldPacket &recvData)
 
void HandleChannelVoiceOnOpcode (WorldPacket &recvData)
 
void HandleVoiceSessionEnableOpcode (WorldPacket &recvData)
 
void HandleSetActiveVoiceChannel (WorldPacket &recvData)
 
void HandleSetTaxiBenchmarkOpcode (WorldPacket &recvData)
 
void HandleGuildPermissions (WorldPackets::Guild::GuildPermissionsQuery &packet)
 
void HandleGuildBankMoneyWithdrawn (WorldPackets::Guild::GuildBankRemainingWithdrawMoneyQuery &packet)
 
void HandleGuildBankerActivate (WorldPackets::Guild::GuildBankActivate &packet)
 
void HandleGuildBankQueryTab (WorldPackets::Guild::GuildBankQueryTab &packet)
 
void HandleGuildBankLogQuery (WorldPackets::Guild::GuildBankLogQuery &packet)
 
void HandleGuildBankDepositMoney (WorldPackets::Guild::GuildBankDepositMoney &packet)
 
void HandleGuildBankWithdrawMoney (WorldPackets::Guild::GuildBankWithdrawMoney &packet)
 
void HandleGuildBankSwapItems (WorldPackets::Guild::GuildBankSwapItems &packet)
 
void HandleGuildBankUpdateTab (WorldPackets::Guild::GuildBankUpdateTab &packet)
 
void HandleGuildBankBuyTab (WorldPackets::Guild::GuildBankBuyTab &packet)
 
void HandleQueryGuildBankTabText (WorldPackets::Guild::GuildBankTextQuery &packet)
 
void HandleSetGuildBankTabText (WorldPackets::Guild::GuildBankSetTabText &packet)
 
void HandleGrantLevel (WorldPacket &recvData)
 
void HandleAcceptGrantLevel (WorldPacket &recvData)
 
void HandleCalendarGetCalendar (WorldPacket &recvData)
 
void HandleCalendarGetEvent (WorldPacket &recvData)
 
void HandleCalendarGuildFilter (WorldPacket &recvData)
 
void HandleCalendarArenaTeam (WorldPacket &recvData)
 
void HandleCalendarAddEvent (WorldPacket &recvData)
 
void HandleCalendarUpdateEvent (WorldPacket &recvData)
 
void HandleCalendarRemoveEvent (WorldPacket &recvData)
 
void HandleCalendarCopyEvent (WorldPacket &recvData)
 
void HandleCalendarEventInvite (WorldPacket &recvData)
 
void HandleCalendarEventRsvp (WorldPacket &recvData)
 
void HandleCalendarEventRemoveInvite (WorldPacket &recvData)
 
void HandleCalendarEventStatus (WorldPacket &recvData)
 
void HandleCalendarEventModeratorStatus (WorldPacket &recvData)
 
void HandleCalendarComplain (WorldPacket &recvData)
 
void HandleCalendarGetNumPending (WorldPacket &recvData)
 
void HandleCalendarEventSignup (WorldPacket &recvData)
 
void SendCalendarRaidLockout (InstanceSave const *save, bool add)
 
void SendCalendarRaidLockoutUpdated (InstanceSave const *save, bool isExtended)
 
void HandleSetSavedInstanceExtend (WorldPacket &recvData)
 
void HandleSpellClick (WorldPacket &recvData)
 
void HandleMirrorImageDataRequest (WorldPacket &recvData)
 
void HandleAlterAppearance (WorldPacket &recvData)
 
void HandleRemoveGlyph (WorldPacket &recvData)
 
void HandleCharCustomize (WorldPacket &recvData)
 
void HandleCharCustomizeCallback (std::shared_ptr< CharacterCustomizeInfo > customizeInfo, PreparedQueryResult result)
 
void HandleQueryInspectAchievements (WorldPacket &recvData)
 
void HandleEquipmentSetSave (WorldPacket &recvData)
 
void HandleEquipmentSetDelete (WorldPacket &recvData)
 
void HandleEquipmentSetUse (WorldPacket &recvData)
 
void HandleWorldStateUITimerUpdate (WorldPacket &recvData)
 
void HandleReadyForAccountDataTimes (WorldPacket &recvData)
 
void HandleQueryQuestsCompleted (WorldPacket &recvData)
 
void HandleQuestPOIQuery (WorldPacket &recvData)
 
void HandleEjectPassenger (WorldPacket &data)
 
void HandleEnterPlayerVehicle (WorldPacket &data)
 
void HandleUpdateProjectilePosition (WorldPacket &recvPacket)
 
void HandleTeleportTimeout (bool updateInSessions)
 
bool HandleSocketClosed ()
 
void SetOfflineTime (uint32 time)
 
uint32 GetOfflineTime () const
 
bool IsKicked () const
 
void SetKicked (bool val)
 
bool IsSocketClosed () const
 
QueryCallbackProcessorGetQueryProcessor ()
 
TransactionCallbackAddTransactionCallback (TransactionCallback &&callback)
 
SQLQueryHolderCallbackAddQueryHolderCallback (SQLQueryHolderCallback &&callback)
 
void InitializeSession ()
 
void InitializeSessionCallback (CharacterDatabaseQueryHolder const &realmHolder, uint32 clientCacheVersion)
 

Public Attributes

time_t m_muteTime
 
std::atomic< time_t > m_timeOutTime
 
Milliseconds _lastAuctionListItemsMSTime
 
Milliseconds _lastAuctionListOwnerItemsMSTime
 

Protected Attributes

class WorldSession::DosProtection AntiDOS
 

Private Types

typedef std::list< AddonInfoAddonsList
 

Private Member Functions

void ProcessQueryCallbacks ()
 
void moveItems (Item *myItems[], Item *hisItems[])
 
bool CanUseBank (ObjectGuid bankerGUID=ObjectGuid::Empty) const
 
bool recoveryItem (Item *pItem)
 
void LogUnexpectedOpcode (WorldPacket *packet, char const *status, const char *reason)
 Logging helper for unexpected opcodes.
 
void LogUnprocessedTail (WorldPacket *packet)
 Logging helper for unexpected opcodes.
 
bool IsLegitCharacterForAccount (ObjectGuid guid)
 
void ComputeNewClockDelta ()
 
 WorldSession (WorldSession const &right)=delete
 
WorldSessionoperator= (WorldSession const &right)=delete
 

Private Attributes

QueryCallbackProcessor _queryProcessor
 
AsyncCallbackProcessor< TransactionCallback_transactionCallbacks
 
AsyncCallbackProcessor< SQLQueryHolderCallback_queryHolderProcessor
 
GuidSet _legitCharacters
 
ObjectGuid::LowType m_GUIDLow
 
Player_player
 
std::shared_ptr< WorldSocketm_Socket
 
std::string m_Address
 
AccountTypes _security
 
bool _skipQueue
 
uint32 _accountId
 
std::string _accountName
 
uint8 m_expansion
 
uint32 m_total_time
 
std::unique_ptr< Warden_warden
 
time_t _logoutTime
 
bool m_inQueue
 
bool m_playerLoading
 
bool m_playerLogout
 
bool m_playerRecentlyLogout
 
bool m_playerSave
 
LocaleConstant m_sessionDbcLocale
 
LocaleConstant m_sessionDbLocaleIndex
 
std::atomic< uint32m_latency
 
AccountData m_accountData [NUM_ACCOUNT_DATA_TYPES]
 
uint32 m_Tutorials [MAX_ACCOUNT_TUTORIAL_VALUES]
 
bool m_TutorialsChanged
 
AddonsList m_addonsList
 
uint32 recruiterId
 
bool isRecruiter
 
LockedQueue< WorldPacket * > _recvQueue
 
uint32 m_currentVendorEntry
 
ObjectGuid m_currentBankerGUID
 
uint32 _offlineTime
 
bool _kicked
 
time_t _calendarEventCreationCooldown
 
std::atomic< uint32_addonMessageReceiveCount
 
CircularBuffer< std::pair< int64, uint32 > > _timeSyncClockDeltaQueue
 
int64 _timeSyncClockDelta
 
std::map< uint32, uint32_pendingTimeSyncRequests
 
uint32 _timeSyncNextCounter
 
uint32 _timeSyncTimer
 

Friends

class World
 

Detailed Description

Player session in the World.

Member Typedef Documentation

◆ AddonsList

typedef std::list<AddonInfo> WorldSession::AddonsList
private

Constructor & Destructor Documentation

◆ WorldSession() [1/2]

WorldSession::WorldSession ( uint32  id,
std::string &&  name,
std::shared_ptr< WorldSocket sock,
AccountTypes  sec,
uint8  expansion,
time_t  mute_time,
LocaleConstant  locale,
uint32  recruiter,
bool  isARecruiter,
bool  skipQueue,
uint32  TotalTime 
)

WorldSession constructor.

105 :
106 m_muteTime(mute_time),
107 m_timeOutTime(0),
110 AntiDOS(this),
111 m_GUIDLow(0),
112 _player(nullptr),
113 m_Socket(sock),
114 _security(sec),
115 _skipQueue(skipQueue),
116 _accountId(id),
117 _accountName(std::move(name)),
118 m_expansion(expansion),
119 m_total_time(TotalTime),
120 _logoutTime(0),
121 m_inQueue(false),
122 m_playerLoading(false),
123 m_playerLogout(false),
125 m_playerSave(false),
126 m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()),
128 m_latency(0),
129 m_TutorialsChanged(false),
130 recruiterId(recruiter),
131 isRecruiter(isARecruiter),
138{
139 memset(m_Tutorials, 0, sizeof(m_Tutorials));
140
141 _offlineTime = 0;
142 _kicked = false;
143
145 _timeSyncTimer = 0;
146
147 if (sock)
148 {
149 m_Address = sock->GetRemoteIpAddress().to_string();
150 ResetTimeOutTime(false);
151 LoginDatabase.Execute("UPDATE account SET online = 1 WHERE id = {};", GetAccountId()); // One-time query
152 }
153}
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
#define sWorld
Definition: World.h:447
bool m_playerRecentlyLogout
Definition: WorldSession.h:1165
bool isRecruiter
Definition: WorldSession.h:1175
std::string m_Address
Definition: WorldSession.h:1147
uint32 _offlineTime
Definition: WorldSession.h:1179
bool m_playerSave
Definition: WorldSession.h:1166
LocaleConstant m_sessionDbLocaleIndex
Definition: WorldSession.h:1168
bool _skipQueue
Definition: WorldSession.h:1150
CircularBuffer< std::pair< int64, uint32 > > _timeSyncClockDeltaQueue
Definition: WorldSession.h:1187
bool m_TutorialsChanged
Definition: WorldSession.h:1172
time_t _logoutTime
Definition: WorldSession.h:1161
uint32 m_currentVendorEntry
Definition: WorldSession.h:1177
Milliseconds _lastAuctionListItemsMSTime
Definition: WorldSession.h:1063
int64 _timeSyncClockDelta
Definition: WorldSession.h:1188
std::atomic< uint32 > _addonMessageReceiveCount
Definition: WorldSession.h:1185
bool m_playerLoading
Definition: WorldSession.h:1163
std::shared_ptr< WorldSocket > m_Socket
Definition: WorldSession.h:1146
std::map< uint32, uint32 > _pendingTimeSyncRequests
Definition: WorldSession.h:1191
time_t _calendarEventCreationCooldown
Definition: WorldSession.h:1182
class WorldSession::DosProtection AntiDOS
std::atomic< time_t > m_timeOutTime
Definition: WorldSession.h:506
uint32 _timeSyncTimer
Definition: WorldSession.h:1193
uint32 m_total_time
Definition: WorldSession.h:1154
std::string _accountName
Definition: WorldSession.h:1152
uint32 _timeSyncNextCounter
Definition: WorldSession.h:1192
uint32 recruiterId
Definition: WorldSession.h:1174
bool m_playerLogout
Definition: WorldSession.h:1164
uint32 _accountId
Definition: WorldSession.h:1151
ObjectGuid::LowType m_GUIDLow
Definition: WorldSession.h:1144
uint32 GetAccountId() const
Definition: WorldSession.h:363
Milliseconds _lastAuctionListOwnerItemsMSTime
Definition: WorldSession.h:1064
Player * _player
Definition: WorldSession.h:1145
AccountTypes _security
Definition: WorldSession.h:1149
bool m_inQueue
Definition: WorldSession.h:1162
LocaleConstant m_sessionDbcLocale
Definition: WorldSession.h:1167
time_t m_muteTime
Definition: WorldSession.h:496
std::atomic< uint32 > m_latency
Definition: WorldSession.h:1169
void ResetTimeOutTime(bool onlyActive)
Definition: WorldSession.h:514
uint32 m_Tutorials[MAX_ACCOUNT_TUTORIAL_VALUES]
Definition: WorldSession.h:1171
uint8 m_expansion
Definition: WorldSession.h:1153
bool _kicked
Definition: WorldSession.h:1180

References _kicked, _offlineTime, _timeSyncNextCounter, _timeSyncTimer, GetAccountId(), LoginDatabase, m_Address, m_Tutorials, and ResetTimeOutTime().

◆ ~WorldSession()

WorldSession::~WorldSession ( )

WorldSession destructor.

  • unload player if not unloaded
  • If have unclosed socket, close it
  • empty incoming packet queue
157{
158 LoginDatabase.Execute("UPDATE account SET totaltime = {} WHERE id = {}", GetTotalTime(), GetAccountId());
159
161 if (_player)
162 LogoutPlayer(true);
163
165 if (m_Socket)
166 {
167 m_Socket->CloseSocket();
168 m_Socket = nullptr;
169 }
170
172 WorldPacket* packet = nullptr;
173 while (_recvQueue.next(packet))
174 delete packet;
175
176 LoginDatabase.Execute("UPDATE account SET online = 0 WHERE id = {};", GetAccountId()); // One-time query
177}
bool next(T &result)
Gets the next result in the queue, if any.
Definition: LockedQueue.h:63
Definition: WorldPacket.h:27
void LogoutPlayer(bool save)
Log the player out
Definition: WorldSession.cpp:571
uint32 GetTotalTime() const
Definition: WorldSession.h:378
LockedQueue< WorldPacket * > _recvQueue
Definition: WorldSession.h:1176

References _player, _recvQueue, GetAccountId(), GetTotalTime(), LoginDatabase, LogoutPlayer(), m_Socket, and LockedQueue< T, StorageType >::next().

◆ WorldSession() [2/2]

WorldSession::WorldSession ( WorldSession const &  right)
privatedelete

Member Function Documentation

◆ AddQueryHolderCallback()

SQLQueryHolderCallback & WorldSession::AddQueryHolderCallback ( SQLQueryHolderCallback &&  callback)
1305{
1306 return _queryHolderProcessor.AddCallback(std::move(callback));
1307}
T & AddCallback(T &&query)
Definition: AsyncCallbackProcessor.h:35
AsyncCallbackProcessor< SQLQueryHolderCallback > _queryHolderProcessor
Definition: WorldSession.h:1090

References _queryHolderProcessor, and AsyncCallbackProcessor< T >::AddCallback().

Referenced by HandlePlayerLoginOpcode(), InitializeSession(), and Pet::LoadPetFromDB().

◆ AddTransactionCallback()

TransactionCallback & WorldSession::AddTransactionCallback ( TransactionCallback &&  callback)
1300{
1301 return _transactionCallbacks.AddCallback(std::move(callback));
1302}
AsyncCallbackProcessor< TransactionCallback > _transactionCallbacks
Definition: WorldSession.h:1089

References _transactionCallbacks, and AsyncCallbackProcessor< T >::AddCallback().

◆ BuildPartyMemberStatsChangedPacket()

void WorldSession::BuildPartyMemberStatsChangedPacket ( Player player,
WorldPacket data 
)
773{
774 uint32 mask = player->GetGroupUpdateFlag();
775
776 if (mask == GROUP_UPDATE_FLAG_NONE)
777 return;
778
779 if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
781
782 if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
784
785 uint32 byteCount = 0;
786 for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i)
787 if (mask & (1 << i))
788 byteCount += GroupUpdateLength[i];
789
790 data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
791 *data << player->GetPackGUID();
792 *data << uint32(mask);
793
794 if (mask & GROUP_UPDATE_FLAG_STATUS)
795 {
796 uint16 playerStatus = MEMBER_STATUS_ONLINE;
797 if (player->IsPvP())
798 playerStatus |= MEMBER_STATUS_PVP;
799
800 if (!player->IsAlive())
801 {
803 playerStatus |= MEMBER_STATUS_GHOST;
804 else
805 playerStatus |= MEMBER_STATUS_DEAD;
806 }
807
808 if (player->IsFFAPvP())
809 playerStatus |= MEMBER_STATUS_PVP_FFA;
810
811 if (player->isAFK())
812 playerStatus |= MEMBER_STATUS_AFK;
813
814 if (player->isDND())
815 playerStatus |= MEMBER_STATUS_DND;
816
817 *data << uint16(playerStatus);
818 }
819
820 if (mask & GROUP_UPDATE_FLAG_CUR_HP)
821 *data << uint32(player->GetHealth());
822
823 if (mask & GROUP_UPDATE_FLAG_MAX_HP)
824 *data << uint32(player->GetMaxHealth());
825
826 Powers powerType = player->getPowerType();
828 *data << uint8(powerType);
829
831 *data << uint16(player->GetPower(powerType));
832
834 *data << uint16(player->GetMaxPower(powerType));
835
836 if (mask & GROUP_UPDATE_FLAG_LEVEL)
837 *data << uint16(player->GetLevel());
838
839 if (mask & GROUP_UPDATE_FLAG_ZONE)
840 *data << uint16(player->GetZoneId());
841
843 {
844 *data << uint16(player->GetPositionX());
845 *data << uint16(player->GetPositionY());
846 }
847
848 if (mask & GROUP_UPDATE_FLAG_AURAS)
849 {
850 uint64 auramask = player->GetAuraUpdateMaskForRaid();
851 *data << uint64(auramask);
852 for (uint32 i = 0; i < MAX_AURAS_GROUP_UPDATE; ++i)
853 {
854 if (auramask & (uint64(1) << i))
855 {
856 AuraApplication const* aurApp = player->GetVisibleAura(i);
857 *data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
858 *data << uint8(1);
859 }
860 }
861 }
862
863 Pet* pet = player->GetPet();
865 {
866 if (pet)
867 *data << pet->GetGUID();
868 else
869 *data << (uint64) 0;
870 }
871
873 {
874 if (pet)
875 *data << pet->GetName();
876 else
877 *data << uint8(0);
878 }
879
881 {
882 if (pet)
883 *data << uint16(pet->GetDisplayId());
884 else
885 *data << uint16(0);
886 }
887
889 {
890 if (pet)
891 *data << uint32(pet->GetHealth());
892 else
893 *data << uint32(0);
894 }
895
897 {
898 if (pet)
899 *data << uint32(pet->GetMaxHealth());
900 else
901 *data << uint32(0);
902 }
903
905 {
906 if (pet)
907 *data << uint8(pet->getPowerType());
908 else
909 *data << uint8(0);
910 }
911
913 {
914 if (pet)
915 *data << uint16(pet->GetPower(pet->getPowerType()));
916 else
917 *data << uint16(0);
918 }
919
921 {
922 if (pet)
923 *data << uint16(pet->GetMaxPower(pet->getPowerType()));
924 else
925 *data << uint16(0);
926 }
927
929 {
930 if (pet)
931 {
932 uint64 auramask = pet->GetAuraUpdateMaskForRaid();
933 *data << uint64(auramask);
934 for (uint32 i = 0; i < MAX_AURAS_GROUP_UPDATE; ++i)
935 {
936 if (auramask & (uint64(1) << i))
937 {
938 AuraApplication const* aurApp = pet->GetVisibleAura(i);
939 *data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
940 *data << uint8(aurApp ? aurApp->GetFlags() : 0);
941 }
942 }
943 }
944 else
945 *data << uint64(0);
946 }
947
949 {
950 if (Vehicle* veh = player->GetVehicle())
951 * data << uint32(veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.transport.seat]);
952 else
953 *data << uint32(0);
954 }
955}
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
std::uint64_t uint64
Definition: Define.h:107
std::uint16_t uint16
Definition: Define.h:109
@ PLAYER_FLAGS_GHOST
Definition: Player.h:479
@ MEMBER_STATUS_AFK
Definition: Group.h:67
@ MEMBER_STATUS_PVP
Definition: Group.h:62
@ MEMBER_STATUS_ONLINE
Definition: Group.h:61
@ MEMBER_STATUS_DEAD
Definition: Group.h:63
@ MEMBER_STATUS_GHOST
Definition: Group.h:64
@ MEMBER_STATUS_DND
Definition: Group.h:68
@ MEMBER_STATUS_PVP_FFA
Definition: Group.h:65
static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT]
Definition: Group.h:140
@ GROUP_UPDATE_FLAG_CUR_HP
Definition: Group.h:101
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition: Group.h:113
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition: Group.h:103
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition: Group.h:116
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition: Group.h:117
@ GROUP_UPDATE_FLAG_MAX_HP
Definition: Group.h:102
@ GROUP_UPDATE_FLAG_VEHICLE_SEAT
Definition: Group.h:119
@ GROUP_UPDATE_FLAG_STATUS
Definition: Group.h:100
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition: Group.h:115
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition: Group.h:105
@ GROUP_UPDATE_FLAG_ZONE
Definition: Group.h:107
@ GROUP_UPDATE_FLAG_NONE
Definition: Group.h:99
@ GROUP_UPDATE_FLAG_POSITION
Definition: Group.h:108
@ GROUP_UPDATE_FLAG_PET_MODEL_ID
Definition: Group.h:112
@ GROUP_UPDATE_FLAG_PET_NAME
Definition: Group.h:111
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition: Group.h:118
@ GROUP_UPDATE_FLAG_AURAS
Definition: Group.h:109
@ GROUP_UPDATE_FLAG_LEVEL
Definition: Group.h:106
@ GROUP_UPDATE_FLAG_PET_GUID
Definition: Group.h:110
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition: Group.h:114
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition: Group.h:104
#define GROUP_UPDATE_FLAGS_COUNT
Definition: Group.h:138
#define MAX_AURAS_GROUP_UPDATE
Definition: SpellAuraDefines.h:22
Powers
Definition: SharedDefines.h:268
@ SMSG_PARTY_MEMBER_STATS
Definition: Opcodes.h:156
PackedGuid const & GetPackGUID() const
Definition: Object.h:108
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
struct MovementInfo::TransportInfo transport
int8 seat
Definition: Object.h:286
std::string const & GetName() const
Definition: Object.h:446
uint32 GetZoneId() const
Definition: Object.cpp:3100
MovementInfo m_movementInfo
Definition: Object.h:595
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Definition: Pet.h:40
uint64 GetAuraUpdateMaskForRaid() const
Definition: Pet.h:135
uint64 GetAuraUpdateMaskForRaid() const
Definition: Player.h:2438
Pet * GetPet() const
Definition: Player.cpp:8819
bool IsFFAPvP()
Definition: Player.cpp:16138
bool isDND() const
Definition: Player.h:1125
uint32 GetGroupUpdateFlag() const
Definition: Player.h:2436
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1100
bool isAFK() const
Definition: Player.h:1124
bool IsPvP()
Definition: Player.cpp:16147
Vehicle * GetVehicle() const
Definition: Unit.h:2368
AuraApplication * GetVisibleAura(uint8 slot)
Definition: Unit.h:2166
uint32 GetMaxHealth() const
Definition: Unit.h:1455
bool IsAlive() const
Definition: Unit.h:1822
uint32 GetDisplayId() const
Definition: Unit.h:2182
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1476
uint32 GetHealth() const
Definition: Unit.h:1454
Powers getPowerType() const
Definition: Unit.h:1473
uint32 GetPower(Powers power) const
Definition: Unit.h:1475
uint8 GetLevel() const
Definition: Unit.h:1432
Definition: Vehicle.h:30
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:69
Definition: SpellAuras.h:37
uint8 GetFlags() const
Definition: SpellAuras.h:65
Aura * GetBase() const
Definition: SpellAuras.h:62
uint32 GetId() const
Definition: SpellAuras.cpp:466

References Pet::GetAuraUpdateMaskForRaid(), Player::GetAuraUpdateMaskForRaid(), AuraApplication::GetBase(), Unit::GetDisplayId(), AuraApplication::GetFlags(), Player::GetGroupUpdateFlag(), Object::GetGUID(), Unit::GetHealth(), Aura::GetId(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetMaxPower(), WorldObject::GetName(), Object::GetPackGUID(), Player::GetPet(), Position::GetPositionX(), Position::GetPositionY(), Unit::GetPower(), Unit::getPowerType(), Unit::GetVehicle(), Unit::GetVisibleAura(), 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_NONE, 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_VEHICLE_SEAT, GROUP_UPDATE_FLAG_ZONE, GROUP_UPDATE_FLAGS_COUNT, GroupUpdateLength, Player::HasPlayerFlag(), WorldPacket::Initialize(), Player::isAFK(), Unit::IsAlive(), Player::isDND(), Player::IsFFAPvP(), Player::IsPvP(), WorldObject::m_movementInfo, MAX_AURAS_GROUP_UPDATE, MEMBER_STATUS_AFK, MEMBER_STATUS_DEAD, MEMBER_STATUS_DND, MEMBER_STATUS_GHOST, MEMBER_STATUS_ONLINE, MEMBER_STATUS_PVP, MEMBER_STATUS_PVP_FFA, PLAYER_FLAGS_GHOST, MovementInfo::TransportInfo::seat, SMSG_PARTY_MEMBER_STATS, and MovementInfo::transport.

Referenced by Group::UpdatePlayerOutOfRange().

◆ CanOpenMailBox()

bool WorldSession::CanOpenMailBox ( ObjectGuid  guid)
37{
38 if (guid == _player->GetGUID())
39 {
41 {
42 LOG_ERROR("network.opcode", "{} attempt open mailbox in cheating way.", _player->GetName());
43 return false;
44 }
45 }
46 else if (guid.IsGameObject())
47 {
49 return false;
50 }
51 else if (guid.IsAnyTypeCreature())
52 {
54 return false;
55 }
56 else
57 return false;
58
59 return true;
60}
@ SEC_MODERATOR
Definition: Common.h:60
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
@ UNIT_NPC_FLAG_MAILBOX
Definition: Unit.h:542
@ GAMEOBJECT_TYPE_MAILBOX
Definition: SharedDefines.h:1579
bool IsGameObject() const
Definition: ObjectGuid.h:173
bool IsAnyTypeCreature() const
Definition: ObjectGuid.h:169
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const
Definition: Player.cpp:2120
WorldSession * GetSession() const
Definition: Player.h:1961
Creature * GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
Definition: Player.cpp:2063
AccountTypes GetSecurity() const
Definition: WorldSession.h:361

References _player, GAMEOBJECT_TYPE_MAILBOX, Player::GetGameObjectIfCanInteractWith(), Object::GetGUID(), WorldObject::GetName(), Player::GetNPCIfCanInteractWith(), GetSecurity(), Player::GetSession(), ObjectGuid::IsAnyTypeCreature(), ObjectGuid::IsGameObject(), LOG_ERROR, SEC_MODERATOR, and UNIT_NPC_FLAG_MAILBOX.

Referenced by HandleGetMailList(), HandleMailCreateTextItem(), HandleMailDelete(), HandleMailMarkAsRead(), HandleMailReturnToSender(), HandleMailTakeItem(), HandleMailTakeMoney(), and HandleSendMail().

◆ CanSkipQueue()

bool WorldSession::CanSkipQueue ( ) const
inline
362{ return _skipQueue; }

References _skipQueue.

Referenced by World::AddSession_().

◆ CanUseBank()

bool WorldSession::CanUseBank ( ObjectGuid  bankerGUID = ObjectGuid::Empty) const
private
28{
29 // bankerGUID parameter is optional, set to 0 by default.
30 if (!bankerGUID)
31 bankerGUID = m_currentBankerGUID;
32
33 bool isUsingBankCommand = (bankerGUID == GetPlayer()->GetGUID() && bankerGUID == m_currentBankerGUID);
34
35 if (!isUsingBankCommand)
36 {
38 if (!creature)
39 return false;
40 }
41
42 return true;
43}
@ UNIT_NPC_FLAG_BANKER
Definition: Unit.h:533
Definition: Creature.h:46
Player * GetPlayer() const
Definition: WorldSession.h:364
ObjectGuid m_currentBankerGUID
Definition: WorldSession.h:1178

References Object::GetGUID(), Player::GetNPCIfCanInteractWith(), GetPlayer(), m_currentBankerGUID, and UNIT_NPC_FLAG_BANKER.

Referenced by HandleAutoBankItemOpcode(), HandleAutoStoreBankItemOpcode(), HandleBuyBankSlotOpcode(), HandleSwapInvItemOpcode(), and HandleSwapItem().

◆ CheckStableMaster()

bool WorldSession::CheckStableMaster ( ObjectGuid  guid)
662{
663 // spell case or GM
664 if (guid == GetPlayer()->GetGUID())
665 {
666 if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
667 {
668 LOG_DEBUG("network.opcode", "Player ({}) attempt open stable in cheating way.", guid.ToString());
669 return false;
670 }
671 }
672 // stable master case
673 else
674 {
675 if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
676 {
677 LOG_DEBUG("network.opcode", "Stablemaster ({}) not found or you can't interact with him.", guid.ToString());
678 return false;
679 }
680 }
681 return true;
682}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
@ UNIT_NPC_FLAG_STABLEMASTER
Definition: Unit.h:538
@ SPELL_AURA_OPEN_STABLE
Definition: SpellAuraDefines.h:355
std::string ToString() const
Definition: ObjectGuid.cpp:47

References GetPlayer(), LOG_DEBUG, SPELL_AURA_OPEN_STABLE, ObjectGuid::ToString(), and UNIT_NPC_FLAG_STABLEMASTER.

Referenced by HandleBuyStableSlot(), HandleListStabledPetsOpcode(), HandleStablePet(), HandleStableSwapPet(), and HandleUnstablePet().

◆ ComputeNewClockDelta()

void WorldSession::ComputeNewClockDelta ( )
private
925{
926 // implementation of the technique described here: https://web.archive.org/web/20180430214420/http://www.mine-control.com/zack/timesync/timesync.html
927 // to reduce the skew induced by dropped TCP packets that get resent.
928
929 std::vector<uint32> latencies;
930 std::vector<int64> clockDeltasAfterFiltering;
931
932 for (auto& pair : _timeSyncClockDeltaQueue.content())
933 latencies.push_back(pair.second);
934
935 uint32 latencyMedian = median(latencies);
936 uint32 latencyStandardDeviation = standard_deviation(latencies);
937
938 uint32 sampleSizeAfterFiltering = 0;
939 for (auto& pair : _timeSyncClockDeltaQueue.content())
940 {
941 if (pair.second <= latencyMedian + latencyStandardDeviation) {
942 clockDeltasAfterFiltering.push_back(pair.first);
943 sampleSizeAfterFiltering++;
944 }
945 }
946
947 if (sampleSizeAfterFiltering != 0)
948 {
949 int64 meanClockDelta = static_cast<int64>(mean(clockDeltasAfterFiltering));
950 if (std::abs(meanClockDelta - _timeSyncClockDelta) > 25)
951 _timeSyncClockDelta = meanClockDelta;
952 }
953 else if (_timeSyncClockDelta == 0)
954 {
955 std::pair<int64, uint32> back = _timeSyncClockDeltaQueue.peak_back();
956 _timeSyncClockDelta = back.first;
957 }
958}
std::int64_t int64
Definition: Define.h:103
T median(std::vector< T > a)
Definition: MathUtil.h:59
T standard_deviation(Container &&c)
Definition: MathUtil.h:28
T mean(Container &&c)
Definition: MathUtil.h:49
std::vector< T > content()
Definition: CircularBuffer.h:81
T peak_back()
Definition: CircularBuffer.h:88

References _timeSyncClockDelta, _timeSyncClockDeltaQueue, CircularBuffer< T >::content(), mean(), median(), CircularBuffer< T >::peak_back(), and standard_deviation().

Referenced by HandleTimeSyncResp().

◆ DisallowHyperlinksAndMaybeKick()

bool WorldSession::DisallowHyperlinksAndMaybeKick ( std::string_view  str)
772{
773 if (str.find('|') == std::string_view::npos)
774 return true;
775
776 LOG_ERROR("network", "Player {} {} sent a message which illegally contained a hyperlink:\n%.*s", GetPlayer()->GetName(),
777 GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
778
780 KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
781
782 return false;
783}
#define STRING_VIEW_FMT_ARG(str)
Definition: Define.h:101
@ CONFIG_CHAT_STRICT_LINK_CHECKING_KICK
Definition: IWorld.h:290
std::string ToString(Type &&val, Params &&... params)
Definition: StringConvert.h:250
bool GetName(uint32 accountId, std::string &name)
Definition: AccountMgr.cpp:228
void KickPlayer(bool setKicked=true)
Definition: WorldSession.h:402

References CONFIG_CHAT_STRICT_LINK_CHECKING_KICK, GetPlayer(), KickPlayer(), LOG_ERROR, STRING_VIEW_FMT_ARG, and sWorld.

Referenced by HandleJoinChannel().

◆ DoLootRelease()

void WorldSession::DoLootRelease ( ObjectGuid  lguid)
271{
272 Player* player = GetPlayer();
273 Loot* loot;
274
276 player->SendLootRelease(lguid);
277
279
280 if (!player->IsInWorld())
281 return;
282
283 if (lguid.IsGameObject())
284 {
285 GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
286
287 // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
288 if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player)))
289 {
290 return;
291 }
292
293 loot = &go->loot;
294
295 if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR)
296 {
297 // locked doors are opened with spelleffect openlock, prevent remove its as looted
298 go->UseDoorOrButton();
299 }
300 else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
301 {
303 {
304 // The fishing hole used once more
305 go->AddUse(); // if the max usage is reached, will be despawned in next tick
306 if (go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens)
308 else
310 }
311 else
312 {
314
315 // Xinef: moved event execution to loot release (after everything is looted)
316 // Xinef: 99% sure that this worked like this on blizz
317 // Xinef: prevents exploits with just opening GO and spawning bilions of npcs, which can crash core if you know what you're doin ;)
319 {
320 LOG_DEBUG("spells.aura", "Chest ScriptStart id {} for GO {}", go->GetGOInfo()->chest.eventId, go->GetSpawnId());
321 player->GetMap()->ScriptsStart(sEventScripts, go->GetGOInfo()->chest.eventId, player, go);
322 }
323 }
324
325 loot->clear();
326 }
327 else
328 {
329 // not fully looted object
330 go->SetLootState(GO_ACTIVATED, player);
331
332 // if the round robin player release, reset it.
333 if (player->GetGUID() == loot->roundRobinPlayer)
334 loot->roundRobinPlayer.Clear();
335 }
336 }
337 else if (lguid.IsCorpse()) // ONLY remove insignia at BG
338 {
339 Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
340 if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
341 return;
342
343 loot = &corpse->loot;
344
345 // Xinef: Buggs client? (Opening loot after closing)
346 //if (loot->isLooted())
347 {
348 loot->clear();
350 }
351 }
352 else if (lguid.IsItem())
353 {
354 Item* pItem = player->GetItemByGuid(lguid);
355 if (!pItem)
356 return;
357
358 loot = &pItem->loot;
359 ItemTemplate const* proto = pItem->GetTemplate();
360
361 // destroy only 5 items from stack in case prospecting and milling
363 {
364 pItem->m_lootGenerated = false;
365 pItem->loot.clear();
366
367 uint32 count = pItem->GetCount();
368
369 // >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
370 if (count > 5)
371 count = 5;
372
373 player->DestroyItemCount(pItem, count, true);
374 }
375 else if (pItem->loot.isLooted() || !(proto->Flags & ITEM_FLAG_HAS_LOOT))
376 {
377 player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
378 return;
379 }
380 }
381 else
382 {
383 Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
384
385 bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
386 if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
387 return;
388
389 loot = &creature->loot;
390 if (loot->isLooted())
391 {
392 // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
393 if (!creature->IsAlive())
394 creature->AllLootRemovedFromCorpse();
395
397 loot->clear();
398 }
399 else
400 {
401 // if the round robin player release, reset it.
402 if (player->GetGUID() == loot->roundRobinPlayer)
403 {
404 loot->roundRobinPlayer.Clear();
405
406 if (Group* group = player->GetGroup())
407 group->SendLooter(creature, nullptr);
408 }
409 // force dynflag update to update looter and lootable info
411 }
412 }
413
414 //Player is not looking at loot list, he doesn't need to see updates on the loot list
415 if (!lguid.IsItem())
416 {
417 loot->RemoveLooter(player->GetGUID());
418 }
419}
@ GO_ACTIVATED
Definition: GameObject.h:114
@ GO_READY
Definition: GameObject.h:113
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:115
@ ITEM_FLAG_IS_MILLABLE
Definition: ItemTemplate.h:177
@ ITEM_FLAG_IS_PROSPECTABLE
Definition: ItemTemplate.h:166
@ ITEM_FLAG_HAS_LOOT
Definition: ItemTemplate.h:150
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
@ CORPSE_FIELD_DYNAMIC_FLAGS
Definition: UpdateFields.h:428
@ UNIT_DYNAMIC_FLAGS
Definition: UpdateFields.h:136
@ UNIT_FLAG_LOOTING
Definition: Unit.h:458
ScriptMapMap sEventScripts
Definition: ObjectMgr.cpp:58
@ LOOT_PICKPOCKETING
Definition: LootMgr.h:82
@ GAMEOBJECT_TYPE_CHEST
Definition: SharedDefines.h:1563
@ GAMEOBJECT_TYPE_FISHINGHOLE
Definition: SharedDefines.h:1585
@ GAMEOBJECT_TYPE_FISHINGNODE
Definition: SharedDefines.h:1577
@ GAMEOBJECT_TYPE_DOOR
Definition: SharedDefines.h:1560
@ CORPSE_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3133
@ UNIT_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3121
@ CLASS_ROGUE
Definition: SharedDefines.h:144
Corpse * GetCorpse(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:182
Definition: Corpse.h:49
Loot loot
Definition: Corpse.h:77
Loot loot
Definition: Creature.h:220
void AllLootRemovedFromCorpse()
Definition: Creature.cpp:2909
uint32 MaxOpens
Definition: GameObject.h:62
struct GameObjectValue::@220 FishingHole
Definition: GameObject.h:122
bool IsWithinDistInMap(Player const *player) const
Definition: GameObject.cpp:3058
Loot loot
Definition: GameObject.h:249
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
Definition: GameObject.cpp:1427
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:138
void AddUse()
Definition: GameObject.h:241
GameObjectValue const * GetGOValue() const
Definition: GameObject.h:141
void SetLootState(LootState s, Unit *unit=nullptr)
Definition: GameObject.cpp:2442
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:175
GameobjectTypes GetGoType() const
Definition: GameObject.h:205
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:146
uint32 GetUseCount() const
Definition: GameObject.h:243
uint32 eventId
Definition: GameObjectData.h:90
struct GameObjectTemplate::@223::@228 chest
Definition: Item.h:214
uint8 GetSlot() const
Definition: Item.h:272
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
bool m_lootGenerated
Definition: Item.h:312
uint32 GetCount() const
Definition: Item.h:263
Loot loot
Definition: Item.h:311
uint8 GetBagSlot() const
Definition: Item.cpp:785
Definition: ItemTemplate.h:628
uint32 Flags
Definition: ItemTemplate.h:636
virtual void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:118
bool IsInWorld() const
Definition: Object.h:101
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:860
void ForceValuesUpdateAtIndex(uint32)
Definition: Object.cpp:2067
Map * GetMap() const
Definition: Object.h:517
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
bool IsCorpse() const
Definition: ObjectGuid.h:175
bool IsItem() const
Definition: ObjectGuid.h:172
void Clear()
Definition: ObjectGuid.h:140
Definition: Player.h:1056
void SendLootRelease(ObjectGuid guid)
Definition: Player.cpp:7679
void SetLootGUID(ObjectGuid guid)
Definition: Player.h:1957
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3045
Group * GetGroup()
Definition: Player.h:2431
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: PlayerStorage.cpp:3143
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:435
uint8 getClass() const
Definition: Unit.h:1438
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1496
Definition: Group.h:169
Definition: LootMgr.h:313
bool isLooted() const
Definition: LootMgr.h:368
void clear()
Definition: LootMgr.h:343
ObjectGuid roundRobinPlayer
Definition: LootMgr.h:324
void RemoveLooter(ObjectGuid GUID)
Definition: LootMgr.h:374
LootType loot_type
Definition: LootMgr.h:326
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
Definition: MapScripts.cpp:33
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3312
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3307

References _player, GameObject::AddUse(), Creature::AllLootRemovedFromCorpse(), GameObjectTemplate::chest, CLASS_ROGUE, ObjectGuid::Clear(), Loot::clear(), CORPSE_DYNFLAG_LOOTABLE, CORPSE_FIELD_DYNAMIC_FLAGS, Player::DestroyItem(), Player::DestroyItemCount(), ObjectGuid::Empty, GameObjectTemplate::eventId, GameObjectValue::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(), GameObject::GetGOValue(), Player::GetGroup(), Object::GetGUID(), Player::GetItemByGuid(), WorldObject::GetMap(), GameObject::GetOwnerGUID(), GetPlayer(), Item::GetSlot(), GameObject::GetSpawnId(), Item::GetTemplate(), GameObject::GetUseCount(), GO_ACTIVATED, GO_JUST_DEACTIVATED, GO_READY, INTERACTION_DISTANCE, Unit::IsAlive(), ObjectGuid::IsCorpse(), ObjectGuid::IsGameObject(), Object::IsInWorld(), ObjectGuid::IsItem(), Loot::isLooted(), GameObject::IsWithinDistInMap(), WorldObject::IsWithinDistInMap(), ITEM_FLAG_HAS_LOOT, ITEM_FLAG_IS_MILLABLE, ITEM_FLAG_IS_PROSPECTABLE, LOG_DEBUG, Corpse::loot, Creature::loot, GameObject::loot, Item::loot, LOOT_PICKPOCKETING, Loot::loot_type, Item::m_lootGenerated, GameObjectValue::MaxOpens, Object::RemoveDynamicFlag(), Object::RemoveFlag(), Loot::RemoveLooter(), Unit::RemoveUnitFlag(), Loot::roundRobinPlayer, Map::ScriptsStart(), Player::SendLootRelease(), Player::SetLootGUID(), GameObject::SetLootState(), sEventScripts, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_FLAG_LOOTING, and GameObject::UseDoorOrButton().

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

◆ Expansion()

◆ GetAccountData()

AccountData * WorldSession::GetAccountData ( AccountDataType  type)
inline
452{ return &m_accountData[type]; }
AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES]
Definition: WorldSession.h:1170

References m_accountData.

Referenced by HandleRequestAccountData(), and SendAccountDataTimes().

◆ GetAccountId()

uint32 WorldSession::GetAccountId ( ) const
inline
363{ return _accountId; }

References _accountId.

Referenced by World::AddSession_(), Warden::ApplyPenalty(), CharacterActionIpLogger::CharacterIPLogAction(), Spell::CheckCast(), Spell::CheckEffectTarget(), WorldSession::DosProtection::EvaluateOpcode(), GetPlayerInfo(), Player::GetsRecruitAFriendBonus(), HandleAcceptGrantLevel(), HandleAcceptTradeOpcode(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccount2FASetupCommand(), account_commandscript::HandleAccountAddonCommand(), account_commandscript::HandleAccountCreateCommand(), account_commandscript::HandleAccountLockCountryCommand(), account_commandscript::HandleAccountLockIpCommand(), account_commandscript::HandleAccountPasswordCommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), HandleAuctionPlaceBid(), HandleCharCreateOpcode(), HandleCharCustomize(), HandleCharCustomizeCallback(), HandleCharDeleteOpcode(), HandleCharEnum(), HandleCharEnumOpcode(), HandleCharFactionOrRaceChange(), HandleCharFactionOrRaceChangeCallback(), HandleCharRenameCallBack(), HandleCharRenameOpcode(), WardenWin::HandleData(), HandleDismissCritter(), HandleForceSpeedChangeAck(), HandleGrantLevel(), HandleMailReturnToSender(), HandleMailTakeItem(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), misc_commandscript::HandleMuteCommand(), HandlePetitionSignOpcode(), misc_commandscript::HandlePInfoCommand(), HandlePlayerLoginFromDB(), HandlePlayerLoginOpcode(), HandleSendMail(), misc_commandscript::HandleUnmuteCommand(), HandleWhoisOpcode(), World::HasRecentlyDisconnected(), WardenMac::Init(), WardenWin::Init(), InitializeSession(), BattlegroundQueue::InviteGroupToBG(), Channel::JoinChannel(), Channel::KickOrBan(), KickPlayer(), Player::LoadFromDB(), LogCommandUsage(), LogoutPlayer(), go_ulduar_pure_saronite_deposit::OnGossipHello(), SaveTutorialsData(), AuctionHouseMgr::SendAuctionWonMail(), SetAccountData(), Channel::SetMode(), Channel::SetOwner(), Guild::Member::SetStats(), Channel::UnBan(), Update(), World::UpdateSessions(), WorldSession(), and ~WorldSession().

◆ GetAcoreString()

◆ GetCalendarEventCreationCooldown()

time_t WorldSession::GetCalendarEventCreationCooldown ( ) const
inline

◆ GetCurrentVendor()

◆ GetGuidLow()

ObjectGuid::LowType WorldSession::GetGuidLow ( ) const

Get player guid if available. Use for logging purposes only.

207{
208 return GetPlayer() ? GetPlayer()->GetGUID().GetCounter() : 0;
209}
LowType GetCounter() const
Definition: ObjectGuid.h:147

References ObjectGuid::GetCounter(), Object::GetGUID(), and GetPlayer().

◆ GetLatency()

◆ GetOfflineTime()

uint32 WorldSession::GetOfflineTime ( ) const
inline
1069{ return _offlineTime; }

References _offlineTime.

Referenced by World::UpdateSessions().

◆ GetPlayer()

Player * WorldSession::GetPlayer ( ) const
inline
364{ return _player; }

References _player.

Referenced by ticket_commandscript::_HandleGMTicketResponseAppendCommand(), Guild::_SendBankContent(), Guild::_SendBankList(), Warden::ApplyPenalty(), Guild::BroadcastToGuild(), CanUseBank(), CheckStableMaster(), DisallowHyperlinksAndMaybeKick(), DoLootRelease(), go_commandscript::DoTeleport(), ChatHandler::GetCreatureFromPlayerMapByDbGuid(), GetGuidLow(), ChatHandler::GetNearbyGameObject(), ChatHandler::GetObjectFromPlayerMapByDbGuid(), ChatHandler::GetPlayer(), ChatHandler::GetPlayerGroupAndGUIDByName(), ChatHandler::getSelectedCreature(), ChatHandler::getSelectedObject(), ChatHandler::getSelectedPlayer(), ChatHandler::getSelectedPlayerOrSelf(), ChatHandler::getSelectedUnit(), Guild::HandleAcceptMember(), account_commandscript::HandleAccountCreateCommand(), HandleActivateTaxiExpressOpcode(), HandleActivateTaxiOpcode(), HandleAddFriendOpcode(), HandleAddIgnoreOpcode(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), Guild::HandleAddNewRank(), misc_commandscript::HandleAppearCommand(), HandleAreaSpiritHealerQueryOpcode(), HandleAreaSpiritHealerQueueOpcode(), HandleAreaTriggerOpcode(), HandleArenaTeamInviteOpcode(), HandleAttackStopOpcode(), HandleAuctionHelloOpcode(), HandleAuctionListBidderItems(), HandleAuctionListOwnerItemsEvent(), HandleAuctionPlaceBid(), HandleAuctionRemoveItem(), HandleAuctionSellItem(), HandleAutostoreLootItemOpcode(), bg_commandscript::HandleBagsClearCommand(), HandleBankerActivateOpcode(), HandleBattlemasterHelloOpcode(), HandleBattlemasterJoinArena(), HandleBattlemasterJoinOpcode(), HandleBinderActivateOpcode(), misc_commandscript::HandleBindSightCommand(), HandleBuybackItem(), Guild::HandleBuyBankTab(), HandleBuyItemInSlotOpcode(), HandleBuyItemOpcode(), HandleBuyStableSlot(), HandleCancelTempEnchantmentOpcode(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDistCommand(), cheat_commandscript::HandleCasttimeCheatCommand(), HandleChangeSeatsOnControlledVehicle(), misc_commandscript::HandleChangeWeather(), HandleChannelAnnouncements(), HandleChannelBan(), HandleChannelInvite(), HandleChannelKick(), HandleChannelList(), HandleChannelModerateOpcode(), HandleChannelModerator(), HandleChannelMute(), HandleChannelOwner(), HandleChannelPassword(), HandleChannelSetOwner(), HandleChannelUnban(), HandleChannelUnmoderator(), HandleChannelUnmute(), HandleCharacterAuraFrozen(), character_commandscript::HandleCharacterCheckBankCommand(), character_commandscript::HandleCharacterLevelCommand(), HandleChatIgnoredOpcode(), cheat_commandscript::HandleCheatStatusCommand(), HandleClearChannelWatch(), misc_commandscript::HandleComeToMeCommand(), misc_commandscript::HandleCommentatorCommand(), HandleCompleteCinematic(), cheat_commandscript::HandleCoolDownCheatCommand(), misc_commandscript::HandleCooldownCommand(), HandleCorpseQueryOpcode(), misc_commandscript::HandleDamageCommand(), debug_commandscript::HandleDebugAreaTriggersCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugLoSCommand(), debug_commandscript::HandleDebugSendOpcodeCommand(), debug_commandscript::HandleDebugSpawnVehicleCommand(), debug_commandscript::HandleDebugUnitStateCommand(), HandleDelFriendOpcode(), HandleDelIgnoreOpcode(), misc_commandscript::HandleDevCommand(), misc_commandscript::HandleDieCommand(), Guild::HandleDisband(), HandleDismissCritter(), misc_commandscript::HandleDismountCommand(), HandleDuelAcceptedOpcode(), HandleDuelCancelledOpcode(), HandleEjectPassenger(), HandleEmoteOpcode(), cheat_commandscript::HandleExploreCheatCommand(), HandleFarSightOpcode(), gobject_commandscript::HandleGameObjectActivateCommand(), gobject_commandscript::HandleGameObjectAddCommand(), gobject_commandscript::HandleGameObjectAddTempCommand(), gobject_commandscript::HandleGameObjectDeleteCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectNearCommand(), HandleGameobjectReportUse(), gobject_commandscript::HandleGameObjectTargetCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), HandleGameObjectUseOpcode(), HandleGetChannelMemberCount(), misc_commandscript::HandleGetDistanceCommand(), gm_commandscript::HandleGMFlyCommand(), gm_commandscript::HandleGMListIngameCommand(), HandleGMResponseResolve(), HandleGMSurveySubmit(), ticket_commandscript::HandleGMTicketAssignToCommand(), ticket_commandscript::HandleGMTicketCloseByIdCommand(), ticket_commandscript::HandleGMTicketCommentCommand(), ticket_commandscript::HandleGMTicketCompleteCommand(), HandleGMTicketCreateOpcode(), ticket_commandscript::HandleGMTicketDeleteByIdCommand(), HandleGMTicketDeleteOpcode(), HandleGMTicketGetTicketOpcode(), ticket_commandscript::HandleGMTicketUnAssignCommand(), HandleGMTicketUpdateOpcode(), gm_commandscript::HandleGMVisibleCommand(), cheat_commandscript::HandleGodModeCheatCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), HandleGossipHelloOpcode(), HandleGossipSelectOptionOpcode(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoXYZCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGPSCommand(), HandleGroupAcceptOpcode(), HandleGroupAssistantLeaderOpcode(), HandleGroupChangeSubGroupOpcode(), HandleGroupDeclineOpcode(), HandleGroupDisbandOpcode(), HandleGroupInviteOpcode(), HandleGroupRaidConvertOpcode(), HandleGroupSetLeaderOpcode(), misc_commandscript::HandleGroupSummonCommand(), HandleGroupSwapSubGroupOpcode(), HandleGroupUninviteGuidOpcode(), HandleGroupUninviteOpcode(), misc_commandscript::HandleGUIDCommand(), HandleGuildAcceptOpcode(), HandleGuildAddRankOpcode(), HandleGuildBankBuyTab(), HandleGuildBankDepositMoney(), HandleGuildBankerActivate(), HandleGuildBankLogQuery(), HandleGuildBankMoneyWithdrawn(), HandleGuildBankQueryTab(), HandleGuildBankSwapItems(), HandleGuildBankUpdateTab(), HandleGuildBankWithdrawMoney(), HandleGuildChangeInfoTextOpcode(), HandleGuildDeclineOpcode(), HandleGuildDelRankOpcode(), HandleGuildDemoteOpcode(), HandleGuildDisbandOpcode(), HandleGuildEventLogQueryOpcode(), HandleGuildInfoOpcode(), HandleGuildInviteOpcode(), HandleGuildLeaderOpcode(), HandleGuildLeaveOpcode(), HandleGuildMOTDOpcode(), HandleGuildPermissions(), HandleGuildPromoteOpcode(), HandleGuildRankOpcode(), HandleGuildRemoveOpcode(), HandleGuildRosterOpcode(), HandleGuildSetOfficerNoteOpcode(), HandleGuildSetPublicNoteOpcode(), honor_commandscript::HandleHonorAddKillCommand(), HandleInitiateTradeOpcode(), HandleInspectArenaTeamsOpcode(), HandleInspectHonorStatsOpcode(), HandleInspectOpcode(), instance_commandscript::HandleInstanceListBindsCommand(), instance_commandscript::HandleInstanceSaveDataCommand(), instance_commandscript::HandleInstanceUnbindCommand(), Guild::HandleInviteMember(), item_commandscript::HandleItemMoveCommand(), HandleItemRefund(), HandleItemRefundInfoRequest(), HandleJoinChannel(), misc_commandscript::HandleKickPlayerCommand(), learn_commandscript::HandleLearnAllCraftsCommand(), learn_commandscript::HandleLearnAllGMCommand(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), learn_commandscript::HandleLearnAllMySpellsCommand(), learn_commandscript::HandleLearnAllMyTalentsCommand(), HandleLeaveChannel(), Guild::HandleLeaveMember(), character_commandscript::HandleLevelUpCommand(), HandleLfgGetStatus(), HandleLfgJoinOpcode(), HandleLfgLeaveOpcode(), HandleLfgPartyLockInfoRequestOpcode(), HandleLfgPlayerLockInfoRequestOpcode(), HandleLfgProposalResultOpcode(), HandleLfgSetBootVoteOpcode(), HandleLfgSetCommentOpcode(), HandleLfgSetRolesOpcode(), HandleLfgTeleportOpcode(), HandleLfrSearchJoinOpcode(), HandleLfrSearchLeaveOpcode(), misc_commandscript::HandleLinkGraveCommand(), list_commandscript::HandleListCreatureCommand(), HandleListInventoryOpcode(), list_commandscript::HandleListObjectCommand(), HandleListStabledPetsOpcode(), HandleLoadActionsSwitchSpec(), HandleLogoutCancelOpcode(), HandleLogoutRequestOpcode(), lookup_commandscript::HandleLookupPlayerIpCommand(), HandleLootMasterGiveOpcode(), HandleLootMethodOpcode(), HandleLootMoneyOpcode(), HandleLootOpcode(), HandleLootReleaseOpcode(), HandleLootRoll(), misc_commandscript::HandleMailBoxCommand(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberLogout(), Guild::HandleMemberWithdrawMoney(), HandleMessagechatOpcode(), HandleMinimapPingOpcode(), mmaps_commandscript::HandleMmapLoadedTilesCommand(), mmaps_commandscript::HandleMmapLocCommand(), mmaps_commandscript::HandleMmapPathCommand(), mmaps_commandscript::HandleMmapStatsCommand(), mmaps_commandscript::HandleMmapTestArea(), modify_commandscript::HandleModifyPhaseCommand(), modify_commandscript::HandleModifyStandStateCommand(), modify_commandscript::HandleMorphResetCommand(), modify_commandscript::HandleMorphTargetCommand(), HandleMountSpecialAnimOpcode(), HandleMovementOpcodes(), HandleMoveSplineDoneOpcode(), HandleMoveTeleportAck(), HandleMoveTimeSkippedOpcode(), HandleMoveWorldportAck(), misc_commandscript::HandleNearGraveCommand(), HandleNextCinematicCamera(), npc_commandscript::HandleNpcAddCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcAddTempSpawnCommand(), npc_commandscript::HandleNpcAddVendorItemCommand(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcNearCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcUnFollowCommand(), HandleOfferPetitionOpcode(), HandleOpenWrappedItemCallback(), HandleOptOutOfLootOpcode(), HandlePartyAssignmentOpcode(), HandlePetAction(), HandlePetActionHelper(), HandlePetCancelAuraOpcode(), HandlePetCastSpellOpcode(), pet_commandscript::HandlePetCreateCommand(), HandlePetitionBuyOpcode(), HandlePetitionSignOpcode(), pet_commandscript::HandlePetLearnCommand(), HandlePetSetAction(), HandlePetSpellAutocastOpcode(), HandlePetStopAttack(), pet_commandscript::HandlePetUnlearnCommand(), HandlePlayerLoginOpcode(), HandlePlayerLoginToCharInWorld(), misc_commandscript::HandlePossessCommand(), cheat_commandscript::HandlePowerCheatCommand(), HandleQueryGuildBankTabText(), HandleQueryInspectAchievements(), HandleQuestgiverAcceptQuestOpcode(), HandleQuestgiverHelloOpcode(), HandleQuestLogSwapQuest(), HandleRaidReadyCheckFinishedOpcode(), HandleRaidReadyCheckOpcode(), HandleRaidTargetUpdateOpcode(), HandleRandomRollOpcode(), Guild::HandleRemoveMember(), Guild::HandleRemoveRank(), HandleRepairItemOpcode(), HandleRepopRequestOpcode(), HandleReportLag(), HandleRequestVehicleExit(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnAllCommand(), misc_commandscript::HandleRespawnCommand(), HandleResurrectResponseOpcode(), Guild::HandleRoster(), misc_commandscript::HandleSaveCommand(), HandleSaveGuildEmblemOpcode(), HandleSellItemOpcode(), send_commandscript::HandleSendItemsCommand(), HandleSendMail(), send_commandscript::HandleSendMailCommand(), send_commandscript::HandleSendMoneyCommand(), HandleSetActionBarToggles(), HandleSetActionButtonOpcode(), HandleSetActiveMoverOpcode(), HandleSetChannelWatch(), Guild::HandleSetEmblem(), HandleSetFactionAtWar(), HandleSetFactionCheat(), HandleSetGuildBankTabText(), Guild::HandleSetInfo(), Guild::HandleSetLeader(), Guild::HandleSetMemberNote(), Guild::HandleSetMOTD(), Guild::HandleSetRankInfo(), HandleSetSavedInstanceExtend(), HandleSetTitleOpcode(), HandleSetWatchedFactionOpcode(), HandleSocketClosed(), spectator_commandscript::HandleSpectatorLeaveCommand(), spectator_commandscript::HandleSpectatorResetCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), spectator_commandscript::HandleSpectatorVersionCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleSpiritHealerActivateOpcode(), HandleStablePet(), HandleStableSwapPet(), misc_commandscript::HandleSummonCommand(), HandleTabardVendorActivateOpcode(), HandleTalentWipeConfirmOpcode(), cheat_commandscript::HandleTaxiCheatCommand(), HandleTaxiQueryAvailableNodes(), tele_commandscript::HandleTeleAddCommand(), tele_commandscript::HandleTeleCommand(), HandleTeleportTimeout(), HandleTextEmoteOpcode(), HandleTogglePvP(), HandleTotemDestroyed(), HandleTrainerBuySpellOpcode(), misc_commandscript::HandleUnbindSightCommand(), HandleUnlearnSkillOpcode(), misc_commandscript::HandleUnPossessCommand(), HandleUnstablePet(), misc_commandscript::HandleUnstuckCommand(), Guild::HandleUpdateMemberRank(), cheat_commandscript::HandleWaterWalkCheatCommand(), message_commandscript::HandleWhispersCommand(), HandleWhoisOpcode(), HandleWorldTeleportOpcode(), wp_commandscript::HandleWpAddCommand(), debug_commandscript::HandleWPGPSCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), HandleZoneUpdateOpcode(), LogCommandUsage(), ArenaTeam::MassInviteToEvent(), Guild::MassInviteToEvent(), ChatHandler::needReportToTarget(), MapSessionFilter::Process(), WorldSessionFilter::Process(), ReadMovementInfo(), ResetTimeOutTime(), SendActivateTaxiReply(), SendAttackStop(), SendAuctionHello(), Guild::SendBankTabsInfo(), SendBindPoint(), SendDiscoverNewTaxiNode(), SendDoFlight(), SendEnchantmentLog(), World::SendGMText(), SendLearnNewTaxiNode(), SendLfgBootProposalUpdate(), SendLfgDisabled(), SendLfgJoinResult(), SendLfgLfrList(), SendLfgOfferContinue(), SendLfgPlayerReward(), SendLfgQueueStatus(), SendLfgRoleCheckUpdate(), SendLfgRoleChosen(), SendLfgTeleportError(), SendLfgUpdateProposal(), SendListInventory(), Guild::SendLoginInfo(), Guild::SendMoneyInfo(), Guild::SendPermissions(), SendPetitionShowList(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestGiverRequestItems(), PlayerMenu::SendQuestQueryResponse(), SendStablePet(), SendTaxiMenu(), SendTaxiStatus(), SendTrainerList(), Update(), World::UpdateSessions(), and ValidateHyperlinksAndMaybeKick().

◆ GetPlayerInfo()

std::string WorldSession::GetPlayerInfo ( ) const
190{
191 std::ostringstream ss;
192
193 ss << "[Player: ";
194
195 if (!m_playerLoading && _player)
196 {
197 ss << _player->GetName() << ' ' << _player->GetGUID().ToString() << ", ";
198 }
199
200 ss << "Account: " << GetAccountId() << "]";
201
202 return ss.str();
203}

References _player, GetAccountId(), Object::GetGUID(), WorldObject::GetName(), m_playerLoading, and ObjectGuid::ToString().

Referenced by Guild::_SendBankList(), Handle_Deprecated(), Handle_EarlyProccess(), Handle_NULL(), Handle_ServerSide(), HandleBattleFieldPortOpcode(), HandleChannelAnnouncements(), HandleChannelBan(), HandleChannelInvite(), HandleChannelKick(), HandleChannelList(), HandleChannelModerateOpcode(), HandleChannelModerator(), HandleChannelMute(), HandleChannelOwner(), HandleChannelPassword(), HandleChannelSetOwner(), HandleChannelUnban(), HandleChannelUnmoderator(), HandleChannelUnmute(), HandleCharFactionOrRaceChangeCallback(), HandleGetChannelMemberCount(), HandleGuildAddRankOpcode(), HandleGuildBankBuyTab(), HandleGuildBankDepositMoney(), HandleGuildBankerActivate(), HandleGuildBankLogQuery(), HandleGuildBankMoneyWithdrawn(), HandleGuildBankQueryTab(), HandleGuildBankUpdateTab(), HandleGuildBankWithdrawMoney(), HandleGuildChangeInfoTextOpcode(), HandleGuildCreateOpcode(), HandleGuildDeclineOpcode(), HandleGuildDelRankOpcode(), HandleGuildDemoteOpcode(), HandleGuildDisbandOpcode(), HandleGuildEventLogQueryOpcode(), HandleGuildInfoOpcode(), HandleGuildInviteOpcode(), HandleGuildLeaderOpcode(), HandleGuildLeaveOpcode(), HandleGuildMOTDOpcode(), HandleGuildPromoteOpcode(), HandleGuildQueryOpcode(), HandleGuildRankOpcode(), HandleGuildRemoveOpcode(), HandleGuildRosterOpcode(), HandleGuildSetOfficerNoteOpcode(), HandleGuildSetPublicNoteOpcode(), HandleJoinChannel(), HandleLeaveChannel(), HandleLfgGetStatus(), HandleLfgJoinOpcode(), HandleMessagechatOpcode(), WorldSocket::HandlePing(), Guild::HandleQuery(), HandleQueryGuildBankTabText(), Guild::HandleRoster(), HandleSaveGuildEmblemOpcode(), Guild::HandleSetBankTabInfo(), HandleSetGuildBankTabText(), Channel::List(), WorldSocket::LogOpcodeText(), LogUnexpectedOpcode(), LogUnprocessedTail(), WorldSocket::ReadDataHandler(), Guild::SendBankLog(), Guild::SendCommandResult(), Guild::SendEventLog(), Guild::SendInfo(), SendLfgPlayerReward(), SendLfgUpdateParty(), SendLfgUpdatePlayer(), Guild::SendLoginInfo(), Guild::SendMoneyInfo(), Guild::SendPermissions(), Guild::SendSaveEmblemResult(), Guild::BankTab::SendText(), Pet::Update(), and Update().

◆ GetPlayerName()

◆ GetQueryProcessor()

QueryCallbackProcessor & WorldSession::GetQueryProcessor ( )
inline
1078{ return _queryProcessor; }
QueryCallbackProcessor _queryProcessor
Definition: WorldSession.h:1088

References _queryProcessor.

Referenced by Player::ActivateSpec(), and ServerMailReward::OnLogin().

◆ GetRecruiterId()

◆ GetRemoteAddress()

◆ GetSecurity()

◆ GetSessionDbcLocale()

◆ GetSessionDbLocaleIndex()

◆ GetTotalTime()

uint32 WorldSession::GetTotalTime ( ) const
inline
378{ return m_total_time; }

References m_total_time.

Referenced by ~WorldSession().

◆ GetTutorialInt()

uint32 WorldSession::GetTutorialInt ( uint8  index) const
inline
460{ return m_Tutorials[index]; }

References m_Tutorials.

Referenced by HandleTutorialFlag().

◆ GetWarden()

Warden * WorldSession::GetWarden ( )
1325{
1326 return &(*_warden);
1327}

◆ Handle_Deprecated()

void WorldSession::Handle_Deprecated ( WorldPacket recvPacket)
844{
845 LOG_ERROR("network.opcode", "Received deprecated opcode {} from {}",
846 GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())), GetPlayerInfo());
847}
Opcodes
List of Opcodes.
Definition: Opcodes.h:30
std::string GetOpcodeNameForLogging(Opcodes opcode)
Lookup opcode name for human understandable logging.
Definition: Opcodes.cpp:1468
uint16 GetOpcode() const
Definition: WorldPacket.h:76
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:189

References WorldPacket::GetOpcode(), GetOpcodeNameForLogging(), GetPlayerInfo(), and LOG_ERROR.

◆ Handle_EarlyProccess()

void WorldSession::Handle_EarlyProccess ( WorldPacket recvPacket)
832{
833 LOG_ERROR("network.opcode", "Received opcode {} that must be processed in WorldSocket::ReadDataHandler from {}",
834 GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())), GetPlayerInfo());
835}

References WorldPacket::GetOpcode(), GetOpcodeNameForLogging(), GetPlayerInfo(), and LOG_ERROR.

Referenced by OpcodeTable::Initialize().

◆ Handle_NULL()

void WorldSession::Handle_NULL ( WorldPacket null)
826{
827 LOG_ERROR("network.opcode", "Received unhandled opcode {} from {}",
829}

References WorldPacket::GetOpcode(), GetOpcodeNameForLogging(), GetPlayerInfo(), and LOG_ERROR.

Referenced by OpcodeTable::Initialize().

◆ Handle_ServerSide()

void WorldSession::Handle_ServerSide ( WorldPacket recvPacket)
838{
839 LOG_ERROR("network.opcode", "Received server-side opcode {} from {}",
840 GetOpcodeNameForLogging(static_cast<OpcodeServer>(recvPacket.GetOpcode())), GetPlayerInfo());
841}

References WorldPacket::GetOpcode(), GetOpcodeNameForLogging(), GetPlayerInfo(), and LOG_ERROR.

◆ HandleAcceptGrantLevel()

void WorldSession::HandleAcceptGrantLevel ( WorldPacket recvData)
67{
68 LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT");
69
70 ObjectGuid guid;
71 recvData >> guid.ReadAsPacked();
72
74 if (!other)
75 return;
76
77 if (GetAccountId() != other->GetSession()->GetRecruiterId())
78 return;
79
80 if (other->GetGrantableLevels())
81 other->SetGrantableLevels(other->GetGrantableLevels() - 1);
82 else
83 return;
84
86}
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:223
Definition: ObjectGuid.h:120
PackedGuidReader ReadAsPacked()
Definition: ObjectGuid.h:137
void GiveLevel(uint8 level)
Definition: Player.cpp:2431
void SetGrantableLevels(uint8 val)
Definition: Player.h:2087
uint8 GetGrantableLevels()
Definition: Player.h:2086
uint32 GetRecruiterId() const
Definition: WorldSession.h:527

References _player, GetAccountId(), Player::GetGrantableLevels(), Unit::GetLevel(), ObjectAccessor::GetPlayer(), GetRecruiterId(), Player::GetSession(), Player::GiveLevel(), LOG_DEBUG, ObjectGuid::ReadAsPacked(), and Player::SetGrantableLevels().

Referenced by OpcodeTable::Initialize().

◆ HandleAcceptTradeOpcode()

void WorldSession::HandleAcceptTradeOpcode ( WorldPacket recvPacket)
246{
247 TradeData* my_trade = _player->m_trade;
248 if (!my_trade)
249 return;
250
251 Player* trader = my_trade->GetTrader();
252
253 TradeData* his_trade = trader->m_trade;
254 if (!his_trade)
255 return;
256
257 Item* myItems[TRADE_SLOT_TRADED_COUNT] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
258 Item* hisItems[TRADE_SLOT_TRADED_COUNT] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
259 bool myCanCompleteTrade = true, hisCanCompleteTrade = true;
260
261 // set before checks for propertly undo at problems (it already set in to client)
262 my_trade->SetAccepted(true);
263
264 // not accept case incorrect money amount
265 if (!_player->HasEnoughMoney(my_trade->GetMoney()))
266 {
268 my_trade->SetAccepted(false, true);
269 return;
270 }
271
272 // not accept case incorrect money amount
273 if (!trader->HasEnoughMoney(his_trade->GetMoney()))
274 {
276 his_trade->SetAccepted(false, true);
277 return;
278 }
279
280 if (_player->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - his_trade->GetMoney())
281 {
283 my_trade->SetAccepted(false, true);
284 return;
285 }
286
287 if (trader->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - my_trade->GetMoney())
288 {
289 trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, nullptr, nullptr);
290 his_trade->SetAccepted(false, true);
291 return;
292 }
293
294 // not accept if some items now can't be trade (cheating)
295 for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
296 {
297 if (Item* item = my_trade->GetItem(TradeSlots(i)))
298 {
299 if (!item->CanBeTraded(false, true))
300 {
302 return;
303 }
304
305 if (item->IsBindedNotWith(trader))
306 {
308 SendTradeStatus(TRADE_STATUS_CLOSE_WINDOW/*TRADE_STATUS_TRADE_CANCELED*/);
309 return;
310 }
311 }
312
313 if (Item* item = his_trade->GetItem(TradeSlots(i)))
314 {
315 if (!item->CanBeTraded(false, true))
316 {
318 return;
319 }
320 //if (item->IsBindedNotWith(_player)) // dont mark as invalid when his item isnt good (not exploitable because if item is invalid trade will fail anyway later on the same check)
321 //{
322 // SendTradeStatus(TRADE_STATUS_NOT_ELIGIBLE);
323 // his_trade->SetAccepted(false, true);
324 // return;
325 //}
326 }
327 }
328
329 if (his_trade->IsAccepted())
330 {
331 setAcceptTradeMode(my_trade, his_trade, myItems, hisItems);
332
333 Spell* my_spell = nullptr;
334 SpellCastTargets my_targets;
335
336 Spell* his_spell = nullptr;
337 SpellCastTargets his_targets;
338
339 // not accept if spell can't be casted now (cheating)
340 if (uint32 my_spell_id = my_trade->GetSpell())
341 {
342 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(my_spell_id);
343 Item* castItem = my_trade->GetSpellCastItem();
344
345 if (!spellInfo || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
346 (my_trade->HasSpellCastItem() && !castItem))
347 {
348 clearAcceptTradeMode(my_trade, his_trade);
349 clearAcceptTradeMode(myItems, hisItems);
350
351 my_trade->SetSpell(0);
352 return;
353 }
354
355 my_spell = new Spell(_player, spellInfo, TRIGGERED_FULL_MASK);
356 my_spell->m_CastItem = castItem;
357 my_targets.SetTradeItemTarget(_player);
358 my_spell->m_targets = my_targets;
359
360 SpellCastResult res = my_spell->CheckCast(true);
361 if (res != SPELL_CAST_OK)
362 {
363 my_spell->SendCastResult(res);
364
365 clearAcceptTradeMode(my_trade, his_trade);
366 clearAcceptTradeMode(myItems, hisItems);
367
368 delete my_spell;
369 my_trade->SetSpell(0);
370 return;
371 }
372 }
373
374 // not accept if spell can't be casted now (cheating)
375 if (uint32 his_spell_id = his_trade->GetSpell())
376 {
377 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(his_spell_id);
378 Item* castItem = his_trade->GetSpellCastItem();
379
380 if (!spellInfo || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
381 {
382 delete my_spell;
383 his_trade->SetSpell(0);
384
385 clearAcceptTradeMode(my_trade, his_trade);
386 clearAcceptTradeMode(myItems, hisItems);
387 return;
388 }
389
390 his_spell = new Spell(trader, spellInfo, TRIGGERED_FULL_MASK);
391 his_spell->m_CastItem = castItem;
392 his_targets.SetTradeItemTarget(trader);
393 his_spell->m_targets = his_targets;
394
395 SpellCastResult res = his_spell->CheckCast(true);
396 if (res != SPELL_CAST_OK)
397 {
398 his_spell->SendCastResult(res);
399
400 clearAcceptTradeMode(my_trade, his_trade);
401 clearAcceptTradeMode(myItems, hisItems);
402
403 delete my_spell;
404 delete his_spell;
405
406 his_trade->SetSpell(0);
407 return;
408 }
409 }
410
411 // inform partner client
413
414 // test if item will fit in each inventory
415 hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
416 myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
417
418 clearAcceptTradeMode(myItems, hisItems);
419
420 // in case of missing space report error
421 if (!myCanCompleteTrade)
422 {
423 clearAcceptTradeMode(my_trade, his_trade);
424
427 my_trade->SetAccepted(false);
428 his_trade->SetAccepted(false);
429 delete my_spell;
430 delete his_spell;
431 return;
432 }
433 else if (!hisCanCompleteTrade)
434 {
435 clearAcceptTradeMode(my_trade, his_trade);
436
439 my_trade->SetAccepted(false);
440 his_trade->SetAccepted(false);
441 delete my_spell;
442 delete his_spell;
443 return;
444 }
445
446 // execute trade: 1. remove
447 for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
448 {
449 if (myItems[i])
450 {
452 _player->MoveItemFromInventory(myItems[i]->GetBagSlot(), myItems[i]->GetSlot(), true);
453 }
454 if (hisItems[i])
455 {
456 hisItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
457 trader->MoveItemFromInventory(hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot(), true);
458 }
459 }
460
461 // execute trade: 2. store
462 moveItems(myItems, hisItems);
463
464 if( my_trade->GetMoney() >= 10 * GOLD )
465 {
466 CharacterDatabase.Execute("INSERT INTO log_money VALUES({}, {}, \"{}\", \"{}\", {}, \"{}\", {}, \"goods\", NOW(), {})",
467 GetAccountId(), _player->GetGUID().GetCounter(), _player->GetName(), GetRemoteAddress(), trader->GetSession()->GetAccountId(), trader->GetName(), my_trade->GetMoney(), 6);
468 }
469 if( his_trade->GetMoney() >= 10 * GOLD )
470 {
471 CharacterDatabase.Execute("INSERT INTO log_money VALUES({}, {}, \"{}\", \"{}\", {}, \"{}\", {}, \"goods\", NOW(), {})",
472 trader->GetSession()->GetAccountId(), trader->GetGUID().GetCounter(), trader->GetName(), trader->GetSession()->GetRemoteAddress(), GetAccountId(), _player->GetName(), his_trade->GetMoney(), 6);
473 }
474
475 // update money
476 _player->ModifyMoney(-int32(my_trade->GetMoney()));
477 _player->ModifyMoney(his_trade->GetMoney());
478 trader->ModifyMoney(-int32(his_trade->GetMoney()));
479 trader->ModifyMoney(my_trade->GetMoney());
480
481 if (my_spell)
482 my_spell->prepare(&my_targets);
483
484 if (his_spell)
485 his_spell->prepare(&his_targets);
486
487 // cleanup
488 clearAcceptTradeMode(my_trade, his_trade);
489 delete _player->m_trade;
490 _player->m_trade = nullptr;
491 delete trader->m_trade;
492 trader->m_trade = nullptr;
493
494 // desynchronized with the other saves here (SaveInventoryAndGoldToDB() not have own transaction guards)
495 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
497 trader->SaveInventoryAndGoldToDB(trans);
498 CharacterDatabase.CommitTransaction(trans);
499
502 }
503 else
504 {
506 }
507}
std::int32_t int32
Definition: Define.h:104
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:70
@ EQUIP_ERR_TOO_MUCH_GOLD
Definition: Item.h:117
@ EQUIP_ERR_OK
Definition: Item.h:41
@ ITEM_FIELD_GIFTCREATOR
Definition: UpdateFields.h:38
#define MAX_MONEY_AMOUNT
Definition: Player.h:922
TradeSlots
Definition: TradeData.h:28
@ TRADE_SLOT_TRADED_COUNT
Definition: TradeData.h:30
@ TRADE_SLOT_NONTRADED
Definition: TradeData.h:31
static void setAcceptTradeMode(TradeData *myTrade, TradeData *hisTrade, Item **myItems, Item **hisItems)
Definition: TradeHandler.cpp:202
static void clearAcceptTradeMode(TradeData *myTrade, TradeData *hisTrade)
Definition: TradeHandler.cpp:227
@ LANG_NOT_PARTNER_FREE_TRADE_SLOTS
Definition: Language.h:723
@ LANG_NOT_FREE_TRADE_SLOTS
Definition: Language.h:722
@ LANG_NOT_ENOUGH_GOLD
Definition: Language.h:721
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:148
#define sSpellMgr
Definition: SpellMgr.h:825
@ TRADE_STATUS_TRADE_COMPLETE
Definition: SharedDefines.h:3558
@ TRADE_STATUS_TRADE_ACCEPT
Definition: SharedDefines.h:3554
@ TRADE_STATUS_TRADE_CANCELED
Definition: SharedDefines.h:3553
@ TRADE_STATUS_NOT_ELIGIBLE
Definition: SharedDefines.h:3573
@ TRADE_STATUS_CLOSE_WINDOW
Definition: SharedDefines.h:3562
@ GOLD
Definition: SharedDefines.h:253
SpellCastResult
Definition: SharedDefines.h:948
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7144
bool ModifyMoney(int32 amount, bool sendError=true)
Definition: Player.cpp:11430
TradeData * m_trade
Definition: Player.h:2802
bool HasEnoughMoney(uint32 amount) const
Definition: Player.h:1582
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3000
uint32 GetMoney() const
Definition: Player.h:1580
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4043
InventoryResult CanStoreItems(Item **pItem, int32 count) const
Definition: PlayerStorage.cpp:1567
Definition: TradeData.h:36
Item * GetSpellCastItem() const
Definition: TradeData.cpp:49
bool HasSpellCastItem() const
Definition: TradeData.h:53
void SetSpell(uint32 spell_id, Item *castItem=nullptr)
Definition: TradeData.cpp:76
Player * GetTrader() const
Definition: TradeData.h:41
uint32 GetMoney() const
Definition: TradeData.h:55
Item * GetItem(TradeSlots slot) const
Definition: TradeData.cpp:26
bool IsAccepted() const
Definition: TradeData.h:58
uint32 GetSpell() const
Definition: TradeData.h:49
void SetAccepted(bool state, bool crosssend=false)
Definition: TradeData.cpp:120
void moveItems(Item *myItems[], Item *hisItems[])
Definition: TradeHandler.cpp:133
void SendNotification(const char *format,...) ATTR_PRINTF(2
Definition: WorldSession.cpp:785
std::string const & GetRemoteAddress()
Definition: WorldSession.h:373
void SendTradeStatus(TradeStatus status)
Definition: TradeHandler.cpp:32
Definition: Spell.h:109
void SetTradeItemTarget(Player *caster)
Definition: Spell.cpp:338
Definition: Spell.h:284
SpellCastTargets m_targets
Definition: Spell.h:527
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3464
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5626
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4645
Item * m_CastItem
Definition: Spell.h:521
Definition: SpellInfo.h:314

References _player, Player::CanStoreItems(), CharacterDatabase, Spell::CheckCast(), clearAcceptTradeMode(), EQUIP_ERR_OK, EQUIP_ERR_TOO_MUCH_GOLD, GetAccountId(), ObjectGuid::GetCounter(), Object::GetGUID(), TradeData::GetItem(), Player::GetMoney(), TradeData::GetMoney(), WorldObject::GetName(), GetRemoteAddress(), Player::GetSession(), TradeData::GetSpell(), TradeData::GetSpellCastItem(), TradeData::GetTrader(), GOLD, Player::HasEnoughMoney(), TradeData::HasSpellCastItem(), TradeData::IsAccepted(), ITEM_FIELD_GIFTCREATOR, LANG_NOT_ENOUGH_GOLD, LANG_NOT_FREE_TRADE_SLOTS, LANG_NOT_PARTNER_FREE_TRADE_SLOTS, Spell::m_CastItem, Spell::m_targets, Player::m_trade, MAX_MONEY_AMOUNT, Player::ModifyMoney(), Player::MoveItemFromInventory(), moveItems(), Spell::prepare(), Player::SaveInventoryAndGoldToDB(), Spell::SendCastResult(), Player::SendEquipError(), SendNotification(), SendTradeStatus(), TradeData::SetAccepted(), setAcceptTradeMode(), Object::SetGuidValue(), TradeData::SetSpell(), SpellCastTargets::SetTradeItemTarget(), SPELL_CAST_OK, sSpellMgr, TRADE_SLOT_NONTRADED, TRADE_SLOT_TRADED_COUNT, TRADE_STATUS_CLOSE_WINDOW, TRADE_STATUS_NOT_ELIGIBLE, TRADE_STATUS_TRADE_ACCEPT, TRADE_STATUS_TRADE_CANCELED, TRADE_STATUS_TRADE_COMPLETE, and TRIGGERED_FULL_MASK.

Referenced by OpcodeTable::Initialize().

◆ HandleActivateTaxiExpressOpcode()

void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket recvPacket)
166{
167 ObjectGuid guid;
168 uint32 node_count;
169
170 recvData >> guid >> node_count;
171
173 if (!npc)
174 {
175 LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit ({}) not found or you can't interact with it.", guid.ToString());
177 return;
178 }
179 std::vector<uint32> nodes;
180
181 for (uint32 i = 0; i < node_count; ++i)
182 {
183 uint32 node;
184 recvData >> node;
185
186 if (!GetPlayer()->m_taxi.IsTaximaskNodeKnown(node) && !GetPlayer()->isTaxiCheater())
187 {
189 recvData.rfinish();
190 return;
191 }
192
193 nodes.push_back(node);
194 }
195
196 if (nodes.empty())
197 return;
198
199 LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from {} to {}", nodes.front(), nodes.back());
200
201 GetPlayer()->ActivateTaxiPathTo(nodes, npc, 0);
202}
npc
Definition: BattlegroundSA.h:75
@ UNIT_NPC_FLAG_FLIGHTMASTER
Definition: Unit.h:529
@ ERR_TAXINOTVISITED
Definition: SharedDefines.h:3601
@ ERR_TAXITOOFARAWAY
Definition: SharedDefines.h:3599
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=1)
Definition: Player.cpp:10149
void SendActivateTaxiReply(ActivateTaxiReply reply)
Definition: TaxiHandler.cpp:284

References Player::ActivateTaxiPathTo(), ERR_TAXINOTVISITED, ERR_TAXITOOFARAWAY, Player::GetNPCIfCanInteractWith(), GetPlayer(), LOG_DEBUG, ByteBuffer::rfinish(), SendActivateTaxiReply(), ObjectGuid::ToString(), and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by OpcodeTable::Initialize().

◆ HandleActivateTaxiOpcode()

void WorldSession::HandleActivateTaxiOpcode ( WorldPacket recvPacket)
257{
258 ObjectGuid guid;
259 std::vector<uint32> nodes;
260 nodes.resize(2);
261 GetPlayer()->SetCanTeleport(true);
262 recvData >> guid >> nodes[0] >> nodes[1];
263 LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI from {} to {}", nodes[0], nodes[1]);
265 if (!npc)
266 {
267 LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit ({}) not found or you can't interact with it.", guid.ToString());
269 return;
270 }
271
272 if (!GetPlayer()->isTaxiCheater())
273 {
274 if (!GetPlayer()->m_taxi.IsTaximaskNodeKnown(nodes[0]) || !GetPlayer()->m_taxi.IsTaximaskNodeKnown(nodes[1]))
275 {
277 return;
278 }
279 }
280
281 GetPlayer()->ActivateTaxiPathTo(nodes, npc, 0);
282}
void SetCanTeleport(bool value)
Definition: Player.h:2461

References Player::ActivateTaxiPathTo(), ERR_TAXINOTVISITED, ERR_TAXITOOFARAWAY, Player::GetNPCIfCanInteractWith(), GetPlayer(), LOG_DEBUG, SendActivateTaxiReply(), Player::SetCanTeleport(), ObjectGuid::ToString(), and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by OpcodeTable::Initialize().

◆ HandleAddFriendOpcode()

void WorldSession::HandleAddFriendOpcode ( WorldPacket recvPacket)
38{
39 std::string friendName = GetAcoreString(LANG_FRIEND_IGNORE_UNKNOWN);
40 std::string friendNote;
41
42 recv_data >> friendName;
43 recv_data >> friendNote;
44
45 if (!normalizePlayerName(friendName))
46 return;
47
48 ObjectGuid friendGuid = sCharacterCache->GetCharacterGuidByName(friendName);
49 if (!friendGuid)
50 return;
51
52 CharacterCacheEntry const* playerData = sCharacterCache->GetCharacterCacheByGuid(friendGuid);
53 if (!playerData)
54 return;
55
56 uint32 friendAccountId = playerData->AccountId;
57 TeamId teamId = Player::TeamIdForRace(playerData->Race);
58 FriendsResult friendResult = FRIEND_NOT_FOUND;
59
61 {
62 if (friendGuid)
63 {
64 if (friendGuid == GetPlayer()->GetGUID())
65 friendResult = FRIEND_SELF;
67 friendResult = FRIEND_ENEMY;
68 else if (GetPlayer()->GetSocial()->HasFriend(friendGuid))
69 friendResult = FRIEND_ALREADY;
70 else
71 {
72 Player* pFriend = ObjectAccessor::FindConnectedPlayer(friendGuid);
73 if (pFriend && pFriend->IsVisibleGloballyFor(GetPlayer()) && !pFriend->GetSession()->IsGMAccount())
74 friendResult = FRIEND_ADDED_ONLINE;
75 else
76 friendResult = FRIEND_ADDED_OFFLINE;
77 if (GetPlayer()->GetSocial()->AddToSocialList(friendGuid, SOCIAL_FLAG_FRIEND))
78 GetPlayer()->GetSocial()->SetFriendNote(friendGuid, friendNote);
79 else
80 friendResult = FRIEND_LIST_FULL;
81 }
82 GetPlayer()->GetSocial()->SetFriendNote(friendGuid, friendNote);
83 }
84 }
85
86 sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid, false);
87
88 LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
89}
#define sCharacterCache
Definition: CharacterCache.h:83
FriendsResult
Results of friend related commands.
Definition: SocialMgr.h:66
@ FRIEND_ENEMY
Definition: SocialMgr.h:77
@ FRIEND_ALREADY
Definition: SocialMgr.h:75
@ FRIEND_ADDED_OFFLINE
Definition: SocialMgr.h:74
@ FRIEND_NOT_FOUND
Definition: SocialMgr.h:71
@ FRIEND_ADDED_ONLINE
Definition: SocialMgr.h:73
@ FRIEND_SELF
Definition: SocialMgr.h:76
@ FRIEND_LIST_FULL
Definition: SocialMgr.h:68
#define sSocialMgr
Definition: SocialMgr.h:148
@ SOCIAL_FLAG_FRIEND
Definition: SocialMgr.h:40
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:262
@ LANG_FRIEND_IGNORE_UNKNOWN
Definition: Language.h:80
@ CONFIG_ALLOW_GM_FRIEND
Definition: IWorld.h:94
@ CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND
Definition: IWorld.h:86
TeamId GetTeamId(PvPTeamId teamId)
Definition: SharedDefines.h:3462
TeamId
Definition: SharedDefines.h:759
Realm realm
Definition: World.cpp:112
bool IsPlayerAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:276
uint32 GetSecurity(uint32 accountId)
Definition: AccountMgr.cpp:209
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:260
Definition: CharacterCache.h:28
uint8 Race
Definition: CharacterCache.h:33
uint32 AccountId
Definition: CharacterCache.h:31
static TeamId TeamIdForRace(uint8 race)
Definition: Player.cpp:5745
bool IsVisibleGloballyFor(Player const *player) const
Definition: Player.cpp:11401
PlayerSocial * GetSocial()
Definition: Player.h:1131
void SetFriendNote(ObjectGuid friendGuid, std::string note)
Definition: SocialMgr.cpp:105
bool IsGMAccount() const
Definition: WorldSession.cpp:179
char const * GetAcoreString(uint32 entry) const
Definition: WorldSession.cpp:820
uint32 Realm
Definition: Realm.h:42
RealmHandle Id
Definition: Realm.h:68

References CharacterCacheEntry::AccountId, CONFIG_ALLOW_GM_FRIEND, CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND, ObjectAccessor::FindConnectedPlayer(), FRIEND_ADDED_OFFLINE, FRIEND_ADDED_ONLINE, FRIEND_ALREADY, FRIEND_ENEMY, FRIEND_LIST_FULL, FRIEND_NOT_FOUND, FRIEND_SELF, GetAcoreString(), GetPlayer(), GetSecurity(), AccountMgr::GetSecurity(), Player::GetSession(), Player::GetSocial(), GetTeamId(), Realm::Id, IsGMAccount(), AccountMgr::IsPlayerAccount(), Player::IsVisibleGloballyFor(), LANG_FRIEND_IGNORE_UNKNOWN, LOG_DEBUG, normalizePlayerName(), CharacterCacheEntry::Race, realm, RealmHandle::Realm, sCharacterCache, PlayerSocial::SetFriendNote(), SOCIAL_FLAG_FRIEND, sSocialMgr, sWorld, and Player::TeamIdForRace().

Referenced by OpcodeTable::Initialize().

◆ HandleAddIgnoreOpcode()

void WorldSession::HandleAddIgnoreOpcode ( WorldPacket recvPacket)
104{
105 std::string ignoreName = GetAcoreString(LANG_FRIEND_IGNORE_UNKNOWN);
106
107 recv_data >> ignoreName;
108
109 if (!normalizePlayerName(ignoreName))
110 return;
111
112 LOG_DEBUG("network", "WORLD: {} asked to Ignore: '{}'", GetPlayer()->GetName(), ignoreName);
113
114 ObjectGuid ignoreGuid = sCharacterCache->GetCharacterGuidByName(ignoreName);
115 if (!ignoreGuid)
116 return;
117
118 FriendsResult ignoreResult;
119
120 if (ignoreGuid == GetPlayer()->GetGUID()) //not add yourself
121 ignoreResult = FRIEND_IGNORE_SELF;
122 else if (GetPlayer()->GetSocial()->HasIgnore(ignoreGuid))
123 ignoreResult = FRIEND_IGNORE_ALREADY;
124 else
125 {
126 ignoreResult = FRIEND_IGNORE_ADDED;
127
128 // ignore list full
129 if (!GetPlayer()->GetSocial()->AddToSocialList(ignoreGuid, SOCIAL_FLAG_IGNORED))
130 ignoreResult = FRIEND_IGNORE_FULL;
131 }
132
133 sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, ignoreGuid, false);
134
135 LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
136}
@ FRIEND_IGNORE_FULL
Definition: SocialMgr.h:78
@ FRIEND_IGNORE_ADDED
Definition: SocialMgr.h:82
@ FRIEND_IGNORE_SELF
Definition: SocialMgr.h:79
@ FRIEND_IGNORE_ALREADY
Definition: SocialMgr.h:81
@ SOCIAL_FLAG_IGNORED
Definition: SocialMgr.h:41

References FRIEND_IGNORE_ADDED, FRIEND_IGNORE_ALREADY, FRIEND_IGNORE_FULL, FRIEND_IGNORE_SELF, GetAcoreString(), GetPlayer(), LANG_FRIEND_IGNORE_UNKNOWN, LOG_DEBUG, normalizePlayerName(), sCharacterCache, SOCIAL_FLAG_IGNORED, and sSocialMgr.

Referenced by OpcodeTable::Initialize().

◆ HandleAlterAppearance()

void WorldSession::HandleAlterAppearance ( WorldPacket recvData)
1492{
1493 LOG_DEBUG("network", "CMSG_ALTER_APPEARANCE");
1494
1495 uint32 Hair, Color, FacialHair, SkinColor;
1496 recvData >> Hair >> Color >> FacialHair >> SkinColor;
1497
1498 BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
1499
1500 if (!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
1501 return;
1502
1503 BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair);
1504
1505 if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
1506 return;
1507
1508 BarberShopStyleEntry const* bs_skinColor = sBarberShopStyleStore.LookupEntry(SkinColor);
1509
1510 if (bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
1511 return;
1512
1514 if (!go)
1515 {
1517 data << uint32(2);
1518 SendPacket(&data);
1519 return;
1520 }
1521
1523 {
1525 data << uint32(2);
1526 SendPacket(&data);
1527 return;
1528 }
1529
1530 uint32 cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
1531
1532 // 0 - ok
1533 // 1, 3 - not enough money
1534 // 2 - you have to seat on barber chair
1535 if (!_player->HasEnoughMoney(cost))
1536 {
1538 data << uint32(1); // no money
1539 SendPacket(&data);
1540 return;
1541 }
1542 else
1543 {
1545 data << uint32(0); // ok
1546 SendPacket(&data);
1547 }
1548
1549 _player->ModifyMoney(-int32(cost)); // it isn't free
1551
1554 _player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id));
1555 if (bs_skinColor)
1556 _player->SetByteValue(PLAYER_BYTES, 0, uint8(bs_skinColor->hair_id));
1557
1559
1560 _player->SetStandState(0); // stand up
1561}
DBCStorage< BarberShopStyleEntry > sBarberShopStyleStore(BarberShopStyleEntryfmt)
@ PLAYER_BYTES_2
Definition: UpdateFields.h:182
@ PLAYER_BYTES
Definition: UpdateFields.h:181
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition: Unit.h:57
@ ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP
Definition: DBCEnums.h:170
@ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER
Definition: DBCEnums.h:185
@ GAMEOBJECT_TYPE_BARBER_CHAIR
Definition: SharedDefines.h:1592
@ SMSG_BARBER_SHOP_RESULT
Definition: Opcodes.h:1094
uint32 chairheight
Definition: GameObjectData.h:346
struct GameObjectTemplate::@223::@250 barberChair
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
GameObject * FindNearestGameObjectOfType(GameobjectTypes type, float range) const
Definition: Object.cpp:2452
uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const *newSkin=nullptr)
Definition: Player.cpp:13165
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2131
uint8 getGender() const
Definition: Unit.h:1440
uint8 getRace(bool original=false) const
Definition: Unit.cpp:21287
uint8 getStandState() const
Definition: Unit.h:1548
void SetStandState(uint8 state)
Definition: Unit.cpp:16994
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:212
Definition: DBCStructure.h:590
uint32 type
Definition: DBCStructure.h:592
uint32 race
Definition: DBCStructure.h:598
uint32 gender
Definition: DBCStructure.h:599
uint32 hair_id
Definition: DBCStructure.h:600

References _player, ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, GameObjectTemplate::barberChair, GameObjectTemplate::chairheight, WorldObject::FindNearestGameObjectOfType(), GAMEOBJECT_TYPE_BARBER_CHAIR, BarberShopStyleEntry::gender, Player::GetBarberShopCost(), Unit::getGender(), GameObject::GetGOInfo(), Unit::getRace(), Unit::getStandState(), BarberShopStyleEntry::hair_id, Player::HasEnoughMoney(), LOG_DEBUG, Player::ModifyMoney(), PLAYER_BYTES, PLAYER_BYTES_2, BarberShopStyleEntry::race, sBarberShopStyleStore, SendPacket(), Object::SetByteValue(), Unit::SetStandState(), SMSG_BARBER_SHOP_RESULT, BarberShopStyleEntry::type, UNIT_STAND_STATE_SIT_LOW_CHAIR, and Player::UpdateAchievementCriteria().

Referenced by OpcodeTable::Initialize().

◆ HandleAreaSpiritHealerQueryOpcode()

void WorldSession::HandleAreaSpiritHealerQueryOpcode ( WorldPacket recvData)
1660{
1661 LOG_DEBUG("network", "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
1662
1664
1665 ObjectGuid guid;
1666 recv_data >> guid;
1667
1668 Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
1669 if (!unit)
1670 return;
1671
1672 if (!unit->IsSpiritService()) // it's not spirit service
1673 return;
1674
1675 if (bg)
1676 sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
1677
1678 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
1679 bf->SendAreaSpiritHealerQueryOpcode(_player, guid);
1680}
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188
Definition: Battlefield.h:206
Definition: Battleground.h:298
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12117
bool IsSpiritService() const
Definition: Unit.h:1687

References _player, Player::GetBattleground(), Map::GetCreature(), WorldObject::GetMap(), GetPlayer(), WorldObject::GetZoneId(), Unit::IsSpiritService(), LOG_DEBUG, sBattlefieldMgr, and sBattlegroundMgr.

Referenced by OpcodeTable::Initialize().

◆ HandleAreaSpiritHealerQueueOpcode()

void WorldSession::HandleAreaSpiritHealerQueueOpcode ( WorldPacket recvData)
1683{
1684 LOG_DEBUG("network", "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
1685
1687
1688 ObjectGuid guid;
1689 recv_data >> guid;
1690
1691 Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
1692 if (!unit)
1693 return;
1694
1695 if (!unit->IsSpiritService()) // it's not spirit service
1696 return;
1697
1698 if (bg)
1700
1701 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
1702 bf->AddPlayerToResurrectQueue(guid, _player->GetGUID());
1703}
void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid)
Definition: Battleground.cpp:1362

References _player, Battleground::AddPlayerToResurrectQueue(), Player::GetBattleground(), Map::GetCreature(), Object::GetGUID(), WorldObject::GetMap(), GetPlayer(), WorldObject::GetZoneId(), Unit::IsSpiritService(), LOG_DEBUG, and sBattlefieldMgr.

Referenced by OpcodeTable::Initialize().

◆ HandleAreaTriggerOpcode()

void WorldSession::HandleAreaTriggerOpcode ( WorldPacket recvPacket)
730{
731 uint32 triggerId;
732 recv_data >> triggerId;
733
734 LOG_DEBUG("network", "CMSG_AREATRIGGER. Trigger ID: {}", triggerId);
735
736 Player* player = GetPlayer();
737 if (player->IsInFlight())
738 {
739 LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' ({}) in flight, ignore Area Trigger ID:{}",
740 player->GetName(), player->GetGUID().ToString(), triggerId);
741 return;
742 }
743
744 AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(triggerId);
745 if (!atEntry)
746 {
747 LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' ({}) send unknown (by DBC) Area Trigger ID:{}",
748 player->GetName(), player->GetGUID().ToString(), triggerId);
749 return;
750 }
751
752 uint32 teamFaction = player->GetTeamId(true) == TEAM_ALLIANCE ? FACTION_MASK_ALLIANCE : FACTION_MASK_HORDE;
753 bool isTavernAreatrigger = sObjectMgr->IsTavernAreaTrigger(triggerId, teamFaction);
754 if (!player->IsInAreaTriggerRadius(atEntry, isTavernAreatrigger ? 5.f : 0.f))
755 {
756 LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player {} ({}) too far (trigger map: {} player map: {}), ignore Area Trigger ID: {}",
757 player->GetName(), player->GetGUID().ToString(), atEntry->map, player->GetMapId(), triggerId);
758 return;
759 }
760
761 if (player->isDebugAreaTriggers)
763
764 if (sScriptMgr->OnAreaTrigger(player, atEntry))
765 return;
766
767 if (player->IsAlive())
768 if (uint32 questId = sObjectMgr->GetQuestForAreaTrigger(triggerId))
769 if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
770 player->AreaExploredOrEventHappens(questId);
771
772 if (isTavernAreatrigger)
773 {
774 // set resting flag we are in the inn
775 player->SetRestFlag(REST_FLAG_IN_TAVERN, atEntry->entry);
776
777 if (sWorld->IsFFAPvPRealm())
778 {
780 {
782 sScriptMgr->OnFfaPvpStateUpdate(player, false);
783
784 }
785 }
786 return;
787 }
788
789 if (Battleground* bg = player->GetBattleground())
790 if (bg->GetStatus() == STATUS_IN_PROGRESS)
791 {
792 bg->HandleAreaTrigger(player, triggerId);
793 return;
794 }
795
796 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
797 if (pvp->HandleAreaTrigger(_player, triggerId))
798 return;
799
800 AreaTriggerTeleport const* at = sObjectMgr->GetAreaTriggerTeleport(triggerId);
801 if (!at)
802 return;
803
804 bool teleported = false;
805 if (player->GetMapId() != at->target_mapId)
806 {
807 if (Map::EnterState denyReason = sMapMgr->PlayerCannotEnter(at->target_mapId, player, false))
808 {
809 bool reviveAtTrigger = false; // should we revive the player if he is trying to enter the correct instance?
810 switch (denyReason)
811 {
817 reviveAtTrigger = true;
818 break;
819 default:
820 break;
821 }
822
823 if (reviveAtTrigger) // check if the player is touching the areatrigger leading to the map his corpse is on
824 {
825 if (!player->IsAlive() && player->HasCorpse())
826 {
827 if (player->GetCorpseLocation().GetMapId() == at->target_mapId)
828 {
829 player->ResurrectPlayer(0.5f);
830 player->SpawnCorpseBones();
831 }
832 }
833 }
834
835 return;
836 }
837
838 if (Group* group = player->GetGroup())
839 if (group->isLFGGroup() && player->GetMap()->IsDungeon())
840 teleported = player->TeleportToEntryPoint();
841 }
842
843 if (!teleported)
845}
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:815
@ REST_FLAG_IN_TAVERN
Definition: Player.h:807
@ UNIT_BYTE2_FLAG_FFA_PVP
Definition: Unit.h:138
#define sMapMgr
Definition: MapMgr.h:221
@ LANG_DEBUG_AREATRIGGER_REACHED
Definition: Language.h:963
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
#define sScriptMgr
Definition: ScriptMgr.h:698
@ FACTION_MASK_ALLIANCE
Definition: DBCEnums.h:346
@ FACTION_MASK_HORDE
Definition: DBCEnums.h:347
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
Definition: Chat.h:38
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:930
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:949
uint32 GetMapId() const
Definition: Position.h:276
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition: Player.cpp:16068
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2072
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4600
bool HasCorpse() const
Definition: Player.h:2002
bool TeleportToEntryPoint()
Definition: Player.cpp:1584
OutdoorPvP * GetOutdoorPvP() const
Definition: Player.cpp:12426
WorldLocation GetCorpseLocation() const
Definition: Player.h:2003
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1314
void AreaExploredOrEventHappens(uint32 questId)
Definition: PlayerQuest.cpp:1777
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1416
bool isDebugAreaTriggers
Definition: Player.h:2519
bool IsInAreaTriggerRadius(AreaTrigger const *trigger, float delta=0.f) const
Definition: Player.cpp:2168
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4388
bool IsInFlight() const
Definition: Unit.h:1690
Definition: ObjectMgr.h:412
float target_Z
Definition: ObjectMgr.h:416
float target_X
Definition: ObjectMgr.h:414
float target_Orientation
Definition: ObjectMgr.h:417
float target_Y
Definition: ObjectMgr.h:415
uint32 target_mapId
Definition: ObjectMgr.h:413
Definition: ObjectMgr.h:421
uint32 entry
Definition: ObjectMgr.h:422
uint32 map
Definition: ObjectMgr.h:423
bool IsDungeon() const
Definition: Map.h:448
EnterState
Definition: Map.h:423
@ CANNOT_ENTER_TOO_MANY_INSTANCES
Definition: Map.h:432
@ CANNOT_ENTER_MAX_PLAYERS
Definition: Map.h:433
@ CANNOT_ENTER_ZONE_IN_COMBAT
Definition: Map.h:434
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
Definition: Map.h:431
@ CANNOT_ENTER_NOT_IN_RAID
Definition: Map.h:429
Definition: OutdoorPvP.h:186

References _player, Player::AreaExploredOrEventHappens(), Map::CANNOT_ENTER_INSTANCE_BIND_MISMATCH, Map::CANNOT_ENTER_MAX_PLAYERS, Map::CANNOT_ENTER_NOT_IN_RAID, Map::CANNOT_ENTER_TOO_MANY_INSTANCES, Map::CANNOT_ENTER_ZONE_IN_COMBAT, AreaTrigger::entry, FACTION_MASK_ALLIANCE, FACTION_MASK_HORDE, Player::GetBattleground(), Player::GetCorpseLocation(), Player::GetGroup(), Object::GetGUID(), WorldObject::GetMap(), WorldLocation::GetMapId(), WorldObject::GetName(), Player::GetOutdoorPvP(), GetPlayer(), Player::GetQuestStatus(), Player::GetTeamId(), Object::HasByteFlag(), Player::HasCorpse(), Unit::IsAlive(), Player::isDebugAreaTriggers, Map::IsDungeon(), Player::IsInAreaTriggerRadius(), Unit::IsInFlight(), LANG_DEBUG_AREATRIGGER_REACHED, LOG_DEBUG, AreaTrigger::map, ChatHandler::PSendSysMessage(), QUEST_STATUS_INCOMPLETE, Object::RemoveByteFlag(), REST_FLAG_IN_TAVERN, Player::ResurrectPlayer(), Player::SetRestFlag(), sMapMgr, sObjectMgr, Player::SpawnCorpseBones(), sScriptMgr, STATUS_IN_PROGRESS, sWorld, AreaTriggerTeleport::target_mapId, AreaTriggerTeleport::target_Orientation, AreaTriggerTeleport::target_X, AreaTriggerTeleport::target_Y, AreaTriggerTeleport::target_Z, TEAM_ALLIANCE, TELE_TO_NOT_LEAVE_TRANSPORT, Player::TeleportTo(), Player::TeleportToEntryPoint(), ObjectGuid::ToString(), UNIT_BYTE2_FLAG_FFA_PVP, and UNIT_FIELD_BYTES_2.

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamAcceptOpcode()

void WorldSession::HandleArenaTeamAcceptOpcode ( WorldPacket recvData)
169{
170 LOG_DEBUG("network", "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
171
172 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(_player->GetArenaTeamIdInvited());
173 if (!arenaTeam)
174 return;
175
176 // Check if player is already in another team of the same size
177 if (_player->GetArenaTeamId(arenaTeam->GetSlot()))
178 {
180 return;
181 }
182
183 // Only allow members of the other faction to join the team if cross faction interaction is enabled
184 if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_ARENA) && _player->GetTeamId() != sCharacterCache->GetCharacterTeamByGuid(arenaTeam->GetCaptain()))
185 {
187 return;
188 }
189
190 // Add player to team
191 if (!arenaTeam->AddMember(_player->GetGUID()))
192 {
194 return;
195 }
196
197 // Broadcast event
198 arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName().c_str(), arenaTeam->GetName(), "");
199}
@ ERR_ARENA_TEAM_CREATE_S
Definition: ArenaTeam.h:33
@ ERR_ARENA_TEAM_INTERNAL
Definition: ArenaTeam.h:41
@ ERR_ALREADY_IN_ARENA_TEAM
Definition: ArenaTeam.h:42
@ ERR_ARENA_TEAM_NOT_ALLIED
Definition: ArenaTeam.h:53
@ ERR_ARENA_TEAM_JOIN_SS
Definition: ArenaTeam.h:64
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:67
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_ARENA
Definition: IWorld.h:82
Definition: ArenaTeam.h:138
ObjectGuid GetCaptain() const
Definition: ArenaTeam.h:154
uint8 GetSlot() const
Definition: ArenaTeam.h:151
void BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const &str1, std::string const &str2, std::string const &str3)
Definition: ArenaTeam.cpp:570
bool AddMember(ObjectGuid playerGuid)
Definition: ArenaTeam.cpp:89
std::string const & GetName() const
Definition: ArenaTeam.h:155
uint32 GetArenaTeamId(uint8 slot) const
Definition: Player.cpp:16129
uint32 GetArenaTeamIdInvited()
Definition: Player.h:1881
void SendArenaTeamCommandResult(uint32 team_action, std::string const &team, std::string const &player, uint32 error_id=0)
Definition: ArenaTeamHandler.cpp:406

References _player, ArenaTeam::AddMember(), ArenaTeam::BroadcastEvent(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_ARENA, 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::GetTeamId(), LOG_DEBUG, sArenaTeamMgr, sCharacterCache, SendArenaTeamCommandResult(), and sWorld.

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamDeclineOpcode()

void WorldSession::HandleArenaTeamDeclineOpcode ( WorldPacket recvData)
202{
203 LOG_DEBUG("network", "CMSG_ARENA_TEAM_DECLINE"); // empty opcode
204
205 // Remove invite from player
207}
void SetArenaTeamIdInvited(uint32 ArenaTeamId)
Definition: Player.h:1880

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

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamDisbandOpcode()

void WorldSession::HandleArenaTeamDisbandOpcode ( WorldPacket recvData)
267{
268 LOG_DEBUG("network", "CMSG_ARENA_TEAM_DISBAND");
269
270 uint32 arenaTeamId;
271 recvData >> arenaTeamId;
272
273 if (ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId))
274 {
275 // Only captain can disband the team
276 if (arenaTeam->GetCaptain() != _player->GetGUID())
277 return;
278
279 // Teams cannot be disbanded during queues
281 {
282 GroupQueueInfo ginfo;
283 BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueue);
284 if (queue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
286 return;
287 }
288
289 // Teams cannot be disbanded during fights
290 if (arenaTeam->IsFighting())
291 return;
292
293 arenaTeam->Disband(this);
294 delete arenaTeam;
295 }
296}
@ BATTLEGROUND_AA
Definition: SharedDefines.h:3486
BattlegroundQueueTypeId
Definition: SharedDefines.h:3619
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
Definition: BattlegroundMgr.cpp:672
Definition: BattlegroundQueue.h:31
uint32 IsInvitedToBGInstanceGUID
Definition: BattlegroundQueue.h:41
Definition: BattlegroundQueue.h:64
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo *ginfo)
Definition: BattlegroundQueue.cpp:383

References _player, BATTLEGROUND_AA, BattlegroundMgr::BGQueueTypeId(), Object::GetGUID(), BattlegroundQueue::GetPlayerGroupInfoData(), GroupQueueInfo::IsInvitedToBGInstanceGUID, LOG_DEBUG, sArenaTeamMgr, and sBattlegroundMgr.

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamInviteOpcode()

void WorldSession::HandleArenaTeamInviteOpcode ( WorldPacket recvData)
85{
86 LOG_DEBUG("network", "CMSG_ARENA_TEAM_INVITE");
87
88 uint32 arenaTeamId; // arena team id
89 std::string invitedName;
90
91 Player* player = nullptr;
92
93 recvData >> arenaTeamId >> invitedName;
94
95 if (!invitedName.empty())
96 {
97 if (!normalizePlayerName(invitedName))
98 return;
99
100 player = ObjectAccessor::FindPlayerByName(invitedName, false);
101 }
102
103 if (!player)
104 {
106 return;
107 }
108
109 if (player->GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
110 {
112 return;
113 }
114
115 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
116 if (!arenaTeam)
117 {
119 return;
120 }
121
122 if (GetPlayer()->GetArenaTeamId(arenaTeam->GetSlot()) != arenaTeamId)
123 {
125 return;
126 }
127
128 // OK result but don't send invite
129 if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUID()))
130 return;
131
132 if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_ARENA) && player->GetTeamId() != GetPlayer()->GetTeamId())
133 {
135 return;
136 }
137
138 if (player->GetArenaTeamId(arenaTeam->GetSlot()))
139 {
141 return;
142 }
143
144 if (player->GetArenaTeamIdInvited())
145 {
147 return;
148 }
149
150 if (arenaTeam->GetMembersSize() >= arenaTeam->GetType() * 2)
151 {
153 return;
154 }
155
156 LOG_DEBUG("bg.battleground", "Player {} Invited {} to Join his ArenaTeam", GetPlayer()->GetName(), invitedName);
157
158 player->SetArenaTeamIdInvited(arenaTeam->GetId());
159
160 WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8 + 10));
161 data << GetPlayer()->GetName();
162 data << arenaTeam->GetName();
163 player->GetSession()->SendPacket(&data);
164
165 LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_INVITE");
166}
@ ERR_ARENA_TEAM_INVITE_SS
Definition: ArenaTeam.h:34
@ ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S
Definition: ArenaTeam.h:57
@ ERR_ALREADY_IN_ARENA_TEAM_S
Definition: ArenaTeam.h:43
@ ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM
Definition: ArenaTeam.h:50
@ ERR_ARENA_TEAM_PERMISSIONS
Definition: ArenaTeam.h:49
@ ERR_ARENA_TEAM_TARGET_TOO_LOW_S
Definition: ArenaTeam.h:55
@ ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S
Definition: ArenaTeam.h:52
@ ERR_ALREADY_INVITED_TO_ARENA_TEAM_S
Definition: ArenaTeam.h:45
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:236
@ SMSG_ARENA_TEAM_INVITE
Definition: Opcodes.h:878
Player * FindPlayerByName(std::string const &name, bool checkInWorld=true)
Definition: ObjectAccessor.cpp:274
size_t GetMembersSize() const
Definition: ArenaTeam.h:170
uint32 GetType() const
Definition: ArenaTeam.h:150
uint32 GetId() const
Definition: ArenaTeam.h:149
bool HasIgnore(ObjectGuid ignore_guid) const
Definition: SocialMgr.cpp:193

References CONFIG_ALLOW_TWO_SIDE_INTERACTION_ARENA, CONFIG_MAX_PLAYER_LEVEL, 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::GetTeamId(), GetTeamId(), ArenaTeam::GetType(), PlayerSocial::HasIgnore(), LOG_DEBUG, normalizePlayerName(), sArenaTeamMgr, SendArenaTeamCommandResult(), SendPacket(), Player::SetArenaTeamIdInvited(), SMSG_ARENA_TEAM_INVITE, and sWorld.

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamLeaderOpcode()

void WorldSession::HandleArenaTeamLeaderOpcode ( WorldPacket recvData)
364{
365 LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEADER");
366
367 uint32 arenaTeamId;
368 std::string name;
369
370 recvData >> arenaTeamId;
371 recvData >> name;
372
373 // Check for valid arena team
374 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
375 if (!arenaTeam)
376 return;
377
378 // Only captain can pass leadership
379 if (arenaTeam->GetCaptain() != _player->GetGUID())
380 {
382 return;
383 }
384
385 if (!normalizePlayerName(name))
386 return;
387
388 // Check if team member exists
389 ArenaTeamMember* member = arenaTeam->GetMember(name);
390 if (!member)
391 {
393 return;
394 }
395
396 // Check if the target is already team captain
397 if (arenaTeam->GetCaptain() == member->Guid)
398 return;
399
400 arenaTeam->SetCaptain(member->Guid);
401
402 // Broadcast event
403 arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName().c_str(), name, arenaTeam->GetName());
404}
@ ERR_ARENA_TEAM_LEADER_CHANGED_SSS
Definition: ArenaTeam.h:68
Definition: ArenaTeam.h:109
ObjectGuid Guid
Definition: ArenaTeam.h:110
void SetCaptain(ObjectGuid guid)
Definition: ArenaTeam.cpp:295
ArenaTeamMember * GetMember(ObjectGuid guid)
Definition: ArenaTeam.cpp:1012

References _player, ArenaTeam::BroadcastEvent(), ObjectGuid::Empty, 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, LOG_DEBUG, normalizePlayerName(), sArenaTeamMgr, SendArenaTeamCommandResult(), and ArenaTeam::SetCaptain().

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamLeaveOpcode()

void WorldSession::HandleArenaTeamLeaveOpcode ( WorldPacket recvData)
210{
211 LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEAVE");
212
213 uint32 arenaTeamId;
214 recvData >> arenaTeamId;
215
216 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
217 if (!arenaTeam)
218 return;
219
220 // Disallow leave team while in arena
221 if (arenaTeam->IsFighting())
222 {
224 return;
225 }
226
227 // Team captain can't leave the team if other members are still present
228 if (_player->GetGUID() == arenaTeam->GetCaptain() && arenaTeam->GetMembersSize() > 1)
229 {
231 return;
232 }
233
234 // Player cannot be removed during queues
236 {
237 GroupQueueInfo ginfo;
238 BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueue);
239 if (queue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
240 {
242 {
244 return;
245 }
246 }
247 }
248
249 // If team consists only of the captain, disband the team
250 if (_player->GetGUID() == arenaTeam->GetCaptain())
251 {
252 arenaTeam->Disband(this);
253 delete arenaTeam;
254 return;
255 }
256 else
257 arenaTeam->DelMember(_player->GetGUID(), true);
258
259 // Broadcast event
260 arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), 2, _player->GetName().c_str(), arenaTeam->GetName(), "");
261
262 // Inform player who left
264}
@ ERR_ARENA_TEAM_QUIT_S
Definition: ArenaTeam.h:35
@ ERR_ARENA_TEAMS_LOCKED
Definition: ArenaTeam.h:59
@ ERR_ARENA_TEAM_LEADER_LEAVE_S
Definition: ArenaTeam.h:48
@ ERR_ARENA_TEAM_LEAVE_SS
Definition: ArenaTeam.h:65
void Disband(WorldSession *session)
Definition: ArenaTeam.cpp:383
void DelMember(ObjectGuid guid, bool cleanDb)
Definition: ArenaTeam.cpp:324
bool IsFighting() const
Definition: ArenaTeam.cpp:997

References _player, BATTLEGROUND_AA, BattlegroundMgr::BGQueueTypeId(), ArenaTeam::BroadcastEvent(), ArenaTeam::DelMember(), ArenaTeam::Disband(), ERR_ARENA_TEAM_LEADER_LEAVE_S, ERR_ARENA_TEAM_LEAVE_SS, ERR_ARENA_TEAM_QUIT_S, ERR_ARENA_TEAMS_LOCKED, ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMembersSize(), ArenaTeam::GetName(), WorldObject::GetName(), BattlegroundQueue::GetPlayerGroupInfoData(), ArenaTeam::GetType(), ArenaTeam::IsFighting(), GroupQueueInfo::IsInvitedToBGInstanceGUID, LOG_DEBUG, sArenaTeamMgr, sBattlegroundMgr, and SendArenaTeamCommandResult().

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamQueryOpcode()

void WorldSession::HandleArenaTeamQueryOpcode ( WorldPacket recvData)
64{
65 uint32 arenaTeamId;
66 recvData >> arenaTeamId;
67
68 if (ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId))
69 {
70 arenaTeam->Query(this);
71 arenaTeam->SendStats(this);
72 }
73}

References sArenaTeamMgr.

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamRemoveOpcode()

void WorldSession::HandleArenaTeamRemoveOpcode ( WorldPacket recvData)
299{
300 LOG_DEBUG("network", "CMSG_ARENA_TEAM_REMOVE");
301
302 uint32 arenaTeamId;
303 std::string name;
304
305 recvData >> arenaTeamId;
306 recvData >> name;
307
308 // Check for valid arena team
309 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
310 if (!arenaTeam)
311 return;
312
313 // Only captain can remove members
314 if (arenaTeam->GetCaptain() != _player->GetGUID())
315 {
317 return;
318 }
319
320 if (!normalizePlayerName(name))
321 return;
322
323 // Check if team member exists
324 ArenaTeamMember* member = arenaTeam->GetMember(name);
325 if (!member)
326 {
328 return;
329 }
330
331 // Captain cannot be removed
332 if (arenaTeam->GetCaptain() == member->Guid)
333 {
335 return;
336 }
337
338 // Team member cannot be removed during queues
340 {
341 GroupQueueInfo ginfo;
342 BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueue);
343 if (queue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
344 {
346 {
348 return;
349 }
350 }
351 }
352
353 // Player cannot be removed during fights
354 if (arenaTeam->IsFighting())
355 return;
356
357 arenaTeam->DelMember(member->Guid, true);
358
359 // Broadcast event
361}
@ ERR_ARENA_TEAM_REMOVE_SSS
Definition: ArenaTeam.h:66

References _player, BATTLEGROUND_AA, BattlegroundMgr::BGQueueTypeId(), ArenaTeam::BroadcastEvent(), ArenaTeam::DelMember(), ObjectGuid::Empty, 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, ERR_ARENA_TEAMS_LOCKED, ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMember(), ArenaTeam::GetName(), WorldObject::GetName(), BattlegroundQueue::GetPlayerGroupInfoData(), ArenaTeam::GetType(), ArenaTeamMember::Guid, ArenaTeam::IsFighting(), GroupQueueInfo::IsInvitedToBGInstanceGUID, LOG_DEBUG, normalizePlayerName(), sArenaTeamMgr, sBattlegroundMgr, and SendArenaTeamCommandResult().

Referenced by OpcodeTable::Initialize().

◆ HandleArenaTeamRosterOpcode()

void WorldSession::HandleArenaTeamRosterOpcode ( WorldPacket recvData)
76{
77 uint32 arenaTeamId; // arena team id
78 recvData >> arenaTeamId;
79
80 if (ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId))
81 arenaTeam->Roster(this);
82}

References sArenaTeamMgr.

Referenced by OpcodeTable::Initialize().

◆ HandleAttackStopOpcode()

void WorldSession::HandleAttackStopOpcode ( WorldPacket recvPacket)
70{
72}
bool AttackStop()
Definition: Unit.cpp:10407

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

Referenced by OpcodeTable::Initialize().

◆ HandleAttackSwingOpcode()

void WorldSession::HandleAttackSwingOpcode ( WorldPacket recvPacket)

Client explicitly checks the following before sending CMSG_ATTACKSWING packet, so we'll place the same check here. Note that it might be possible to reuse this snippet in other places as well.

30{
31 ObjectGuid guid;
32 recvData >> guid;
33
34 LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING: {}", guid.ToString());
35
36 Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid);
37
38 if (!pEnemy)
39 {
40 // stop attack state at client
41 SendAttackStop(nullptr);
42 return;
43 }
44
45 if (!_player->IsValidAttackTarget(pEnemy))
46 {
47 // stop attack state at client
48 SendAttackStop(pEnemy);
49 return;
50 }
51
55 if (Vehicle* vehicle = _player->GetVehicle())
56 {
57 VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(_player);
58 ASSERT(seat);
60 {
61 SendAttackStop(pEnemy);
62 return;
63 }
64 }
65
66 _player->Attack(pEnemy, true);
67}
#define ASSERT
Definition: Errors.h:68
@ VEHICLE_SEAT_FLAG_CAN_ATTACK
Definition: DBCEnums.h:466
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Definition: Unit.h:1302
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10280
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13859
void SendAttackStop(Unit const *enemy)
Definition: CombatHandler.cpp:85
Definition: DBCStructure.h:2065
uint32 m_flags
Definition: DBCStructure.h:2067

References _player, ASSERT, Unit::Attack(), ObjectAccessor::GetUnit(), Unit::GetVehicle(), Unit::IsValidAttackTarget(), LOG_DEBUG, VehicleSeatEntry::m_flags, SendAttackStop(), ObjectGuid::ToString(), and VEHICLE_SEAT_FLAG_CAN_ATTACK.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionHelloOpcode()

void WorldSession::HandleAuctionHelloOpcode ( WorldPacket recvPacket)
35{
36 ObjectGuid guid; //NPC guid
37 recvData >> guid;
38
40 if (!unit)
41 {
42 LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit ({}) not found or you can't interact with him.", guid.ToString());
43 return;
44 }
45
46 // remove fake death
47 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
49
50 SendAuctionHello(guid, unit);
51}
@ UNIT_NPC_FLAG_AUCTIONEER
Definition: Unit.h:537
@ UNIT_STATE_DIED
Definition: Unit.h:325
@ SPELL_AURA_FEIGN_DEATH
Definition: SpellAuraDefines.h:129
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5045
void SendAuctionHello(ObjectGuid guid, Creature *unit)
Definition: AuctionHouseHandler.cpp:54

References Player::GetNPCIfCanInteractWith(), GetPlayer(), LOG_DEBUG, Unit::RemoveAurasByType(), SendAuctionHello(), SPELL_AURA_FEIGN_DEATH, ObjectGuid::ToString(), UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionListBidderItems()

void WorldSession::HandleAuctionListBidderItems ( WorldPacket recvData)
601{
602 ObjectGuid guid; //NPC guid
603 uint32 listfrom; //page of auctions
604 uint32 outbiddedCount; //count of outbidded auctions
605
606 recvData >> guid;
607 recvData >> listfrom; // not used in fact (this list not have page control in client)
608 recvData >> outbiddedCount;
609 if (recvData.size() != (16 + outbiddedCount * 4))
610 {
611 LOG_ERROR("network.opcode", "Client sent bad opcode!!! with count: {} and size : {} (must be: {})", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4));
612 outbiddedCount = 0;
613 }
614
616 if (!creature)
617 {
618 LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit ({}) not found or you can't interact with him.", guid.ToString());
619 recvData.rfinish();
620 return;
621 }
622
623 // remove fake death
624 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
626
627 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
628
629 WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4) + 30000); // pussywizard: ensure there is enough memory
630 Player* player = GetPlayer();
631 data << (uint32) 0; //add 0 as count
632 uint32 count = 0;
633 uint32 totalcount = 0;
634 while (outbiddedCount > 0) //add all data, which client requires
635 {
636 --outbiddedCount;
637 uint32 outbiddedAuctionId;
638 recvData >> outbiddedAuctionId;
639 AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
640 if (auction && auction->BuildAuctionInfo(data))
641 {
642 ++totalcount;
643 ++count;
644 }
645 }
646
647 auctionHouse->BuildListBidderItems(data, player, count, totalcount);
648 data.put<uint32>(0, count); // add count to placeholder
649 data << totalcount;
650 data << (uint32)300; //unk 2.3.0
651 SendPacket(&data);
652}
#define sAuctionMgr
Definition: AuctionHouseMgr.h:227
@ SMSG_AUCTION_BIDDER_LIST_RESULT
Definition: Opcodes.h:643
Definition: AuctionHouseMgr.h:101
bool BuildAuctionInfo(WorldPacket &data) const
Definition: AuctionHouseMgr.cpp:930
Definition: AuctionHouseMgr.h:130
void BuildListBidderItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
Definition: AuctionHouseMgr.cpp:695
AuctionEntry * GetAuction(uint32 id) const
Definition: AuctionHouseMgr.h:148
uint32 GetFaction() const
Definition: Unit.h:1509
void rfinish()
Definition: ByteBuffer.h:325
size_t size() const
Definition: ByteBuffer.h:444

References AuctionEntry::BuildAuctionInfo(), AuctionHouseObject::BuildListBidderItems(), AuctionHouseObject::GetAuction(), Unit::GetFaction(), Player::GetNPCIfCanInteractWith(), GetPlayer(), LOG_DEBUG, LOG_ERROR, ByteBuffer::put(), Unit::RemoveAurasByType(), ByteBuffer::rfinish(), sAuctionMgr, SendPacket(), ByteBuffer::size(), SMSG_AUCTION_BIDDER_LIST_RESULT, SPELL_AURA_FEIGN_DEATH, ObjectGuid::ToString(), UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionListItems()

void WorldSession::HandleAuctionListItems ( WorldPacket recvData)
710{
711 std::string searchedname;
712 uint8 levelmin, levelmax, usable;
713 uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
714 ObjectGuid guid;
715
716 recvData >> guid;
717 recvData >> listfrom; // start, used for page control listing by 50 elements
718 recvData >> searchedname;
719
720 recvData >> levelmin >> levelmax;
721 recvData >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
722 recvData >> quality >> usable;
723
724 //recvData.read_skip<uint8>(); // pussywizard: this is the getAll option
725 uint8 getAll;
726 recvData >> getAll;
727
728 // Read sort block
729 uint8 sortOrderCount;
730 recvData >> sortOrderCount;
731 AuctionSortOrderVector sortOrder;
732 for (uint8 i = 0; i < sortOrderCount; i++)
733 {
734 uint8 sortMode;
735 uint8 isDesc;
736 recvData >> sortMode;
737 recvData >> isDesc;
738 AuctionSortInfo sortInfo;
739 sortInfo.isDesc = (isDesc == 1);
740 sortInfo.sortOrder = static_cast<AuctionSortOrder>(sortMode);
741 sortOrder.push_back(std::move(sortInfo));
742 }
743
744 // remove fake death
746 {
748 }
749
750 // pussywizard:
751 const Milliseconds delay = 2s;
754 if (diff > delay)
755 {
756 diff = delay;
757 }
758 _lastAuctionListItemsMSTime = now + delay - diff;
759 std::lock_guard<std::mutex> guard(AsyncAuctionListingMgr::GetTempLock());
760 AsyncAuctionListingMgr::GetTempList().emplace_back(delay - diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID,
761 auctionMainCategory, auctionSubCategory, quality, getAll, sortOrder);
762}
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:27
Milliseconds GetMSTimeDiff(Milliseconds oldMSTime, Milliseconds newMSTime)
Definition: Timer.h:91
AuctionSortOrder
Definition: AuctionHouseMgr.h:74
std::vector< AuctionSortInfo > AuctionSortOrderVector
Definition: AuctionHouseMgr.h:98
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Definition: AuctionHouseMgr.h:91
bool isDesc
Definition: AuctionHouseMgr.h:95
AuctionSortOrder sortOrder
Definition: AuctionHouseMgr.h:94
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410
static std::mutex & GetTempLock()
Definition: AsyncAuctionListing.h:73
static std::list< AuctionListItemsDelayEvent > & GetTempList()
Definition: AsyncAuctionListing.h:72

References _lastAuctionListItemsMSTime, _player, GameTime::GetGameTimeMS(), Object::GetGUID(), GetMSTimeDiff(), AsyncAuctionListingMgr::GetTempList(), AsyncAuctionListingMgr::GetTempLock(), Unit::HasUnitState(), AuctionSortInfo::isDesc, Unit::RemoveAurasByType(), AuctionSortInfo::sortOrder, SPELL_AURA_FEIGN_DEATH, and UNIT_STATE_DIED.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionListOwnerItems()

void WorldSession::HandleAuctionListOwnerItems ( WorldPacket recvData)
656{
657 // prevent crash caused by malformed packet
658 ObjectGuid guid;
659 uint32 listfrom;
660
661 recvData >> guid;
662 recvData >> listfrom; // not used in fact (this list does not have page control in client)
663
664 // pussywizard:
666 if (_lastAuctionListOwnerItemsMSTime > now) // list is pending
667 return;
668
669 const Milliseconds delay = Milliseconds(4500);
671 if (diff > delay)
672 diff = delay;
673
674 _lastAuctionListOwnerItemsMSTime = now + delay; // set longest possible here, actual executing will change this to getMSTime of that moment
676}
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.h:104
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:159
EventProcessor m_Events
Definition: Unit.h:2108
Definition: AsyncAuctionListing.h:26

References _lastAuctionListOwnerItemsMSTime, _player, EventProcessor::AddEvent(), EventProcessor::CalculateTime(), GameTime::GetGameTimeMS(), Object::GetGUID(), GetMSTimeDiff(), and Unit::m_Events.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionListOwnerItemsEvent()

void WorldSession::HandleAuctionListOwnerItemsEvent ( ObjectGuid  creatureGuid)
679{
681
683 if (!creature)
684 {
685 LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit ({}) not found or you can't interact with him.", creatureGuid.ToString());
686 return;
687 }
688
689 // remove fake death
690 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
692
693 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
694
695 WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4 + 4 + 4) + 60000); // pussywizard: ensure there is enough memory
696 data << (uint32) 0; // amount place holder
697
698 uint32 count = 0;
699 uint32 totalcount = 0;
700
701 auctionHouse->BuildListOwnerItems(data, _player, count, totalcount);
702 data.put<uint32>(0, count);
703 data << (uint32) totalcount;
704 data << (uint32) 0;
705 SendPacket(&data);
706}
@ SMSG_AUCTION_OWNER_LIST_RESULT
Definition: Opcodes.h:635
void BuildListOwnerItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
Definition: AuctionHouseMgr.cpp:710

References _lastAuctionListOwnerItemsMSTime, _player, AuctionHouseObject::BuildListOwnerItems(), Unit::GetFaction(), GameTime::GetGameTimeMS(), Player::GetNPCIfCanInteractWith(), GetPlayer(), LOG_DEBUG, ByteBuffer::put(), Unit::RemoveAurasByType(), sAuctionMgr, SendPacket(), SMSG_AUCTION_OWNER_LIST_RESULT, SPELL_AURA_FEIGN_DEATH, ObjectGuid::ToString(), UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

◆ HandleAuctionListPendingSales()

void WorldSession::HandleAuctionListPendingSales ( WorldPacket recvData)
765{
766 recvData.read_skip<uint64>();
767
768 uint32 count = 0;
769
771 data << uint32(count); // count
772 /*for (uint32 i = 0; i < count; ++i)
773 {
774 data << ""; // string
775 data << ""; // string
776 data << uint32(0);
777 data << uint32(0);
778 data << float(0);
779 }*/
780 SendPacket(&data);
781}
@ SMSG_AUCTION_LIST_PENDING_SALES
Definition: Opcodes.h:1198
void read_skip()
Definition: ByteBuffer.h:339

References ByteBuffer::read_skip(), SendPacket(), and SMSG_AUCTION_LIST_PENDING_SALES.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionPlaceBid()

void WorldSession::HandleAuctionPlaceBid ( WorldPacket recvData)
397{
398 ObjectGuid auctioneer;
399 uint32 auctionId;
400 uint32 price;
401 recvData >> auctioneer;
402 recvData >> auctionId >> price;
403
404 if (!auctionId || !price)
405 return; //check for cheaters
406
408 if (!creature)
409 {
410 LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit ({}) not found or you can't interact with him.", auctioneer.ToString());
411 return;
412 }
413
414 // remove fake death
415 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
417
418 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
419
420 AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
421 Player* player = GetPlayer();
422
423 if (!sScriptMgr->CanPlaceAuctionBid(player, auction))
424 {
426 return;
427 }
428
429 if (!auction || auction->owner == player->GetGUID())
430 {
431 //you cannot bid your own auction:
433 return;
434 }
435
436 // impossible have online own another character (use this for speedup check in case online owner)
437 Player* auction_owner = ObjectAccessor::FindConnectedPlayer(auction->owner);
438 if (!auction_owner && sCharacterCache->GetCharacterAccountIdByGuid(auction->owner) == GetAccountId())
439 {
440 //you cannot bid your another character auction:
442 return;
443 }
444
445 // cheating
446 if (price <= auction->bid || price < auction->startbid)
447 return;
448
449 // price too low for next bid if not buyout
450 if ((price < auction->buyout || auction->buyout == 0) &&
451 price < auction->bid + auction->GetAuctionOutBid())
452 {
453 //auction has already higher bid, client tests it!
454 return;
455 }
456
457 if (!player->HasEnoughMoney(price))
458 {
459 //you don't have enought money!, client tests!
460 //SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
461 return;
462 }
463
464 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
465
466 if (price < auction->buyout || auction->buyout == 0)
467 {
468 if (auction->bidder)
469 {
470 if (auction->bidder == player->GetGUID())
471 player->ModifyMoney(-int32(price - auction->bid));
472 else
473 {
474 // mail to last bidder and return money
475 sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
476 player->ModifyMoney(-int32(price));
477 }
478 }
479 else
480 player->ModifyMoney(-int32(price));
481
482 auction->bidder = player->GetGUID();
483 auction->bid = price;
485
487 stmt->SetData(0, auction->bidder.GetCounter());
488 stmt->SetData(1, auction->bid);
489 stmt->SetData(2, auction->Id);
490 trans->Append(stmt);
491
493 }
494 else
495 {
496 //buyout:
497 if (player->GetGUID() == auction->bidder)
498 player->ModifyMoney(-int32(auction->buyout - auction->bid));
499 else
500 {
501 player->ModifyMoney(-int32(auction->buyout));
502 if (auction->bidder) //buyout for bidded auction ..
503 sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
504 }
505 auction->bidder = player->GetGUID();
506 auction->bid = auction->buyout;
508
509 //- Mails must be under transaction control too to prevent data loss
510 sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
511 sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
512 sAuctionMgr->SendAuctionWonMail(auction, trans);
513 sScriptMgr->OnAuctionSuccessful(auctionHouse, auction);
514
516
517 auction->DeleteFromDB(trans);
518
519 sAuctionMgr->RemoveAItem(auction->item_guid);
520 auctionHouse->RemoveAuction(auction);
521 }
522 player->SaveInventoryAndGoldToDB(trans);
523 CharacterDatabase.CommitTransaction(trans);
524}
@ CHAR_UPD_AUCTION_BID
Definition: CharacterDatabase.h:107
@ AUCTION_PLACE_BID
Definition: AuctionHouseMgr.h:52
@ ERR_AUCTION_OK
Definition: AuctionHouseMgr.h:37
@ ERR_AUCTION_RESTRICTED_ACCOUNT
Definition: AuctionHouseMgr.h:45
@ ERR_AUCTION_BID_OWN
Definition: AuctionHouseMgr.h:44
@ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID
Definition: DBCEnums.h:199
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
uint32 GetAuctionOutBid() const
the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
Definition: AuctionHouseMgr.cpp:971
uint32 bid
Definition: AuctionHouseMgr.h:109
void DeleteFromDB(CharacterDatabaseTransaction trans) const
Definition: AuctionHouseMgr.cpp:977
ObjectGuid bidder
Definition: AuctionHouseMgr.h:112
ObjectGuid item_guid
Definition: AuctionHouseMgr.h:104
uint32 Id
Definition: AuctionHouseMgr.h:102
uint32 buyout
Definition: AuctionHouseMgr.h:110
ObjectGuid owner
Definition: AuctionHouseMgr.h:107
bool RemoveAuction(AuctionEntry *auction)
Definition: AuctionHouseMgr.cpp:637
void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError=0)
Definition: AuctionHouseHandler.cpp:77

References ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, AUCTION_PLACE_BID, AuctionEntry::bid, AuctionEntry::bidder, AuctionEntry::buyout, CHAR_UPD_AUCTION_BID, CharacterDatabase, AuctionEntry::DeleteFromDB(), ERR_AUCTION_BID_OWN, ERR_AUCTION_OK, ERR_AUCTION_RESTRICTED_ACCOUNT, ObjectAccessor::FindConnectedPlayer(), GetAccountId(), AuctionHouseObject::GetAuction(), AuctionEntry::GetAuctionOutBid(), ObjectGuid::GetCounter(), Unit::GetFaction(), Object::GetGUID(), Player::GetNPCIfCanInteractWith(), GetPlayer(), Player::HasEnoughMoney(), AuctionEntry::Id, AuctionEntry::item_guid, LOG_DEBUG, Player::ModifyMoney(), AuctionEntry::owner, AuctionHouseObject::RemoveAuction(), Unit::RemoveAurasByType(), sAuctionMgr, Player::SaveInventoryAndGoldToDB(), sCharacterCache, SendAuctionCommandResult(), PreparedStatementBase::SetData(), SPELL_AURA_FEIGN_DEATH, sScriptMgr, ObjectGuid::ToString(), UNIT_NPC_FLAG_AUCTIONEER, UNIT_STATE_DIED, and Player::UpdateAchievementCriteria().

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionRemoveItem()

void WorldSession::HandleAuctionRemoveItem ( WorldPacket recvData)
528{
529 ObjectGuid auctioneer;
530 uint32 auctionId;
531 recvData >> auctioneer;
532 recvData >> auctionId;
533
535 if (!creature)
536 {
537 LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit ({}) not found or you can't interact with him.", auctioneer.ToString());
538 return;
539 }
540
541 // remove fake death
542 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
544
545 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
546
547 AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
548 Player* player = GetPlayer();
549
550 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
551 if (auction && auction->owner == player->GetGUID())
552 {
553 Item* pItem = sAuctionMgr->GetAItem(auction->item_guid);
554 if (pItem)
555 {
556 if (auction->bidder) // If we have a bidder, we have to send him the money he paid
557 {
558 uint32 auctionCut = auction->GetAuctionCut();
559 if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
560 return;
561 //some auctionBidderNotification would be needed, but don't know that parts..
562 sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
563 player->ModifyMoney(-int32(auctionCut));
564 }
565
566 // item will deleted or added to received mail list
568 .AddItem(pItem)
569 .SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
570 }
571 else
572 {
573 LOG_ERROR("network.opcode", "Auction id: {} has non-existed item (item: {})!!!", auction->Id, auction->item_guid.ToString());
575 return;
576 }
577 }
578 else
579 {
581 //this code isn't possible ... maybe there should be assert
582 LOG_ERROR("network.opcode", "CHEATER : {}, he tried to cancel auction (id: {}) of another player, or auction is nullptr", player->GetGUID().ToString(), auctionId);
583 return;
584 }
585
586 //inform player, that auction is removed
588
589 // Now remove the auction
590
591 player->SaveInventoryAndGoldToDB(trans);
592 auction->DeleteFromDB(trans);
593 CharacterDatabase.CommitTransaction(trans);
594
595 sAuctionMgr->RemoveAItem(auction->item_guid);
596 auctionHouse->RemoveAuction(auction);
597}
@ AUCTION_CANCELED
Definition: AuctionHouseMgr.h:62
@ AUCTION_CANCEL
Definition: AuctionHouseMgr.h:51
@ ERR_AUCTION_DATABASE_ERROR
Definition: AuctionHouseMgr.h:39
@ MAIL_CHECK_MASK_COPIED
This mail was returned. Do not allow returning mail back again.
Definition: Mail.h:50
static std::string BuildAuctionMailBody(ObjectGuid guid, uint32 bid, uint32 buyout, uint32 deposit=0, uint32 cut=0, uint32 moneyDelay=0, uint32 eta=0)
Definition: AuctionHouseMgr.cpp:1039
std::string BuildAuctionMailSubject(MailAuctionAnswers response) const
Definition: AuctionHouseMgr.cpp:1032
uint32 deposit
Definition: AuctionHouseMgr.h:113
uint32 GetAuctionCut() const
Definition: AuctionHouseMgr.cpp:964
Definition: Mail.h:120
void SendMailTo(CharacterDatabaseTransaction trans, MailReceiver const &receiver, MailSender const &sender, MailCheckMask checked=MAIL_CHECK_MASK_NONE, uint32 deliver_delay=0, uint32 custom_expiration=0, bool deleteMailItemsFromDB=false, bool sendMail=true)
Definition: Mail.cpp:186
MailDraft & AddItem(Item *item)
Definition: Mail.cpp:94

References MailDraft::AddItem(), AUCTION_CANCEL, AUCTION_CANCELED, AuctionEntry::bidder, AuctionEntry::BuildAuctionMailBody(), AuctionEntry::BuildAuctionMailSubject(), AuctionEntry::buyout, CharacterDatabase, AuctionEntry::DeleteFromDB(), AuctionEntry::deposit, ObjectGuid::Empty, ERR_AUCTION_DATABASE_ERROR, ERR_AUCTION_OK, AuctionHouseObject::GetAuction(), AuctionEntry::GetAuctionCut(), Unit::GetFaction(), Object::GetGUID(), Player::GetNPCIfCanInteractWith(), GetPlayer(), Player::HasEnoughMoney(), AuctionEntry::Id, AuctionEntry::item_guid, LOG_DEBUG, LOG_ERROR, MAIL_CHECK_MASK_COPIED, Player::ModifyMoney(), AuctionEntry::owner, AuctionHouseObject::RemoveAuction(), Unit::RemoveAurasByType(), sAuctionMgr, Player::SaveInventoryAndGoldToDB(), SendAuctionCommandResult(), MailDraft::SendMailTo(), SPELL_AURA_FEIGN_DEATH, ObjectGuid::ToString(), UNIT_NPC_FLAG_AUCTIONEER, and UNIT_STATE_DIED.

Referenced by OpcodeTable::Initialize().

◆ HandleAuctionSellItem()

void WorldSession::HandleAuctionSellItem ( WorldPacket recvData)
118{
119 ObjectGuid auctioneer;
120 uint32 itemsCount, etime, bid, buyout;
121 recvData >> auctioneer;
122 recvData >> itemsCount;
123
124 ObjectGuid itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
126 memset(count, 0, sizeof(count));
127
128 if (itemsCount > MAX_AUCTION_ITEMS)
129 {
131 recvData.rfinish();
132 return;
133 }
134
135 for (uint32 i = 0; i < itemsCount; ++i)
136 {
137 recvData >> itemGUIDs[i];
138 recvData >> count[i];
139
140 if (!itemGUIDs[i] || !count[i] || count[i] > 1000)
141 {
142 recvData.rfinish();
143 return;
144 }
145 }
146
147 recvData >> bid;
148 recvData >> buyout;
149 recvData >> etime;
150
151 if (!bid || !etime)
152 return;
153
154 if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT)
155 {
156 LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Player {} ({}) attempted to sell item with higher price than max gold amount.",
159 return;
160 }
161
163 if (!creature)
164 {
165 LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit ({}) not found or you can't interact with him.", auctioneer.ToString());
166 return;
167 }
168
169 AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->GetFaction());
170 if (!auctionHouseEntry)
171 {
172 LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit ({}) has wrong faction.", auctioneer.ToString());
173 return;
174 }
175
176 etime *= MINUTE;
177
178 switch (etime)
179 {
180 case 1*MIN_AUCTION_TIME:
181 case 2*MIN_AUCTION_TIME:
182 case 4*MIN_AUCTION_TIME:
183 break;
184 default:
185 return;
186 }
187
188 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
190
191 Item* items[MAX_AUCTION_ITEMS];
192
193 uint32 finalCount = 0;
194 uint32 itemEntry = 0;
195
196 for (uint32 i = 0; i < itemsCount; ++i)
197 {
198 Item* item = _player->GetItemByGuid(itemGUIDs[i]);
199
200 if (!item)
201 {
203 return;
204 }
205
206 if (itemEntry == 0)
207 itemEntry = item->GetTemplate()->ItemId;
208
209 if (sAuctionMgr->GetAItem(item->GetGUID()) || !item->CanBeTraded() || item->IsNotEmptyBag() ||
211 item->GetCount() < count[i] || itemEntry != item->GetTemplate()->ItemId)
212 {
214 return;
215 }
216
217 items[i] = item;
218 finalCount += count[i];
219 }
220
221 if (!finalCount)
222 {
224 return;
225 }
226
227 // check if there are 2 identical guids, in this case user is most likely cheating
228 for (uint32 i = 0; i < itemsCount - 1; ++i)
229 {
230 for (uint32 j = i + 1; j < itemsCount; ++j)
231 {
232 if (itemGUIDs[i] == itemGUIDs[j])
233 {
235 return;
236 }
237 }
238 }
239
240 for (uint32 i = 0; i < itemsCount; ++i)
241 {
242 Item* item = items[i];
243
244 if (item->GetMaxStackCount() < finalCount)
245 {
247 return;
248 }
249 }
250
251 for (uint32 i = 0; i < itemsCount; ++i)
252 {
253 Item* item = items[i];
254
255 uint32 auctionTime = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
256 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
257
258 uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
259 if (!_player->HasEnoughMoney(deposit))
260 {
262 return;
263 }
264
265 _player->ModifyMoney(-int32(deposit));
266
267 AuctionEntry* AH = new AuctionEntry;