refactor(Core/Instances): Implement GetTeamIdInInstance() for two-fac… (#21168)

This commit is contained in:
Andrew
2025-01-17 23:51:25 -03:00
committed by GitHub
parent 30a9c87d7d
commit 4a3fab424c
10 changed files with 156 additions and 514 deletions

View File

@@ -141,7 +141,7 @@ typedef std::map<ObjectGuid::LowType /*spawnId*/, uint8 /*state*/> ObjectStateMa
class InstanceScript : public ZoneScript
{
public:
explicit InstanceScript(Map* map) : instance(map), completedEncounters(0) {}
explicit InstanceScript(Map* map) : instance(map), completedEncounters(0), _teamIdInInstance(TEAM_NEUTRAL) {}
~InstanceScript() override {}
@@ -182,10 +182,10 @@ public:
GameObject* GetGameObject(uint32 type);
//Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player* /*player*/) {}
virtual void OnPlayerEnter(Player* /*player*/);
//Called when a player successfully leaves the instance.
virtual void OnPlayerLeave(Player* /*player*/) {}
virtual void OnPlayerLeave(Player* /*player*/);
virtual void OnPlayerAreaUpdate(Player* /*player*/, uint32 /*oldArea*/, uint32 /*newArea*/) {}
@@ -322,6 +322,9 @@ protected:
void WritePersistentData(std::ostringstream& data);
virtual void WriteSaveDataMore(std::ostringstream& /*data*/) { }
TeamId GetTeamIdInInstance() const { return _teamIdInInstance; }
bool IsTwoFactionInstance() const;
private:
static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo);
@@ -336,6 +339,7 @@ private:
ObjectGuidMap _objectGuids;
ObjectStateMap _objectStateMap;
uint32 completedEncounters; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets
TeamId _teamIdInInstance;
std::unordered_set<uint32> _activatedAreaTriggers;
};