TrinityCore
WorldSession Class Reference

Player session in the World. More...

#include <WorldSession.h>

Classes

union  ConnectToKey
 
class  DosProtection
 

Public Member Functions

 WorldSession (uint32 id, std::string &&name, uint32 battlenetAccountId, std::shared_ptr< WorldSocket > sock, AccountTypes sec, uint8 expansion, time_t mute_time, std::string os, LocaleConstant locale, uint32 recruiter, bool isARecruiter)
 WorldSession constructor. More...
 
 ~WorldSession ()
 WorldSession destructor. More...
 
bool PlayerLoading () const
 
bool PlayerLogout () const
 
bool PlayerLogoutWithSave () const
 
bool PlayerRecentlyLoggedOut () const
 
bool PlayerDisconnected () const
 
bool IsAddonRegistered (const std::string &prefix) const
 
void SendPacket (WorldPacket const *packet, bool forced=false)
 Send a packet to the client. More...
 
void AddInstanceConnection (std::shared_ptr< WorldSocket > sock)
 
void SendNotification (char const *format,...) ATTR_PRINTF(2
 
void void SendNotification (uint32 stringId,...)
 
void SendPetNameInvalid (uint32 error, std::string const &name, DeclinedName *declinedName)
 
void SendPartyResult (PartyOperation operation, std::string const &member, PartyResult res, uint32 val=0)
 
void SendQueryTimeResponse ()
 
void SendAuthResponse (uint32 code, bool queued, uint32 queuePos=0)
 
void SendClientCacheVersion (uint32 version)
 
void SendAvailableHotfixes ()
 
void InitializeSession ()
 
void InitializeSessionCallback (LoginDatabaseQueryHolder *realmHolder, CharacterDatabaseQueryHolder *holder)
 
rbac::RBACDataGetRBACData ()
 
bool HasPermission (uint32 permissionId)
 
void LoadPermissions ()
 
QueryCallback LoadPermissionsAsync ()
 
void InvalidateRBACData ()
 
AccountTypes GetSecurity () const
 
uint32 GetAccountId () const
 
ObjectGuid GetAccountGUID () const
 
std::string const & GetAccountName () const
 
uint32 GetBattlenetAccountId () const
 
ObjectGuid GetBattlenetAccountGUID () const
 
PlayerGetPlayer () const
 
std::string const & GetPlayerName () const
 
std::string GetPlayerInfo () const
 
void SetSecurity (AccountTypes security)
 
std::string const & GetRemoteAddress () const
 
void SetPlayer (Player *player)
 
uint8 GetAccountExpansion () const
 
uint8 GetExpansion () const
 
std::string const & GetOS () const
 
bool CanAccessAlliedRaces () const
 
void InitWarden (SessionKey const &k)
 
void SetInQueue (bool state)
 Session in auth.queue currently. More...
 
bool isLogingOut () const
 Is the user engaged in a log out process? More...
 
void SetLogoutStartTime (time_t requestTime)
 Engage the logout process for the user. More...
 
bool ShouldLogOut (time_t currTime) const
 Is logout cooldown expired? More...
 
void LogoutPlayer (bool save)
 Log the player out More...
 
void KickPlayer ()
 Kick a player out of the World. More...
 
void QueuePacket (WorldPacket *new_packet)
 Add an incoming packet to the queue. More...
 
bool Update (uint32 diff, PacketFilter &updater)
 Update the WorldSession (triggered by World update) More...
 
void SendAuthWaitQue (uint32 position)
 Handle the authentication waiting queue (to be completed) More...
 
void SendSetTimeZoneInformation ()
 
void SendFeatureSystemStatus ()
 
void SendFeatureSystemStatusGlueScreen ()
 
void SendNameQueryOpcode (ObjectGuid guid)
 
void SendTrainerList (Creature *npc, uint32 trainerId)
 
void SendListInventory (ObjectGuid guid)
 
void SendShowBank (ObjectGuid guid)
 
bool CanOpenMailBox (ObjectGuid guid)
 
void SendShowMailBox (ObjectGuid guid)
 
void SendTabardVendorActivate (ObjectGuid guid)
 
void SendSpiritResurrect ()
 
void SendBindPoint (Creature *npc)
 
void SendOpenTransmogrifier (ObjectGuid const &guid)
 
void SendAttackStop (Unit const *enemy)
 
void SendTradeStatus (WorldPackets::Trade::TradeStatus &status)
 
void SendUpdateTrade (bool trader_data=true)
 
void SendCancelTrade ()
 
void SendPetitionQueryOpcode (ObjectGuid petitionguid)
 
void SendQueryPetNameResponse (ObjectGuid guid)
 
void SendStablePet (ObjectGuid guid)
 
void SendStablePetCallback (ObjectGuid guid, PreparedQueryResult result)
 
void SendPetStableResult (StableResult result)
 
bool CheckStableMaster (ObjectGuid guid)
 
AccountData const * GetAccountData (AccountDataType type) const
 
void SetAccountData (AccountDataType type, time_t time, std::string const &data)
 
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, AuctionCommand command, AuctionResult errorCode, Milliseconds delayForNextAction, InventoryResult bagError=InventoryResult(0))
 Notifies the client of the result of his last auction operation. It is called when the player bids, creates, or deletes an auction. More...
 
void SendAuctionClosedNotification (AuctionPosting const *auction, float mailDelay, bool sold)
 
void SendAuctionOwnerBidNotification (AuctionPosting const *auction)
 
void SendBlackMarketOpenResult (ObjectGuid guid, Creature *auctioneer)
 
void SendBlackMarketBidOnItemResult (int32 result, int32 marketId, WorldPackets::Item::ItemInstance &item)
 
void SendBlackMarketWonNotification (BlackMarketEntry const *entry, Item const *item)
 
void SendBlackMarketOutbidNotification (BlackMarketTemplate const *templ)
 
void SendEnchantmentLog (ObjectGuid owner, ObjectGuid caster, ObjectGuid itemGuid, uint32 itemId, uint32 enchantId, uint32 enchantSlot)
 
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 SendPetitionShowList (ObjectGuid guid)
 
void DoLootRelease (ObjectGuid lguid)
 
void DoLootReleaseAll ()
 
bool CanSpeak () const
 
LocaleConstant GetSessionDbcLocale () const
 
LocaleConstant GetSessionDbLocaleIndex () const
 
char const * GetTrinityString (uint32 entry) const
 
uint32 GetLatency () const
 
void SetLatency (uint32 latency)
 
void ResetClientTimeDelay ()
 
void ResetTimeOutTime (bool onlyActive)
 
bool IsConnectionIdle () const
 
uint32 GetRecruiterId () const
 
bool IsARecruiter () const
 
BattlePetMgrGetBattlePetMgr () const
 
CollectionMgrGetCollectionMgr () const
 
void Handle_NULL (WorldPackets::Null &null)
 
void Handle_EarlyProccess (WorldPackets::Null &null)
 
void LogUnprocessedTail (WorldPacket const *packet)
 Logging helper for unexpected opcodes. More...
 
void HandleCharEnum (CharacterDatabaseQueryHolder *holder)
 
void HandleCharEnumOpcode (WorldPackets::Character::EnumCharacters &)
 
void HandleCharUndeleteEnumOpcode (WorldPackets::Character::EnumCharacters &)
 
void HandleCharDeleteOpcode (WorldPackets::Character::CharDelete &charDelete)
 
void HandleCharCreateOpcode (WorldPackets::Character::CreateCharacter &charCreate)
 
void HandlePlayerLoginOpcode (WorldPackets::Character::PlayerLogin &playerLogin)
 
void SendConnectToInstance (WorldPackets::Auth::ConnectToSerial serial)
 
void HandleContinuePlayerLogin ()
 
void AbortLogin (WorldPackets::Character::LoginFailureReason reason)
 
void HandleLoadScreenOpcode (WorldPackets::Character::LoadingScreenNotify &loadingScreenNotify)
 
void HandlePlayerLogin (LoginQueryHolder *holder)
 
void HandleCheckCharacterNameAvailability (WorldPackets::Character::CheckCharacterNameAvailability &checkCharacterNameAvailability)
 
void HandleCharRenameOpcode (WorldPackets::Character::CharacterRenameRequest &request)
 
void HandleCharRenameCallBack (std::shared_ptr< WorldPackets::Character::CharacterRenameInfo > renameInfo, PreparedQueryResult result)
 
void HandleSetPlayerDeclinedNames (WorldPackets::Character::SetPlayerDeclinedNames &packet)
 
void HandleAlterAppearance (WorldPackets::Character::AlterApperance &packet)
 
void HandleCharCustomizeOpcode (WorldPackets::Character::CharCustomize &packet)
 
void HandleCharCustomizeCallback (std::shared_ptr< WorldPackets::Character::CharCustomizeInfo > customizeInfo, PreparedQueryResult result)
 
void HandleCharRaceOrFactionChangeOpcode (WorldPackets::Character::CharRaceOrFactionChange &packet)
 
void HandleCharRaceOrFactionChangeCallback (std::shared_ptr< WorldPackets::Character::CharRaceOrFactionChangeInfo > factionChangeInfo, PreparedQueryResult result)
 
void HandleRandomizeCharNameOpcode (WorldPackets::Character::GenerateRandomCharacterName &packet)
 
void HandleReorderCharacters (WorldPackets::Character::ReorderCharacters &reorderChars)
 
void HandleOpeningCinematic (WorldPackets::Misc::OpeningCinematic &packet)
 
void HandleGetUndeleteCooldownStatus (WorldPackets::Character::GetUndeleteCharacterCooldownStatus &)
 
void HandleUndeleteCooldownStatusCallback (PreparedQueryResult result)
 
void HandleCharUndeleteOpcode (WorldPackets::Character::UndeleteCharacter &undeleteInfo)
 
bool MeetsChrCustomizationReq (ChrCustomizationReqEntry const *req, Classes playerClass, bool checkRequiredDependentChoices, Trinity::IteratorPair< UF::ChrCustomizationChoice const *> selectedChoices) const
 
bool ValidateAppearance (Races race, Classes playerClass, Gender gender, Trinity::IteratorPair< UF::ChrCustomizationChoice const *> customizations)
 
void SendCharCreate (ResponseCodes result, ObjectGuid const &guid=ObjectGuid::Empty)
 
void SendCharDelete (ResponseCodes result)
 
void SendCharRename (ResponseCodes result, WorldPackets::Character::CharacterRenameInfo const *renameInfo)
 
void SendCharCustomize (ResponseCodes result, WorldPackets::Character::CharCustomizeInfo const *customizeInfo)
 
void SendCharFactionChange (ResponseCodes result, WorldPackets::Character::CharRaceOrFactionChangeInfo const *factionChangeInfo)
 
void SendSetPlayerDeclinedNamesResult (DeclinedNameResult result, ObjectGuid guid)
 
void SendUndeleteCooldownStatusResponse (uint32 currentCooldown, uint32 maxCooldown)
 
void SendUndeleteCharacterResponse (CharacterUndeleteResult result, WorldPackets::Character::CharacterUndeleteInfo const *undeleteInfo)
 
void HandlePlayedTime (WorldPackets::Character::RequestPlayedTime &packet)
 
void HandlePortGraveyard (WorldPackets::Misc::PortGraveyard &packet)
 
void HandleRequestCemeteryList (WorldPackets::Misc::RequestCemeteryList &packet)
 
void HandleInspectOpcode (WorldPackets::Inspect::Inspect &inspect)
 
void HandleQueryInspectAchievements (WorldPackets::Inspect::QueryInspectAchievements &inspect)
 
void HandleMountSpecialAnimOpcode (WorldPackets::Misc::MountSpecial &mountSpecial)
 
void HandleRepairItemOpcode (WorldPackets::Item::RepairItem &packet)
 
void HandleMoveKnockBackAck (WorldPackets::Movement::MoveKnockBackAck &movementAck)
 
void HandleMoveTeleportAck (WorldPackets::Movement::MoveTeleportAck &packet)
 
void HandleForceSpeedChangeAck (WorldPackets::Movement::MovementSpeedAck &packet)
 
void HandleSetCollisionHeightAck (WorldPackets::Movement::MoveSetCollisionHeightAck &setCollisionHeightAck)
 
void HandleMoveApplyMovementForceAck (WorldPackets::Movement::MoveApplyMovementForceAck &moveApplyMovementForceAck)
 
void HandleMoveRemoveMovementForceAck (WorldPackets::Movement::MoveRemoveMovementForceAck &moveRemoveMovementForceAck)
 
void HandleMoveSetModMovementForceMagnitudeAck (WorldPackets::Movement::MovementSpeedAck &setModMovementForceMagnitudeAck)
 
void HandleRepopRequest (WorldPackets::Misc::RepopRequest &packet)
 
void HandleAutostoreLootItemOpcode (WorldPackets::Loot::LootItem &packet)
 
void HandleLootMoneyOpcode (WorldPackets::Loot::LootMoney &packet)
 
void HandleLootOpcode (WorldPackets::Loot::LootUnit &packet)
 
void HandleLootReleaseOpcode (WorldPackets::Loot::LootRelease &packet)
 
void HandleLootMasterGiveOpcode (WorldPackets::Loot::MasterLootItem &masterLootItem)
 
void HandleSetLootSpecialization (WorldPackets::Loot::SetLootSpecialization &packet)
 
void HandleWhoOpcode (WorldPackets::Who::WhoRequestPkt &whoRequest)
 
void HandleLogoutRequestOpcode (WorldPackets::Character::LogoutRequest &logoutRequest)
 
void HandleLogoutCancelOpcode (WorldPackets::Character::LogoutCancel &logoutCancel)
 
void HandleGMTicketGetCaseStatusOpcode (WorldPackets::Ticket::GMTicketGetCaseStatus &packet)
 
void HandleGMTicketSystemStatusOpcode (WorldPackets::Ticket::GMTicketGetSystemStatus &packet)
 
void HandleSubmitUserFeedback (WorldPackets::Ticket::SubmitUserFeedback &userFeedback)
 
void HandleSupportTicketSubmitComplaint (WorldPackets::Ticket::SupportTicketSubmitComplaint &packet)
 
void HandleBugReportOpcode (WorldPackets::Ticket::BugReport &bugReport)
 
void HandleComplaint (WorldPackets::Ticket::Complaint &packet)
 
void HandleTogglePvP (WorldPackets::Misc::TogglePvP &packet)
 
void HandleSetPvP (WorldPackets::Misc::SetPvP &packet)
 
void HandleSetSelectionOpcode (WorldPackets::Misc::SetSelection &packet)
 
void HandleStandStateChangeOpcode (WorldPackets::Misc::StandStateChange &packet)
 
void HandleEmoteOpcode (WorldPackets::Chat::EmoteClient &packet)
 
void HandleContactListOpcode (WorldPackets::Social::SendContactList &packet)
 
void HandleAddFriendOpcode (WorldPackets::Social::AddFriend &packet)
 
void HandleDelFriendOpcode (WorldPackets::Social::DelFriend &packet)
 
void HandleAddIgnoreOpcode (WorldPackets::Social::AddIgnore &packet)
 
void HandleDelIgnoreOpcode (WorldPackets::Social::DelIgnore &packet)
 
void HandleSetContactNotesOpcode (WorldPackets::Social::SetContactNotes &packet)
 
void HandleAreaTriggerOpcode (WorldPackets::AreaTrigger::AreaTrigger &packet)
 
void HandleSetFactionAtWar (WorldPackets::Character::SetFactionAtWar &packet)
 
void HandleSetFactionNotAtWar (WorldPackets::Character::SetFactionNotAtWar &packet)
 
void HandleSetFactionCheat (WorldPacket &recvData)
 
void HandleSetWatchedFactionOpcode (WorldPackets::Character::SetWatchedFaction &packet)
 
void HandleSetFactionInactiveOpcode (WorldPackets::Character::SetFactionInactive &packet)
 
void HandleRequestForcedReactionsOpcode (WorldPackets::Reputation::RequestForcedReactions &requestForcedReactions)
 
void HandleUpdateAccountData (WorldPackets::ClientConfig::UserClientUpdateAccountData &packet)
 
void HandleRequestAccountData (WorldPackets::ClientConfig::RequestAccountData &request)
 
void HandleSetAdvancedCombatLogging (WorldPackets::ClientConfig::SetAdvancedCombatLogging &setAdvancedCombatLogging)
 
void HandleSetActionButtonOpcode (WorldPackets::Spells::SetActionButton &packet)
 
void HandleGameObjectUseOpcode (WorldPackets::GameObject::GameObjUse &packet)
 
void HandleGameobjectReportUse (WorldPackets::GameObject::GameObjReportUse &packet)
 
void HandleNameQueryOpcode (WorldPackets::Query::QueryPlayerName &packet)
 
void HandleQueryTimeOpcode (WorldPackets::Query::QueryTime &queryTime)
 
void HandleCreatureQuery (WorldPackets::Query::QueryCreature &packet)
 Only static data is sent in this packet !!! More...
 
void HandleGameObjectQueryOpcode (WorldPackets::Query::QueryGameObject &packet)
 Only static data is sent in this packet !!! More...
 
void HandleDBQueryBulk (WorldPackets::Hotfix::DBQueryBulk &dbQuery)
 
void HandleHotfixRequest (WorldPackets::Hotfix::HotfixRequest &hotfixQuery)
 
void HandleMoveWorldportAckOpcode (WorldPackets::Movement::WorldPortResponse &packet)
 
void HandleMoveWorldportAck ()
 
void HandleSuspendTokenResponse (WorldPackets::Movement::SuspendTokenResponse &suspendTokenResponse)
 
void HandleMovementOpcodes (WorldPackets::Movement::ClientPlayerMovement &packet)
 
void HandleMovementOpcode (OpcodeClient opcode, MovementInfo &movementInfo)
 
void HandleSetActiveMoverOpcode (WorldPackets::Movement::SetActiveMover &packet)
 
void HandleMoveDismissVehicle (WorldPackets::Vehicle::MoveDismissVehicle &moveDismissVehicle)
 
void HandleRequestVehiclePrevSeat (WorldPackets::Vehicle::RequestVehiclePrevSeat &requestVehiclePrevSeat)
 
void HandleRequestVehicleNextSeat (WorldPackets::Vehicle::RequestVehicleNextSeat &requestVehicleNextSeat)
 
void HandleMoveChangeVehicleSeats (WorldPackets::Vehicle::MoveChangeVehicleSeats &moveChangeVehicleSeats)
 
void HandleRequestVehicleSwitchSeat (WorldPackets::Vehicle::RequestVehicleSwitchSeat &requestVehicleSwitchSeat)
 
void HandleRideVehicleInteract (WorldPackets::Vehicle::RideVehicleInteract &rideVehicleInteract)
 
void HandleEjectPassenger (WorldPackets::Vehicle::EjectPassenger &ejectPassenger)
 
void HandleRequestVehicleExit (WorldPackets::Vehicle::RequestVehicleExit &requestVehicleExit)
 
void HandleMoveSetVehicleRecAck (WorldPackets::Vehicle::MoveSetVehicleRecIdAck &setVehicleRecIdAck)
 
void HandleMoveTimeSkippedOpcode (WorldPackets::Movement::MoveTimeSkipped &moveTimeSkipped)
 
void HandleMovementAckMessage (WorldPackets::Movement::MovementAckMessage &movementAck)
 
void HandleRequestRaidInfoOpcode (WorldPackets::Party::RequestRaidInfo &packet)
 
void HandlePartyInviteOpcode (WorldPackets::Party::PartyInviteClient &packet)
 
void HandlePartyInviteResponseOpcode (WorldPackets::Party::PartyInviteResponse &packet)
 
void HandlePartyUninviteOpcode (WorldPackets::Party::PartyUninvite &packet)
 
void HandleSetPartyLeaderOpcode (WorldPackets::Party::SetPartyLeader &packet)
 
void HandleSetRoleOpcode (WorldPackets::Party::SetRole &packet)
 
void HandleLeaveGroupOpcode (WorldPackets::Party::LeaveGroup &packet)
 
void HandleOptOutOfLootOpcode (WorldPackets::Party::OptOutOfLoot &packet)
 
void HandleSetLootMethodOpcode (WorldPackets::Party::SetLootMethod &packet)
 
void HandleLootRoll (WorldPackets::Loot::LootRoll &packet)
 
void HandleRequestPartyMemberStatsOpcode (WorldPackets::Party::RequestPartyMemberStats &packet)
 
