diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index f45a32b5ad..9fe68bf3d1 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -205,6 +205,7 @@ struct BattlegroundObjectInfo enum ArenaType : uint8 { + ARENA_TYPE_NONE = 0, ARENA_TYPE_2v2 = 2, ARENA_TYPE_3v3 = 3, ARENA_TYPE_5v5 = 5 diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 6824d4602d..00c31f579f 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -718,7 +718,7 @@ BattlegroundTypeId BattlegroundMgr::BGTemplateId(BattlegroundQueueTypeId bgQueue uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId) { - uint8 arenaType = 0; + uint8 arenaType = ARENA_TYPE_NONE; if (BattlegroundMgr::QueueToArenaType.find(bgQueueTypeId) != BattlegroundMgr::QueueToArenaType.end()) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 230292aa49..142d263508 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -279,6 +279,7 @@ private: void NodeOccupied(uint8 node); void NodeDeoccupied(uint8 node); +public: struct CapturePointInfo { CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false) @@ -293,6 +294,13 @@ private: bool _captured; }; + [[nodiscard]] CapturePointInfo const& GetCapturePointInfo(uint32 node) const + { + ASSERT(node < BG_AB_DYNAMIC_NODES_COUNT); + return _capturePointInfo[node]; + } + +private: CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT]; EventMap _bgEvents; uint32 _honorTics; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index e1e46b9aaa..7e91faa99a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1791,6 +1791,14 @@ public: TeamId GetPrematureWinner() override; + [[nodiscard]] BG_AV_NodeInfo const& GetAVNodeInfo(uint32 node) const + { + ASSERT(node < BG_AV_NODES_MAX); + return m_Nodes[node]; + } + [[nodiscard]] bool IsCaptainAlive(uint8 index) const { return index < PVP_TEAMS_COUNT && m_CaptainAlive[index]; } + [[nodiscard]] TeamId GetMineOwner(uint8 index) const { return index < PVP_TEAMS_COUNT ? m_Mine_Owner[index] : TEAM_NEUTRAL; } + private: void PostUpdateImpl(uint32 diff) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 268c28688c..51ff6c4a19 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -20,6 +20,7 @@ #include "Creature.h" #include "GameGraveyard.h" #include "GameTime.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" #include "Util.h" @@ -133,6 +134,7 @@ void BattlegroundEY::UpdatePointsState() pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point)); _capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0; _capturePointInfo[point]._playersCount[TEAM_HORDE] = 0; + _capturePointInfo[point]._playerGuid.Clear(); } BattlegroundPlayerMap const& bgPlayerMap = GetPlayers(); @@ -147,7 +149,7 @@ void BattlegroundEY::UpdatePointsState() itr->second->SendUpdateWorldState(WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY); itr->second->SendUpdateWorldState(WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus); ++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()]; - _capturePointInfo[point].player = itr->second; + _capturePointInfo[point]._playerGuid = itr->second->GetGUID(); // Xinef: ugly hax... area trigger is no longer called by client... if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f) @@ -169,10 +171,10 @@ void BattlegroundEY::UpdatePointsState() if (pointOwnerTeamId != _capturePointInfo[point]._ownerTeamId) { if (_capturePointInfo[point].IsUncontrolled()) - EventTeamCapturedPoint(_capturePointInfo[point].player, pointOwnerTeamId, point); + EventTeamCapturedPoint(ObjectAccessor::FindPlayer(_capturePointInfo[point]._playerGuid), pointOwnerTeamId, point); if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl()) - EventTeamLostPoint(_capturePointInfo[point].player, point); + EventTeamLostPoint(ObjectAccessor::FindPlayer(_capturePointInfo[point]._playerGuid), point); } } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 2730a06041..85ef7383f6 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -400,6 +400,7 @@ private: /* Scorekeeping */ void AddPoints(TeamId teamId, uint32 points); +public: struct CapturePointInfo { CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0) @@ -412,13 +413,20 @@ private: int8 _barStatus; uint32 _areaTrigger; int8 _playersCount[PVP_TEAMS_COUNT]; - Player* player = nullptr; + ObjectGuid _playerGuid; bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; } bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; } bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; } }; + [[nodiscard]] CapturePointInfo const& GetCapturePointInfo(uint32 node) const + { + ASSERT(node < EY_POINTS_MAX); + return _capturePointInfo[node]; + } + +private: CapturePointInfo _capturePointInfo[EY_POINTS_MAX]; EventMap _bgEvents; uint32 _honorTics; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 9f859ddfe0..2bef72ce74 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -922,6 +922,13 @@ public: bool AllNodesConrolledByTeam(TeamId teamId) const override; // overwrited bool IsResourceGlutAllowed(TeamId teamId) const; void DoAction(uint32 action, ObjectGuid guid) override; + + [[nodiscard]] ICNodePoint const& GetICNodePoint(uint8 index) const + { + ASSERT(index < MAX_NODE_TYPES); + return nodePoint[index]; + } + private: uint32 closeFortressDoorsTimer; bool doorsClosed; diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 1255e7ea83..e7eea2b1ff 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -27,10 +27,10 @@ class ChannelMgr { +public: typedef std::unordered_map ChannelMap; typedef std::map ChannelRightsMap; -public: ChannelMgr(TeamId teamId) : _teamId(teamId) { } @@ -40,6 +40,7 @@ public: Channel* GetJoinChannel(std::string const& name, uint32 channel_id); Channel* GetChannel(std::string const& name, Player* p, bool pkt = true); + [[nodiscard]] ChannelMap const& GetChannels() const { return channels; } static void LoadChannels(); static void LoadChannelRights(); diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 034e92b944..08e530688b 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -589,6 +589,7 @@ namespace lfg [[nodiscard]] bool IsTesting() const { return m_Testing; } void SetDungeon(ObjectGuid guid, uint32 dungeon); + LFGDungeonData const* GetLFGDungeon(uint32 id); private: TeamId GetTeam(ObjectGuid guid); @@ -601,7 +602,6 @@ namespace lfg void SetCanOverrideRBState(ObjectGuid guid, bool val); void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap, uint32 randomDungeonId = 0); void _SaveToDB(ObjectGuid guid); - LFGDungeonData const* GetLFGDungeon(uint32 id); // Proposals void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type); diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h index 9b43136df7..709e3eb491 100644 --- a/src/server/game/Entities/Item/ItemTemplate.h +++ b/src/server/game/Entities/Item/ItemTemplate.h @@ -818,6 +818,8 @@ struct ItemTemplate [[nodiscard]] bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; } [[nodiscard]] bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; } [[nodiscard]] bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && HasFlag(ITEM_FLAG_CONJURED); } + [[nodiscard]] bool IsWeapon() const { return Class == ITEM_CLASS_WEAPON; } + [[nodiscard]] bool IsRangedWeapon() const { return IsWeapon() && (InventoryType == INVTYPE_RANGED || InventoryType == INVTYPE_THROWN || InventoryType == INVTYPE_RANGEDRIGHT); } [[nodiscard]] bool HasStat(ItemModType stat) const; [[nodiscard]] bool HasSpellPowerStat() const; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 577df4803e..8c97ebb0cc 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6986,6 +6986,13 @@ ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTem } } + return GetFactionReactionTo(factionTemplateEntry, targetFactionTemplateEntry); +} + +ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, FactionTemplateEntry const* targetFactionTemplateEntry) +{ + if (!factionTemplateEntry || !targetFactionTemplateEntry) + return REP_NEUTRAL; // common faction based check if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry)) return REP_HOSTILE; @@ -6995,6 +7002,7 @@ ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTem return REP_FRIENDLY; if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS) return REP_HOSTILE; + // neutral by default return REP_NEUTRAL; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 7bb3db7f51..2d476e5197 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1876,6 +1876,7 @@ public: // Reputations system ReputationRank GetReactionTo(Unit const* target, bool checkOriginalFaction = false) const; ReputationRank GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, Unit const* target) const; + static ReputationRank GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, FactionTemplateEntry const* targetFactionTemplateEntry); // Shared vision SharedVisionList const& GetSharedVisionList() { return m_sharedVision; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 24f837cb71..271ea7cb0b 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -873,6 +873,7 @@ public: return nullptr; } + [[nodiscard]] AreaTriggerTeleportContainer const& GetAllAreaTriggerTeleports() const { return _areaTriggerTeleportStore; } [[nodiscard]] AreaTriggerTeleport const* GetAreaTriggerTeleport(uint32 trigger) const { AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.find(trigger); diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 32da012913..919004e856 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -270,6 +270,7 @@ public: void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid); void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag); void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag); + [[nodiscard]] ObjectGuid GetTargetIcon(uint8 id) const { return id < TARGETICONCOUNT ? m_targetIcons[id] : ObjectGuid::Empty; } Difficulty GetDifficulty(bool isRaid) const; Difficulty GetDungeonDifficulty() const; @@ -311,6 +312,9 @@ public: void EndRoll(Loot* loot); void RemovePlayerFromRolls(ObjectGuid guid); + // Snapshot of the active rolls, roll is deleted after a roll finishes. Do not cache the pointers across ticks. + [[nodiscard]] std::vector GetRolls() const { return { RollId.begin(), RollId.end() }; } + // related to disenchant rolls void ResetMaxEnchantingLevel();