aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Maps/Map.cpp4
-rw-r--r--src/server/game/Maps/Map.h5
-rw-r--r--src/server/game/Maps/MapInstanced.cpp10
-rw-r--r--src/server/game/Maps/MapInstanced.h2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp15
5 files changed, 14 insertions, 22 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 17be3a915d3..64a1a5fb2dd 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3743,10 +3743,10 @@ template TC_GAME_API void Map::RemoveFromMap(DynamicObject*, bool);
/* ******* Dungeon Instance Maps ******* */
-InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent)
+InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent, TeamId InstanceTeam)
: Map(id, expiry, InstanceId, SpawnMode, _parent),
m_resetAfterUnload(false), m_unloadWhenEmpty(false),
- i_data(nullptr), i_script_id(0)
+ i_data(nullptr), i_script_id(0), i_script_team(InstanceTeam)
{
//lets initialize visibility distance for dungeons
InstanceMap::InitVisibilityDistance();
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index a6a4e53bc50..06c148cae00 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -916,7 +916,7 @@ enum InstanceResetMethod
class TC_GAME_API InstanceMap : public Map
{
public:
- InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
+ InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent, TeamId InstanceTeam);
~InstanceMap();
bool AddPlayerToMap(Player*) override;
void RemovePlayerFromMap(Player*, bool) override;
@@ -938,6 +938,8 @@ class TC_GAME_API InstanceMap : public Map
bool HasPermBoundPlayers() const;
uint32 GetMaxPlayers() const;
uint32 GetMaxResetDelay() const;
+ TeamId GetTeamIdInInstance() const { return i_script_team; }
+ Team GetTeamInInstance() const { return i_script_team == TEAM_ALLIANCE ? ALLIANCE : HORDE; }
virtual void InitVisibilityDistance() override;
@@ -947,6 +949,7 @@ class TC_GAME_API InstanceMap : public Map
bool m_unloadWhenEmpty;
InstanceScript* i_data;
uint32 i_script_id;
+ TeamId i_script_team;
};
class TC_GAME_API BattlegroundMap : public Map
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index ae023f153bb..2d7feeda28d 100644
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -155,7 +155,7 @@ Map* MapInstanced::CreateInstanceForPlayer(uint32 mapId, Player* player, uint32
{
map = FindInstanceMap(loginInstanceId);
if (!map && pSave && pSave->GetInstanceId() == loginInstanceId)
- map = CreateInstance(loginInstanceId, pSave, pSave->GetDifficulty());
+ map = CreateInstance(loginInstanceId, pSave, pSave->GetDifficulty(), player->GetTeamId());
return map;
}
@@ -180,7 +180,7 @@ Map* MapInstanced::CreateInstanceForPlayer(uint32 mapId, Player* player, uint32
map = FindInstanceMap(newInstanceId);
// it is possible that the save exists but the map doesn't
if (!map)
- map = CreateInstance(newInstanceId, pSave, pSave->GetDifficulty());
+ map = CreateInstance(newInstanceId, pSave, pSave->GetDifficulty(), player->GetTeamId());
}
else
{
@@ -193,14 +193,14 @@ Map* MapInstanced::CreateInstanceForPlayer(uint32 mapId, Player* player, uint32
//ASSERT(!FindInstanceMap(NewInstanceId));
map = FindInstanceMap(newInstanceId);
if (!map)
- map = CreateInstance(newInstanceId, nullptr, diff);
+ map = CreateInstance(newInstanceId, nullptr, diff, player->GetTeamId());
}
}
return map;
}
-InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty)
+InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty, TeamId InstanceTeam)
{
// load/create a map
std::lock_guard<std::mutex> lock(_mapLock);
@@ -224,7 +224,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal");
- InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
+ InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this, InstanceTeam);
ASSERT(map->IsDungeon());
map->LoadRespawnTimes();
diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h
index 58be263a767..d60abbc25d1 100644
--- a/src/server/game/Maps/MapInstanced.h
+++ b/src/server/game/Maps/MapInstanced.h
@@ -63,7 +63,7 @@ class TC_GAME_API MapInstanced : public Map
virtual void InitVisibilityDistance() override;
private:
- InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty);
+ InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty, TeamId InstanceTeam);
BattlegroundMap* CreateBattleground(uint32 InstanceId, Battleground* bg);
InstancedMaps m_InstancedMaps;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index 652b7e1b50f..92276664805 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -145,7 +145,7 @@ class instance_icecrown_citadel : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadBossBoundaries(boundaries);
LoadDoorData(doorData);
- TeamInInstance = 0;
+ TeamInInstance = map->GetTeamInInstance();
HeroicAttempts = MaxHeroicAttempts;
ColdflameJetsState = NOT_STARTED;
UpperSpireTeleporterActiveState = NOT_STARTED;
@@ -186,9 +186,6 @@ class instance_icecrown_citadel : public InstanceMapScript
void OnPlayerEnter(Player* player) override
{
- if (!TeamInInstance)
- TeamInInstance = player->GetTeam();
-
uint8 spawnGroupId = TeamInInstance == ALLIANCE ? SPAWN_GROUP_ALLIANCE_ROS : SPAWN_GROUP_HORDE_ROS;
if (!instance->IsSpawnGroupActive(spawnGroupId))
instance->SpawnGroupSpawn(spawnGroupId);
@@ -332,14 +329,6 @@ class instance_icecrown_citadel : public InstanceMapScript
// Weekly quest spawn prevention
uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
{
- if (!TeamInInstance)
- {
- Map::PlayerList const& players = instance->GetPlayers();
- if (!players.isEmpty())
- if (Player* player = players.begin()->GetSource())
- TeamInInstance = player->GetTeam();
- }
-
uint32 entry = data->id;
switch (entry)
{
@@ -1528,7 +1517,7 @@ class instance_icecrown_citadel : public InstanceMapScript
ObjectGuid FrozenBolvarGUID;
ObjectGuid PillarsChainedGUID;
ObjectGuid PillarsUnchainedGUID;
- uint32 TeamInInstance;
+ Team TeamInInstance;
uint32 ColdflameJetsState;
uint32 UpperSpireTeleporterActiveState;
std::unordered_set<uint32> FrostwyrmGUIDs;