void HandleUpdateRaidTargetOpcode (WorldPackets::Party::UpdateRaidTarget &packet)
 
void HandleDoReadyCheckOpcode (WorldPackets::Party::DoReadyCheck &packet)
 
void HandleReadyCheckResponseOpcode (WorldPackets::Party::ReadyCheckResponseClient &packet)
 
void HandleConvertRaidOpcode (WorldPackets::Party::ConvertRaid &packet)
 
void HandleRequestPartyJoinUpdates (WorldPackets::Party::RequestPartyJoinUpdates &packet)
 
void HandleChangeSubGroupOpcode (WorldPackets::Party::ChangeSubGroup &packet)
 
void HandleSwapSubGroupsOpcode (WorldPackets::Party::SwapSubGroups &packet)
 
void HandleSetAssistantLeaderOpcode (WorldPackets::Party::SetAssistantLeader &packet)
 
void HandleSetPartyAssignment (WorldPackets::Party::SetPartyAssignment &packet)
 
void HandleInitiateRolePoll (WorldPackets::Party::InitiateRolePoll &packet)
 
void HandleSetEveryoneIsAssistant (WorldPackets::Party::SetEveryoneIsAssistant &packet)
 
void HandleClearRaidMarker (WorldPackets::Party::ClearRaidMarker &packet)
 
void HandlePetitionBuy (WorldPackets::Petition::PetitionBuy &packet)
 
void HandlePetitionShowSignatures (WorldPackets::Petition::PetitionShowSignatures &packet)
 
void SendPetitionSigns (Petition const *petition, Player *sendTo)
 
void HandleQueryPetition (WorldPackets::Petition::QueryPetition &packet)
 
void HandlePetitionRenameGuild (WorldPackets::Petition::PetitionRenameGuild &packet)
 
void HandleSignPetition (WorldPackets::Petition::SignPetition &packet)
 
void HandleDeclinePetition (WorldPackets::Petition::DeclinePetition &packet)
 
void HandleOfferPetition (WorldPackets::Petition::OfferPetition &packet)
 
void HandleTurnInPetition (WorldPackets::Petition::TurnInPetition &packet)
 
void HandleGuildQueryOpcode (WorldPackets::Guild::QueryGuildInfo &query)
 
void HandleGuildInviteByName (WorldPackets::Guild::GuildInviteByName &packet)
 
void HandleGuildOfficerRemoveMember (WorldPackets::Guild::GuildOfficerRemoveMember &packet)
 
void HandleGuildAcceptInvite (WorldPackets::Guild::AcceptGuildInvite &invite)
 
void HandleGuildDeclineInvitation (WorldPackets::Guild::GuildDeclineInvitation &decline)
 
void HandleGuildEventLogQuery (WorldPackets::Guild::GuildEventLogQuery &packet)
 
void HandleGuildGetRoster (WorldPackets::Guild::GuildGetRoster &packet)
 
void HandleRequestGuildRewardsList (WorldPackets::Guild::RequestGuildRewardsList &packet)
 
void HandleGuildPromoteMember (WorldPackets::Guild::GuildPromoteMember &promote)
 
void HandleGuildDemoteMember (WorldPackets::Guild::GuildDemoteMember &demote)
 
void HandleGuildAssignRank (WorldPackets::Guild::GuildAssignMemberRank &packet)
 
void HandleGuildLeave (WorldPackets::Guild::GuildLeave &leave)
 
void HandleGuildDelete (WorldPackets::Guild::GuildDelete &packet)
 
void HandleGuildReplaceGuildMaster (WorldPackets::Guild::GuildReplaceGuildMaster &replaceGuildMaster)
 
void HandleGuildSetAchievementTracking (WorldPackets::Guild::GuildSetAchievementTracking &packet)
 
void HandleGuildGetAchievementMembers (WorldPackets::Achievement::GuildGetAchievementMembers &getAchievementMembers)
 
void HandleGuildSetGuildMaster (WorldPackets::Guild::GuildSetGuildMaster &packet)
 
void HandleGuildUpdateMotdText (WorldPackets::Guild::GuildUpdateMotdText &packet)
 
void HandleGuildNewsUpdateSticky (WorldPackets::Guild::GuildNewsUpdateSticky &packet)
 
void HandleGuildSetMemberNote (WorldPackets::Guild::GuildSetMemberNote &packet)
 
void HandleGuildGetRanks (WorldPackets::Guild::GuildGetRanks &packet)
 
void HandleGuildQueryNews (WorldPackets::Guild::GuildQueryNews &newsQuery)
 
void HandleGuildSetRankPermissions (WorldPackets::Guild::GuildSetRankPermissions &packet)
 
void HandleGuildAddRank (WorldPackets::Guild::GuildAddRank &packet)
 
void HandleGuildDeleteRank (WorldPackets::Guild::GuildDeleteRank &packet)
 
void HandleGuildUpdateInfoText (WorldPackets::Guild::GuildUpdateInfoText &packet)
 
void HandleSaveGuildEmblem (WorldPackets::Guild::SaveGuildEmblem &packet)
 
void HandleGuildRequestPartyState (WorldPackets::Guild::RequestGuildPartyState &packet)
 
void HandleGuildChallengeUpdateRequest (WorldPackets::Guild::GuildChallengeUpdateRequest &packet)
 
void HandleDeclineGuildInvites (WorldPackets::Guild::DeclineGuildInvites &packet)
 
void HandleGuildFinderAddRecruit (WorldPackets::GuildFinder::LFGuildAddRecruit &lfGuildAddRecruit)
 
void HandleGuildFinderBrowse (WorldPackets::GuildFinder::LFGuildBrowse &lfGuildBrowse)
 
void HandleGuildFinderDeclineRecruit (WorldPackets::GuildFinder::LFGuildDeclineRecruit &lfGuildDeclineRecruit)
 
void HandleGuildFinderGetApplications (WorldPackets::GuildFinder::LFGuildGetApplications &lfGuildGetApplications)
 
void HandleGuildFinderGetGuildPost (WorldPackets::GuildFinder::LFGuildGetGuildPost &lfGuildGetGuildPost)
 
void HandleGuildFinderGetRecruits (WorldPackets::GuildFinder::LFGuildGetRecruits &lfGuildGetRecruits)
 
void HandleGuildFinderRemoveRecruit (WorldPackets::GuildFinder::LFGuildRemoveRecruit &lfGuildRemoveRecruit)
 
void HandleGuildFinderSetGuildPost (WorldPackets::GuildFinder::LFGuildSetGuildPost &lfGuildSetGuildPost)
 
void HandleEnableTaxiNodeOpcode (WorldPackets::Taxi::EnableTaxiNode &enableTaxiNode)
 
void HandleTaxiNodeStatusQueryOpcode (WorldPackets::Taxi::TaxiNodeStatusQuery &taxiNodeStatusQuery)
 
void HandleTaxiQueryAvailableNodesOpcode (WorldPackets::Taxi::TaxiQueryAvailableNodes &taxiQueryAvailableNodes)
 
void HandleActivateTaxiOpcode (WorldPackets::Taxi::ActivateTaxi &activateTaxi)
 
void HandleMoveSplineDoneOpcode (WorldPackets::Movement::MoveSplineDone &moveSplineDone)
 
void SendActivateTaxiReply (ActivateTaxiReply reply)
 
void HandleTaxiRequestEarlyLanding (WorldPackets::Taxi::TaxiRequestEarlyLanding &taxiRequestEarlyLanding)
 
void HandleTabardVendorActivateOpcode (WorldPackets::NPC::Hello &packet)
 
void HandleBankerActivateOpcode (WorldPackets::NPC::Hello &packet)
 
void HandleTrainerListOpcode (WorldPackets::NPC::Hello &packet)
 
void HandleTrainerBuySpellOpcode (WorldPackets::NPC::TrainerBuySpell &packet)
 
void HandlePetitionShowList (WorldPackets::Petition::PetitionShowList &packet)
 
void HandleGossipHelloOpcode (WorldPackets::NPC::Hello &packet)
 
void HandleGossipSelectOptionOpcode (WorldPackets::NPC::GossipSelectOption &packet)
 
void HandleSpiritHealerActivate (WorldPackets::NPC::SpiritHealerActivate &packet)
 
void HandleNpcTextQueryOpcode (WorldPackets::Query::QueryNPCText &packet)
 
void HandleBinderActivateOpcode (WorldPackets::NPC::Hello &packet)
 
void HandleRequestStabledPets (WorldPackets::NPC::RequestStabledPets &packet)
 
void HandleStablePet (WorldPacket &recvPacket)
 
void HandleStablePetCallback (PreparedQueryResult result)
 
void HandleUnstablePet (WorldPacket &recvPacket)
 
void HandleUnstablePetCallback (uint32 petId, PreparedQueryResult result)
 
void HandleBuyStableSlot (WorldPacket &recvPacket)
 
void HandleStableRevivePet (WorldPacket &recvPacket)
 
void HandleStableSwapPet (WorldPacket &recvPacket)
 
void HandleStableSwapPetCallback (uint32 petId, PreparedQueryResult result)
 
void HandleCanDuel (WorldPackets::Duel::CanDuel &packet)
 
void HandleDuelResponseOpcode (WorldPackets::Duel::DuelResponse &duelResponse)
 
void HandleDuelAccepted ()
 
void HandleDuelCancelled ()
 
void HandleAcceptTradeOpcode (WorldPackets::Trade::AcceptTrade &acceptTrade)
 
void HandleBeginTradeOpcode (WorldPackets::Trade::BeginTrade &beginTrade)
 
void HandleBusyTradeOpcode (WorldPackets::Trade::BusyTrade &busyTrade)
 
void HandleCancelTradeOpcode (WorldPackets::Trade::CancelTrade &cancelTrade)
 
void HandleClearTradeItemOpcode (WorldPackets::Trade::ClearTradeItem &clearTradeItem)
 
void HandleIgnoreTradeOpcode (WorldPackets::Trade::IgnoreTrade &ignoreTrade)
 
void HandleInitiateTradeOpcode (WorldPackets::Trade::InitiateTrade &initiateTrade)
 
void HandleSetTradeCurrencyOpcode (WorldPackets::Trade::SetTradeCurrency &setTradeCurrency)
 
void HandleSetTradeGoldOpcode (WorldPackets::Trade::SetTradeGold &setTradeGold)
 
void HandleSetTradeItemOpcode (WorldPackets::Trade::SetTradeItem &setTradeItem)
 
void HandleUnacceptTradeOpcode (WorldPackets::Trade::UnacceptTrade &unacceptTrade)
 
void HandleAuctionBrowseQuery (WorldPackets::AuctionHouse::AuctionBrowseQuery &browseQuery)
 
void HandleAuctionCancelCommoditiesPurchase (WorldPackets::AuctionHouse::AuctionCancelCommoditiesPurchase &cancelCommoditiesPurchase)
 
void HandleAuctionConfirmCommoditiesPurchase (WorldPackets::AuctionHouse::AuctionConfirmCommoditiesPurchase &confirmCommoditiesPurchase)
 
void HandleAuctionGetCommodityQuote (WorldPackets::AuctionHouse::AuctionGetCommodityQuote &startCommoditiesPurchase)
 
void HandleAuctionHelloOpcode (WorldPackets::AuctionHouse::AuctionHelloRequest &hello)
 
void HandleAuctionListBiddedItems (WorldPackets::AuctionHouse::AuctionListBiddedItems &listBiddedItems)
 
void HandleAuctionListBucketsByBucketKeys (WorldPackets::AuctionHouse::AuctionListBucketsByBucketKeys &listBucketsByBucketKeys)
 
void HandleAuctionListItemsByBucketKey (WorldPackets::AuctionHouse::AuctionListItemsByBucketKey &listItemsByBucketKey)
 
void HandleAuctionListItemsByItemID (WorldPackets::AuctionHouse::AuctionListItemsByItemID &listItemsByItemID)
 
void HandleAuctionListOwnedItems (WorldPackets::AuctionHouse::AuctionListOwnedItems &listOwnedItems)
 
void HandleAuctionPlaceBid (WorldPackets::AuctionHouse::AuctionPlaceBid &placeBid)
 
void HandleAuctionRemoveItem (WorldPackets::AuctionHouse::AuctionRemoveItem &removeItem)
 
void HandleAuctionReplicateItems (WorldPackets::AuctionHouse::AuctionReplicateItems &replicateItems)
 
void HandleAuctionSellCommodity (WorldPackets::AuctionHouse::AuctionSellCommodity &sellCommodity)
 
void HandleAuctionSellItem (WorldPackets::AuctionHouse::AuctionSellItem &sellItem)
 
void HandleAuctionSetFavoriteItem (WorldPackets::AuctionHouse::AuctionSetFavoriteItem &setFavoriteItem)
 
void HandleAutoBankItemOpcode (WorldPackets::Bank::AutoBankItem &packet)
 
void HandleAutoStoreBankItemOpcode (WorldPackets::Bank::AutoStoreBankItem &packet)
 
void HandleBuyBankSlotOpcode (WorldPackets::Bank::BuyBankSlot &packet)
 
void HandleBlackMarketOpen (WorldPackets::BlackMarket::BlackMarketOpen &blackMarketOpen)
 
void HandleBlackMarketRequestItems (WorldPackets::BlackMarket::BlackMarketRequestItems &blackMarketRequestItems)
 
void HandleBlackMarketBidOnItem (WorldPackets::BlackMarket::BlackMarketBidOnItem &blackMarketBidOnItem)
 
void HandleGetMailList (WorldPackets::Mail::MailGetList &packet)
 
void HandleSendMail (WorldPackets::Mail::SendMail &packet)
 
void HandleMailTakeMoney (WorldPackets::Mail::MailTakeMoney &packet)
 
void HandleMailTakeItem (WorldPackets::Mail::MailTakeItem &packet)
 
void HandleMailMarkAsRead (WorldPackets::Mail::MailMarkAsRead &packet)
 
void HandleMailReturnToSender (WorldPackets::Mail::MailReturnToSender &packet)
 
void HandleMailDelete (WorldPackets::Mail::MailDelete &packet)
 
void HandleItemTextQuery (WorldPackets::Query::ItemTextQuery &itemTextQuery)
 
void HandleMailCreateTextItem (WorldPackets::Mail::MailCreateTextItem &packet)
 
void HandleQueryNextMailTime (WorldPackets::Mail::MailQueryNextMailTime &packet)
 
void HandleCancelChanneling (WorldPackets::Spells::CancelChannelling &cancelChanneling)
 
void HandleSplitItemOpcode (WorldPackets::Item::SplitItem &splitItem)
 
void HandleSwapInvItemOpcode (WorldPackets::Item::SwapInvItem &swapInvItem)
 
void HandleDestroyItemOpcode (WorldPackets::Item::DestroyItem &destroyItem)
 
void HandleAutoEquipItemOpcode (WorldPackets::Item::AutoEquipItem &autoEquipItem)
 
void HandleSellItemOpcode (WorldPackets::Item::SellItem &packet)
 
void HandleBuyItemOpcode (WorldPackets::Item::BuyItem &packet)
 
void HandleListInventoryOpcode (WorldPackets::NPC::Hello &packet)
 
void HandleAutoStoreBagItemOpcode (WorldPackets::Item::AutoStoreBagItem &packet)
 
void HandleReadItem (WorldPackets::Item::ReadItem &readItem)
 
void HandleAutoEquipItemSlotOpcode (WorldPackets::Item::AutoEquipItemSlot &autoEquipItemSlot)
 
void HandleSwapItem (WorldPackets::Item::SwapItem &swapItem)
 
void HandleBuybackItem (WorldPackets::Item::BuyBackItem &packet)
 
void HandleWrapItem (WorldPackets::Item::WrapItem &packet)
 
void HandleUseCritterItem (WorldPackets::Item::UseCritterItem &packet)
 
void HandleAttackSwingOpcode (WorldPackets::Combat::AttackSwing &packet)
 
void HandleAttackStopOpcode (WorldPackets::Combat::AttackStop &packet)
 
void HandleSetSheathedOpcode (WorldPackets::Combat::SetSheathed &packet)
 
void HandleUseItemOpcode (WorldPackets::Spells::UseItem &packet)
 
void HandleOpenItemOpcode (WorldPackets::Spells::OpenItem &packet)
 
void HandleOpenWrappedItemCallback (uint16 pos, ObjectGuid itemGuid, PreparedQueryResult result)
 
void HandleCastSpellOpcode (WorldPackets::Spells::CastSpell &castRequest)
 
void HandleCancelCastOpcode (WorldPackets::Spells::CancelCast &packet)
 
void HandleCancelAuraOpcode (WorldPackets::Spells::CancelAura &cancelAura)
 
void HandleCancelGrowthAuraOpcode (WorldPackets::Spells::CancelGrowthAura &cancelGrowthAura)
 
void HandleCancelMountAuraOpcode (WorldPackets::Spells::CancelMountAura &cancelMountAura)
 
void HandleCancelAutoRepeatSpellOpcode (WorldPackets::Spells::CancelAutoRepeatSpell &cancelAutoRepeatSpell)
 
void HandleMissileTrajectoryCollision (WorldPackets::Spells::MissileTrajectoryCollision &packet)
 
void HandleUpdateMissileTrajectory (WorldPackets::Spells::UpdateMissileTrajectory &packet)
 
void HandleLearnPvpTalentsOpcode (WorldPackets::Talent::LearnPvpTalents &packet)
 
void HandleLearnTalentsOpcode (WorldPackets::Talent::LearnTalents &packet)
 
void HandleConfirmRespecWipeOpcode (WorldPackets::Talent::ConfirmRespecWipe &confirmRespecWipe)
 
void HandleUnlearnSkillOpcode (WorldPackets::Spells::UnlearnSkill &packet)
 
void HandleQuestgiverStatusQueryOpcode (WorldPackets::Quest::QuestGiverStatusQuery &packet)
 
void HandleQuestgiverStatusMultipleQuery (WorldPackets::Quest::QuestGiverStatusMultipleQuery &packet)
 
void HandleQuestgiverHelloOpcode (WorldPackets::Quest::QuestGiverHello &packet)
 
void HandleQuestgiverAcceptQuestOpcode (WorldPackets::Quest::QuestGiverAcceptQuest &packet)
 
void HandleQuestgiverQueryQuestOpcode (WorldPackets::Quest::QuestGiverQueryQuest &packet)
 
void HandleQuestgiverChooseRewardOpcode (WorldPackets::Quest::QuestGiverChooseReward &packet)
 
void HandleQuestgiverRequestRewardOpcode (WorldPackets::Quest::QuestGiverRequestReward &packet)
 
void HandleQuestQueryOpcode (WorldPackets::Quest::QueryQuestInfo &packet)
 
void HandleQuestLogRemoveQuest (WorldPackets::Quest::QuestLogRemoveQuest &packet)
 
void HandleQuestConfirmAccept (WorldPackets::Quest::QuestConfirmAccept &packet)
 
void HandleQuestgiverCompleteQuest (WorldPackets::Quest::QuestGiverCompleteQuest &packet)
 
void HandleQuestgiverCloseQuest (WorldPackets::Quest::QuestGiverCloseQuest &questGiverCloseQuest)
 
void HandlePushQuestToParty (WorldPackets::Quest::PushQuestToParty &packet)
 
void HandleQuestPushResult (WorldPackets::Quest::QuestPushResult &packet)
 
void HandleRequestWorldQuestUpdate (WorldPackets::Quest::RequestWorldQuestUpdate &packet)
 
void HandlePlayerChoiceResponse (WorldPackets::Quest::ChoiceResponse &choiceResponse)
 
void HandleChatMessageOpcode (WorldPackets::Chat::ChatMessage &chatMessage)
 
void HandleChatMessageWhisperOpcode (WorldPackets::Chat::ChatMessageWhisper &chatMessageWhisper)
 
void HandleChatMessageChannelOpcode (WorldPackets::Chat::ChatMessageChannel &chatMessageChannel)
 
void HandleChatMessage (ChatMsg type, Language lang, std::string msg, std::string target="", Optional< ObjectGuid > channelGuid={})
 
void HandleChatAddonMessageOpcode (WorldPackets::Chat::ChatAddonMessage &chatAddonMessage)
 
void HandleChatAddonMessageTargetedOpcode (WorldPackets::Chat::ChatAddonMessageTargeted &chatAddonMessageTargeted)
 
void HandleChatAddonMessage (ChatMsg type, std::string prefix, std::string text, bool isLogged, std::string target="", Optional< ObjectGuid > channelGuid={})
 
