refactor(Core/Instances): Implement GetTeamIdInInstance() for two-fac… (#21168)
This commit is contained in:
@@ -55,6 +55,34 @@ void InstanceScript::SaveToDB()
|
|||||||
CharacterDatabase.Execute(stmt);
|
CharacterDatabase.Execute(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InstanceScript::OnPlayerEnter(Player* player)
|
||||||
|
{
|
||||||
|
if (!IsTwoFactionInstance())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetTeamIdInInstance() == TEAM_NEUTRAL)
|
||||||
|
{
|
||||||
|
if (Group* group = player->GetGroup())
|
||||||
|
{
|
||||||
|
if (Player* leader = ObjectAccessor::FindConnectedPlayer(group->GetLeaderGUID()))
|
||||||
|
_teamIdInInstance = leader->GetTeamId();
|
||||||
|
else
|
||||||
|
_teamIdInInstance = player->GetTeamId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_teamIdInInstance = player->GetTeamId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||||
|
player->SetFaction((_teamIdInInstance == TEAM_HORDE) ? 1610 /*FACTION_HORDE*/ : 1 /*FACTION_ALLIANCE*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstanceScript::OnPlayerLeave(Player* player)
|
||||||
|
{
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsTwoFactionInstance())
|
||||||
|
player->SetFactionForRace(player->getRace());
|
||||||
|
}
|
||||||
|
|
||||||
void InstanceScript::OnCreatureCreate(Creature* creature)
|
void InstanceScript::OnCreatureCreate(Creature* creature)
|
||||||
{
|
{
|
||||||
AddObject(creature);
|
AddObject(creature);
|
||||||
@@ -848,3 +876,21 @@ bool InstanceHasScript(WorldObject const* obj, char const* scriptName)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InstanceScript::IsTwoFactionInstance() const
|
||||||
|
{
|
||||||
|
switch (instance->GetId())
|
||||||
|
{
|
||||||
|
case 540: // Shattered Halls
|
||||||
|
case 576: // Nexus
|
||||||
|
case 631: // Icecrown Citadel
|
||||||
|
case 632: // Forge of Souls
|
||||||
|
case 649: // Trial of the Champion
|
||||||
|
case 650: // Trial of the Crusader
|
||||||
|
case 658: // Pit of Saron
|
||||||
|
case 668: // Halls of Reflection
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ typedef std::map<ObjectGuid::LowType /*spawnId*/, uint8 /*state*/> ObjectStateMa
|
|||||||
class InstanceScript : public ZoneScript
|
class InstanceScript : public ZoneScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit InstanceScript(Map* map) : instance(map), completedEncounters(0) {}
|
explicit InstanceScript(Map* map) : instance(map), completedEncounters(0), _teamIdInInstance(TEAM_NEUTRAL) {}
|
||||||
|
|
||||||
~InstanceScript() override {}
|
~InstanceScript() override {}
|
||||||
|
|
||||||
@@ -182,10 +182,10 @@ public:
|
|||||||
GameObject* GetGameObject(uint32 type);
|
GameObject* GetGameObject(uint32 type);
|
||||||
|
|
||||||
//Called when a player successfully enters the instance.
|
//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.
|
//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*/) {}
|
virtual void OnPlayerAreaUpdate(Player* /*player*/, uint32 /*oldArea*/, uint32 /*newArea*/) {}
|
||||||
|
|
||||||
@@ -322,6 +322,9 @@ protected:
|
|||||||
void WritePersistentData(std::ostringstream& data);
|
void WritePersistentData(std::ostringstream& data);
|
||||||
virtual void WriteSaveDataMore(std::ostringstream& /*data*/) { }
|
virtual void WriteSaveDataMore(std::ostringstream& /*data*/) { }
|
||||||
|
|
||||||
|
TeamId GetTeamIdInInstance() const { return _teamIdInInstance; }
|
||||||
|
bool IsTwoFactionInstance() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo);
|
static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo);
|
||||||
|
|
||||||
@@ -336,6 +339,7 @@ private:
|
|||||||
ObjectGuidMap _objectGuids;
|
ObjectGuidMap _objectGuids;
|
||||||
ObjectStateMap _objectStateMap;
|
ObjectStateMap _objectStateMap;
|
||||||
uint32 completedEncounters; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets
|
uint32 completedEncounters; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets
|
||||||
|
TeamId _teamIdInInstance;
|
||||||
std::unordered_set<uint32> _activatedAreaTriggers;
|
std::unordered_set<uint32> _activatedAreaTriggers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+13
-55
@@ -57,7 +57,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CLEANED;
|
bool CLEANED;
|
||||||
TeamId TeamIdInInstance;
|
|
||||||
uint32 InstanceProgress;
|
uint32 InstanceProgress;
|
||||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||||
std::string str_data;
|
std::string str_data;
|
||||||
@@ -83,7 +82,6 @@ public:
|
|||||||
|
|
||||||
void Initialize() override
|
void Initialize() override
|
||||||
{
|
{
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
InstanceProgress = 0;
|
InstanceProgress = 0;
|
||||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||||
|
|
||||||
@@ -109,67 +107,49 @@ public:
|
|||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* pPlayer = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = pPlayer->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = pPlayer->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = pPlayer->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
// Grand Champions:
|
// Grand Champions:
|
||||||
case NPC_MOKRA:
|
case NPC_MOKRA:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_JACOB);
|
creature->UpdateEntry(NPC_JACOB);
|
||||||
break;
|
break;
|
||||||
case NPC_ERESSEA:
|
case NPC_ERESSEA:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_AMBROSE);
|
creature->UpdateEntry(NPC_AMBROSE);
|
||||||
break;
|
break;
|
||||||
case NPC_RUNOK:
|
case NPC_RUNOK:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_COLOSOS);
|
creature->UpdateEntry(NPC_COLOSOS);
|
||||||
break;
|
break;
|
||||||
case NPC_ZULTORE:
|
case NPC_ZULTORE:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_JAELYNE);
|
creature->UpdateEntry(NPC_JAELYNE);
|
||||||
break;
|
break;
|
||||||
case NPC_VISCERI:
|
case NPC_VISCERI:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_LANA);
|
creature->UpdateEntry(NPC_LANA);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Grand Champion Minions:
|
// Grand Champion Minions:
|
||||||
case NPC_ORGRIMMAR_MINION:
|
case NPC_ORGRIMMAR_MINION:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_STORMWIND_MINION);
|
creature->UpdateEntry(NPC_STORMWIND_MINION);
|
||||||
break;
|
break;
|
||||||
case NPC_SILVERMOON_MINION:
|
case NPC_SILVERMOON_MINION:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_GNOMEREGAN_MINION);
|
creature->UpdateEntry(NPC_GNOMEREGAN_MINION);
|
||||||
break;
|
break;
|
||||||
case NPC_THUNDER_BLUFF_MINION:
|
case NPC_THUNDER_BLUFF_MINION:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_EXODAR_MINION);
|
creature->UpdateEntry(NPC_EXODAR_MINION);
|
||||||
break;
|
break;
|
||||||
case NPC_SENJIN_MINION:
|
case NPC_SENJIN_MINION:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_DARNASSUS_MINION);
|
creature->UpdateEntry(NPC_DARNASSUS_MINION);
|
||||||
break;
|
break;
|
||||||
case NPC_UNDERCITY_MINION:
|
case NPC_UNDERCITY_MINION:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_IRONFORGE_MINION);
|
creature->UpdateEntry(NPC_IRONFORGE_MINION);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -183,7 +163,7 @@ public:
|
|||||||
case NPC_JAEREN:
|
case NPC_JAEREN:
|
||||||
case NPC_ARELAS:
|
case NPC_ARELAS:
|
||||||
NPC_AnnouncerGUID = creature->GetGUID();
|
NPC_AnnouncerGUID = creature->GetGUID();
|
||||||
//if (TeamIdInInstance == TEAM_ALLIANCE)
|
//if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
// creature->UpdateEntry(NPC_ARELAS);
|
// creature->UpdateEntry(NPC_ARELAS);
|
||||||
creature->SetReactState(REACT_PASSIVE);
|
creature->SetReactState(REACT_PASSIVE);
|
||||||
break;
|
break;
|
||||||
@@ -283,36 +263,14 @@ public:
|
|||||||
|
|
||||||
void OnPlayerEnter(Player* player) override
|
void OnPlayerEnter(Player* player) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
InstanceScript::OnPlayerEnter(player);
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFaction((TeamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
|
|
||||||
if (DoNeedCleanup(player))
|
if (DoNeedCleanup(player))
|
||||||
{
|
|
||||||
InstanceCleanup();
|
InstanceCleanup();
|
||||||
}
|
|
||||||
|
|
||||||
events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL);
|
events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DoNeedCleanup(Player* ignoredPlayer = nullptr)
|
bool DoNeedCleanup(Player* ignoredPlayer = nullptr)
|
||||||
{
|
{
|
||||||
uint8 aliveCount = 0;
|
uint8 aliveCount = 0;
|
||||||
@@ -497,7 +455,7 @@ public:
|
|||||||
case DATA_INSTANCE_PROGRESS:
|
case DATA_INSTANCE_PROGRESS:
|
||||||
return InstanceProgress;
|
return InstanceProgress;
|
||||||
case DATA_TEAMID_IN_INSTANCE:
|
case DATA_TEAMID_IN_INSTANCE:
|
||||||
return TeamIdInInstance;
|
return GetTeamIdInInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+21
-79
@@ -41,7 +41,6 @@ public:
|
|||||||
uint32 EncounterStatus;
|
uint32 EncounterStatus;
|
||||||
uint32 InstanceProgress;
|
uint32 InstanceProgress;
|
||||||
uint32 AttemptsLeft;
|
uint32 AttemptsLeft;
|
||||||
TeamId TeamIdInInstance;
|
|
||||||
uint8 Counter;
|
uint8 Counter;
|
||||||
uint8 northrendBeastsMask;
|
uint8 northrendBeastsMask;
|
||||||
uint32 AchievementTimer;
|
uint32 AchievementTimer;
|
||||||
@@ -168,7 +167,6 @@ public:
|
|||||||
EncounterStatus = NOT_STARTED;
|
EncounterStatus = NOT_STARTED;
|
||||||
InstanceProgress = INSTANCE_PROGRESS_INITIAL;
|
InstanceProgress = INSTANCE_PROGRESS_INITIAL;
|
||||||
AttemptsLeft = 50;
|
AttemptsLeft = 50;
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
Counter = 0;
|
Counter = 0;
|
||||||
northrendBeastsMask = 0;
|
northrendBeastsMask = 0;
|
||||||
AchievementTimer = 0;
|
AchievementTimer = 0;
|
||||||
@@ -475,7 +473,7 @@ public:
|
|||||||
case TYPE_FACTION_CHAMPIONS_PLAYER_DIED:
|
case TYPE_FACTION_CHAMPIONS_PLAYER_DIED:
|
||||||
if (urand(0, 2) == 0 )
|
if (urand(0, 2) == 0 )
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
{
|
{
|
||||||
if (Creature* pTemp = instance->GetCreature(NPC_VarianGUID))
|
if (Creature* pTemp = instance->GetCreature(NPC_VarianGUID))
|
||||||
pTemp->AI()->Talk(SAY_VARIAN_KILL_HORDE_PLAYER_1);
|
pTemp->AI()->Talk(SAY_VARIAN_KILL_HORDE_PLAYER_1);
|
||||||
@@ -971,16 +969,7 @@ public:
|
|||||||
}
|
}
|
||||||
case EVENT_SCENE_202:
|
case EVENT_SCENE_202:
|
||||||
{
|
{
|
||||||
Map::PlayerList const& pl = instance->GetPlayers();
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr )
|
|
||||||
if (Player* plr = itr->GetSource())
|
|
||||||
if (!plr->IsGameMaster())
|
|
||||||
{
|
|
||||||
TeamIdInInstance = plr->GetTeamId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
|
||||||
{
|
{
|
||||||
if (Creature* c = instance->GetCreature(NPC_GarroshGUID))
|
if (Creature* c = instance->GetCreature(NPC_GarroshGUID))
|
||||||
c->AI()->Talk(SAY_STAGE_2_02h);
|
c->AI()->Talk(SAY_STAGE_2_02h);
|
||||||
@@ -1004,7 +993,7 @@ public:
|
|||||||
}
|
}
|
||||||
case EVENT_SCENE_204:
|
case EVENT_SCENE_204:
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
if (Creature* c = instance->GetCreature(NPC_GarroshGUID))
|
if (Creature* c = instance->GetCreature(NPC_GarroshGUID))
|
||||||
c->AI()->Talk(SAY_STAGE_2_04h);
|
c->AI()->Talk(SAY_STAGE_2_04h);
|
||||||
@@ -1022,26 +1011,26 @@ public:
|
|||||||
}
|
}
|
||||||
case EVENT_SCENE_205:
|
case EVENT_SCENE_205:
|
||||||
{
|
{
|
||||||
if (Creature* c = instance->GetCreature(TeamIdInInstance == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID))
|
if (Creature* c = instance->GetCreature(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID))
|
||||||
c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_STAGE_2_05a : SAY_STAGE_2_05h);
|
c->AI()->Talk(GetTeamIdInInstance() == TEAM_ALLIANCE ? SAY_STAGE_2_05a : SAY_STAGE_2_05h);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EVENT_SUMMON_CHAMPIONS:
|
case EVENT_SUMMON_CHAMPIONS:
|
||||||
{
|
{
|
||||||
std::vector<uint32> vHealerEntries;
|
std::vector<uint32> vHealerEntries;
|
||||||
vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION);
|
vHealerEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION);
|
||||||
vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY);
|
vHealerEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY);
|
||||||
vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE);
|
vHealerEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE);
|
||||||
vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION);
|
vHealerEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION);
|
||||||
|
|
||||||
std::vector<uint32> vOtherEntries;
|
std::vector<uint32> vOtherEntries;
|
||||||
vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT);
|
vOtherEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT);
|
||||||
vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER);
|
vOtherEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER);
|
||||||
vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE);
|
vOtherEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE);
|
||||||
vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE);
|
vOtherEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE);
|
||||||
vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK);
|
vOtherEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK);
|
||||||
vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR);
|
vOtherEntries.push_back(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR);
|
||||||
|
|
||||||
uint8 healersSubtracted = 2;
|
uint8 healersSubtracted = 2;
|
||||||
if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC )
|
if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC )
|
||||||
@@ -1089,11 +1078,11 @@ public:
|
|||||||
uint8 pos2 = 10;
|
uint8 pos2 = 10;
|
||||||
for( std::vector<uint32>::iterator itr = vOtherEntries.begin(); itr != vOtherEntries.end(); ++itr )
|
for( std::vector<uint32>::iterator itr = vOtherEntries.begin(); itr != vOtherEntries.end(); ++itr )
|
||||||
{
|
{
|
||||||
if (Creature* pTemp = instance->SummonCreature(*itr, FactionChampionLoc[urand(0, 4) + (TeamIdInInstance == TEAM_ALLIANCE ? 0 : 5)]))
|
if (Creature* pTemp = instance->SummonCreature(*itr, FactionChampionLoc[urand(0, 4) + (GetTeamIdInInstance() == TEAM_ALLIANCE ? 0 : 5)]))
|
||||||
{
|
{
|
||||||
NPC_ChampionGUIDs.push_back(pTemp->GetGUID());
|
NPC_ChampionGUIDs.push_back(pTemp->GetGUID());
|
||||||
pTemp->SetHomePosition((TeamIdInInstance == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX() * 2 - FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 0.0f);
|
pTemp->SetHomePosition((GetTeamIdInInstance() == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX() * 2 - FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 0.0f);
|
||||||
pTemp->GetMotionMaster()->MoveJump((TeamIdInInstance == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX() * 2 - FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 20.0f, 20.0f);
|
pTemp->GetMotionMaster()->MoveJump((GetTeamIdInInstance() == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX() * 2 - FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 20.0f, 20.0f);
|
||||||
}
|
}
|
||||||
++pos2;
|
++pos2;
|
||||||
}
|
}
|
||||||
@@ -1196,35 +1185,8 @@ public:
|
|||||||
}
|
}
|
||||||
case EVENT_SCENE_VALKYR_DEAD:
|
case EVENT_SCENE_VALKYR_DEAD:
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
if (Creature* c = instance->GetCreature(GetTeamIdInInstance() == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID))
|
||||||
{
|
c->AI()->Talk((GetTeamIdInInstance() == TEAM_ALLIANCE ? SAY_STAGE_3_03a : SAY_STAGE_3_03h));
|
||||||
Map::PlayerList const& pl = instance->GetPlayers();
|
|
||||||
for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr )
|
|
||||||
if (Player* plr = itr->GetSource())
|
|
||||||
if (!plr->IsGameMaster())
|
|
||||||
{
|
|
||||||
if (Group* group = plr->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
{
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TeamIdInInstance = plr->GetTeamId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TeamIdInInstance = plr->GetTeamId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Creature* c = instance->GetCreature(TeamIdInInstance == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID))
|
|
||||||
c->AI()->Talk((TeamIdInInstance == TEAM_ALLIANCE ? SAY_STAGE_3_03a : SAY_STAGE_3_03h));
|
|
||||||
|
|
||||||
events.RescheduleEvent(EVENT_SCENE_401, 60000);
|
events.RescheduleEvent(EVENT_SCENE_401, 60000);
|
||||||
break;
|
break;
|
||||||
@@ -1413,21 +1375,7 @@ public:
|
|||||||
|
|
||||||
void OnPlayerEnter(Player* plr) override
|
void OnPlayerEnter(Player* plr) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
InstanceScript::OnPlayerEnter(plr);
|
||||||
{
|
|
||||||
if (Group* group = plr->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = plr->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = plr->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
plr->SetFaction((TeamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
|
|
||||||
if (instance->IsHeroic())
|
if (instance->IsHeroic())
|
||||||
{
|
{
|
||||||
@@ -1448,12 +1396,6 @@ public:
|
|||||||
events.RescheduleEvent(EVENT_CHECK_PLAYERS, 5s);
|
events.RescheduleEvent(EVENT_CHECK_PLAYERS, 5s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DoNeedCleanup(Player* ignoredPlayer = nullptr)
|
bool DoNeedCleanup(Player* ignoredPlayer = nullptr)
|
||||||
{
|
{
|
||||||
uint8 aliveCount = 0;
|
uint8 aliveCount = 0;
|
||||||
|
|||||||
@@ -96,12 +96,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (teamIdInInstance == TEAM_NEUTRAL)
|
if (teamIdInInstance == TEAM_NEUTRAL)
|
||||||
|
|||||||
+16
-72
@@ -144,7 +144,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint32 EncounterMask;
|
uint32 EncounterMask;
|
||||||
TeamId TeamIdInInstance;
|
|
||||||
ObjectGuid NPC_FalricGUID;
|
ObjectGuid NPC_FalricGUID;
|
||||||
ObjectGuid NPC_MarwynGUID;
|
ObjectGuid NPC_MarwynGUID;
|
||||||
ObjectGuid NPC_LichKingIntroGUID;
|
ObjectGuid NPC_LichKingIntroGUID;
|
||||||
@@ -190,7 +189,6 @@ public:
|
|||||||
void Initialize() override
|
void Initialize() override
|
||||||
{
|
{
|
||||||
EncounterMask = 0;
|
EncounterMask = 0;
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
memset(&TrashActive, 0, sizeof(TrashActive));
|
memset(&TrashActive, 0, sizeof(TrashActive));
|
||||||
TrashCounter = 0;
|
TrashCounter = 0;
|
||||||
memset(&chosenComposition, 0, sizeof(chosenComposition));
|
memset(&chosenComposition, 0, sizeof(chosenComposition));
|
||||||
@@ -214,69 +212,15 @@ public:
|
|||||||
return (instance->HavePlayers() && WaveNumber) || IsDuringLKFight; // during LK fight npcs are active and will unset this variable
|
return (instance->HavePlayers() && WaveNumber) || IsDuringLKFight; // during LK fight npcs are active and will unset this variable
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerEnter(Player* player) override
|
|
||||||
{
|
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFaction((TeamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
|
||||||
if (Player* p = itr->GetSource())
|
|
||||||
if (!p->IsGameMaster())
|
|
||||||
{
|
|
||||||
if (Group* group = p->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
{
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TeamIdInInstance = p->GetTeamId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TeamIdInInstance = p->GetTeamId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_SYLVANAS_PART1:
|
case NPC_SYLVANAS_PART1:
|
||||||
creature->SetVisible(false);
|
creature->SetVisible(false);
|
||||||
creature->SetSpeed(MOVE_RUN, 1.1);
|
creature->SetSpeed(MOVE_RUN, 1.1);
|
||||||
NPC_LeaderIntroGUID = creature->GetGUID();
|
NPC_LeaderIntroGUID = creature->GetGUID();
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_JAINA_PART1);
|
creature->UpdateEntry(NPC_JAINA_PART1);
|
||||||
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
|
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
|
||||||
creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||||
@@ -284,7 +228,7 @@ public:
|
|||||||
case NPC_DARK_RANGER_LORALEN:
|
case NPC_DARK_RANGER_LORALEN:
|
||||||
creature->SetVisible(false);
|
creature->SetVisible(false);
|
||||||
NPC_GuardGUID = creature->GetGUID();
|
NPC_GuardGUID = creature->GetGUID();
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ARCHMAGE_KORELN);
|
creature->UpdateEntry(NPC_ARCHMAGE_KORELN);
|
||||||
break;
|
break;
|
||||||
case NPC_UTHER:
|
case NPC_UTHER:
|
||||||
@@ -345,7 +289,7 @@ public:
|
|||||||
creature->CastSpell(creature, SPELL_SOUL_REAPER, true);
|
creature->CastSpell(creature, SPELL_SOUL_REAPER, true);
|
||||||
}
|
}
|
||||||
else if (!(EncounterMask & (1 << DATA_LICH_KING)))
|
else if (!(EncounterMask & (1 << DATA_LICH_KING)))
|
||||||
creature->AddAura(TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, creature);
|
creature->AddAura(GetTeamIdInInstance() == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, creature);
|
||||||
else
|
else
|
||||||
creature->SetVisible(false);
|
creature->SetVisible(false);
|
||||||
|
|
||||||
@@ -359,7 +303,7 @@ public:
|
|||||||
NPC_LeaderGUID = creature->GetGUID();
|
NPC_LeaderGUID = creature->GetGUID();
|
||||||
creature->SetWalk(false);
|
creature->SetWalk(false);
|
||||||
creature->SetSheath(SHEATH_STATE_MELEE);
|
creature->SetSheath(SHEATH_STATE_MELEE);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_JAINA_PART2);
|
creature->UpdateEntry(NPC_JAINA_PART2);
|
||||||
creature->SetWalk(false);
|
creature->SetWalk(false);
|
||||||
creature->SetHealth(creature->GetMaxHealth() / 20);
|
creature->SetHealth(creature->GetMaxHealth() / 20);
|
||||||
@@ -368,9 +312,9 @@ public:
|
|||||||
if (!(EncounterMask & (1 << DATA_LK_INTRO)))
|
if (!(EncounterMask & (1 << DATA_LK_INTRO)))
|
||||||
{
|
{
|
||||||
creature->SetSheath(SHEATH_STATE_MELEE);
|
creature->SetSheath(SHEATH_STATE_MELEE);
|
||||||
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, TeamIdInInstance == TEAM_ALLIANCE ? EMOTE_ONESHOT_ATTACK2HTIGHT : EMOTE_ONESHOT_ATTACK1H); //the fight cannot be in the form of an emote, it is causing bugs.
|
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, GetTeamIdInInstance() == TEAM_ALLIANCE ? EMOTE_ONESHOT_ATTACK2HTIGHT : EMOTE_ONESHOT_ATTACK1H); //the fight cannot be in the form of an emote, it is causing bugs.
|
||||||
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
|
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
|
||||||
creature->CastSpell(creature, TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_BARRIER : SPELL_SYLVANAS_CLOAK_OF_DARKNESS, true);
|
creature->CastSpell(creature, GetTeamIdInInstance() == TEAM_ALLIANCE ? SPELL_JAINA_ICE_BARRIER : SPELL_SYLVANAS_CLOAK_OF_DARKNESS, true);
|
||||||
}
|
}
|
||||||
else if (!(EncounterMask & (1 << DATA_LICH_KING)))
|
else if (!(EncounterMask & (1 << DATA_LICH_KING)))
|
||||||
{
|
{
|
||||||
@@ -577,7 +521,7 @@ public:
|
|||||||
if (!c->IsAlive())
|
if (!c->IsAlive())
|
||||||
{
|
{
|
||||||
c->Respawn();
|
c->Respawn();
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
c->UpdateEntry(NPC_JAINA_PART2);
|
c->UpdateEntry(NPC_JAINA_PART2);
|
||||||
}
|
}
|
||||||
c->GetThreatMgr().ClearAllThreat();
|
c->GetThreatMgr().ClearAllThreat();
|
||||||
@@ -605,7 +549,7 @@ public:
|
|||||||
c->UpdatePosition(c->GetHomePosition(), true);
|
c->UpdatePosition(c->GetHomePosition(), true);
|
||||||
c->StopMovingOnCurrentPos();
|
c->StopMovingOnCurrentPos();
|
||||||
c->RemoveAllAuras();
|
c->RemoveAllAuras();
|
||||||
c->AddAura(TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, c);
|
c->AddAura(GetTeamIdInInstance() == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, c);
|
||||||
c->AI()->Reset();
|
c->AI()->Reset();
|
||||||
c->setActive(false);
|
c->setActive(false);
|
||||||
c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||||
@@ -1126,18 +1070,18 @@ public:
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
uint32 entry = TeamIdInInstance == TEAM_ALLIANCE ? GO_THE_SKYBREAKER : GO_ORGRIMS_HAMMER;
|
uint32 entry = GetTeamIdInInstance() == TEAM_ALLIANCE ? GO_THE_SKYBREAKER : GO_ORGRIMS_HAMMER;
|
||||||
T1 = sTransportMgr->CreateTransport(entry, 0, instance);
|
T1 = sTransportMgr->CreateTransport(entry, 0, instance);
|
||||||
|
|
||||||
++outroStep;
|
++outroStep;
|
||||||
outroTimer = TeamIdInInstance == TEAM_ALLIANCE ? 10000 : 10500;
|
outroTimer = GetTeamIdInInstance() == TEAM_ALLIANCE ? 10000 : 10500;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (T1)
|
if (T1)
|
||||||
T1->EnableMovement(false);
|
T1->EnableMovement(false);
|
||||||
if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID))
|
if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID))
|
||||||
c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_FIRE_ALLY : SAY_FIRE_HORDE);
|
c->AI()->Talk(GetTeamIdInInstance() == TEAM_ALLIANCE ? SAY_FIRE_ALLY : SAY_FIRE_HORDE);
|
||||||
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
||||||
{
|
{
|
||||||
c->RemoveAllAuras();
|
c->RemoveAllAuras();
|
||||||
@@ -1185,10 +1129,10 @@ public:
|
|||||||
T1->EnableMovement(false);
|
T1->EnableMovement(false);
|
||||||
if (Creature* leader = instance->GetCreature(NPC_LeaderGUID))
|
if (Creature* leader = instance->GetCreature(NPC_LeaderGUID))
|
||||||
{
|
{
|
||||||
uint8 index = TeamIdInInstance == TEAM_ALLIANCE ? 0 : 1;
|
uint8 index = GetTeamIdInInstance() == TEAM_ALLIANCE ? 0 : 1;
|
||||||
for (uint8 i = 0; i < 3; ++i)
|
for (uint8 i = 0; i < 3; ++i)
|
||||||
if (StairsPos[index][i].GetPositionX())
|
if (StairsPos[index][i].GetPositionX())
|
||||||
if (GameObject* go = leader->SummonGameObject(TeamIdInInstance == TEAM_ALLIANCE ? GO_STAIRS_ALLIANCE : GO_STAIRS_HORDE, StairsPos[index][i].GetPositionX(), StairsPos[index][i].GetPositionY(), StairsPos[index][i].GetPositionZ(), StairsPos[index][i].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400, false))
|
if (GameObject* go = leader->SummonGameObject(GetTeamIdInInstance() == TEAM_ALLIANCE ? GO_STAIRS_ALLIANCE : GO_STAIRS_HORDE, StairsPos[index][i].GetPositionX(), StairsPos[index][i].GetPositionY(), StairsPos[index][i].GetPositionZ(), StairsPos[index][i].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400, false))
|
||||||
go->SetGameObjectFlag(GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE);
|
go->SetGameObjectFlag(GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE);
|
||||||
//Position pos = TeamIdInInstance == TEAM_ALLIANCE ? AllyPortalPos : HordePortalPos;
|
//Position pos = TeamIdInInstance == TEAM_ALLIANCE ? AllyPortalPos : HordePortalPos;
|
||||||
//leader->SummonGameObject(GO_PORTAL_TO_DALARAN, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400);
|
//leader->SummonGameObject(GO_PORTAL_TO_DALARAN, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400);
|
||||||
@@ -1200,7 +1144,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID))
|
if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID))
|
||||||
c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_ONBOARD_ALLY : SAY_ONBOARD_HORDE);
|
c->AI()->Talk(GetTeamIdInInstance() == TEAM_ALLIANCE ? SAY_ONBOARD_ALLY : SAY_ONBOARD_HORDE);
|
||||||
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
||||||
{
|
{
|
||||||
c->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
c->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||||
@@ -1212,7 +1156,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
||||||
c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_JAINA_FINAL_1 : SAY_SYLVANA_FINAL);
|
c->AI()->Talk(GetTeamIdInInstance() == TEAM_ALLIANCE ? SAY_JAINA_FINAL_1 : SAY_SYLVANA_FINAL);
|
||||||
HandleGameObject(GO_CaveInGUID, true);
|
HandleGameObject(GO_CaveInGUID, true);
|
||||||
++outroStep;
|
++outroStep;
|
||||||
outroTimer = 11000;
|
outroTimer = 11000;
|
||||||
@@ -1223,7 +1167,7 @@ public:
|
|||||||
for (Map::PlayerList::const_iterator itr = instance->GetPlayers().begin(); itr != instance->GetPlayers().end(); ++itr)
|
for (Map::PlayerList::const_iterator itr = instance->GetPlayers().begin(); itr != instance->GetPlayers().end(); ++itr)
|
||||||
if (Player* p = itr->GetSource())
|
if (Player* p = itr->GetSource())
|
||||||
p->KilledMonsterCredit(NPC_WRATH_OF_THE_LICH_KING_CREDIT);
|
p->KilledMonsterCredit(NPC_WRATH_OF_THE_LICH_KING_CREDIT);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
if (Creature* c = instance->GetCreature(NPC_LeaderGUID))
|
||||||
{
|
{
|
||||||
c->AI()->Talk(SAY_JAINA_FINAL_2);
|
c->AI()->Talk(SAY_JAINA_FINAL_2);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||||
TeamId teamIdInInstance;
|
|
||||||
uint32 InstanceProgress;
|
uint32 InstanceProgress;
|
||||||
std::string str_data;
|
std::string str_data;
|
||||||
|
|
||||||
@@ -61,7 +60,6 @@ public:
|
|||||||
void Initialize() override
|
void Initialize() override
|
||||||
{
|
{
|
||||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||||
teamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
InstanceProgress = INSTANCE_PROGRESS_NONE;
|
InstanceProgress = INSTANCE_PROGRESS_NONE;
|
||||||
|
|
||||||
bAchievEleven = true;
|
bAchievEleven = true;
|
||||||
@@ -78,62 +76,24 @@ public:
|
|||||||
|
|
||||||
void OnPlayerEnter(Player* player) override
|
void OnPlayerEnter(Player* player) override
|
||||||
{
|
{
|
||||||
if (teamIdInInstance == TEAM_NEUTRAL)
|
InstanceScript::OnPlayerEnter(player);
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
teamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
teamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
teamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFaction((teamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
|
|
||||||
instance->LoadGrid(LeaderIntroPos.GetPositionX(), LeaderIntroPos.GetPositionY());
|
instance->LoadGrid(LeaderIntroPos.GetPositionX(), LeaderIntroPos.GetPositionY());
|
||||||
if (Creature* c = instance->GetCreature(GetGuidData(DATA_LEADER_FIRST_GUID)))
|
if (Creature* c = instance->GetCreature(GetGuidData(DATA_LEADER_FIRST_GUID)))
|
||||||
c->AI()->SetData(DATA_START_INTRO, 0);
|
c->AI()->SetData(DATA_START_INTRO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
|
uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
|
||||||
{
|
{
|
||||||
if (teamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
teamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
teamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
teamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 entry = data->id1;
|
uint32 entry = data->id1;
|
||||||
switch (entry)
|
switch (entry)
|
||||||
{
|
{
|
||||||
case NPC_RESCUED_ALLIANCE_SLAVE:
|
case NPC_RESCUED_ALLIANCE_SLAVE:
|
||||||
if (teamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case NPC_RESCUED_HORDE_SLAVE:
|
case NPC_RESCUED_HORDE_SLAVE:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -143,28 +103,10 @@ public:
|
|||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (teamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
teamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
teamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
teamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_SYLVANAS_PART1:
|
case NPC_SYLVANAS_PART1:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_JAINA_PART1);
|
creature->UpdateEntry(NPC_JAINA_PART1);
|
||||||
NPC_LeaderFirstGUID = creature->GetGUID();
|
NPC_LeaderFirstGUID = creature->GetGUID();
|
||||||
|
|
||||||
@@ -183,7 +125,7 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NPC_SYLVANAS_PART2:
|
case NPC_SYLVANAS_PART2:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_JAINA_PART2);
|
creature->UpdateEntry(NPC_JAINA_PART2);
|
||||||
NPC_LeaderSecondGUID = creature->GetGUID();
|
NPC_LeaderSecondGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
@@ -213,50 +155,50 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NPC_LORALEN:
|
case NPC_LORALEN:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ELANDRA);
|
creature->UpdateEntry(NPC_ELANDRA);
|
||||||
if (!NPC_GuardFirstGUID)
|
if (!NPC_GuardFirstGUID)
|
||||||
NPC_GuardFirstGUID = creature->GetGUID();
|
NPC_GuardFirstGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_KALIRA:
|
case NPC_KALIRA:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_KORELN);
|
creature->UpdateEntry(NPC_KORELN);
|
||||||
if (!NPC_GuardSecondGUID)
|
if (!NPC_GuardSecondGUID)
|
||||||
NPC_GuardSecondGUID = creature->GetGUID();
|
NPC_GuardSecondGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_HORDE_SLAVE_1:
|
case NPC_HORDE_SLAVE_1:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_1);
|
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_1);
|
||||||
break;
|
break;
|
||||||
case NPC_HORDE_SLAVE_2:
|
case NPC_HORDE_SLAVE_2:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_2);
|
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_2);
|
||||||
break;
|
break;
|
||||||
case NPC_HORDE_SLAVE_3:
|
case NPC_HORDE_SLAVE_3:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_3);
|
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_3);
|
||||||
break;
|
break;
|
||||||
case NPC_HORDE_SLAVE_4:
|
case NPC_HORDE_SLAVE_4:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_4);
|
creature->UpdateEntry(NPC_ALLIANCE_SLAVE_4);
|
||||||
break;
|
break;
|
||||||
case NPC_GORKUN_IRONSKULL_1:
|
case NPC_GORKUN_IRONSKULL_1:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_MARTIN_VICTUS_1);
|
creature->UpdateEntry(NPC_MARTIN_VICTUS_1);
|
||||||
break;
|
break;
|
||||||
case NPC_GARFROST:
|
case NPC_GARFROST:
|
||||||
NPC_GarfrostGUID = creature->GetGUID();
|
NPC_GarfrostGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_FREED_SLAVE_1_HORDE:
|
case NPC_FREED_SLAVE_1_HORDE:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_FREED_SLAVE_1_ALLIANCE);
|
creature->UpdateEntry(NPC_FREED_SLAVE_1_ALLIANCE);
|
||||||
break;
|
break;
|
||||||
case NPC_FREED_SLAVE_2_HORDE:
|
case NPC_FREED_SLAVE_2_HORDE:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_FREED_SLAVE_2_ALLIANCE);
|
creature->UpdateEntry(NPC_FREED_SLAVE_2_ALLIANCE);
|
||||||
break;
|
break;
|
||||||
case NPC_FREED_SLAVE_3_HORDE:
|
case NPC_FREED_SLAVE_3_HORDE:
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_FREED_SLAVE_3_ALLIANCE);
|
creature->UpdateEntry(NPC_FREED_SLAVE_3_ALLIANCE);
|
||||||
break;
|
break;
|
||||||
case NPC_GORKUN_IRONSKULL_2:
|
case NPC_GORKUN_IRONSKULL_2:
|
||||||
@@ -266,7 +208,7 @@ public:
|
|||||||
c->AI()->DoAction(1); // despawn summons
|
c->AI()->DoAction(1); // despawn summons
|
||||||
c->DespawnOrUnsummon();
|
c->DespawnOrUnsummon();
|
||||||
}
|
}
|
||||||
if (teamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_MARTIN_VICTUS_2);
|
creature->UpdateEntry(NPC_MARTIN_VICTUS_2);
|
||||||
NPC_MartinOrGorkunGUID = creature->GetGUID();
|
NPC_MartinOrGorkunGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
@@ -370,7 +312,7 @@ public:
|
|||||||
case DATA_INSTANCE_PROGRESS:
|
case DATA_INSTANCE_PROGRESS:
|
||||||
return InstanceProgress;
|
return InstanceProgress;
|
||||||
case DATA_TEAMID_IN_INSTANCE:
|
case DATA_TEAMID_IN_INSTANCE:
|
||||||
return teamIdInInstance;
|
return GetTeamIdInInstance();
|
||||||
case DATA_GARFROST:
|
case DATA_GARFROST:
|
||||||
return m_auiEncounter[0];
|
return m_auiEncounter[0];
|
||||||
case DATA_ICK:
|
case DATA_ICK:
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ public:
|
|||||||
LoadBossBoundaries(boundaries);
|
LoadBossBoundaries(boundaries);
|
||||||
LoadObjectData(creatureData, nullptr);
|
LoadObjectData(creatureData, nullptr);
|
||||||
LoadDoorData(doorData);
|
LoadDoorData(doorData);
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
HeroicAttempts = MaxHeroicAttempts;
|
HeroicAttempts = MaxHeroicAttempts;
|
||||||
IsBonedEligible = true;
|
IsBonedEligible = true;
|
||||||
IsOozeDanceEligible = true;
|
IsOozeDanceEligible = true;
|
||||||
@@ -261,22 +260,7 @@ public:
|
|||||||
|
|
||||||
void OnPlayerEnter(Player* player) override
|
void OnPlayerEnter(Player* player) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
InstanceScript::OnPlayerEnter(player);
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFaction((TeamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
|
|
||||||
// for professor putricide hc
|
// for professor putricide hc
|
||||||
DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE);
|
DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE);
|
||||||
DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE);
|
DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE);
|
||||||
@@ -306,32 +290,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// apply ICC buff to pets/summons
|
// apply ICC buff to pets/summons
|
||||||
if (GetData(DATA_BUFF_AVAILABLE) && creature->GetOwnerGUID().IsPlayer() && creature->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && creature->CanHaveThreatList())
|
if (GetData(DATA_BUFF_AVAILABLE) && creature->GetOwnerGUID().IsPlayer() && creature->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && creature->CanHaveThreatList())
|
||||||
if (Unit* owner = creature->GetOwner())
|
if (Unit* owner = creature->GetOwner())
|
||||||
@@ -377,39 +337,39 @@ public:
|
|||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_KOR_KRON_GENERAL:
|
case NPC_KOR_KRON_GENERAL:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ALLIANCE_COMMANDER);
|
creature->UpdateEntry(NPC_ALLIANCE_COMMANDER);
|
||||||
break;
|
break;
|
||||||
case NPC_KOR_KRON_LIEUTENANT:
|
case NPC_KOR_KRON_LIEUTENANT:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_SKYBREAKER_LIEUTENANT);
|
creature->UpdateEntry(NPC_SKYBREAKER_LIEUTENANT);
|
||||||
break;
|
break;
|
||||||
case NPC_TORTUNOK:
|
case NPC_TORTUNOK:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_ALANA_MOONSTRIKE);
|
creature->UpdateEntry(NPC_ALANA_MOONSTRIKE);
|
||||||
break;
|
break;
|
||||||
case NPC_GERARDO_THE_SUAVE:
|
case NPC_GERARDO_THE_SUAVE:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_TALAN_MOONSTRIKE);
|
creature->UpdateEntry(NPC_TALAN_MOONSTRIKE);
|
||||||
break;
|
break;
|
||||||
case NPC_UVLUS_BANEFIRE:
|
case NPC_UVLUS_BANEFIRE:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_MALFUS_GRIMFROST);
|
creature->UpdateEntry(NPC_MALFUS_GRIMFROST);
|
||||||
break;
|
break;
|
||||||
case NPC_IKFIRUS_THE_VILE:
|
case NPC_IKFIRUS_THE_VILE:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_YILI);
|
creature->UpdateEntry(NPC_YILI);
|
||||||
break;
|
break;
|
||||||
case NPC_VOL_GUK:
|
case NPC_VOL_GUK:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_JEDEBIA);
|
creature->UpdateEntry(NPC_JEDEBIA);
|
||||||
break;
|
break;
|
||||||
case NPC_HARAGG_THE_UNSEEN:
|
case NPC_HARAGG_THE_UNSEEN:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_NIBY_THE_ALMIGHTY);
|
creature->UpdateEntry(NPC_NIBY_THE_ALMIGHTY);
|
||||||
break;
|
break;
|
||||||
case NPC_GARROSH_HELLSCREAM:
|
case NPC_GARROSH_HELLSCREAM:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_KING_VARIAN_WRYNN);
|
creature->UpdateEntry(NPC_KING_VARIAN_WRYNN);
|
||||||
|
|
||||||
// Xinef: summon in case of instance unload
|
// Xinef: summon in case of instance unload
|
||||||
@@ -428,7 +388,7 @@ public:
|
|||||||
DeathbringerSaurfangGUID = creature->GetGUID();
|
DeathbringerSaurfangGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_SE_HIGH_OVERLORD_SAURFANG:
|
case NPC_SE_HIGH_OVERLORD_SAURFANG:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
creature->UpdateEntry(NPC_SE_MURADIN_BRONZEBEARD, true);
|
creature->UpdateEntry(NPC_SE_MURADIN_BRONZEBEARD, true);
|
||||||
creature->LoadEquipment();
|
creature->LoadEquipment();
|
||||||
@@ -440,14 +400,14 @@ public:
|
|||||||
DeathbringerSaurfangEventGUID = creature->GetGUID();
|
DeathbringerSaurfangEventGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_HIGH_OVERLORD_SAURFANG_DUMMY:
|
case NPC_HIGH_OVERLORD_SAURFANG_DUMMY:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
creature->UpdateEntry(NPC_MURADIN_BRONZEBEARD_DUMMY, creature->GetCreatureData());
|
creature->UpdateEntry(NPC_MURADIN_BRONZEBEARD_DUMMY, creature->GetCreatureData());
|
||||||
creature->LoadEquipment();
|
creature->LoadEquipment();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NPC_SE_KOR_KRON_REAVER:
|
case NPC_SE_KOR_KRON_REAVER:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_SE_SKYBREAKER_MARINE);
|
creature->UpdateEntry(NPC_SE_SKYBREAKER_MARINE);
|
||||||
break;
|
break;
|
||||||
case NPC_FESTERGUT:
|
case NPC_FESTERGUT:
|
||||||
@@ -579,52 +539,34 @@ public:
|
|||||||
|
|
||||||
uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
|
uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 entry = data->id1;
|
uint32 entry = data->id1;
|
||||||
switch (entry)
|
switch (entry)
|
||||||
{
|
{
|
||||||
case NPC_HORDE_GUNSHIP_CANNON:
|
case NPC_HORDE_GUNSHIP_CANNON:
|
||||||
case NPC_ORGRIMS_HAMMER_CREW:
|
case NPC_ORGRIMS_HAMMER_CREW:
|
||||||
case NPC_SKY_REAVER_KORM_BLACKSCAR:
|
case NPC_SKY_REAVER_KORM_BLACKSCAR:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case NPC_ALLIANCE_GUNSHIP_CANNON:
|
case NPC_ALLIANCE_GUNSHIP_CANNON:
|
||||||
case NPC_SKYBREAKER_DECKHAND:
|
case NPC_SKYBREAKER_DECKHAND:
|
||||||
case NPC_HIGH_CAPTAIN_JUSTIN_BARTLETT:
|
case NPC_HIGH_CAPTAIN_JUSTIN_BARTLETT:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case NPC_ZAFOD_BOOMBOX:
|
case NPC_ZAFOD_BOOMBOX:
|
||||||
if (GameObjectTemplate const* go = sObjectMgr->GetGameObjectTemplate(GO_THE_SKYBREAKER_A))
|
if (GameObjectTemplate const* go = sObjectMgr->GetGameObjectTemplate(GO_THE_SKYBREAKER_A))
|
||||||
if ((TeamIdInInstance == TEAM_ALLIANCE && data->mapid == go->moTransport.mapID) ||
|
if ((GetTeamIdInInstance() == TEAM_ALLIANCE && data->mapid == go->moTransport.mapID) ||
|
||||||
(TeamIdInInstance == TEAM_HORDE && data->mapid != go->moTransport.mapID))
|
(GetTeamIdInInstance() == TEAM_HORDE && data->mapid != go->moTransport.mapID))
|
||||||
return entry;
|
return entry;
|
||||||
return 0;
|
return 0;
|
||||||
case NPC_IGB_MURADIN_BRONZEBEARD:
|
case NPC_IGB_MURADIN_BRONZEBEARD:
|
||||||
if ((TeamIdInInstance == TEAM_ALLIANCE && data->posX > 10.0f) ||
|
if ((GetTeamIdInInstance() == TEAM_ALLIANCE && data->posX > 10.0f) ||
|
||||||
(TeamIdInInstance == TEAM_HORDE && data->posX < 10.0f))
|
(GetTeamIdInInstance() == TEAM_HORDE && data->posX < 10.0f))
|
||||||
return entry;
|
return entry;
|
||||||
return 0;
|
return 0;
|
||||||
case NPC_SPIRE_FROSTWYRM:
|
case NPC_SPIRE_FROSTWYRM:
|
||||||
if ((TeamIdInInstance == TEAM_ALLIANCE && data->posY < 2200.0f) || (TeamIdInInstance == TEAM_HORDE && data->posY > 2200.0f))
|
if ((GetTeamIdInInstance() == TEAM_ALLIANCE && data->posY < 2200.0f) || (GetTeamIdInInstance() == TEAM_HORDE && data->posY > 2200.0f))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -634,38 +576,20 @@ public:
|
|||||||
|
|
||||||
uint32 GetGameObjectEntry(ObjectGuid::LowType /*guidLow*/, uint32 entry) override
|
uint32 GetGameObjectEntry(ObjectGuid::LowType /*guidLow*/, uint32 entry) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (entry)
|
switch (entry)
|
||||||
{
|
{
|
||||||
case GO_GUNSHIP_ARMORY_H_10N:
|
case GO_GUNSHIP_ARMORY_H_10N:
|
||||||
case GO_GUNSHIP_ARMORY_H_25N:
|
case GO_GUNSHIP_ARMORY_H_25N:
|
||||||
case GO_GUNSHIP_ARMORY_H_10H:
|
case GO_GUNSHIP_ARMORY_H_10H:
|
||||||
case GO_GUNSHIP_ARMORY_H_25H:
|
case GO_GUNSHIP_ARMORY_H_25H:
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case GO_GUNSHIP_ARMORY_A_10N:
|
case GO_GUNSHIP_ARMORY_A_10N:
|
||||||
case GO_GUNSHIP_ARMORY_A_25N:
|
case GO_GUNSHIP_ARMORY_A_25N:
|
||||||
case GO_GUNSHIP_ARMORY_A_10H:
|
case GO_GUNSHIP_ARMORY_A_10H:
|
||||||
case GO_GUNSHIP_ARMORY_A_25H:
|
case GO_GUNSHIP_ARMORY_A_25H:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -748,24 +672,6 @@ public:
|
|||||||
|
|
||||||
void OnGameObjectCreate(GameObject* go) override
|
void OnGameObjectCreate(GameObject* go) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (go->GetEntry())
|
switch (go->GetEntry())
|
||||||
{
|
{
|
||||||
case GO_SPIRIT_ALARM_1:
|
case GO_SPIRIT_ALARM_1:
|
||||||
@@ -1021,7 +927,7 @@ public:
|
|||||||
case DATA_COLDFLAME_JETS:
|
case DATA_COLDFLAME_JETS:
|
||||||
return ColdflameJetsState;
|
return ColdflameJetsState;
|
||||||
case DATA_TEAMID_IN_INSTANCE:
|
case DATA_TEAMID_IN_INSTANCE:
|
||||||
return TeamIdInInstance;
|
return GetTeamIdInInstance();
|
||||||
case DATA_BLOOD_QUICKENING_STATE:
|
case DATA_BLOOD_QUICKENING_STATE:
|
||||||
return BloodQuickeningState;
|
return BloodQuickeningState;
|
||||||
case DATA_HEROIC_ATTEMPTS:
|
case DATA_HEROIC_ATTEMPTS:
|
||||||
@@ -1315,7 +1221,7 @@ public:
|
|||||||
if (!GunshipGUID && instance->HavePlayers())
|
if (!GunshipGUID && instance->HavePlayers())
|
||||||
{
|
{
|
||||||
SetBossState(DATA_ICECROWN_GUNSHIP_BATTLE, NOT_STARTED);
|
SetBossState(DATA_ICECROWN_GUNSHIP_BATTLE, NOT_STARTED);
|
||||||
uint32 gunshipEntry = TeamIdInInstance == TEAM_HORDE ? GO_ORGRIMS_HAMMER_H : GO_THE_SKYBREAKER_A;
|
uint32 gunshipEntry = GetTeamIdInInstance() == TEAM_HORDE ? GO_ORGRIMS_HAMMER_H : GO_THE_SKYBREAKER_A;
|
||||||
if (MotionTransport* gunship = sTransportMgr->CreateTransport(gunshipEntry, 0, instance))
|
if (MotionTransport* gunship = sTransportMgr->CreateTransport(gunshipEntry, 0, instance))
|
||||||
{
|
{
|
||||||
GunshipGUID = gunship->GetGUID();
|
GunshipGUID = gunship->GetGUID();
|
||||||
@@ -1880,7 +1786,7 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_ENEMY_GUNSHIP_COMBAT:
|
case EVENT_ENEMY_GUNSHIP_COMBAT:
|
||||||
if (Creature* captain = source->FindNearestCreature(TeamIdInInstance == TEAM_HORDE ? NPC_IGB_HIGH_OVERLORD_SAURFANG : NPC_IGB_MURADIN_BRONZEBEARD, 200.0f))
|
if (Creature* captain = source->FindNearestCreature(GetTeamIdInInstance() == TEAM_HORDE ? NPC_IGB_HIGH_OVERLORD_SAURFANG : NPC_IGB_MURADIN_BRONZEBEARD, 200.0f))
|
||||||
{
|
{
|
||||||
captain->AI()->DoAction(ACTION_ENEMY_GUNSHIP_TALK);
|
captain->AI()->DoAction(ACTION_ENEMY_GUNSHIP_TALK);
|
||||||
}
|
}
|
||||||
@@ -1900,7 +1806,7 @@ public:
|
|||||||
//After movement is stopped remove the backpack
|
//After movement is stopped remove the backpack
|
||||||
RemoveBackPack();
|
RemoveBackPack();
|
||||||
}
|
}
|
||||||
if (Creature* captain = source->FindNearestCreature(TeamIdInInstance == TEAM_HORDE ? NPC_IGB_HIGH_OVERLORD_SAURFANG : NPC_IGB_MURADIN_BRONZEBEARD, 200.0f))
|
if (Creature* captain = source->FindNearestCreature(GetTeamIdInInstance() == TEAM_HORDE ? NPC_IGB_HIGH_OVERLORD_SAURFANG : NPC_IGB_MURADIN_BRONZEBEARD, 200.0f))
|
||||||
captain->AI()->DoAction(ACTION_EXIT_SHIP);
|
captain->AI()->DoAction(ACTION_EXIT_SHIP);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2066,7 +1972,6 @@ public:
|
|||||||
ObjectGuid FrozenBolvarGUID;
|
ObjectGuid FrozenBolvarGUID;
|
||||||
ObjectGuid PillarsChainedGUID;
|
ObjectGuid PillarsChainedGUID;
|
||||||
ObjectGuid PillarsUnchainedGUID;
|
ObjectGuid PillarsUnchainedGUID;
|
||||||
TeamId TeamIdInInstance;
|
|
||||||
uint32 ColdflameJetsState;
|
uint32 ColdflameJetsState;
|
||||||
std::set<ObjectGuid::LowType> FrostwyrmGUIDs;
|
std::set<ObjectGuid::LowType> FrostwyrmGUIDs;
|
||||||
std::set<ObjectGuid::LowType> SpinestalkerTrash;
|
std::set<ObjectGuid::LowType> SpinestalkerTrash;
|
||||||
|
|||||||
@@ -49,85 +49,40 @@ public:
|
|||||||
SetHeaders(DataHeader);
|
SetHeaders(DataHeader);
|
||||||
SetBossNumber(MAX_ENCOUNTERS);
|
SetBossNumber(MAX_ENCOUNTERS);
|
||||||
LoadDoorData(doorData);
|
LoadDoorData(doorData);
|
||||||
|
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* pPlayer = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = pPlayer->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = pPlayer->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = pPlayer->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_ALLIANCE_RANGER:
|
case NPC_ALLIANCE_RANGER:
|
||||||
creature->SetFaction(FACTION_MONSTER_2);
|
creature->SetFaction(FACTION_MONSTER_2);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_HORDE_RANGER);
|
creature->UpdateEntry(NPC_HORDE_RANGER);
|
||||||
break;
|
break;
|
||||||
case NPC_ALLIANCE_BERSERKER:
|
case NPC_ALLIANCE_BERSERKER:
|
||||||
creature->SetFaction(FACTION_MONSTER_2);
|
creature->SetFaction(FACTION_MONSTER_2);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_HORDE_BERSERKER);
|
creature->UpdateEntry(NPC_HORDE_BERSERKER);
|
||||||
break;
|
break;
|
||||||
case NPC_ALLIANCE_COMMANDER:
|
case NPC_ALLIANCE_COMMANDER:
|
||||||
creature->SetFaction(FACTION_MONSTER_2);
|
creature->SetFaction(FACTION_MONSTER_2);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_HORDE_COMMANDER);
|
creature->UpdateEntry(NPC_HORDE_COMMANDER);
|
||||||
break;
|
break;
|
||||||
case NPC_ALLIANCE_CLERIC:
|
case NPC_ALLIANCE_CLERIC:
|
||||||
creature->SetFaction(FACTION_MONSTER_2);
|
creature->SetFaction(FACTION_MONSTER_2);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_HORDE_CLERIC);
|
creature->UpdateEntry(NPC_HORDE_CLERIC);
|
||||||
break;
|
break;
|
||||||
case NPC_COMMANDER_STOUTBEARD:
|
case NPC_COMMANDER_STOUTBEARD:
|
||||||
creature->SetFaction(FACTION_MONSTER_2);
|
creature->SetFaction(FACTION_MONSTER_2);
|
||||||
if (TeamIdInInstance == TEAM_ALLIANCE)
|
if (GetTeamIdInInstance() == TEAM_ALLIANCE)
|
||||||
creature->UpdateEntry(NPC_COMMANDER_KOLURG);
|
creature->UpdateEntry(NPC_COMMANDER_KOLURG);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerEnter(Player* player) override
|
|
||||||
{
|
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFaction((TeamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnGameObjectCreate(GameObject* gameObject) override
|
void OnGameObjectCreate(GameObject* gameObject) override
|
||||||
{
|
{
|
||||||
switch (gameObject->GetEntry())
|
switch (gameObject->GetEntry())
|
||||||
@@ -194,8 +149,6 @@ public:
|
|||||||
(*i)->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
(*i)->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
protected:
|
|
||||||
TeamId TeamIdInInstance;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+5
-51
@@ -59,56 +59,11 @@ public:
|
|||||||
SetBossNumber(ENCOUNTER_COUNT);
|
SetBossNumber(ENCOUNTER_COUNT);
|
||||||
LoadObjectData(creatureData, nullptr);
|
LoadObjectData(creatureData, nullptr);
|
||||||
LoadDoorData(doorData);
|
LoadDoorData(doorData);
|
||||||
|
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
|
||||||
RescueTimer = 100 * MINUTE * IN_MILLISECONDS;
|
RescueTimer = 100 * MINUTE * IN_MILLISECONDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerEnter(Player* player) override
|
|
||||||
{
|
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFaction((TeamIdInInstance == TEAM_HORDE) ? 1610 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnPlayerLeave(Player* player) override
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
|
||||||
player->SetFactionForRace(player->getRace());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCreatureCreate(Creature* creature) override
|
void OnCreatureCreate(Creature* creature) override
|
||||||
{
|
{
|
||||||
if (TeamIdInInstance == TEAM_NEUTRAL)
|
|
||||||
{
|
|
||||||
Map::PlayerList const& players = instance->GetPlayers();
|
|
||||||
if (!players.IsEmpty())
|
|
||||||
if (Player* player = players.begin()->GetSource())
|
|
||||||
{
|
|
||||||
if (Group* group = player->GetGroup())
|
|
||||||
{
|
|
||||||
if (Player* gLeader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()))
|
|
||||||
TeamIdInInstance = Player::TeamIdForRace(gLeader->getRace());
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TeamIdInInstance = player->GetTeamId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_SHATTERED_EXECUTIONER:
|
case NPC_SHATTERED_EXECUTIONER:
|
||||||
@@ -117,22 +72,22 @@ public:
|
|||||||
ExecutionerGUID = creature->GetGUID();
|
ExecutionerGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_RIFLEMAN_BROWNBEARD:
|
case NPC_RIFLEMAN_BROWNBEARD:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_KORAG_PROUDMANE);
|
creature->UpdateEntry(NPC_KORAG_PROUDMANE);
|
||||||
PrisonerGUID[0] = creature->GetGUID();
|
PrisonerGUID[0] = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_CAPTAIN_ALINA:
|
case NPC_CAPTAIN_ALINA:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_CAPTAIN_BONESHATTER);
|
creature->UpdateEntry(NPC_CAPTAIN_BONESHATTER);
|
||||||
PrisonerGUID[1] = creature->GetGUID();
|
PrisonerGUID[1] = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_PRIVATE_JACINT:
|
case NPC_PRIVATE_JACINT:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_SCOUT_ORGARR);
|
creature->UpdateEntry(NPC_SCOUT_ORGARR);
|
||||||
PrisonerGUID[2] = creature->GetGUID();
|
PrisonerGUID[2] = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
case NPC_RANDY_WHIZZLESPROCKET:
|
case NPC_RANDY_WHIZZLESPROCKET:
|
||||||
if (TeamIdInInstance == TEAM_HORDE)
|
if (GetTeamIdInInstance() == TEAM_HORDE)
|
||||||
creature->UpdateEntry(NPC_DRISELLA);
|
creature->UpdateEntry(NPC_DRISELLA);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -147,7 +102,7 @@ public:
|
|||||||
instance->LoadGrid(230, -80);
|
instance->LoadGrid(230, -80);
|
||||||
|
|
||||||
if (Creature* kargath = GetCreature(DATA_KARGATH))
|
if (Creature* kargath = GetCreature(DATA_KARGATH))
|
||||||
sCreatureTextMgr->SendChat(kargath, TeamIdInInstance == TEAM_ALLIANCE ? 3 : 4, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
|
sCreatureTextMgr->SendChat(kargath, GetTeamIdInInstance() == TEAM_ALLIANCE ? 3 : 4, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
|
||||||
|
|
||||||
RescueTimer = 80 * MINUTE * IN_MILLISECONDS;
|
RescueTimer = 80 * MINUTE * IN_MILLISECONDS;
|
||||||
}
|
}
|
||||||
@@ -213,7 +168,6 @@ public:
|
|||||||
ObjectGuid ExecutionerGUID;
|
ObjectGuid ExecutionerGUID;
|
||||||
ObjectGuid PrisonerGUID[3];
|
ObjectGuid PrisonerGUID[3];
|
||||||
uint32 RescueTimer;
|
uint32 RescueTimer;
|
||||||
TeamId TeamIdInInstance;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user