fix(Scripts/Hyjal): Fix hyjal trash (#21194)
Co-authored-by: Exitare <Exitare@users.noreply.github.com> Co-authored-by: Ludwig <sudlud@users.noreply.github.com>
This commit is contained in:
@@ -92,8 +92,9 @@ public:
|
|||||||
{
|
{
|
||||||
_bossWave = TO_BE_DECIDED;
|
_bossWave = TO_BE_DECIDED;
|
||||||
_retreat = 0;
|
_retreat = 0;
|
||||||
trash = 0;
|
_trash = 0;
|
||||||
_currentWave = 0;
|
_currentWave = 0;
|
||||||
|
_initialWaves = false;
|
||||||
_encounterNPCs.clear();
|
_encounterNPCs.clear();
|
||||||
_summonedNPCs.clear();
|
_summonedNPCs.clear();
|
||||||
_baseAlliance.clear();
|
_baseAlliance.clear();
|
||||||
@@ -190,9 +191,9 @@ public:
|
|||||||
|
|
||||||
if (creature->IsSummon() && _bossWave != TO_BE_DECIDED)
|
if (creature->IsSummon() && _bossWave != TO_BE_DECIDED)
|
||||||
{
|
{
|
||||||
if (_currentWave == 0)
|
if (_currentWave == 0 && _initialWaves)
|
||||||
creature->SetReputationRewardDisabled(true);
|
creature->SetReputationRewardDisabled(true);
|
||||||
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, ++trash); // Update the instance wave count on new trash spawn
|
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, ++_trash); // Update the instance wave count on new trash spawn
|
||||||
_encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe
|
_encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -230,10 +231,10 @@ public:
|
|||||||
{
|
{
|
||||||
if (_bossWave != TO_BE_DECIDED)
|
if (_bossWave != TO_BE_DECIDED)
|
||||||
{
|
{
|
||||||
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, --trash); // Update the instance wave count on new trash death
|
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, --_trash); // Update the instance wave count on new trash death
|
||||||
_encounterNPCs.erase(creature->GetGUID()); // Used for despawning on wipe
|
_encounterNPCs.erase(creature->GetGUID()); // Used for despawning on wipe
|
||||||
|
|
||||||
if (trash == 0) // It can reach negatives if trash spawned after a retreat are killed, it shouldn't affect anything. Also happens on retail
|
if (_trash == 0) // It can reach negatives if trash spawned after a retreat are killed, it shouldn't affect anything. Also happens on retail
|
||||||
SetData(DATA_SPAWN_WAVES, 1);
|
SetData(DATA_SPAWN_WAVES, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,14 +246,12 @@ public:
|
|||||||
_summonedNPCs.erase(creature->GetGUID());
|
_summonedNPCs.erase(creature->GetGUID());
|
||||||
break;
|
break;
|
||||||
case NPC_WINTERCHILL:
|
case NPC_WINTERCHILL:
|
||||||
|
_initialWaves = false;
|
||||||
|
[[fallthrough]];
|
||||||
case NPC_ANETHERON:
|
case NPC_ANETHERON:
|
||||||
case NPC_KAZROGAL:
|
case NPC_KAZROGAL:
|
||||||
case NPC_AZGALOR:
|
case NPC_AZGALOR:
|
||||||
if (Creature* jaina = GetCreature(DATA_JAINA))
|
ResetWaves();
|
||||||
jaina->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
|
||||||
if (Creature* thrall = GetCreature(DATA_THRALL))
|
|
||||||
thrall->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
|
||||||
SetData(DATA_RESET_WAVES, 1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,6 +363,7 @@ public:
|
|||||||
_retreat = 0;
|
_retreat = 0;
|
||||||
if (GetBossState(DATA_WINTERCHILL) != DONE)
|
if (GetBossState(DATA_WINTERCHILL) != DONE)
|
||||||
{
|
{
|
||||||
|
_initialWaves = true;
|
||||||
if (_bossWave == TO_BE_DECIDED)
|
if (_bossWave == TO_BE_DECIDED)
|
||||||
for (ObjectGuid const& guid : _baseAlliance)
|
for (ObjectGuid const& guid : _baseAlliance)
|
||||||
if (Creature* creature = instance->GetCreature(guid))
|
if (Creature* creature = instance->GetCreature(guid))
|
||||||
@@ -481,16 +481,19 @@ public:
|
|||||||
SetData(DATA_RESET_WAVES, 0);
|
SetData(DATA_RESET_WAVES, 0);
|
||||||
break;
|
break;
|
||||||
case DATA_RESET_WAVES:
|
case DATA_RESET_WAVES:
|
||||||
|
if (GetBossState(DATA_WINTERCHILL) != DONE)
|
||||||
|
_initialWaves = true;
|
||||||
|
|
||||||
scheduler.CancelGroup(CONTEXT_GROUP_WAVES);
|
scheduler.CancelGroup(CONTEXT_GROUP_WAVES);
|
||||||
_encounterNPCs.clear();
|
_encounterNPCs.clear();
|
||||||
_summonedNPCs.clear();
|
_summonedNPCs.clear();
|
||||||
_currentWave = 0;
|
_currentWave = 0;
|
||||||
trash = 0;
|
_trash = 0;
|
||||||
_bossWave = TO_BE_DECIDED;
|
_bossWave = TO_BE_DECIDED;
|
||||||
_retreat = 0;
|
_retreat = 0;
|
||||||
DoUpdateWorldState(WORLD_STATE_WAVES, _currentWave);
|
DoUpdateWorldState(WORLD_STATE_WAVES, _currentWave);
|
||||||
DoUpdateWorldState(WORLD_STATE_ENEMY, trash);
|
DoUpdateWorldState(WORLD_STATE_ENEMY, _trash);
|
||||||
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, trash);
|
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, _trash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +520,7 @@ public:
|
|||||||
{
|
{
|
||||||
// No overlapping!
|
// No overlapping!
|
||||||
scheduler.CancelGroup(CONTEXT_GROUP_WAVES);
|
scheduler.CancelGroup(CONTEXT_GROUP_WAVES);
|
||||||
trash = 0; // Reset counter here to avoid resetting the counter from scheduled waves. Required because creatures killed for RP events counts towards the kill counter as well, confirmed in Retail.
|
_trash = 0; // Reset counter here to avoid resetting the counter from scheduled waves. Required because creatures killed for RP events counts towards the kill counter as well, confirmed in Retail.
|
||||||
|
|
||||||
scheduler.Schedule(1ms, [this, startWaves, maxWaves, timerptr](TaskContext context)
|
scheduler.Schedule(1ms, [this, startWaves, maxWaves, timerptr](TaskContext context)
|
||||||
{
|
{
|
||||||
@@ -566,8 +569,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int32 trash;
|
int32 _trash;
|
||||||
uint8 _currentWave;
|
uint8 _currentWave;
|
||||||
uint8 _bossWave;
|
uint8 _bossWave;
|
||||||
uint8 _retreat;
|
uint8 _retreat;
|
||||||
@@ -581,6 +584,16 @@ public:
|
|||||||
GuidSet _ancientGemHorde;
|
GuidSet _ancientGemHorde;
|
||||||
GuidSet _roaringFlameAlliance;
|
GuidSet _roaringFlameAlliance;
|
||||||
GuidSet _roaringFlameHorde;
|
GuidSet _roaringFlameHorde;
|
||||||
|
bool _initialWaves;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user