void HandleChatMessageAFKOpcode (WorldPackets::Chat::ChatMessageAFK &chatMessageAFK)
 
void HandleChatMessageDNDOpcode (WorldPackets::Chat::ChatMessageDND &chatMessageDND)
 
void HandleChatMessageEmoteOpcode (WorldPackets::Chat::ChatMessageEmote &chatMessageEmote)
 
void SendChatPlayerNotfoundNotice (std::string const &name)
 
void SendPlayerAmbiguousNotice (std::string const &name)
 
void SendChatRestricted (ChatRestrictionType restriction)
 
void HandleTextEmoteOpcode (WorldPackets::Chat::CTextEmote &packet)
 
void HandleChatIgnoredOpcode (WorldPackets::Chat::ChatReportIgnored &chatReportIgnored)
 
void HandleUnregisterAllAddonPrefixesOpcode (WorldPackets::Chat::ChatUnregisterAllAddonPrefixes &packet)
 
void HandleAddonRegisteredPrefixesOpcode (WorldPackets::Chat::ChatRegisterAddonPrefixes &packet)
 
void HandleReclaimCorpse (WorldPackets::Misc::ReclaimCorpse &packet)
 
void HandleQueryCorpseLocation (WorldPackets::Query::QueryCorpseLocationFromClient &packet)
 
void HandleQueryCorpseTransport (WorldPackets::Query::QueryCorpseTransport &packet)
 
void HandleResurrectResponse (WorldPackets::Misc::ResurrectResponse &packet)
 
void HandleSummonResponseOpcode (WorldPackets::Movement::SummonResponse &packet)
 
void HandleJoinChannel (WorldPackets::Channel::JoinChannel &packet)
 
void HandleLeaveChannel (WorldPackets::Channel::LeaveChannel &packet)
 
void HandleChannelCommand (WorldPackets::Channel::ChannelCommand &packet)
 
void HandleChannelPlayerCommand (WorldPackets::Channel::ChannelPlayerCommand &packet)
 
void HandleChannelPassword (WorldPackets::Channel::ChannelPassword &channelPassword)
 
void HandleCompleteCinematic (WorldPackets::Misc::CompleteCinematic &packet)
 
void HandleNextCinematicCamera (WorldPackets::Misc::NextCinematicCamera &packet)
 
void HandleCompleteMovie (WorldPackets::Misc::CompleteMovie &packet)
 
void HandleQueryPageText (WorldPackets::Query::QueryPageText &packet)
 Only static data is sent in this packet !!! More...
 
void HandleTutorialFlag (WorldPackets::Misc::TutorialSetFlag &packet)
 
void HandlePetAction (WorldPackets::Pet::PetAction &packet)
 
void HandlePetStopAttack (WorldPackets::Pet::PetStopAttack &packet)
 
void HandlePetActionHelper (Unit *pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, Position const &pos)
 
void HandleQueryPetName (WorldPackets::Query::QueryPetName &packet)
 
void HandlePetSetAction (WorldPackets::Pet::PetSetAction &packet)
 
void HandlePetAbandon (WorldPackets::Pet::PetAbandon &packet)
 
void HandlePetRename (WorldPackets::Pet::PetRename &packet)
 
void HandlePetCancelAuraOpcode (WorldPackets::Spells::PetCancelAura &packet)
 
void HandlePetSpellAutocastOpcode (WorldPackets::Pet::PetSpellAutocast &packet)
 
void HandlePetCastSpellOpcode (WorldPackets::Spells::PetCastSpell &petCastSpell)
 
void HandleSetActionBarToggles (WorldPackets::Character::SetActionBarToggles &packet)
 
void HandleTotemDestroyed (WorldPackets::Totem::TotemDestroyed &totemDestroyed)
 
void HandleDismissCritter (WorldPackets::Pet::DismissCritter &dismissCritter)
 
void HandleBattlemasterHelloOpcode (WorldPackets::NPC::Hello &hello)
 
void HandleBattlemasterJoinOpcode (WorldPackets::Battleground::BattlemasterJoin &battlemasterJoin)
 
void HandlePVPLogDataOpcode (WorldPackets::Battleground::PVPLogDataRequest &pvpLogDataRequest)
 
void HandleBattleFieldPortOpcode (WorldPackets::Battleground::BattlefieldPort &battlefieldPort)
 
void HandleBattlefieldListOpcode (WorldPackets::Battleground::BattlefieldListRequest &battlefieldList)
 
void HandleBattlefieldLeaveOpcode (WorldPackets::Battleground::BattlefieldLeave &battlefieldLeave)
 
void HandleBattlemasterJoinArena (WorldPackets::Battleground::BattlemasterJoinArena &packet)
 
void HandleReportPvPAFK (WorldPackets::Battleground::ReportPvPPlayerAFK &reportPvPPlayerAFK)
 
void HandleRequestRatedPvpInfo (WorldPackets::Battleground::RequestRatedPvpInfo &packet)
 
void HandleGetPVPOptionsEnabled (WorldPackets::Battleground::GetPVPOptionsEnabled &getPvPOptionsEnabled)
 
void HandleRequestPvpReward (WorldPackets::Battleground::RequestPVPRewards &packet)
 
void HandleAreaSpiritHealerQueryOpcode (WorldPackets::Battleground::AreaSpiritHealerQuery &areaSpiritHealerQuery)
 
void HandleAreaSpiritHealerQueueOpcode (WorldPackets::Battleground::AreaSpiritHealerQueue &areaSpiritHealerQueue)
 
void HandleHearthAndResurrect (WorldPackets::Battleground::HearthAndResurrect &hearthAndResurrect)
 
void HandleRequestBattlefieldStatusOpcode (WorldPackets::Battleground::RequestBattlefieldStatus &requestBattlefieldStatus)
 
void SendBfInvitePlayerToWar (uint64 queueId, uint32 zoneId, uint32 acceptTime)
 This send to player windows for invite player to join the war. More...
 
void SendBfInvitePlayerToQueue (uint64 queueId, int8 battleState)
 This send invitation to player to join the queue. More...
 
void SendBfQueueInviteResponse (uint64 queueId, uint32 zoneId, int8 battleStatus, bool canQueue=true, bool loggingIn=false)
 This send packet for inform player that he join queue. More...
 
void SendBfEntered (uint64 queueId, bool relocated, bool onOffense)
 This is call when player accept to join war. More...
 
void SendBfLeaveMessage (uint64 queueId, int8 battleState, bool relocated, BFLeaveReason reason=BF_LEAVE_REASON_EXITED)
 This is call when player leave battlefield zone. More...
 
void HandleBfEntryInviteResponse (WorldPackets::Battlefield::BFMgrEntryInviteResponse &bfMgrEntryInviteResponse)
 Send by client on clicking in accept or refuse of invitation windows for join game. More...
 
void HandleBfQueueInviteResponse (WorldPackets::Battlefield::BFMgrQueueInviteResponse &bfMgrQueueInviteResponse)
 Send by client when he click on accept for queue. More...
 
void HandleBfQueueExitRequest (WorldPackets::Battlefield::BFMgrQueueExitRequest &bfMgrQueueExitRequest)
 
void HandleMinimapPingOpcode (WorldPackets::Party::MinimapPingClient &packet)
 
void HandleRandomRollOpcode (WorldPackets::Misc::RandomRollClient &packet)
 
void HandleFarSightOpcode (WorldPackets::Misc::FarSight &packet)
 
void HandleSetDungeonDifficultyOpcode (WorldPackets::Misc::SetDungeonDifficulty &setDungeonDifficulty)
 
void HandleSetRaidDifficultyOpcode (WorldPackets::Misc::SetRaidDifficulty &setRaidDifficulty)
 
void HandleSetTitleOpcode (WorldPackets::Character::SetTitle &packet)
 
void HandleTimeSyncResponse (WorldPackets::Misc::TimeSyncResponse &packet)
 
void HandleWhoIsOpcode (WorldPackets::Who::WhoIsRequest &packet)
 
void HandleResetInstancesOpcode (WorldPackets::Instance::ResetInstances &packet)
 
void HandleInstanceLockResponse (WorldPackets::Instance::InstanceLockResponse &packet)
 
void SendLfgPlayerLockInfo ()
 
void SendLfgPartyLockInfo ()
 
void HandleLfgJoinOpcode (WorldPackets::LFG::DFJoin &dfJoin)
 
void HandleLfgLeaveOpcode (WorldPackets::LFG::DFLeave &dfLeave)
 
void HandleLfgProposalResultOpcode (WorldPackets::LFG::DFProposalResponse &dfProposalResponse)
 
void HandleLfgSetRolesOpcode (WorldPackets::LFG::DFSetRoles &dfSetRoles)
 
void HandleLfgSetBootVoteOpcode (WorldPackets::LFG::DFBootPlayerVote &dfBootPlayerVote)
 
void HandleLfgTeleportOpcode (WorldPackets::LFG::DFTeleport &dfTeleport)
 
void HandleDFGetSystemInfo (WorldPackets::LFG::DFGetSystemInfo &dfGetSystemInfo)
 
void HandleDFGetJoinStatus (WorldPackets::LFG::DFGetJoinStatus &dfGetJoinStatus)
 
void SendLfgUpdateStatus (lfg::LfgUpdateData const &updateData, bool party)
 
void SendLfgRoleChosen (ObjectGuid guid, uint8 roles)
 
void SendLfgRoleCheckUpdate (lfg::LfgRoleCheck const &pRoleCheck)
 
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 (lfg::LfgTeleportResult err)
 
void HandleSelfResOpcode (WorldPackets::Spells::SelfRes &selfRes)
 
void HandleRequestPetInfo (WorldPackets::Pet::RequestPetInfo &packet)
 
void HandleSocketGems (WorldPackets::Item::SocketGems &socketGems)
 
void HandleSortBags (WorldPackets::Item::SortBags &sortBags)
 
void HandleSortBankBags (WorldPackets::Item::SortBankBags &sortBankBags)
 
void HandleSortReagentBankBags (WorldPackets::Item::SortReagentBankBags &sortReagentBankBags)
 
void HandleRemoveNewItem (WorldPackets::Item::RemoveNewItem &removeNewItem)
 
void HandleCancelTempEnchantmentOpcode (WorldPackets::Item::CancelTempEnchantment &cancelTempEnchantment)
 
void HandleGetItemPurchaseData (WorldPackets::Item::GetItemPurchaseData &packet)
 
void HandleItemRefund (WorldPackets::Item::ItemPurchaseRefund &packet)
 
void HandleSetTaxiBenchmark (WorldPackets::Misc::SetTaxiBenchmarkMode &packet)
 
void HandleGuildPermissionsQuery (WorldPackets::Guild::GuildPermissionsQuery &packet)
 
void HandleGuildBankMoneyWithdrawn (WorldPackets::Guild::GuildBankRemainingWithdrawMoneyQuery &packet)
 
