Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Scripts/Hyjal): Fix hyjal trash #21194

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class instance_hyjal : public InstanceMapScript
_retreat = 0;
trash = 0;
_currentWave = 0;
InitialWaves = false;
_encounterNPCs.clear();
_summonedNPCs.clear();
_baseAlliance.clear();
Expand Down Expand Up @@ -190,7 +191,7 @@ class instance_hyjal : public InstanceMapScript

if (creature->IsSummon() && _bossWave != TO_BE_DECIDED)
{
if (_currentWave == 0)
if (_currentWave == 0 && InitialWaves)
creature->SetDisableReputationGain(true);
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, ++trash); // Update the instance wave count on new trash spawn
_encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe
Expand Down Expand Up @@ -245,14 +246,13 @@ class instance_hyjal : public InstanceMapScript
_summonedNPCs.erase(creature->GetGUID());
break;
case NPC_WINTERCHILL:
InitialWaves = false;
ResetWaves();
break;
case NPC_ANETHERON:
case NPC_KAZROGAL:
case NPC_AZGALOR:
if (Creature* jaina = GetCreature(DATA_JAINA))
jaina->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
if (Creature* thrall = GetCreature(DATA_THRALL))
thrall->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
SetData(DATA_RESET_WAVES, 1);
ResetWaves();
break;
}
}
Expand Down Expand Up @@ -364,6 +364,7 @@ class instance_hyjal : public InstanceMapScript
_retreat = 0;
if (GetBossState(DATA_WINTERCHILL) != DONE)
{
InitialWaves = true;
if (_bossWave == TO_BE_DECIDED)
for (ObjectGuid const& guid : _baseAlliance)
if (Creature* creature = instance->GetCreature(guid))
Expand Down Expand Up @@ -481,6 +482,9 @@ class instance_hyjal : public InstanceMapScript
SetData(DATA_RESET_WAVES, 0);
break;
case DATA_RESET_WAVES:
if (GetBossState(DATA_WINTERCHILL) != DONE)
InitialWaves = true;

scheduler.CancelGroup(CONTEXT_GROUP_WAVES);
_encounterNPCs.clear();
_summonedNPCs.clear();
Expand Down Expand Up @@ -581,6 +585,17 @@ class instance_hyjal : public InstanceMapScript
GuidSet _ancientGemHorde;
GuidSet _roaringFlameAlliance;
GuidSet _roaringFlameHorde;
bool InitialWaves;
Exitare marked this conversation as resolved.
Show resolved Hide resolved

private:
void ResetWaves()
{
if (Creature* jaina = GetCreature(DATA_JAINA))
jaina->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
if (Creature* thrall = GetCreature(DATA_THRALL))
thrall->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
SetData(DATA_RESET_WAVES, 1);
}
};
};

Expand Down
Loading