mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
feat(Core/Misc): Add read-only module accessors (#27579)
Co-authored-by: 郑佩茹 <[email protected]> Co-authored-by: UltraNix <[email protected]> Co-authored-by: antony <[email protected]> Co-authored-by: Yunfan Li <[email protected]> Co-authored-by: bashermens <[email protected]> Co-authored-by: sudlud <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
郑佩茹
UltraNix
antony
Yunfan Li
bashermens
sudlud
Claude Opus 5
parent
6a8a1f45fa
commit
129a2d0e22
@@ -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
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
|
||||
class ChannelMgr
|
||||
{
|
||||
public:
|
||||
typedef std::unordered_map<std::wstring, Channel*> ChannelMap;
|
||||
typedef std::map<std::string, ChannelRights> 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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Roll const*> GetRolls() const { return { RollId.begin(), RollId.end() }; }
|
||||
|
||||
// related to disenchant rolls
|
||||
void ResetMaxEnchantingLevel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user