void HandleGuildBankActivate (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 HandleDepositGuildBankItem (WorldPackets::Guild::DepositGuildBankItem &depositGuildBankItem)
 
void HandleStoreGuildBankItem (WorldPackets::Guild::StoreGuildBankItem &storeGuildBankItem)
 
void HandleSwapItemWithGuildBankItem (WorldPackets::Guild::SwapItemWithGuildBankItem &swapItemWithGuildBankItem)
 
void HandleSwapGuildBankItemWithGuildBankItem (WorldPackets::Guild::SwapGuildBankItemWithGuildBankItem &swapGuildBankItemWithGuildBankItem)
 
void HandleMoveGuildBankItem (WorldPackets::Guild::MoveGuildBankItem &moveGuildBankItem)
 
void HandleMergeItemWithGuildBankItem (WorldPackets::Guild::MergeItemWithGuildBankItem &mergeItemWithGuildBankItem)
 
void HandleSplitItemToGuildBank (WorldPackets::Guild::SplitItemToGuildBank &splitItemToGuildBank)
 
void HandleMergeGuildBankItemWithItem (WorldPackets::Guild::MergeGuildBankItemWithItem &mergeGuildBankItemWithItem)
 
void HandleSplitGuildBankItemToInventory (WorldPackets::Guild::SplitGuildBankItemToInventory &splitGuildBankItemToInventory)
 
void HandleAutoStoreGuildBankItem (WorldPackets::Guild::AutoStoreGuildBankItem &autoStoreGuildBankItem)
 
void HandleMergeGuildBankItemWithGuildBankItem (WorldPackets::Guild::MergeGuildBankItemWithGuildBankItem &mergeGuildBankItemWithGuildBankItem)
 
void HandleSplitGuildBankItem (WorldPackets::Guild::SplitGuildBankItem &splitGuildBankItem)
 
void HandleGuildBankUpdateTab (WorldPackets::Guild::GuildBankUpdateTab &packet)
 
void HandleGuildBankBuyTab (WorldPackets::Guild::GuildBankBuyTab &packet)
 
void HandleGuildBankTextQuery (WorldPackets::Guild::GuildBankTextQuery &packet)
 
void HandleGuildBankSetTabText (WorldPackets::Guild::GuildBankSetTabText &packet)
 
void HandleCalendarGetCalendar (WorldPackets::Calendar::CalendarGetCalendar &calendarGetCalendar)
 
void HandleCalendarGetEvent (WorldPackets::Calendar::CalendarGetEvent &calendarGetEvent)
 
void HandleCalendarCommunityInvite (WorldPackets::Calendar::CalendarCommunityInviteRequest &calendarCommunityInvite)
 
void HandleCalendarAddEvent (WorldPackets::Calendar::CalendarAddEvent &calendarAddEvent)
 
void HandleCalendarUpdateEvent (WorldPackets::Calendar::CalendarUpdateEvent &calendarUpdateEvent)
 
void HandleCalendarRemoveEvent (WorldPackets::Calendar::CalendarRemoveEvent &calendarRemoveEvent)
 
void HandleCalendarCopyEvent (WorldPackets::Calendar::CalendarCopyEvent &calendarCopyEvent)
 
void HandleCalendarInvite (WorldPackets::Calendar::CalendarInvite &calendarEventInvite)
 
void HandleCalendarRsvp (WorldPackets::Calendar::CalendarRSVP &calendarRSVP)
 
void HandleCalendarEventRemoveInvite (WorldPackets::Calendar::CalendarRemoveInvite &calendarRemoveInvite)
 
void HandleCalendarStatus (WorldPackets::Calendar::CalendarStatus &calendarStatus)
 
void HandleCalendarModeratorStatus (WorldPackets::Calendar::CalendarModeratorStatusQuery &calendarModeratorStatus)
 
void HandleCalendarComplain (WorldPackets::Calendar::CalendarComplain &calendarComplain)
 
void HandleCalendarGetNumPending (WorldPackets::Calendar::CalendarGetNumPending &calendarGetNumPending)
 
void HandleCalendarEventSignup (WorldPackets::Calendar::CalendarEventSignUp &calendarEventSignUp)
 
void SendCalendarRaidLockout (InstanceSave const *save, bool add)
 
void SendCalendarRaidLockoutUpdated (InstanceSave const *save)
 
void HandleSetSavedInstanceExtend (WorldPackets::Calendar::SetSavedInstanceExtend &setSavedInstanceExtend)
 
void HandleVoidStorageUnlock (WorldPackets::VoidStorage::UnlockVoidStorage &unlockVoidStorage)
 
void HandleVoidStorageQuery (WorldPackets::VoidStorage::QueryVoidStorage &queryVoidStorage)
 
void HandleVoidStorageTransfer (WorldPackets::VoidStorage::VoidStorageTransfer &voidStorageTransfer)
 
void HandleVoidSwapItem (WorldPackets::VoidStorage::SwapVoidItem &swapVoidItem)
 
void SendVoidStorageTransferResult (VoidTransferError result)
 
void HandleCollectionItemSetFavorite (WorldPackets::Collections::CollectionItemSetFavorite &collectionItemSetFavorite)
 
void HandleTransmogrifyItems (WorldPackets::Transmogrification::TransmogrifyItems &transmogrifyItems)
 
void HandleSpellClick (WorldPackets::Spells::SpellClick &spellClick)
 
void HandleMirrorImageDataRequest (WorldPackets::Spells::GetMirrorImageData &getMirrorImageData)
 
void HandleGuildSetFocusedAchievement (WorldPackets::Achievement::GuildSetFocusedAchievement &setFocusedAchievement)
 
void HandleEquipmentSetSave (WorldPackets::EquipmentSet::SaveEquipmentSet &saveEquipmentSet)
 
void HandleDeleteEquipmentSet (WorldPackets::EquipmentSet::DeleteEquipmentSet &deleteEquipmentSet)
 
void HandleUseEquipmentSet (WorldPackets::EquipmentSet::UseEquipmentSet &useEquipmentSet)
 
void HandleServerTimeOffsetRequest (WorldPackets::Misc::ServerTimeOffsetRequest &)
 
void HandleQueryQuestCompletionNPCs (WorldPackets::Query::QueryQuestCompletionNPCs &queryQuestCompletionNPCs)
 
void HandleQuestPOIQuery (WorldPackets::Query::QuestPOIQuery &questPoiQuery)
 
void HandleViolenceLevel (WorldPackets::Misc::ViolenceLevel &violenceLevel)
 
void HandleObjectUpdateFailedOpcode (WorldPackets::Misc::ObjectUpdateFailed &objectUpdateFailed)
 
void HandleObjectUpdateRescuedOpcode (WorldPackets::Misc::ObjectUpdateRescued &objectUpdateRescued)
 
void HandleRequestCategoryCooldowns (WorldPackets::Spells::RequestCategoryCooldowns &requestCategoryCooldowns)
 
void HandleCloseInteraction (WorldPackets::Misc::CloseInteraction &closeInteraction)
 
void HandleAdventureJournalOpenQuest (WorldPackets::AdventureJournal::AdventureJournalOpenQuest &openQuest)
 
void HandleAdventureJournalUpdateSuggestions (WorldPackets::AdventureJournal::AdventureJournalUpdateSuggestions &updateSuggestions)
 
void HandleAdventureMapStartQuest (WorldPackets::AdventureMap::AdventureMapStartQuest &startQuest)
 
void HandleAddToy (WorldPackets::Toy::AddToy &packet)
 
void HandleUseToy (WorldPackets::Toy::UseToy &packet)
 
void HandleToyClearFanfare (WorldPackets::Toy::ToyClearFanfare &toyClearFanfare)
 
void HandleMountSetFavorite (WorldPackets::Misc::MountSetFavorite &mountSetFavorite)
 
void HandleSceneTriggerEvent (WorldPackets::Scenes::SceneTriggerEvent &sceneTriggerEvent)
 
void HandleScenePlaybackComplete (WorldPackets::Scenes::ScenePlaybackComplete &scenePlaybackComplete)
 
void HandleScenePlaybackCanceled (WorldPackets::Scenes::ScenePlaybackCanceled &scenePlaybackCanceled)
 
void HandleCommerceTokenGetLog (WorldPackets::Token::CommerceTokenGetLog &updateListedAuctionableTokens)
 
void HandleCommerceTokenGetMarketPrice (WorldPackets::Token::CommerceTokenGetMarketPrice &requestWowTokenMarketPrice)
 
void HandleSaveCUFProfiles (WorldPackets::Misc::SaveCUFProfiles &packet)
 
void SendLoadCUFProfiles ()
 
void HandleGetGarrisonInfo (WorldPackets::Garrison::GetGarrisonInfo &getGarrisonInfo)
 
void HandleGarrisonPurchaseBuilding (WorldPackets::Garrison::GarrisonPurchaseBuilding &garrisonPurchaseBuilding)
 
void HandleGarrisonCancelConstruction (WorldPackets::Garrison::GarrisonCancelConstruction &garrisonCancelConstruction)
 
void HandleGarrisonRequestBlueprintAndSpecializationData (WorldPackets::Garrison::GarrisonRequestBlueprintAndSpecializationData &garrisonRequestBlueprintAndSpecializationData)
 
void HandleGarrisonGetMapData (WorldPackets::Garrison::GarrisonGetMapData &garrisonGetMapData)
 
void HandleBattlePetRequestJournal (WorldPackets::BattlePet::BattlePetRequestJournal &battlePetRequestJournal)
 
void HandleBattlePetSetBattleSlot (WorldPackets::BattlePet::BattlePetSetBattleSlot &battlePetSetBattleSlot)
 
void HandleBattlePetModifyName (WorldPackets::BattlePet::BattlePetModifyName &battlePetModifyName)
 
void HandleBattlePetDeletePet (WorldPackets::BattlePet::BattlePetDeletePet &battlePetDeletePet)
 
void HandleBattlePetSetFlags (WorldPackets::BattlePet::BattlePetSetFlags &battlePetSetFlags)
 
void HandleBattlePetSummon (WorldPackets::BattlePet::BattlePetSummon &battlePetSummon)
 
void HandleCageBattlePet (WorldPackets::BattlePet::CageBattlePet &cageBattlePet)
 
void HandleWardenData (WorldPackets::Warden::WardenData &packet)
 
void HandleBattlenetChangeRealmTicket (WorldPackets::Battlenet::ChangeRealmTicket &changeRealmTicket)
 
void HandleBattlenetRequest (WorldPackets::Battlenet::Request &request)
 
void SendBattlenetResponse (uint32 serviceHash, uint32 methodId, uint32 token, pb::Message const *response)
 
void SendBattlenetResponse (uint32 serviceHash, uint32 methodId, uint32 token, uint32 status)
 
void SendBattlenetRequest (uint32 serviceHash, uint32 methodId, pb::Message const *request, std::function< void(MessageBuffer)> callback)
 
void SendBattlenetRequest (uint32 serviceHash, uint32 methodId, pb::Message const *request)
 
std::array< uint8, 32 > const & GetRealmListSecret () const
 
void SetRealmListSecret (std::array< uint8, 32 > const &secret)
 
std::unordered_map< uint32, uint8 > const & GetRealmCharacterCounts () const
 
void HandleQueryRealmName (WorldPackets::Query::QueryRealmName &queryRealmName)
 
void HandleArtifactAddPower (WorldPackets::Artifact::ArtifactAddPower &artifactAddPower)
 
void HandleArtifactSetAppearance (WorldPackets::Artifact::ArtifactSetAppearance &artifactSetAppearance)
 
void HandleConfirmArtifactRespec (WorldPackets::Artifact::ConfirmArtifactRespec &confirmArtifactRespec)
 
void HandleQueryScenarioPOI (WorldPackets::Scenario::QueryScenarioPOI &queryScenarioPOI)
 
void HandleAzeriteEssenceUnlockMilestone (WorldPackets::Azerite::AzeriteEssenceUnlockMilestone &azeriteEssenceUnlockMilestone)
 
void HandleAzeriteEssenceActivateEssence (WorldPackets::Azerite::AzeriteEssenceActivateEssence &azeriteEssenceActivateEssence)
 
void HandleAzeriteEmpoweredItemViewed (WorldPackets::Azerite::AzeriteEmpoweredItemViewed &azeriteEmpoweredItemViewed)
 
void HandleAzeriteEmpoweredItemSelectPower (WorldPackets::Azerite::AzeriteEmpoweredItemSelectPower &azeriteEmpoweredItemSelectPower)
 
uint64 GetConnectToInstanceKey () const
 
QueryCallbackProcessorGetQueryProcessor ()
 
TransactionCallbackAddTransactionCallback (TransactionCallback &&callback)
 

Public Attributes

time_t m_muteTime
 
std::atomic< time_t > m_timeOutTime
 

Protected Attributes

class WorldSession::DosProtection AntiDOS
 

Private Member Functions

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

Private Attributes

QueryResultHolderFuture _realmAccountLoginCallback
 
QueryResultHolderFuture _accountLoginCallback
 
QueryResultHolderFuture _charLoginCallback
 
QueryResultHolderFuture _charEnumCallback
 
QueryCallbackProcessor _queryProcessor
 
AsyncCallbackProcessor< TransactionCallback_transactionCallbacks
 
GuidSet _legitCharacters
 
ObjectGuid::LowType m_GUIDLow
 
Player_player
 
std::shared_ptr< WorldSocketm_Socket [MAX_CONNECTION_TYPES]
 
std::string m_Address
 
AccountTypes _security
 
uint32 _accountId
 
std::string _accountName
 
uint32 _battlenetAccountId
 
uint8 m_accountExpansion
 
uint8 m_expansion
 
std::string _os
 
std::array< uint8, 32 > _realmListSecret
 
std::unordered_map< uint32, uint8_realmCharacterCounts
 
std::unordered_map< uint32, std::function< void(MessageBuffer)> > _battlenetResponseCallbacks
 
uint32 _battlenetRequestToken
 
Warden_warden
 
time_t _logoutTime
 
bool m_inQueue
 
ObjectGuid m_playerLoading
 
bool m_playerLogout
 
bool m_playerRecentlyLogout
 
bool m_playerSave
 
LocaleConstant m_sessionDbcLocale
 
LocaleConstant m_sessionDbLocaleIndex
 
std::atomic< uint32m_latency
 
std::atomic< uint32m_clientTimeDelay
 
AccountData _accountData [NUM_ACCOUNT_DATA_TYPES]
 
uint32 _tutorials [MAX_ACCOUNT_TUTORIAL_VALUES]
 
uint8 _tutorialsChanged
 
std::vector< std::string > _registeredAddonPrefixes
 
bool _filterAddonMessages
 
uint32 recruiterId
 
bool isRecruiter
 
LockedQueue< WorldPacket * > _recvQueue
 
rbac::RBACData_RBACData
 
uint32 expireTime
 
bool forceExit
 
ObjectGuid m_currentBankerGUID
 
std::unique_ptr< BattlePetMgr_battlePetMgr
 
std::unique_ptr< CollectionMgr_collectionMgr
 
ConnectToKey _instanceConnectKey
 

Friends

class World
 

Detailed Description

Player session in the World.

Constructor & Destructor Documentation

◆ WorldSession() [1/2]

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

WorldSession constructor.

105  :
106  m_muteTime(mute_time),
107  m_timeOutTime(0),
108  AntiDOS(this),
109  m_GUIDLow(UI64LIT(0)),
110  _player(nullptr),
111  _security(sec),
112  _accountId(id),
113  _accountName(std::move(name)),
114  _battlenetAccountId(battlenetAccountId),
115  m_accountExpansion(expansion),
116  m_expansion(std::min<uint8>(expansion, sWorld->getIntConfig(CONFIG_EXPANSION))),
117  _os(os),
119  _warden(nullptr),
120  _logoutTime(0),
121  m_inQueue(false),
122  m_playerLogout(false),
123  m_playerRecentlyLogout(false),
124  m_playerSave(false),
125  m_sessionDbcLocale(sWorld->GetAvailableDbcLocale(locale)),
126  m_sessionDbLocaleIndex(locale),
127  m_latency(0),
130  _filterAddonMessages(false),
131  recruiterId(recruiter),
132  isRecruiter(isARecruiter),
133  _RBACData(nullptr),
134  expireTime(60000), // 1 min after socket loss, session is deleted
135  forceExit(false),
137  _battlePetMgr(std::make_unique<BattlePetMgr>(this)),
138  _collectionMgr(std::make_unique<CollectionMgr>(this))
139 {
140  memset(_tutorials, 0, sizeof(_tutorials));
141 
142  if (sock)
143  {
144  m_Address = sock->GetRemoteIpAddress().to_string();
145  ResetTimeOutTime(false);
146  LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId()); // One-time query
147  }
148 
151 }
std::atomic< uint32 > m_latency
Definition: WorldSession.h:1903
Warden * _warden
Definition: WorldSession.h:1893
LocaleConstant m_sessionDbcLocale
Definition: WorldSession.h:1901
bool isRecruiter
Definition: WorldSession.h:1911
time_t _logoutTime
Definition: WorldSession.h:1895
std::atomic< time_t > m_timeOutTime
Definition: WorldSession.h:1125
uint8 m_accountExpansion
Definition: WorldSession.h:1883
bool _filterAddonMessages
Definition: WorldSession.h:1909
bool m_playerLogout
Definition: WorldSession.h:1898
LocaleConstant m_sessionDbLocaleIndex
Definition: WorldSession.h:1902
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
#define UI64LIT(N)
Definition: Define.h:140
uint8 m_expansion
Definition: WorldSession.h:1884
#define sWorld
Definition: World.h:925
std::shared_ptr< WorldSocket > m_Socket[MAX_CONNECTION_TYPES]
Definition: WorldSession.h:1875
uint32 expireTime
Definition: WorldSession.h:1914
Definition: WorldSession.h:886
Definition: Opcodes.h:30
uint32 recruiterId
Definition: WorldSession.h:1910
ObjectGuid::LowType m_GUIDLow
Definition: WorldSession.h:1873
time_t m_muteTime
Definition: WorldSession.h:1114
std::string _os
Definition: WorldSession.h:1885
void ResetTimeOutTime(bool onlyActive)
Definition: WorldSession.cpp:698
ObjectGuid m_currentBankerGUID
Definition: WorldSession.h:1916
uint64 Raw
Definition: WorldSession.h:1804
uint32 _battlenetRequestToken
Definition: WorldSession.h:1890
AccountTypes _security
Definition: WorldSession.h:1879
bool m_playerRecentlyLogout
Definition: WorldSession.h:1899
std::unique_ptr< CollectionMgr > _collectionMgr
Definition: WorldSession.h:1920
Definition: World.h:295
std::unique_ptr< BattlePetMgr > _battlePetMgr
Definition: WorldSession.h:1918
uint32 _accountId
Definition: WorldSession.h:1880
class WorldSession::DosProtection AntiDOS
std::string m_Address
Definition: WorldSession.h:1876
uint32 _battlenetAccountId
Definition: WorldSession.h:1882
ConnectToKey _instanceConnectKey
Definition: WorldSession.h:1922
Player * _player
Definition: WorldSession.h:1874
uint32 _tutorials[MAX_ACCOUNT_TUTORIAL_VALUES]
Definition: WorldSession.h:1906
bool m_inQueue
Definition: WorldSession.h:1896
uint32 GetAccountId() const
Definition: WorldSession.h:977
bool forceExit
Definition: WorldSession.h:1915
std::atomic< uint32 > m_clientTimeDelay
Definition: WorldSession.h:1904
rbac::RBACData * _RBACData
Definition: WorldSession.h:1913
std::string _accountName
Definition: WorldSession.h:1881
bool m_playerSave
Definition: WorldSession.h:1900
uint8 _tutorialsChanged
Definition: WorldSession.h:1907
+ Here is the call graph for this function:

◆ ~WorldSession()

WorldSession::~WorldSession ( )

WorldSession destructor.

  • unload player if not unloaded
  • If have unclosed socket, close it
  • empty incoming packet queue
155 {
157  if (_player)
158  LogoutPlayer (true);
159 
161  for (uint8 i = 0; i < 2; ++i)
162  {
163  if (m_Socket[i])
164  {
165  m_Socket[i]->CloseSocket();
166  m_Socket[i].reset();
167  }
168  }
169 
170  delete _warden;
171  delete _RBACData;
172 
174  WorldPacket* packet = nullptr;
175  while (_recvQueue.next(packet))
176  delete packet;
177 
178  LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
179 }
Warden * _warden
Definition: WorldSession.h:1893
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
std::shared_ptr< WorldSocket > m_Socket[MAX_CONNECTION_TYPES]
Definition: WorldSession.h:1875
void LogoutPlayer(bool save)
Log the player out
Definition: WorldSession.cpp:494
bool next(T &result)
Gets the next result in the queue, if any.
Definition: LockedQueue.h:68
Player * _player
Definition: WorldSession.h:1874
LockedQueue< WorldPacket * > _recvQueue
Definition: WorldSession.h:1912
uint8_t uint8
Definition: Define.h:154
uint32 GetAccountId() const
Definition: WorldSession.h:977
rbac::RBACData * _RBACData
Definition: WorldSession.h:1913
Definition: WorldPacket.h:24
+ Here is the call graph for this function:

◆ WorldSession() [2/2]

WorldSession::WorldSession ( WorldSession const &  right)
privatedelete

Member Function Documentation

◆ AbortLogin()

void WorldSession::AbortLogin ( WorldPackets::Character::LoginFailureReason  reason)
1008 {
1009  if (!PlayerLoading() || GetPlayer())
1010  {
1011  KickPlayer();
1012  return;
1013  }
1014 
1017 }
bool PlayerLoading() const
Definition: WorldSession.h:946
void KickPlayer()
Kick a player out of the World.
Definition: WorldSession.cpp:645
ObjectGuid m_playerLoading
Definition: WorldSession.h:1897
Definition: CharacterPackets.h:495
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:208
void Clear()
Definition: ObjectGuid.h:266
Player * GetPlayer() const
Definition: WorldSession.h:982
+ Here is the call graph for this function:

◆ AddInstanceConnection()

void WorldSession::AddInstanceConnection ( std::shared_ptr< WorldSocket sock)
inline
std::shared_ptr< WorldSocket > m_Socket[MAX_CONNECTION_TYPES]
Definition: WorldSession.h:1875
Definition: Opcodes.h:31
+ Here is the caller graph for this function:

◆ AddTransactionCallback()

TransactionCallback & WorldSession::AddTransactionCallback ( TransactionCallback &&  callback)
910 {
911  return _transactionCallbacks.AddCallback(std::move(callback));
912 }
T & AddCallback(T &&query)
Definition: AsyncCallbackProcessor.h:35
AsyncCallbackProcessor< TransactionCallback > _transactionCallbacks
Definition: WorldSession.h:1822
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanAccessAlliedRaces()

bool WorldSession::CanAccessAlliedRaces ( ) const
915 {
917 }
Definition: SharedDefines.h:89
uint8 GetAccountExpansion() const
Definition: WorldSession.h:989
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanOpenMailBox()

bool WorldSession::CanOpenMailBox ( ObjectGuid  guid)
41 {
42  if (guid == _player->GetGUID())
43  {
45  {
46  TC_LOG_WARN("cheat", "%s attempted to open mailbox by using a cheat.", _player->GetName().c_str());
47  return false;
48  }
49  }
50  else if (guid.IsGameObject())
51  {
53  return false;
54  }
55  else if (guid.IsAnyTypeCreature())
56  {
58  return false;
59  }
60  else
61  return false;
62 
63  return true;
64 }
Definition: UnitDefines.h:227
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid const &guid) const
Definition: Player.cpp:2007
#define TC_LOG_WARN(filterType__,...)
Definition: Log.h:183
ObjectGuid const & GetGUID() const
Definition: Object.h:154
std::string const & GetName() const
Definition: Object.h:467
bool IsGameObject() const
Definition: ObjectGuid.h:309
Definition: SharedDefines.h:2635
Definition: UnitDefines.h:217
Player * _player
Definition: WorldSession.h:1874
Definition: RBAC.h:685
bool IsAnyTypeCreature() const
Definition: ObjectGuid.h:305
bool HasPermission(uint32 permissionId)
Definition: WorldSession.cpp:1120
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags, NPCFlags2 npcFlags2) const
Definition: Player.cpp:1953
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanSpeak()

bool WorldSession::CanSpeak ( ) const
689 {
690  return m_muteTime <= GameTime::GetGameTime();
691 }
time_t m_muteTime
Definition: WorldSession.h:1114
time_t GetGameTime()
Definition: GameTime.cpp:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanUseBank()

bool WorldSession::CanUseBank ( ObjectGuid  bankerGUID = ObjectGuid::Empty) const
private
1179 {
1180  // bankerGUID parameter is optional, set to 0 by default.
1181  if (!bankerGUID)
1182  bankerGUID = m_currentBankerGUID;
1183 
1184  bool isUsingBankCommand = (bankerGUID == GetPlayer()->GetGUID() && bankerGUID == m_currentBankerGUID);
1185 
1186  if (!isUsingBankCommand)
1187  {
1189  if (!creature)
1190  return false;
1191  }
1192 
1193  return true;
1194 }
Definition: UnitDefines.h:227
Definition: Creature.h:61
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: UnitDefines.h:208
ObjectGuid m_currentBankerGUID
Definition: WorldSession.h:1916
Player * GetPlayer() const
Definition: WorldSession.h:982
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags, NPCFlags2 npcFlags2) const
Definition: Player.cpp:1953
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckStableMaster()

bool WorldSession::CheckStableMaster ( ObjectGuid  guid)
444 {
445  // spell case or GM
446  if (guid == GetPlayer()->GetGUID())
447  {
448  if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
449  {
450  TC_LOG_DEBUG("entities.player.cheat", "%s attempt open stable in cheating way.", guid.ToString().c_str());
451  return false;
452  }
453  }
454  // stable master case
455  else
456  {
458  {
459  TC_LOG_DEBUG("entities.player", "Stablemaster %s not found or you can't interact with him.", guid.ToString().c_str());
460  return false;
461  }
462  }
463  return true;
464 }
Definition: UnitDefines.h:227
std::string ToString() const
Definition: ObjectGuid.cpp:238
Definition: SpellAuraDefines.h:380
Definition: UnitDefines.h:213
Player * GetPlayer() const
Definition: WorldSession.h:982
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags, NPCFlags2 npcFlags2) const
Definition: Player.cpp:1953
+ Here is the call graph for this function:

◆ DoLootRelease()

void WorldSession::DoLootRelease ( ObjectGuid  lguid)
311 {
312  Player *player = GetPlayer();
313  Loot *loot;
314 
315  if (player->GetLootGUID() == lguid)
317 
318  player->SendLootRelease(lguid);
319  player->RemoveAELootedWorldObject(lguid);
320 
322 
323  if (!player->IsInWorld())
324  return;
325 
326  if (lguid.IsGameObject())
327  {
328  GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
329 
330  // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
332  return;
333 
334  loot = &go->loot;
335 
336  if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR)
337  {
338  // locked doors are opened with spelleffect openlock, prevent remove its as looted
339  go->UseDoorOrButton();
340  }
341  else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
342  {
344  { // The fishing hole used once more
345  go->AddUse(); // if the max usage is reached, will be despawned in next tick
346  if (go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens)
348  else
349  go->SetLootState(GO_READY);
350  }
351  else
353 
354  loot->clear();
355  }
356  else
357  {
358  // not fully looted object
359  go->SetLootState(GO_ACTIVATED, player);
360 
361  // if the round robin player release, reset it.
362  if (player->GetGUID() == loot->roundRobinPlayer)
363  loot->roundRobinPlayer.Clear();
364  }
365  }
366  else if (lguid.IsCorpse()) // ONLY remove insignia at BG
367  {
368  Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
369  if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
370  return;
371 
372  loot = &corpse->loot;
373 
374  if (loot->isLooted())
375  {
376  loot->clear();
378  }
379  }
380  else if (lguid.IsItem())
381  {
382  Item* pItem = player->GetItemByGuid(lguid);
383  if (!pItem)
384  return;
385 
386  ItemTemplate const* proto = pItem->GetTemplate();
387 
388  // destroy only 5 items from stack in case prospecting and milling
389  if (pItem->loot.loot_type == LOOT_PROSPECTING || pItem->loot.loot_type == LOOT_MILLING)
390  {
391  pItem->m_lootGenerated = false;
392  pItem->loot.clear();
393 
394  uint32 count = pItem->GetCount();
395 
396  // >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
397  if (count > 5)
398  count = 5;
399 
400  player->DestroyItemCount(pItem, count, true);
401  }
402  else
403  {
404  // Only delete item if no loot or money (unlooted loot is saved to db) or if it isn't an openable item
405  if (pItem->loot.isLooted() || !(proto->GetFlags() & ITEM_FLAG_HAS_LOOT))
406  player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
407  }
408  return; // item can be looted only single player
409  }
410  else
411  {
412  Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
413 
414  bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
415  if (!lootAllowed || !creature->IsWithinDistInMap(_player, AELootCreatureCheck::LootDistance))
416  return;
417 
418  loot = &creature->loot;
419  if (loot->isLooted())
420  {
422 
423  // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
424  if (!creature->IsAlive())
425  creature->AllLootRemovedFromCorpse();
426 
427  loot->clear();
428  }
429  else
430  {
431  // if the round robin player release, reset it.
432  if (player->GetGUID() == loot->roundRobinPlayer)
433  {
434  loot->roundRobinPlayer.Clear();
435 
436  if (Group* group = player->GetGroup())
437  group->SendLooter(creature, nullptr);
438  }
439  // force dynflag update to update looter and lootable info
441  }
442  }
443 
444  //Player is not looking at loot list, he doesn't need to see updates on the loot list
445  loot->RemoveLooter(player->GetGUID());
446 }
ObjectGuid const & GetLootGUID() const
Definition: Player.h:1981
Group * GetGroup()
Definition: Player.h:2450
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: Corpse.h:50
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:927
bool IsItem() const
Definition: ObjectGuid.h:308
static ObjectGuid const Empty
Definition: ObjectGuid.h:255
Definition: GameObject.h:75
bool IsCorpse() const
Definition: ObjectGuid.h:311
void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:164
uint32 GetUseCount() const
Definition: GameObject.h:216
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: Player.cpp:12762
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
Definition: GameObject.cpp:1494
Definition: GameObject.h:74
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1094
bool isLooted() const
Definition: Loot.h:240
struct GameObjectValue::@208 FishingHole
ObjectGuid GetOwnerGUID() const override
Definition: GameObject.h:143
static float constexpr LootDistance
Definition: LootHandler.cpp:42
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
Loot loot
Definition: Creature.h:206
bool m_lootGenerated
Definition: Item.h:309
Definition: SharedDefines.h:5524
bool IsInWorld() const
Definition: Object.h:149
void RemoveCorpseDynamicFlag(CorpseDynFlags dynamicFlags)
Definition: Corpse.h:78
uint32 GetFlags() const
Definition: ItemTemplate.h:739
Definition: Creature.h:61
UpdateField< uint32, 0, 2 > DynamicFlags
Definition: UpdateFields.h:50
Definition: SharedDefines.h:2633
void AllLootRemovedFromCorpse()
Definition: Creature.cpp:2791
void clear()
Definition: Loot.cpp:106
void RemoveLooter(ObjectGuid GUID)
Definition: Loot.h:246
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:12659
Map * GetMap() const
Definition: Object.h:535
GameObjectValue const * GetGOValue() const
Definition: GameObject.h:111
ObjectGuid const & GetGUID() const
Definition: Object.h:154
uint32 MaxOpens
Definition: GameObject.h:51
uint8 GetBagSlot() const
Definition: Item.cpp:1205
GameobjectTypes GetGoType() const
Definition: GameObject.h:177
bool IsAlive() const
Definition: Unit.h:1217
Definition: Loot.h:207
bool IsGameObject() const
Definition: ObjectGuid.h:309
void SetLootGUID(ObjectGuid const &guid)
Definition: Player.h:1982
uint8 getClass() const
Definition: Unit.h:849
Definition: Item.h:169
void SetLootState(LootState s, Unit *unit=nullptr)
Definition: GameObject.cpp:2453
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:224
uint32_t uint32
Definition: Define.h:152
TC_GAME_API Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:173
Loot loot
Definition: GameObject.h:221
Definition: GameObject.h:81
void ForceUpdateFieldChange(UF::UpdateFieldSetter< T > const &)
Definition: Object.h:227
uint32 GetCount() const
Definition: Item.h:264
ObjectGuid roundRobinPlayer
Definition: Loot.h:217
Definition: ItemTemplate.h:180
Definition: Loot.h:98
Definition: SharedDefines.h:141
Definition: SharedDefines.h:2641
Definition: SharedDefines.h:5514
void Clear()
Definition: ObjectGuid.h:266
Player * GetPlayer() const
Definition: WorldSession.h:982
void RemoveAELootedWorldObject(ObjectGuid const &lootWorldObjectGuid)
Definition: Player.cpp:8651
Item * GetItemByGuid(ObjectGuid guid) const
Definition: Player.cpp:10087
Definition: ItemTemplate.h:730
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:4417
Player * _player
Definition: WorldSession.h:1874
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
void AddUse()
Definition: GameObject.h:214
LootType loot_type
Definition: Loot.h:218
uint8 GetSlot() const
Definition: Item.h:271
Definition: UnitDefines.h:129
Loot loot
Definition: Corpse.h:113
Definition: Loot.h:99
void SendLootRelease(ObjectGuid guid) const
Definition: Player.cpp:8703
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4427
UF::UpdateFieldHolder m_values
Definition: Object.h:223
Definition: GameObject.h:73
Definition: Player.h:1056
Loot loot
Definition: Item.h:308
Definition: Group.h:219
Definition: Loot.h:93
Definition: SharedDefines.h:2616
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoLootReleaseAll()

void WorldSession::DoLootReleaseAll ( )
449 {
450  std::unordered_map<ObjectGuid, ObjectGuid> lootView = _player->GetAELootView();
451  for (std::pair<ObjectGuid const, ObjectGuid> const& lootPair : lootView)
452  DoLootRelease(lootPair.second);
453 }
std::unordered_map< ObjectGuid, ObjectGuid > const & GetAELootView() const
Definition: Player.h:1986
Player * _player
Definition: WorldSession.h:1874
void DoLootRelease(ObjectGuid lguid)
Definition: LootHandler.cpp:310
+ Here is the caller graph for this function:

◆ GetAccountData()

AccountData const* WorldSession::GetAccountData ( AccountDataType  type) const
inline
1056 { return &_accountData[type]; }
AccountData _accountData[NUM_ACCOUNT_DATA_TYPES]
Definition: WorldSession.h:1905
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAccountExpansion()

uint8 WorldSession::GetAccountExpansion ( ) const
inline
989 { return m_accountExpansion; }
uint8 m_accountExpansion
Definition: WorldSession.h:1883
+ Here is the caller graph for this function:

◆ GetAccountGUID()

ObjectGuid WorldSession::GetAccountGUID ( ) const
inline
978 { return ObjectGuid::Create<HighGuid::WowAccount>(GetAccountId()); }
uint32 GetAccountId() const
Definition: WorldSession.h:977
+ Here is the caller graph for this function:

◆ GetAccountId()

uint32 WorldSession::GetAccountId ( ) const
inline
977 { return _accountId; }
uint32 _accountId
Definition: WorldSession.h:1880
+ Here is the caller graph for this function:

◆ GetAccountName()

std::string const& WorldSession::GetAccountName ( ) const
inline
979 { return _accountName; }
std::string _accountName
Definition: WorldSession.h:1881
+ Here is the caller graph for this function:

◆ GetBattlenetAccountGUID()

ObjectGuid WorldSession::GetBattlenetAccountGUID ( ) const
inline
981 { return ObjectGuid::Create<HighGuid::BNetAccount>(GetBattlenetAccountId()); }
uint32 GetBattlenetAccountId() const
Definition: WorldSession.h:980
+ Here is the caller graph for this function:

◆ GetBattlenetAccountId()

uint32 WorldSession::GetBattlenetAccountId ( ) const
inline
980 { return _battlenetAccountId; }
uint32 _battlenetAccountId
Definition: WorldSession.h:1882
+ Here is the caller graph for this function:

◆ GetBattlePetMgr()

BattlePetMgr* WorldSession::GetBattlePetMgr ( ) const
inline
1136 { return _battlePetMgr.get(); }
std::unique_ptr< BattlePetMgr > _battlePetMgr
Definition: WorldSession.h:1918
+ Here is the caller graph for this function:

◆ GetCollectionMgr()

CollectionMgr* WorldSession::GetCollectionMgr ( ) const
inline
1138 { return _collectionMgr.get(); }
std::unique_ptr< CollectionMgr > _collectionMgr
Definition: WorldSession.h:1920
+ Here is the caller graph for this function:

◆ GetConnectToInstanceKey()

uint64 WorldSession::GetConnectToInstanceKey ( ) const
inline
1807 { return _instanceConnectKey.Raw; }
uint64 Raw
Definition: WorldSession.h:1804
ConnectToKey _instanceConnectKey
Definition: WorldSession.h:1922
+ Here is the caller graph for this function:

◆ GetExpansion()

uint8 WorldSession::GetExpansion ( ) const
inline
990 { return m_expansion; }
uint8 m_expansion
Definition: WorldSession.h:1884
+ Here is the caller graph for this function:

◆ GetLatency()

uint32 WorldSession::GetLatency ( ) const
inline
1121 { return m_latency; }
std::atomic< uint32 > m_latency
Definition: WorldSession.h:1903
+ Here is the caller graph for this function:

◆ GetOS()

std::string const& WorldSession::GetOS ( ) const
inline
991 { return _os; }
std::string _os
Definition: WorldSession.h:1885
+ Here is the caller graph for this function:

◆ GetPlayer()

Player* WorldSession::GetPlayer ( ) const
inline
982 { return _player; }
Player * _player
Definition: WorldSession.h:1874
+ Here is the call graph for this function:

◆ GetPlayerInfo()

std::string WorldSession::GetPlayerInfo ( ) const
193 {
194  std::ostringstream ss;
195 
196  ss << "[Player: ";
197  if (!m_playerLoading.IsEmpty())
198  ss << "Logging in: " << m_playerLoading.ToString() << ", ";
199  else if (_player)
200  ss << _player->GetName() << ' ' << _player->GetGUID().ToString() << ", ";
201 
202  ss << "Account: " << GetAccountId() << "]";
203 
204  return ss.str();
205 }
std::string ToString() const
Definition: ObjectGuid.cpp:238
ObjectGuid const & GetGUID() const
Definition: Object.h:154
std::string const & GetName() const
Definition: Object.h:467
ObjectGuid m_playerLoading
Definition: WorldSession.h:1897
bool IsEmpty() const
Definition: ObjectGuid.h:299
Player * _player
Definition: WorldSession.h:1874
uint32 GetAccountId() const
Definition: WorldSession.h:977
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPlayerName()

std::string const & WorldSession::GetPlayerName ( ) const
188 {
189  return _player != nullptr ? _player->GetName() : DefaultPlayerName;
190 }
std::string const & GetName() const
Definition: Object.h:467
Player * _player
Definition: WorldSession.h:1874
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetQueryProcessor()

QueryCallbackProcessor& WorldSession::GetQueryProcessor ( )
inline
1810 { return _queryProcessor; }
QueryCallbackProcessor _queryProcessor
Definition: WorldSession.h:1821
+ Here is the caller graph for this function:

◆ GetRBACData()

rbac::RBACData * WorldSession::GetRBACData ( )
1116 {
1117  return _RBACData;
1118 }
rbac::RBACData * _RBACData
Definition: WorldSession.h:1913
+ Here is the caller graph for this function:

◆ GetRealmCharacterCounts()

std::unordered_map<uint32, uint8> const& WorldSession::GetRealmCharacterCounts ( ) const
inline
1777 { return _realmCharacterCounts; }
std::unordered_map< uint32, uint8 > _realmCharacterCounts
Definition: WorldSession.h:1888
+ Here is the caller graph for this function:

◆ GetRealmListSecret()

std::array<uint8, 32> const& WorldSession::GetRealmListSecret ( ) const
inline
1774 { return _realmListSecret; }
std::array< uint8, 32 > _realmListSecret
Definition: WorldSession.h:1887
+ Here is the caller graph for this function:

◆ GetRecruiterId()

uint32 WorldSession::GetRecruiterId ( ) const
inline
1132 { return recruiterId; }
uint32 recruiterId
Definition: WorldSession.h:1910
+ Here is the caller graph for this function:

◆ GetRemoteAddress()

std::string const& WorldSession::GetRemoteAddress ( ) const
inline
987 { return m_Address; }
std::string m_Address
Definition: WorldSession.h:1876
+ Here is the caller graph for this function:

◆ GetSecurity()

AccountTypes WorldSession::GetSecurity ( ) const
inline
976 { return _security; }
AccountTypes _security
Definition: WorldSession.h:1879
+ Here is the caller graph for this function:

◆ GetSessionDbcLocale()

LocaleConstant WorldSession::GetSessionDbcLocale ( ) const
inline
1117 { return m_sessionDbcLocale; }
LocaleConstant m_sessionDbcLocale
Definition: WorldSession.h:1901
+ Here is the caller graph for this function:

◆ GetSessionDbLocaleIndex()

LocaleConstant WorldSession::GetSessionDbLocaleIndex ( ) const
inline
1118 { return m_sessionDbLocaleIndex; }
LocaleConstant m_sessionDbLocaleIndex
Definition: WorldSession.h:1902
+ Here is the caller graph for this function:

◆ GetTrinityString()

char const * WorldSession::GetTrinityString ( uint32  entry) const
694 {
695  return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
696 }
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:1118
#define sObjectMgr
Definition: ObjectMgr.h:1847
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTutorialInt()

uint32 WorldSession::GetTutorialInt ( uint8  index) const
inline
1063 { return _tutorials[index]; }
uint32 _tutorials[MAX_ACCOUNT_TUTORIAL_VALUES]
Definition: WorldSession.h:1906

◆ Handle_EarlyProccess()

void WorldSession::Handle_EarlyProccess ( WorldPackets::Null null)
717 {
718  TC_LOG_ERROR("network.opcode", "Received opcode %s that must be processed in WorldSocket::OnRead from %s"
719  , GetOpcodeNameForLogging(null.GetOpcode()).c_str(), GetPlayerInfo().c_str());
720 }
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:186
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:192
OpcodeClient GetOpcode() const
Definition: Packet.h:67
std::string GetOpcodeNameForLogging(OpcodeClient opcode)
Lookup opcode name for human understandable logging.
Definition: Opcodes.cpp:2082
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Handle_NULL()

void WorldSession::Handle_NULL ( WorldPackets::Null null)
712 {
713  TC_LOG_ERROR("network.opcode", "Received unhandled opcode %s from %s", GetOpcodeNameForLogging(null.GetOpcode()).c_str(), GetPlayerInfo().c_str());
714 }
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:186
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:192
OpcodeClient GetOpcode() const
Definition: Packet.h:67
std::string GetOpcodeNameForLogging(OpcodeClient opcode)
Lookup opcode name for human understandable logging.
Definition: Opcodes.cpp:2082
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAcceptTradeOpcode()

void WorldSession::HandleAcceptTradeOpcode ( WorldPackets::Trade::AcceptTrade acceptTrade)
234 {
235  TradeData* my_trade = _player->m_trade;
236  if (!my_trade)
237  return;
238 
239  Player* trader = my_trade->GetTrader();
240 
241  TradeData* his_trade = trader->m_trade;
242  if (!his_trade)
243  return;
244 
245  Item* myItems[TRADE_SLOT_TRADED_COUNT] = { };
246  Item* hisItems[TRADE_SLOT_TRADED_COUNT] = { };
247 
248  // set before checks for propertly undo at problems (it already set in to client)
249  my_trade->SetAccepted(true);
250 
252  if (his_trade->GetServerStateIndex() != acceptTrade.StateIndex)
253  {
255  SendTradeStatus(info);
256  my_trade->SetAccepted(false);
257  return;
258  }
259 
260  if (!_player->IsWithinDistInMap(trader, TRADE_DISTANCE, false))
261  {
263  SendTradeStatus(info);
264  my_trade->SetAccepted(false);
265  return;
266  }
267 
268  // not accept case incorrect money amount
269  if (!_player->HasEnoughMoney(my_trade->GetMoney()))
270  {
273  SendTradeStatus(info);
274  my_trade->SetAccepted(false, true);
275  return;
276  }
277 
278  // not accept case incorrect money amount
279  if (!trader->HasEnoughMoney(his_trade->GetMoney()))
280  {
283  trader->GetSession()->SendTradeStatus(info);
284  his_trade->SetAccepted(false, true);
285  return;
286  }
287 
288  if (_player->GetMoney() > MAX_MONEY_AMOUNT - his_trade->GetMoney())
289  {
292  SendTradeStatus(info);
293  my_trade->SetAccepted(false, true);
294  return;
295  }
296 
297  if (trader->GetMoney() > MAX_MONEY_AMOUNT - my_trade->GetMoney())
298  {
301  trader->GetSession()->SendTradeStatus(info);
302  his_trade->SetAccepted(false, true);
303  return;
304  }
305 
306  // not accept if some items now can't be trade (cheating)
307  for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
308  {
309  if (Item* item = my_trade->GetItem(TradeSlots(i)))
310  {
311  if (!item->CanBeTraded(false, true))
312  {
314  SendTradeStatus(info);
315  return;
316  }
317 
318  if (item->IsBindedNotWith(trader))
319  {
322  SendTradeStatus(info);
323  return;
324  }
325  }
326 
327  if (Item* item = his_trade->GetItem(TradeSlots(i)))
328  {
329  if (!item->CanBeTraded(false, true))
330  {
332  SendTradeStatus(info);
333  return;
334  }
335  //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)
336  //{
337  // SendTradeStatus(TRADE_STATUS_NOT_ELIGIBLE);
338  // his_trade->SetAccepted(false, true);
339  // return;
340  //}
341  }
342  }
343 
344  if (his_trade->IsAccepted())
345  {
346  setAcceptTradeMode(my_trade, his_trade, myItems, hisItems);
347 
348  Spell* my_spell = nullptr;
349  SpellCastTargets my_targets;
350 
351  Spell* his_spell = nullptr;
352  SpellCastTargets his_targets;
353 
354  // not accept if spell can't be cast now (cheating)
355  if (uint32 my_spell_id = my_trade->GetSpell())
356  {
357  SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(my_spell_id, _player->GetMap()->GetDifficultyID());
358  Item* castItem = my_trade->GetSpellCastItem();
359 
360  if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
361  (my_trade->HasSpellCastItem() && !castItem))
362  {
363  clearAcceptTradeMode(my_trade, his_trade);
364  clearAcceptTradeMode(myItems, hisItems);
365 
366  my_trade->SetSpell(0);
367  return;
368  }
369 
370  my_spell = new Spell(_player, spellEntry, TRIGGERED_FULL_MASK);
371  my_spell->m_CastItem = castItem;
372  my_targets.SetTradeItemTarget(_player);
373  my_spell->m_targets = my_targets;
374 
375  SpellCastResult res = my_spell->CheckCast(true);
376  if (res != SPELL_CAST_OK)
377  {
378  my_spell->SendCastResult(res);
379 
380  clearAcceptTradeMode(my_trade, his_trade);
381  clearAcceptTradeMode(myItems, hisItems);
382 
383  delete my_spell;
384  my_trade->SetSpell(0);
385  return;
386  }
387  }
388 
389  // not accept if spell can't be cast now (cheating)
390  if (uint32 his_spell_id = his_trade->GetSpell())
391  {
392  SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(his_spell_id, trader->GetMap()->GetDifficultyID());
393  Item* castItem = his_trade->GetSpellCastItem();
394 
395  if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
396  {
397  delete my_spell;
398  his_trade->SetSpell(0);
399 
400  clearAcceptTradeMode(my_trade, his_trade);
401  clearAcceptTradeMode(myItems, hisItems);
402  return;
403  }
404 
405  his_spell = new Spell(trader, spellEntry, TRIGGERED_FULL_MASK);
406  his_spell->m_CastItem = castItem;
407  his_targets.SetTradeItemTarget(trader);
408  his_spell->m_targets = his_targets;
409 
410  SpellCastResult res = his_spell->CheckCast(true);
411  if (res != SPELL_CAST_OK)
412  {
413  his_spell->SendCastResult(res);
414 
415  clearAcceptTradeMode(my_trade, his_trade);
416  clearAcceptTradeMode(myItems, hisItems);
417 
418  delete my_spell;
419  delete his_spell;
420 
421  his_trade->SetSpell(0);
422  return;
423  }
424  }
425 
426  // inform partner client
428  trader->GetSession()->SendTradeStatus(info);
429 
430  // test if item will fit in each inventory
431  WorldPackets::Trade::TradeStatus myCanCompleteInfo, hisCanCompleteInfo;
432  hisCanCompleteInfo.BagResult = trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT, &hisCanCompleteInfo.ItemID);
433  myCanCompleteInfo.BagResult = _player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT, &myCanCompleteInfo.ItemID);
434 
435  clearAcceptTradeMode(myItems, hisItems);
436 
437  // in case of missing space report error
438  if (myCanCompleteInfo.BagResult != EQUIP_ERR_OK)
439  {
440  clearAcceptTradeMode(my_trade, his_trade);
441 
442  myCanCompleteInfo.Status = TRADE_STATUS_FAILED;
443  trader->GetSession()->SendTradeStatus(myCanCompleteInfo);
444  myCanCompleteInfo.FailureForYou = true;
445  SendTradeStatus(myCanCompleteInfo);
446  my_trade->SetAccepted(false);
447  his_trade->SetAccepted(false);
448  delete my_spell;
449  delete his_spell;
450  return;
451  }
452  else if (hisCanCompleteInfo.BagResult != EQUIP_ERR_OK)
453  {
454  clearAcceptTradeMode(my_trade, his_trade);
455 
456  hisCanCompleteInfo.Status = TRADE_STATUS_FAILED;
457  SendTradeStatus(hisCanCompleteInfo);
458  hisCanCompleteInfo.FailureForYou = true;
459  trader->GetSession()->SendTradeStatus(hisCanCompleteInfo);
460  my_trade->SetAccepted(false);
461  his_trade->SetAccepted(false);
462  delete my_spell;
463  delete his_spell;
464  return;
465  }
466 
467  // execute trade: 1. remove
468  for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
469  {
470  if (myItems[i])
471  {
472  myItems[i]->SetGiftCreator(_player->GetGUID());
473  _player->MoveItemFromInventory(myItems[i]->GetBagSlot(), myItems[i]->GetSlot(), true);
474  }
475  if (hisItems[i])
476  {
477  hisItems[i]->SetGiftCreator(trader->GetGUID());
478  trader->MoveItemFromInventory(hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot(), true);
479  }
480  }
481 
482  // execute trade: 2. store
483  moveItems(myItems, hisItems);
484 
485  // logging money
487  {
488  if (my_trade->GetMoney() > 0)
489  {
490  sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: " UI64FMTD ") to player: %s (Account: %u)",
491  _player->GetName().c_str(), _player->GetSession()->GetAccountId(),
492  my_trade->GetMoney(),
493  trader->GetName().c_str(), trader->GetSession()->GetAccountId());
494  }
495 
496  if (his_trade->GetMoney() > 0)
497  {
498  sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: " UI64FMTD ") to player: %s (Account: %u)",
499  trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
500  his_trade->GetMoney(),
501  _player->GetName().c_str(), _player->GetSession()->GetAccountId());
502  }
503  }
504 
505  // update money
506  _player->ModifyMoney(-int64(my_trade->GetMoney()));
507  _player->ModifyMoney(his_trade->GetMoney());
508  trader->ModifyMoney(-int64(his_trade->GetMoney()));
509  trader->ModifyMoney(my_trade->GetMoney());
510 
511  if (my_spell)
512  my_spell->prepare(my_targets);
513 
514  if (his_spell)
515  his_spell->prepare(his_targets);
516 
517  // cleanup
518  clearAcceptTradeMode(my_trade, his_trade);
519  delete _player->m_trade;
520  _player->m_trade = nullptr;
521  delete trader->m_trade;
522  trader->m_trade = nullptr;
523 
524  // desynchronized with the other saves here (SaveInventoryAndGoldToDB() not have own transaction guards)
525  CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
527  trader->SaveInventoryAndGoldToDB(trans);
528  CharacterDatabase.CommitTransaction(trans);
529 
531  trader->GetSession()->SendTradeStatus(info);
532  SendTradeStatus(info);
533  }
534  else
535  {
537  trader->GetSession()->SendTradeStatus(info);
538  }
539 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, uint32 *param1=nullptr, uint32 *param2=nullptr)
Definition: Spell.cpp:4204
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:12616
uint64 const MAX_MONEY_AMOUNT
Definition: Player.cpp:141
Difficulty GetDifficultyID() const
Definition: Map.h:387
int64_t int64
Definition: Define.h:147
Definition: SpellInfo.h:372
SpellCastTargets m_targets
Definition: Spell.h:675
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1094
WorldSession * GetSession() const
Definition: Player.h:1990
Item * GetItem(TradeSlots slot) const
Definition: TradeData.cpp:30
Definition: SharedDefines.h:6078
bool IsAccepted() const
Definition: TradeData.h:58
void SendTradeStatus(WorldPackets::Trade::TradeStatus &status)
Definition: TradeHandler.cpp:35
#define sLog
Definition: Log.h:131
uint64 GetMoney() const
Definition: Player.h:1649
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction &trans)
Definition: Player.cpp:20670
Item * m_CastItem
Definition: Spell.h:633
uint32 ItemID
Definition: TradePackets.h:148
#define TRADE_DISTANCE
Definition: ObjectDefines.h:27
Definition: SharedDefines.h:6086
InventoryResult CanStoreItems(Item **items, int count, uint32 *offendingItemId) const
Definition: Player.cpp:11216
Map * GetMap() const
Definition: Object.h:535
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: SharedDefines.h:6083
std::string const & GetName() const
Definition: Object.h:467
bool HasEnoughMoney(uint64 amount) const
Definition: Player.h:1651
Definition: TradeData.h:34
TradeSlots
Definition: TradeData.h:23
TradeData * m_trade
Definition: Player.h:2906
Definition: TradeData.h:27
uint32 GetSpell() const
Definition: TradeData.h:49
Definition: Item.h:169
#define UI64FMTD
Definition: Define.h:139
#define sSpellMgr
Definition: SpellMgr.h:790
uint32_t uint32
Definition: Define.h:152
Item * GetSpellCastItem() const
Definition: TradeData.cpp:53
Definition: SharedDefines.h:6077
Definition: Spell.h:220
static void setAcceptTradeMode(TradeData *myTrade, TradeData *hisTrade, Item **myItems, Item **hisItems)
Definition: TradeHandler.cpp:190
static void clearAcceptTradeMode(TradeData *myTrade, TradeData *hisTrade)
Definition: TradeHandler.cpp:215
void SetSpell(uint32 spell_id, Item *castItem=nullptr)
Definition: TradeData.cpp:84
Player * GetTrader() const
Definition: TradeData.h:41
Definition: SharedDefines.h:6084
Definition: ItemDefines.h:25
bool ModifyMoney(int64 amount, bool sendError=true)
Definition: Player.cpp:24028
Definition: TradePackets.h:133
void moveItems(Item *myItems[], Item *hisItems[])
Definition: TradeHandler.cpp:107
Definition: ItemDefines.h:55
Player * _player
Definition: WorldSession.h:1874
void SetTradeItemTarget(Player *caster)
Definition: Spell.cpp:308
Definition: ItemDefines.h:105
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:246
uint32 StateIndex
Definition: TradePackets.h:37
Definition: RBAC.h:64
uint64 GetMoney() const
Definition: TradeData.h:55
::TradeStatus Status
Definition: TradePackets.h:140
uint8_t uint8
Definition: Define.h:154
void prepare(SpellCastTargets const &targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3037
bool FailureForYou
Definition: TradePackets.h:146
SpellCastResult
Definition: SharedDefines.h:1381
uint32 GetServerStateIndex() const
Definition: TradeData.h:67
bool HasSpellCastItem() const
Definition: TradeData.h:53
uint32 GetAccountId() const
Definition: WorldSession.h:977
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:194
int32 BagResult
Definition: TradePackets.h:147
Definition: TradeData.h:26
Definition: SharedDefines.h:6082
bool HasPermission(uint32 permissionId)
Definition: WorldSession.cpp:1120
Definition: Player.h:1056
Definition: SharedDefines.h:1697
void SetAccepted(bool state, bool forTrader=false)
Definition: TradeData.cpp:135
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
SpellCastResult CheckCast(bool strict, uint32 *param1=nullptr, uint32 *param2=nullptr)
Definition: Spell.cpp:5087
Definition: ItemDefines.h:103
Definition: Spell.h:348
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleActivateTaxiOpcode()

void WorldSession::HandleActivateTaxiOpcode ( WorldPackets::Taxi::ActivateTaxi activateTaxi)
171 {
173  if (!unit)
174  {
175  TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - %s not found or you can't interact with it.", activateTaxi.Vendor.ToString().c_str());
177  return;
178  }
179 
180  uint32 curloc = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), GetPlayer()->GetTeam());
181  if (!curloc)
182  return;
183 
184  TaxiNodesEntry const* from = sTaxiNodesStore.LookupEntry(curloc);
185  TaxiNodesEntry const* to = sTaxiNodesStore.LookupEntry(activateTaxi.Node);
186  if (!to)
187  return;
188 
189  if (!GetPlayer()->isTaxiCheater())
190  {
191  if (!GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) || !GetPlayer()->m_taxi.IsTaximaskNodeKnown(activateTaxi.Node))
192  {
194  return;
195  }
196  }
197 
198  uint32 preferredMountDisplay = 0;
199  if (MountEntry const* mount = sMountStore.LookupEntry(activateTaxi.FlyingMountID))
200  {
201  if (GetPlayer()->HasSpell(mount->SourceSpellID))
202  {
203  if (DB2Manager::MountXDisplayContainer const* mountDisplays = sDB2Manager.GetMountDisplays(mount->ID))
204  {
205  DB2Manager::MountXDisplayContainer usableDisplays;
206  std::copy_if(mountDisplays->begin(), mountDisplays->end(), std::back_inserter(usableDisplays), [this](MountXDisplayEntry const* mountDisplay)
207  {
208  if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(mountDisplay->PlayerConditionID))
209  return sConditionMgr->IsPlayerMeetingCondition(GetPlayer(), playerCondition);
210 
211  return true;
212  });
213 
214  if (!usableDisplays.empty())
215  preferredMountDisplay = Trinity::Containers::SelectRandomContainerElement(usableDisplays)->CreatureDisplayInfoID;
216  }
217  }
218  }
219 
220  std::vector<uint32> nodes;
221  sTaxiPathGraph.GetCompleteNodeRoute(from, to, GetPlayer(), nodes);
222  GetPlayer()->ActivateTaxiPathTo(nodes, unit, 0, preferredMountDisplay);
223 }
Definition: UnitDefines.h:227
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=0, uint32 preferredMountDisplay=0)
Definition: Player.cpp:22538
std::vector< MountXDisplayEntry const * > MountXDisplayContainer
Definition: DB2Stores.h:326
#define sDB2Manager
Definition: DB2Stores.h:445
PlayerTaxi m_taxi
Definition: Player.h:1119
std::string ToString() const
Definition: ObjectGuid.cpp:238
void SendActivateTaxiReply(ActivateTaxiReply reply)
Definition: TaxiHandler.cpp:225
bool IsTaximaskNodeKnown(uint32 nodeidx) const
Definition: PlayerTaxi.h:45
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3698
Definition: Creature.h:61
uint32 Node
Definition: TaxiPackets.h:97
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:100
#define sObjectMgr
Definition: ObjectMgr.h:1847
float GetPositionY() const
Definition: Position.h:102
ObjectGuid Vendor
Definition: TaxiPackets.h:96
uint32_t uint32
Definition: Define.h:152
#define sConditionMgr
Definition: ConditionMgr.h:326
float GetPositionZ() const
Definition: Position.h:103
DB2Storage< MountEntry > sMountStore("Mount.db2", MountLoadInfo::Instance())
Player * GetPlayer() const
Definition: WorldSession.h:982
float GetPositionX() const
Definition: Position.h:101
DB2Storage< TaxiNodesEntry > sTaxiNodesStore("TaxiNodes.db2", TaxiNodesLoadInfo::Instance())
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
uint32 GetMapId() const
Definition: Position.h:252
uint32 FlyingMountID
Definition: TaxiPackets.h:99
#define sTaxiPathGraph
Definition: TaxiPathGraph.h:69
Definition: DB2Structure.h:3441
uint32 GetTeam() const
Definition: Player.h:2105
Definition: DB2Structure.h:2571
Definition: UnitDefines.h:204
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
Definition: DB2Structure.h:2447
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags, NPCFlags2 npcFlags2) const
Definition: Player.cpp:1953
Definition: DB2Structure.h:2487
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAddFriendOpcode()

void WorldSession::HandleAddFriendOpcode ( WorldPackets::Social::AddFriend packet)
39 {
40  if (!normalizePlayerName(packet.Name))
41  return;
42 
43  TC_LOG_DEBUG("network", "WorldSession::HandleAddFriendOpcode: %s asked to add friend: %s",
44  GetPlayerInfo().c_str(), packet.Name.c_str());
45 
46  FriendsResult friendResult = FRIEND_NOT_FOUND;
47  ObjectGuid friendGuid = sCharacterCache->GetCharacterGuidByName(packet.Name);
48  if (!friendGuid.IsEmpty())
49  {
50  if (CharacterCacheEntry const* characterInfo = sCharacterCache->GetCharacterCacheByGuid(friendGuid))
51  {
52  uint32 team = Player::TeamForRace(characterInfo->Race);
53  uint32 friendAccountId = characterInfo->AccountId;
54 
56  {
57  if (friendGuid == GetPlayer()->GetGUID())
58  friendResult = FRIEND_SELF;
59  else if (GetPlayer()->GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_ADD_FRIEND))
60  friendResult = FRIEND_ENEMY;
61  else if (GetPlayer()->GetSocial()->HasFriend(friendGuid))
62  friendResult = FRIEND_ALREADY;
63  else
64  {
65  Player* playerFriend = ObjectAccessor::FindPlayer(friendGuid);
66  if (playerFriend && playerFriend->IsVisibleGloballyFor(GetPlayer()))
67  friendResult = FRIEND_ADDED_ONLINE;
68  else
69  friendResult = FRIEND_ADDED_OFFLINE;
70 
72  GetPlayer()->GetSocial()->SetFriendNote(friendGuid, packet.Notes);
73  else
74  friendResult = FRIEND_LIST_FULL;
75  }
76  }
77  }
78  }
79 
80  sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid);
81 }
Definition: RBAC.h:93
uint32 Realm
Definition: Realm.h:48
FriendsResult
Results of friend related commands.
Definition: SocialMgr.h:67
Definition: SocialMgr.h:77
Realm realm
Definition: World.cpp:3730
std::string Notes
Definition: SocialPackets.h:104
void SetFriendNote(ObjectGuid const &guid, std::string const &note)
Definition: SocialMgr.cpp:103
bool IsVisibleGloballyFor(Player const *player) const
Definition: Player.cpp:23812
Definition: CharacterCache.h:25
Definition: SocialMgr.h:78
Definition: SocialMgr.h:75
static uint32 GetSecurity(uint32 accountId)
Definition: AccountMgr.cpp:317
PlayerSocial * GetSocial() const
Definition: Player.h:1116
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
#define sCharacterCache
Definition: CharacterCache.h:73
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:150
static uint32 TeamForRace(uint8 race)
Definition: Player.cpp:6225
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:192
Battlenet::RealmHandle Id
Definition: Realm.h:79
Definition: SocialMgr.h:73
uint32_t uint32
Definition: Define.h:152
std::string Name
Definition: SocialPackets.h:105
#define sSocialMgr
Definition: SocialMgr.h:160
static bool IsPlayerAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:429
Player * GetPlayer() const
Definition: WorldSession.h:982
bool IsEmpty() const
Definition: ObjectGuid.h:299
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
bool AddToSocialList(ObjectGuid const &guid, SocialFlag flag)
Definition: SocialMgr.cpp:37
Definition: SocialMgr.h:76
Definition: SocialMgr.h:70
Definition: ObjectGuid.h:248
bool HasPermission(uint32 permissionId)
Definition: WorldSession.cpp:1120
Definition: SocialMgr.h:40
Definition: Player.h:1056
Definition: SocialMgr.h:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAddIgnoreOpcode()

void WorldSession::HandleAddIgnoreOpcode ( WorldPackets::Social::AddIgnore packet)
94 {
95  if (!normalizePlayerName(packet.Name))
96  return;
97 
98  TC_LOG_DEBUG("network", "WorldSession::HandleAddIgnoreOpcode: %s asked to Ignore: %s",
99  GetPlayer()->GetName().c_str(), packet.Name.c_str());
100 
101  ObjectGuid ignoreGuid = sCharacterCache->GetCharacterGuidByName(packet.Name);
102  FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND;
103  if (!ignoreGuid.IsEmpty())
104  {
105  if (ignoreGuid == GetPlayer()->GetGUID()) //not add yourself
106  ignoreResult = FRIEND_IGNORE_SELF;
107  else if (GetPlayer()->GetSocial()->HasIgnore(ignoreGuid))
108  ignoreResult = FRIEND_IGNORE_ALREADY;
109  else
110  {
111  ignoreResult = FRIEND_IGNORE_ADDED;
112 
113  // ignore list full
114  if (!GetPlayer()->GetSocial()->AddToSocialList(ignoreGuid, SOCIAL_FLAG_IGNORED))
115  ignoreResult = FRIEND_IGNORE_FULL;
116  }
117  }
118 
119  sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, ignoreGuid);
120 }
FriendsResult
Results of friend related commands.
Definition: SocialMgr.h:67
Definition: SocialMgr.h:82
Definition: SocialMgr.h:81
Definition: SocialMgr.h:41
Definition: SocialMgr.h:83
PlayerSocial * GetSocial() const
Definition: Player.h:1116
#define sCharacterCache
Definition: CharacterCache.h:73
ObjectGuid const & GetGUID() const
Definition: Object.h:154
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:150
bool HasIgnore(ObjectGuid const &ignoreGuid)
Definition: SocialMgr.cpp:159
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
Definition: BattlenetAccountMgr.cpp:141
Definition: SocialMgr.h:84
#define sSocialMgr
Definition: SocialMgr.h:160
Player * GetPlayer() const
Definition: WorldSession.h:982
std::string Name
Definition: SocialPackets.h:136
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
Definition: SocialMgr.h:80
bool AddToSocialList(ObjectGuid const &guid, SocialFlag flag)
Definition: SocialMgr.cpp:37
Definition: ObjectGuid.h:248
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAddonRegisteredPrefixesOpcode()

void WorldSession::HandleAddonRegisteredPrefixesOpcode ( WorldPackets::Chat::ChatRegisterAddonPrefixes packet)
870 {
871  // This is always sent after CMSG_CHAT_UNREGISTER_ALL_ADDON_PREFIXES
874  {
875  _filterAddonMessages = false;
876  return;
877  }
878 
879  _filterAddonMessages = true;
880 }
iterator begin()
Definition: PacketUtilities.h:56
bool _filterAddonMessages
Definition: WorldSession.h:1909
Array< std::string, MAX_PREFIXES > Prefixes
Definition: ChatPackets.h:272
std::vector< std::string > _registeredAddonPrefixes
Definition: WorldSession.h:1908
iterator end()
Definition: PacketUtilities.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAddToy()

void WorldSession::HandleAddToy ( WorldPackets::Toy::AddToy packet)
29 {
30  if (!packet.Guid)
31  return;
32 
33  Item* item = _player->GetItemByGuid(packet.Guid);
34  if (!item)
35  {
37  return;
38  }
39 
40  if (!sDB2Manager.IsToyItem(item->GetEntry()))
41  return;
42 
43  InventoryResult msg = _player->CanUseItem(item);
44  if (msg != EQUIP_ERR_OK)
45  {
46  _player->SendEquipError(msg, item, nullptr);
47  return;
48  }
49 
50  if (_collectionMgr->AddToy(item->GetEntry(), false, false))
51  _player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
52 }
#define sDB2Manager
Definition: DB2Stores.h:445
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:12659
uint8 GetBagSlot() const
Definition: Item.cpp:1205
ObjectGuid Guid
Definition: ToyPackets.h:35
InventoryResult
Definition: ItemDefines.h:23
Definition: Item.h:169
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition: Player.cpp:11854
Definition: ItemDefines.h:48
std::unique_ptr< CollectionMgr > _collectionMgr
Definition: WorldSession.h:1920
Definition: ItemDefines.h:25
uint32 GetEntry() const
Definition: Object.h:155
Item * GetItemByGuid(ObjectGuid guid) const
Definition: Player.cpp:10087
Player * _player
Definition: WorldSession.h:1874
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition: Player.cpp:13728
uint8 GetSlot() const
Definition: Item.h:271
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAdventureJournalOpenQuest()

void WorldSession::HandleAdventureJournalOpenQuest ( WorldPackets::AdventureJournal::AdventureJournalOpenQuest openQuest)
26 {
27  if (ChrClassUIDisplayEntry const* uiDisplay = sDB2Manager.GetUiDisplayForClass(Classes(_player->getClass())))
28  if (!_player->MeetPlayerCondition(uiDisplay->AdvGuidePlayerConditionID))
29  return;
30 
31  AdventureJournalEntry const* adventureJournal = sAdventureJournalStore.LookupEntry(openQuest.AdventureJournalID);
32  if (!adventureJournal)
33  return;
34 
35  if (!_player->MeetPlayerCondition(adventureJournal->PlayerConditionID))
36  return;
37 
38  Quest const* quest = sObjectMgr->GetQuestTemplate(adventureJournal->QuestID);
39  if (!quest)
40  return;
41 
42  if (_player->CanTakeQuest(quest, true))
44 }
#define sDB2Manager
Definition: DB2Stores.h:445
PlayerMenu * PlayerTalkClass
Definition: Player.h:2249
Definition: QuestDef.h:447
DB2Storage< AdventureJournalEntry > sAdventureJournalStore("AdventureJournal.db2", AdventureJournalLoadInfo::Instance())
#define sObjectMgr
Definition: ObjectMgr.h:1847
uint32 PlayerConditionID
Definition: DB2Structure.h:66
Definition: DB2Structure.h:580
Definition: DB2Structure.h:57
bool CanTakeQuest(Quest const *quest, bool msg)
Definition: Player.cpp:15052
ObjectGuid const & GetGUID() const
Definition: Object.h:154
uint8 getClass() const
Definition: Unit.h:849
int32 QuestID
Definition: DB2Structure.h:71
Player * _player
Definition: WorldSession.h:1874
Classes
Definition: SharedDefines.h:135
int32 AdventureJournalID
Definition: AdventureJournalPackets.h:34
bool MeetPlayerCondition(uint32 conditionId) const
Definition: Player.cpp:28215
void SendQuestGiverQuestDetails(Quest const *quest, ObjectGuid npcGUID, bool autoLaunched, bool displayPopup) const
Definition: GossipDef.cpp:402
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAdventureJournalUpdateSuggestions()

void WorldSession::HandleAdventureJournalUpdateSuggestions ( WorldPackets::AdventureJournal::AdventureJournalUpdateSuggestions updateSuggestions)
47 {
48  if (ChrClassUIDisplayEntry const* uiDisplay = sDB2Manager.GetUiDisplayForClass(Classes(_player->getClass())))
49  if (!_player->MeetPlayerCondition(uiDisplay->AdvGuidePlayerConditionID))
50  return;
51 
53  response.OnLevelUp = updateSuggestions.OnLevelUp;
54 
55  for (AdventureJournalEntry const* adventureJournal : sAdventureJournalStore)
56  {
57  if (_player->MeetPlayerCondition(adventureJournal->PlayerConditionID))
58  {
60  adventureJournalData.AdventureJournalID = int32(adventureJournal->ID);
61  adventureJournalData.Priority = int32(adventureJournal->PriorityMax);
62  response.Entries.push_back(adventureJournalData);
63  }
64  }
65 
66  SendPacket(response.Write());
67 }
WorldPacket const * Write() override
Definition: AdventureJournalPackets.cpp:42
#define sDB2Manager
Definition: DB2Stores.h:445
DB2Storage< AdventureJournalEntry > sAdventureJournalStore("AdventureJournal.db2", AdventureJournalLoadInfo::Instance())
std::vector< AdventureJournalEntry > Entries
Definition: AdventureJournalPackets.h:61
bool OnLevelUp
Definition: AdventureJournalPackets.h:60
Definition: AdventureJournalPackets.h:53
int32 AdventureJournalID
Definition: AdventureJournalPackets.h:49
Definition: DB2Structure.h:580
int32 Priority
Definition: AdventureJournalPackets.h:50
Definition: DB2Structure.h:57
bool OnLevelUp
Definition: AdventureJournalPackets.h:44
uint8 getClass() const
Definition: Unit.h:849
int32_t int32
Definition: Define.h:148
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:208
Definition: AdventureJournalPackets.h:47
Player * _player
Definition: WorldSession.h:1874
Classes
Definition: SharedDefines.h:135
bool MeetPlayerCondition(uint32 conditionId) const
Definition: Player.cpp:28215
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAdventureMapStartQuest()

void WorldSession::HandleAdventureMapStartQuest ( WorldPackets::AdventureMap::AdventureMapStartQuest startQuest)
25 {
26  Quest const* quest = sObjectMgr->GetQuestTemplate(startQuest.QuestID);
27  if (!quest)
28  return;
29 
30  auto itr = std::find_if(sAdventureMapPOIStore.begin(), sAdventureMapPOIStore.end(), [&](AdventureMapPOIEntry const* adventureMap)
31  {
32  return adventureMap->QuestID == uint32(startQuest.QuestID) && _player->MeetPlayerCondition(adventureMap->PlayerConditionID);
33  });
34 
35  if (itr == sAdventureMapPOIStore.end())
36  return;
37 
38  if (_player->CanTakeQuest(quest, true))
40 }
int32 QuestID
Definition: AdventureMapPackets.h:34
Definition: QuestDef.h:447
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition: Player.cpp:15203
DB2Storage< AdventureMapPOIEntry > sAdventureMapPOIStore("AdventureMapPOI.db2", AdventureMapPoiLoadInfo::Instance())
#define sObjectMgr
Definition: ObjectMgr.h:1847
bool CanTakeQuest(Quest const *quest, bool msg)
Definition: Player.cpp:15052
uint32_t uint32
Definition: Define.h:152
Player * _player
Definition: WorldSession.h:1874
bool MeetPlayerCondition(uint32 conditionId) const
Definition: Player.cpp:28215
Definition: DB2Structure.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAlterAppearance()

void WorldSession::HandleAlterAppearance ( WorldPackets::Character::AlterApperance packet)
1670 {
1672  return;
1673 
1675  if (!go)
1676  {
1678  return;
1679  }
1680 
1682  {
1684  return;
1685  }
1686 
1688 
1689  // 0 - ok
1690  // 1, 3 - not enough money
1691  // 2 - you have to sit on barber chair
1692  if (!_player->HasEnoughMoney(cost))
1693  {
1695  return;
1696  }
1697 
1699 
1700  _player->ModifyMoney(-cost); // it isn't free
1702 
1703  if (_player->GetNativeSex() != packet.NewSex)
1704  {
1705  _player->SetNativeSex(packet.NewSex);
1707  _player->RestoreDisplayId(false);
1708  }
1709 
1711 
1713 
1715 
1716  sCharacterCache->UpdateCharacterGender(_player->GetGUID(), packet.NewSex);
1717 }
int64 GetBarberShopCost(Trinity::IteratorPair< UF::ChrCustomizationChoice const *> newCustomizations) const
Definition: Player.cpp:26031
uint8 NewSex
Definition: CharacterPackets.h:621
int64_t int64
Definition: Define.h:147
UnitStandStateType GetStandState() const
Definition: Unit.h:973
Races
Definition: RaceMask.h:24
Trinity::IteratorPair< UF::ChrCustomizationChoice const * > MakeChrCustomizationChoiceRange(Container const &container)
Definition: Player.h:3058
uint8 getRace() const
Definition: Unit.h:846
GameObject * FindNearestGameObjectOfType(GameobjectTypes type, float range) const
Definition: Object.cpp:2002
Definition: UnitDefines.h:40
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition: Player.cpp:26592
#define sCharacterCache
Definition: CharacterCache.h:73
ObjectGuid const & GetGUID() const
Definition: Object.h:154
bool ValidateAppearance(Races race, Classes playerClass, Gender gender, Trinity::IteratorPair< UF::ChrCustomizationChoice const *> customizations)
Definition: CharacterHandler.cpp:524
struct GameObjectTemplate::@211::@245 barberChair
bool HasEnoughMoney(uint64 amount) const
Definition: Player.h:1651
void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting=false)
Definition: Unit.cpp:9888
Gender
Definition: SharedDefines.h:126
void SetCustomizations(Trinity::IteratorPair< Iter > customizations, bool markChanged=true)
Definition: Player.h:2600
UnitStandStateType
Definition: UnitDefines.h:34
void SetNativeSex(uint8 sex)
Definition: Player.h:2614
uint8 getClass() const
Definition: Unit.h:849
Definition: GameObject.h:81
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:208
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:107
bool ModifyMoney(int64 amount, bool sendError=true)
Definition: Player.cpp:24028
Player * _player
Definition: WorldSession.h:1874
Classes
Definition: SharedDefines.h:135
Definition: CharacterPackets.h:625
constexpr Trinity::IteratorPair< iterator > MakeIteratorPair(iterator first, iterator second)
Definition: IteratorPair.h:49
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:9838
Definition: SharedDefines.h:2648
void InitDisplayIds()
Definition: Player.cpp:22819
Array< ChrCustomizationChoice, 50 > Customizations
Definition: CharacterPackets.h:622
Definition: UnitDefines.h:36
Gender GetNativeSex() const
Definition: Player.h:2613
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAreaSpiritHealerQueryOpcode()

void WorldSession::HandleAreaSpiritHealerQueryOpcode ( WorldPackets::Battleground::AreaSpiritHealerQuery areaSpiritHealerQuery)
628 {
629  Creature* unit = ObjectAccessor::GetCreature(*GetPlayer(), areaSpiritHealerQuery.HealerGuid);
630  if (!unit)
631  return;
632 
633  if (!unit->IsSpiritService()) // it's not spirit service
634  return;
635 
636  if (Battleground* bg = _player->GetBattleground())
637  sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, areaSpiritHealerQuery.HealerGuid);
638 
639  if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
640  bf->SendAreaSpiritHealerQueryOpcode(_player, areaSpiritHealerQuery.HealerGuid);
641 }
ObjectGuid HealerGuid
Definition: BattlegroundPackets.h:55
bool IsSpiritService() const
Definition: Unit.h:1080
Definition: Creature.h:61
Battleground * GetBattleground() const
Definition: Player.cpp:24820
uint32 GetZoneId() const
Definition: Object.h:459
Definition: Battlefield.h:210
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:219
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Player * GetPlayer() const
Definition: WorldSession.h:982
Player * _player
Definition: WorldSession.h:1874
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:197
Definition: Battleground.h:259
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAreaSpiritHealerQueueOpcode()

void WorldSession::HandleAreaSpiritHealerQueueOpcode ( WorldPackets::Battleground::AreaSpiritHealerQueue areaSpiritHealerQueue)
644 {
645  Creature* unit = ObjectAccessor::GetCreature(*GetPlayer(), areaSpiritHealerQueue.HealerGuid);
646  if (!unit)
647  return;
648 
649  if (!unit->IsSpiritService()) // it's not spirit service
650  return;
651 
652  if (Battleground* bg = _player->GetBattleground())
653  bg->AddPlayerToResurrectQueue(areaSpiritHealerQueue.HealerGuid, _player->GetGUID());
654 
655  if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
656  bf->AddPlayerToResurrectQueue(areaSpiritHealerQueue.HealerGuid, _player->GetGUID());
657 }
bool IsSpiritService() const
Definition: Unit.h:1080
Definition: Creature.h:61
Battleground * GetBattleground() const
Definition: Player.cpp:24820
uint32 GetZoneId() const
Definition: Object.h:459
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: Battlefield.h:210
ObjectGuid HealerGuid
Definition: BattlegroundPackets.h:65
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:219
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Player * GetPlayer() const
Definition: WorldSession.h:982
Player * _player
Definition: WorldSession.h:1874
Definition: Battleground.h:259
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAreaTriggerOpcode()

void WorldSession::HandleAreaTriggerOpcode ( WorldPackets::AreaTrigger::AreaTrigger packet)
460 {
461  Player* player = GetPlayer();
462  if (player->IsInFlight())
463  {
464  TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) in flight, ignore Area Trigger ID:%u",
465  player->GetName().c_str(), player->GetGUID().ToString().c_str(), packet.AreaTriggerID);
466  return;
467  }
468 
469  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(packet.AreaTriggerID);
470  if (!atEntry)
471  {
472  TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) send unknown (by DBC) Area Trigger ID:%u",
473  player->GetName().c_str(), player->GetGUID().ToString().c_str(), packet.AreaTriggerID);
474  return;
475  }
476 
477  if (packet.Entered && !player->IsInAreaTriggerRadius(atEntry))
478  {
479  TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) too far, ignore Area Trigger ID: %u",
480  player->GetName().c_str(), player->GetGUID().ToString().c_str(), packet.AreaTriggerID);
481  return;
482  }
483 
484  if (player->isDebugAreaTriggers)
486 
487  if (sScriptMgr->OnAreaTrigger(player, atEntry, packet.Entered))
488  return;
489 
490  if (player->IsAlive())
491  {
492  // not using Player::UpdateQuestObjectiveProgress, ObjectID in quest_objectives can be set to -1, areatrigger_involvedrelation then holds correct id
493  if (std::unordered_set<uint32> const* quests = sObjectMgr->GetQuestsForAreaTrigger(packet.AreaTriggerID))
494  {
495  bool anyObjectiveChangedCompletionState = false;
496  for (uint32 questId : *quests)
497  {
498  Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
499  uint16 slot = player->FindQuestSlot(questId);
500  if (qInfo && slot < MAX_QUEST_LOG_SIZE && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
501  {
502  for (QuestObjective const& obj : qInfo->Objectives)
503  {
505  continue;
506 
507  if (!player->IsQuestObjectiveCompletable(slot, qInfo, obj))
508  continue;
509 
510  if (player->IsQuestObjectiveComplete(slot, qInfo, obj))
511  continue;
512 
513  if (obj.ObjectID != -1 && obj.ObjectID != packet.AreaTriggerID)
514  continue;
515 
516  player->SetQuestObjectiveData(obj, 1);
517  player->SendQuestUpdateAddCreditSimple(obj);
518  anyObjectiveChangedCompletionState = true;
519  break;
520  }
521 
522  if (player->CanCompleteQuest(questId))
523  player->CompleteQuest(questId);
524  }
525  }
526 
527  if (anyObjectiveChangedCompletionState)
528  player->UpdateForQuestWorldObjects();
529  }
530  }
531 
532  if (sObjectMgr->IsTavernAreaTrigger(packet.AreaTriggerID))
533  {
534  // set resting flag we are in the inn
535  player->GetRestMgr().SetRestFlag(REST_FLAG_IN_TAVERN, atEntry->ID);
536 
537  if (sWorld->IsFFAPvPRealm())
539 
540  return;
541  }
542 
543  if (Battleground* bg = player->GetBattleground())
544  bg->HandleAreaTrigger(player, packet.AreaTriggerID, packet.Entered);
545 
546  if (OutdoorPvP* pvp = player->GetOutdoorPvP())
547  if (pvp->HandleAreaTrigger(_player, packet.AreaTriggerID, packet.Entered))
548  return;
549 
550  AreaTriggerStruct const* at = sObjectMgr->GetAreaTrigger(packet.AreaTriggerID);
551  if (!at)
552  return;
553 
554  bool teleported = false;
555  if (player->GetMapId() != at->target_mapId)
556  {
557  if (Map::EnterState denyReason = sMapMgr->PlayerCannotEnter(at->target_mapId, player, false))
558  {
559  bool reviveAtTrigger = false; // should we revive the player if he is trying to enter the correct instance?
560  switch (denyReason)
561  {
563  TC_LOG_DEBUG("maps", "MAP: Player '%s' attempted to enter map with id %d which has no entry", player->GetName().c_str(), at->target_mapId);
564  break;
566  TC_LOG_DEBUG("maps", "MAP: Player '%s' attempted to enter dungeon map %d but no instance template was found", player->GetName().c_str(), at->target_mapId);
567  break;
569  TC_LOG_DEBUG("maps", "MAP: Player '%s' attempted to enter instance map %d but the requested difficulty was not found", player->GetName().c_str(), at->target_mapId);
570  if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
571  player->SendTransferAborted(entry->ID, TRANSFER_ABORT_DIFFICULTY, player->GetDifficultyID(entry));
572  break;
574  TC_LOG_DEBUG("maps", "MAP: Player '%s' must be in a raid group to enter map %d", player->GetName().c_str(), at->target_mapId);
576  reviveAtTrigger = true;
577  break;
580  TC_LOG_DEBUG("maps", "MAP: Player '%s' does not have a corpse in instance map %d and cannot enter", player->GetName().c_str(), at->target_mapId);
581  break;
583  if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
584  {
585  char const* mapName = entry->MapName[player->GetSession()->GetSessionDbcLocale()];
586  TC_LOG_DEBUG("maps", "MAP: Player '%s' cannot enter instance map '%s' because their permanent bind is incompatible with their group's", player->GetName().c_str(), mapName);
587  // is there a special opcode for this?
588  // @todo figure out how to get player localized difficulty string (e.g. "10 player", "Heroic" etc)
589  ChatHandler(player->GetSession()).PSendSysMessage(player->GetSession()->GetTrinityString(LANG_INSTANCE_BIND_MISMATCH), mapName);
590  }
591  reviveAtTrigger = true;
592  break;
595  TC_LOG_DEBUG("maps", "MAP: Player '%s' cannot enter instance map %d because he has exceeded the maximum number of instances per hour.", player->GetName().c_str(), at->target_mapId);
596  reviveAtTrigger = true;
597  break;
600  reviveAtTrigger = true;
601  break;
604  reviveAtTrigger = true;
605  break;
606  default:
607  break;
608  }
609 
610  if (reviveAtTrigger) // check if the player is touching the areatrigger leading to the map his corpse is on
611  if (!player->IsAlive() && player->HasCorpse())
612  if (player->GetCorpseLocation().GetMapId() == at->target_mapId)
613  {
614  player->ResurrectPlayer(0.5f);
615  player->SpawnCorpseBones();
616  }
617 
618  return;
619  }
620 
621  if (Group* group = player->GetGroup())
622  if (group->isLFGGroup() && player->GetMap()->IsDungeon())
623  teleported = player->TeleportToBGEntryPoint();
624  }
625 
626  if (!teleported)
627  {
628  WorldSafeLocsEntry const* entranceLocation = nullptr;
629  InstanceSave* instanceSave = player->GetInstanceSave(at->target_mapId);
630  if (instanceSave)
631  {
632  // Check if we can contact the instancescript of the instance for an updated entrance location
633  if (Map* map = sMapMgr->FindMap(at->target_mapId, player->GetInstanceSave(at->target_mapId)->GetInstanceId()))
634  if (InstanceMap* instanceMap = map->ToInstanceMap())
635  if (InstanceScript* instanceScript = instanceMap->GetInstanceScript())
636  entranceLocation = sObjectMgr->GetWorldSafeLoc(instanceScript->GetEntranceLocation());
637 
638  // Finally check with the instancesave for an entrance location if we did not get a valid one from the instancescript
639  if (!entranceLocation)
640  entranceLocation = sObjectMgr->GetWorldSafeLoc(instanceSave->GetEntranceLocation());
641  }
642 
643  if (entranceLocation)
644  player->TeleportTo(entranceLocation->Loc, TELE_TO_NOT_LEAVE_TRANSPORT);
645  else
647  }
648 }
Definition: ObjectMgr.h:458
Group * GetGroup()
Definition: Player.h:2450
void SetQuestObjectiveData(QuestObjective const &objective, int32 data)
Definition: Player.cpp:17091
bool IsQuestObjectiveComplete(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition: Player.cpp:17198
Definition: Language.h:1155
Definition: QuestDef.h:447
std::string ToString() const
Definition: ObjectGuid.cpp:238
DB2Storage< AreaTriggerEntry > sAreaTriggerStore("AreaTrigger.db2", AreaTriggerLoadInfo::Instance())
bool IsInAreaTriggerRadius(AreaTriggerEntry const *trigger) const
Definition: Player.cpp:2063
Definition: QuestDef.h:362
WorldSession * GetSession() const
Definition: Player.h:1990
Definition: AreaTriggerPackets.h:66
Definition: QuestDef.h:113
Definition: Map.h:375
float target_Orientation
Definition: ObjectMgr.h:464
Definition: ObjectMgr.h:770
Definition: DB2Structure.h:2343
Definition: Language.h:952
OutdoorPvP * GetOutdoorPvP() const
Definition: Player.cpp:25231
bool TeleportToBGEntryPoint()
Definition: Player.cpp:1551
bool IsDungeon() const
Definition: Map.cpp:4240
WorldLocation GetCorpseLocation() const
Definition: Player.h:2040
Battleground * GetBattleground() const
Definition: Player.cpp:24820
Definition: SharedDefines.h:6418
#define sWorld
Definition: World.h:925
uint32 ID
Definition: DB2Structure.h:175
RestMgr & GetRestMgr() const
Definition: Player.h:2553
bool IsQuestObjectiveCompletable(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition: Player.cpp:17140
#define sObjectMgr
Definition: ObjectMgr.h:1847
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4479
Definition: Player.h:724
uint8 Type
Definition: QuestDef.h:366
char const * GetTrinityString(uint32 entry) const
Definition: WorldSession.cpp:693
bool CanCompleteQuest(uint32 quest_id, uint32 ignoredQuestObjectiveId=0)
Definition: Player.cpp:15088
Map * GetMap() const
Definition: Object.h:535
float target_Y
Definition: ObjectMgr.h:462
ObjectGuid const & GetGUID() const
Definition: Object.h:154
std::string const & GetName() const
Definition: Object.h:467
bool isDebugAreaTriggers
Definition: Player.h:2517
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition: Player.cpp:1313
bool HasCorpse() const
Definition: Player.h:2039
InstanceSave * GetInstanceSave(uint32 mapid)
Definition: Player.cpp:19862
Definition: Player.h:719
Definition: Map.h:860
Definition: QuestDef.h:291
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition: Unit.h:957
Definition: Map.h:372
bool IsAlive() const
Definition: Unit.h:1217
uint16 FindQuestSlot(uint32 quest_id) const
Definition: Player.cpp:16632
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
Definition: Player.cpp:28469
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0, int32 mapDifficultyXConditionID=0) const
Definition: Player.cpp:24336
Definition: RestMgr.h:52
InstanceMap * ToInstanceMap()
Definition: Map.h:488
uint32_t uint32
Definition: Define.h:152
uint16_t uint16
Definition: Define.h:153
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4294
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:208
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:1117
Definition: Map.h:248
Definition: Language.h:949
Definition: InstanceSaveMgr.h:43
Definition: UnitDefines.h:85
bool IsInFlight() const
Definition: Unit.h:1083
WorldLocation Loc
Definition: ObjectMgr.h:773
int32 ObjectID
Definition: QuestDef.h:368
Definition: Map.h:379
Player * GetPlayer() const
Definition: WorldSession.h:982
bool Entered
Definition: AreaTriggerPackets.h:51
Definition: Chat.h:54
Definition: OutdoorPvP.h:184
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition: RestMgr.cpp:97
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
uint32 GetMapId() const
Definition: Position.h:252
Player * _player
Definition: WorldSession.h:1874
float target_Z
Definition: ObjectMgr.h:463
#define sMapMgr
Definition: MapManager.h:212
Definition: Player.h:773
Definition: Player.h:721
Definition: InstanceScript.h:155
void CompleteQuest(uint32 quest_id)
Definition: Player.cpp:15456
Definition: Player.h:722
Definition: Battleground.h:259
void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const
Definition: Player.cpp:28633
Definition: DB2Structure.h:172
EnterState
Definition: Map.h:368
#define sScriptMgr
Definition: ScriptMgr.h:1221
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:63
void UpdateForQuestWorldObjects()
Definition: Player.cpp:25044
DB2Storage< MapEntry > sMapStore("Map.db2", MapLoadInfo::Instance())
int32 AreaTriggerID
Definition: AreaTriggerPackets.h:50
Definition: Player.h:1056
void SendQuestUpdateAddCreditSimple(QuestObjective const &obj) const
Definition: Player.cpp:17397
uint32 GetEntranceLocation() const
Definition: InstanceSaveMgr.h:77
QuestObjectives Objectives
Definition: QuestDef.h:594
Definition: Group.h:219
float target_X
Definition: ObjectMgr.h:461
uint32 target_mapId
Definition: ObjectMgr.h:460
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleArtifactAddPower()

void WorldSession::HandleArtifactAddPower ( WorldPackets::Artifact::ArtifactAddPower artifactAddPower)
30 {
32  return;
33 
34  Item* artifact = _player->GetItemByGuid(artifactAddPower.ArtifactGUID);
35  if (!artifact || artifact->IsArtifactDisabled())
36  return;
37 
38  uint32 currentArtifactTier = artifact->GetModifier(ITEM_MODIFIER_ARTIFACT_TIER);
39 
40  uint64 xpCost = 0;
42  xpCost = uint64(currentArtifactTier == MAX_ARTIFACT_TIER ? cost->XP2 : cost->XP);
43 
44  if (xpCost > artifact->m_itemData->ArtifactXP)
45  return;
46 
47  if (artifactAddPower.PowerChoices.empty())
48  return;
49 
50  UF::ArtifactPower const* artifactPower = artifact->GetArtifactPower(artifactAddPower.PowerChoices[0].ArtifactPowerID);
51  if (!artifactPower)
52  return;
53 
54  ArtifactPowerEntry const* artifactPowerEntry = sArtifactPowerStore.LookupEntry(artifactPower->ArtifactPowerID);
55  if (!artifactPowerEntry)
56  return;
57 
58  if (artifactPowerEntry->Tier > currentArtifactTier)
59  return;
60 
61  uint32 maxRank = artifactPowerEntry->MaxPurchasableRank;
62  if (artifactPowerEntry->Tier < currentArtifactTier)
63  {
64  if (artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_FINAL)
65  maxRank = 1;
66  else if (artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_MAX_RANK_WITH_TIER)
67  maxRank += currentArtifactTier - artifactPowerEntry->Tier;
68  }
69 
70  if (artifactAddPower.PowerChoices[0].Rank != artifactPower->PurchasedRank + 1 ||
71  artifactAddPower.PowerChoices[0].Rank > maxRank)
72  return;
73 
74  if (!(artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_NO_LINK_REQUIRED))
75  {
76  if (std::unordered_set<uint32> const* artifactPowerLinks = sDB2Manager.GetArtifactPowerLinks(artifactPower->ArtifactPowerID))
77  {
78  bool hasAnyLink = false;
79  for (uint32 artifactPowerLinkId : *artifactPowerLinks)
80  {
81  ArtifactPowerEntry const* artifactPowerLink = sArtifactPowerStore.LookupEntry(artifactPowerLinkId);
82  if (!artifactPowerLink)
83  continue;
84 
85  UF::ArtifactPower const* artifactPowerLinkLearned = artifact->GetArtifactPower(artifactPowerLinkId);
86  if (!artifactPowerLinkLearned)
87  continue;
88 
89  if (artifactPowerLinkLearned->PurchasedRank >= artifactPowerLink->MaxPurchasableRank)
90  {
91  hasAnyLink = true;
92  break;
93  }
94  }
95 
96  if (!hasAnyLink)
97  return;
98  }
99  }
100 
101  ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower->ArtifactPowerID, artifactPower->CurrentRankWithBonus + 1 - 1); // need data for next rank, but -1 because of how db2 data is structured
102  if (!artifactPowerRank)
103  return;
104 
105  artifact->SetArtifactPower(artifactPower->ArtifactPowerID, artifactPower->PurchasedRank + 1, artifactPower->CurrentRankWithBonus + 1);
106 
107  if (artifact->IsEquipped())
108  {
109  _player->ApplyArtifactPowerRank(artifact, artifactPowerRank, true);
110 
111  for (UF::ArtifactPower const& power : artifact->m_itemData->ArtifactPowers)
112  {
113  ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerID);
114  if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
115  continue;
116 
117  ArtifactPowerRankEntry const* scaledArtifactPowerRank = sDB2Manager.GetArtifactPowerRank(scaledArtifactPowerEntry->ID, 0);
118  if (!scaledArtifactPowerRank)
119  continue;
120 
121  artifact->SetArtifactPower(power.ArtifactPowerID, power.PurchasedRank, power.CurrentRankWithBonus + 1);
122 
123  _player->ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, false);
124  _player->ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, true);
125  }
126  }
127 
128  artifact->SetArtifactXP(artifact->m_itemData->ArtifactXP - xpCost);
129  artifact->SetState(ITEM_CHANGED, _player);
130 
131  uint32 totalPurchasedArtifactPower = artifact->GetTotalPurchasedArtifactPowers();
132  uint32 artifactTier = 0;
133 
134  for (ArtifactTierEntry const* tier : sArtifactTierStore)
135  {
136  if (artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_FINAL && artifactPowerEntry->Tier < MAX_ARTIFACT_TIER)
137  {
138  artifactTier = artifactPowerEntry->Tier + 1;
139  break;
140  }
141 
142  if (totalPurchasedArtifactPower < tier->MaxNumTraits)
143  {
144  artifactTier = tier->ArtifactTier;
145  break;
146  }
147  }
148 
149  artifactTier = std::max(artifactTier, currentArtifactTier);
150 
151  for (uint32 i = currentArtifactTier; i <= artifactTier; ++i)
152  artifact->InitArtifactPowers(artifact->GetTemplate()->GetArtifactID(), uint8(i));
153 
154  artifact->SetModifier(ITEM_MODIFIER_ARTIFACT_TIER, artifactTier);
155 }
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid const &guid) const
Definition: Player.cpp:2007
#define sDB2Manager
Definition: DB2Stores.h:445
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
void SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus)
Definition: Item.cpp:2477
bool IsArtifactDisabled() const
Definition: Item.cpp:2449
Definition: DBCEnums.h:167
Array< ArtifactPowerChoice, 1 > PowerChoices
Definition: ArtifactPackets.h:44
UF::ArtifactPower const * GetArtifactPower(uint32 artifactPowerId) const
Definition: Item.cpp:2457
Definition: DB2Structure.h:280
int16 ArtifactPowerID
Definition: UpdateFields.h:94
uint8 MaxPurchasableRank
Definition: DB2Structure.h:261
void InitArtifactPowers(uint8 artifactId, uint8 artifactTier)
Definition: Item.cpp:2492
DB2Storage< ArtifactPowerEntry > sArtifactPowerStore("ArtifactPower.db2", ArtifactPowerLoadInfo::Instance())
uint8 GetArtifactID() const
Definition: ItemTemplate.h:786
Definition: DBCEnums.h:170
Definition: SharedDefines.h:2663
Definition: GameTables.h:32
ObjectGuid ForgeGUID
Definition: ArtifactPackets.h:43
Definition: DBCEnums.h:166
Definition: ItemDefines.h:221
uint8 CurrentRankWithBonus
Definition: UpdateFields.h:96
uint8 PurchasedRank
Definition: UpdateFields.h:95
Definition: Item.h:169
uint32_t uint32
Definition: Define.h:152
uint64_t uint64
Definition: Define.h:151
ObjectGuid ArtifactGUID
Definition: ArtifactPackets.h:42
#define MAX_ARTIFACT_TIER
Definition: DBCEnums.h:175
void ApplyArtifactPowerRank(Item *artifact, ArtifactPowerRankEntry const *artifactPowerRank, bool apply)
Definition: Player.cpp:8077
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2331
Definition: DB2Structure.h:296
Definition: Item.h:55
Item * GetItemByGuid(ObjectGuid guid) const
Definition: Player.cpp:10087
bool IsEquipped() const
Definition: Item.cpp:1210
uint32 ID
Definition: DB2Structure.h:259
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1132
Player * _player
Definition: WorldSession.h:1874
Definition: DB2Structure.h:256
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
void SetArtifactXP(uint64 xp)
Definition: Item.h:420
uint8_t uint8
Definition: Define.h:154
Definition: UpdateFields.h:92
DB2Storage< ArtifactTierEntry > sArtifactTierStore("ArtifactTier.db2", ArtifactTierLoadInfo::Instance())
uint8 Flags
Definition: DB2Structure.h:263
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
GameTable< GtArtifactLevelXPEntry > sArtifactLevelXPGameTable
Definition: GameTables.cpp:28
uint8 Tier
Definition: DB2Structure.h:264
uint32 GetTotalPurchasedArtifactPowers() const
Definition: Item.cpp:2533
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleArtifactSetAppearance()

void WorldSession::HandleArtifactSetAppearance ( WorldPackets::Artifact::ArtifactSetAppearance artifactSetAppearance)
158 {
160  return;
161 
162  ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifactSetAppearance.ArtifactAppearanceID);
163  if (!artifactAppearance)
164  return;
165 
166  Item* artifact = _player->GetItemByGuid(artifactSetAppearance.ArtifactGUID);
167  if (!artifact)
168  return;
169 
170  ArtifactAppearanceSetEntry const* artifactAppearanceSet = sArtifactAppearanceSetStore.LookupEntry(artifactAppearance->ArtifactAppearanceSetID);
171  if (!artifactAppearanceSet || artifactAppearanceSet->ArtifactID != artifact->GetTemplate()->GetArtifactID())
172  return;
173 
174  if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID))
175  if (!sConditionMgr->IsPlayerMeetingCondition(_player, playerCondition))
176  return;
177 
178  artifact->SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
179  artifact->SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID);
180  artifact->SetState(ITEM_CHANGED, _player);
181  Item* childItem = _player->GetChildItemByGuid(artifact->GetChildItem());
182  if (childItem)
183  {
184  childItem->SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
185  childItem->SetState(ITEM_CHANGED, _player);
186  }
187 
188  if (artifact->IsEquipped())
189  {
190  // change weapon appearance
191  _player->SetVisibleItemSlot(artifact->GetSlot(), artifact);
192  if (childItem)
193  _player->SetVisibleItemSlot(childItem->GetSlot(), childItem);
194 
195  // change druid form appearance
196  if (artifactAppearance->OverrideShapeshiftDisplayID && artifactAppearance->OverrideShapeshiftFormID && _player->GetShapeshiftForm() == ShapeshiftForm(artifactAppearance->OverrideShapeshiftFormID))
198  }
199 }
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid const &guid) const
Definition: Player.cpp:2007
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint16 ArtifactAppearanceSetID
Definition: DB2Structure.h:220
uint32 ArtifactID
Definition: DB2Structure.h:246
void SetAppearanceModId(uint32 appearanceModId)
Definition: Item.h:336
bool IsMounted() const
Definition: Unit.h:984
ObjectGuid ArtifactGUID
Definition: ArtifactPackets.h:54
int32 ArtifactAppearanceID
Definition: ArtifactPackets.h:56
uint8 OverrideShapeshiftFormID
Definition: DB2Structure.h:227
uint8 GetArtifactID() const
Definition: ItemTemplate.h:786
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1501
uint8 ItemAppearanceModifierID
Definition: DB2Structure.h:223
DB2Storage< ArtifactAppearanceSetEntry > sArtifactAppearanceSetStore("ArtifactAppearanceSet.db2", ArtifactAppearanceSetLoadInfo::Instance())
Definition: SharedDefines.h:2663
void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting=false)
Definition: Unit.cpp:9888
DB2Storage< ArtifactAppearanceEntry > sArtifactAppearanceStore("ArtifactAppearance.db2", ArtifactAppearanceLoadInfo::Instance())
ObjectGuid ForgeGUID
Definition: ArtifactPackets.h:55
void SetVisibleItemSlot(uint8 slot, Item *pItem)
Definition: Player.cpp:12483
Definition: Item.h:169
ShapeshiftForm
Definition: SpellAuraDefines.h:604
uint32 OverrideShapeshiftDisplayID
Definition: DB2Structure.h:228
#define sConditionMgr
Definition: ConditionMgr.h:326
ObjectGuid GetChildItem() const
Definition: Item.h:405
uint32 UnlockPlayerConditionID
Definition: DB2Structure.h:222
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2331
Definition: Item.h:55
Item * GetChildItemByGuid(ObjectGuid guid) const
Definition: Player.cpp:10189
Item * GetItemByGuid(ObjectGuid guid) const
Definition: Player.cpp:10087
bool IsEquipped() const
Definition: Item.cpp:1210
Definition: ItemDefines.h:205
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1132
Player * _player
Definition: WorldSession.h:1874
Definition: DB2Structure.h:216
Definition: DB2Structure.h:236
uint8 GetSlot() const
Definition: Item.h:271
Definition: DB2Structure.h:2571
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
uint32 ID
Definition: DB2Structure.h:219
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAttackStopOpcode()

void WorldSession::HandleAttackStopOpcode ( WorldPackets::Combat::AttackStop packet)
64 {
65  GetPlayer()->AttackStop();
66 }
bool AttackStop()
Definition: Unit.cpp:5516
Player * GetPlayer() const
Definition: WorldSession.h:982
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAttackSwingOpcode()

void WorldSession::HandleAttackSwingOpcode ( WorldPackets::Combat::AttackSwing packet)

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.

29 {
30  Unit* enemy = ObjectAccessor::GetUnit(*_player, packet.Victim);
31 
32  if (!enemy)
33  {
34  // stop attack state at client
35  SendAttackStop(nullptr);
36  return;
37  }
38 
39  if (!_player->IsValidAttackTarget(enemy))
40  {
41  // stop attack state at client
42  SendAttackStop(enemy);
43  return;
44  }
45 
49  if (Vehicle* vehicle = _player->GetVehicle())
50  {
51  VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(_player);
52  ASSERT(seat);
53  if (!(seat->Flags & VEHICLE_SEAT_FLAG_CAN_ATTACK))
54  {
55  SendAttackStop(enemy);
56  return;
57  }
58  }
59 
60  _player->Attack(enemy, true);
61 }
Definition: DB2Structure.h:3661
void SendAttackStop(Unit const *enemy)
Definition: CombatHandler.cpp:79
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5400
Definition: Vehicle.h:31
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2674
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:208
int32 Flags
Definition: DB2Structure.h:3666
Definition: DBCEnums.h:1621
Vehicle * GetVehicle() const
Definition: Unit.h:1749
ObjectGuid Victim
Definition: CombatPackets.h:36
Player * _player
Definition: WorldSession.h:1874
#define ASSERT
Definition: Errors.h:57
Definition: Unit.h:736
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleAuctionBrowseQuery()

void WorldSession::HandleAuctionBrowseQuery ( WorldPackets::AuctionHouse::AuctionBrowseQuery browseQuery)
38 {
39  AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, browseQuery.TaintedBy.is_initialized());
40  if (throttle.Throttled)
41  return;
42 
44  if (!creature)
45  {
46  TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", browseQuery.Auctioneer.ToString().c_str());
47  return;
48  }
49 
50  // remove fake death
53 
54  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
55 
56  TC_LOG_DEBUG("auctionHouse", "Auctionhouse search (%s), searchedname: %s, levelmin: %u, levelmax: %u, filters: %u",
57  browseQuery.Auctioneer.ToString().c_str(), browseQuery.Name.c_str(), browseQuery.MinLevel, browseQuery.MaxLevel, AsUnderlyingType(browseQuery.Filters));
58 
59  std::wstring name;
60  if (!Utf8toWStr(browseQuery.Name, name))
61  return;
62 
64 
66  if (!browseQuery.ItemClassFilters.empty())
67  {
68  classFilters = boost::in_place();
69 
70  for (auto const& classFilter : browseQuery.ItemClassFilters)
71  {
72  if (!classFilter.SubClassFilters.empty())
73  {
74  for (auto const& subClassFilter : classFilter.SubClassFilters)
75  {
76  if (classFilter.ItemClass < MAX_ITEM_CLASS)
77  {
78  classFilters->Classes[classFilter.ItemClass].SubclassMask |= 1 << subClassFilter.ItemSubclass;
79  if (subClassFilter.ItemSubclass < MAX_ITEM_SUBCLASS_TOTAL)
80  classFilters->Classes[classFilter.ItemClass].InvTypes[subClassFilter.ItemSubclass] = subClassFilter.InvTypeMask;
81  }
82  }
83  }
84  else
85  classFilters->Classes[classFilter.ItemClass].SubclassMask = AuctionSearchClassFilters::FILTER_SKIP_SUBCLASS;
86  }
87  }
88 
89  auctionHouse->BuildListBuckets(listBucketsResult, _player,
90  name, browseQuery.MinLevel, browseQuery.MaxLevel, browseQuery.Filters, classFilters,
91  browseQuery.KnownPets.data(), browseQuery.KnownPets.size(), browseQuery.MaxPetLevel,
92  browseQuery.Offset, browseQuery.Sorts.data(), browseQuery.Sorts.size());
93 
94  listBucketsResult.BrowseMode = AuctionHouseBrowseMode::Search;
95  listBucketsResult.DesiredDelay = uint32(throttle.DelayUntilNext.count());
96  SendPacket(listBucketsResult.Write());
97 }
Definition: UnitDefines.h:227
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition: Util.h:558
uint8 MinLevel
Definition: AuctionHousePackets.h:154
uint32 GetFaction() const override
Definition: Unit.h:947
std::string ToString() const
Definition: ObjectGuid.cpp:238
Definition: AuctionHouseMgr.h:142
WorldPacket const * Write() override
Definition: AuctionHousePackets.cpp:600
uint8 MaxLevel
Definition: AuctionHousePackets.h:155
Definition: Unit.h:236
#define MAX_ITEM_CLASS
Definition: ItemTemplate.h:428
Definition: Creature.h:61
Milliseconds DelayUntilNext
Definition: AuctionHouseMgr.h:263
uint32 Offset
Definition: AuctionHousePackets.h:153
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
Array< AuctionListFilterClass, 7 > ItemClassFilters
Definition: AuctionHousePackets.h:161
Definition: SpellAuraDefines.h:154
pointer data()
Definition: PacketUtilities.h:62
AuctionHouseBrowseMode BrowseMode
Definition: AuctionHousePackets.h:439