Scripts/Icecrown Citadel: Fixed crashes on despawning abominations during Professor Putricide's phase transition
This commit is contained in:
@@ -167,6 +167,33 @@ enum PutricideData
|
||||
#define EXPERIMENT_STATE_OOZE false
|
||||
#define EXPERIMENT_STATE_GAS true
|
||||
|
||||
class AbominationDespawner
|
||||
{
|
||||
public:
|
||||
explicit AbominationDespawner(Unit* owner) : _owner(owner) { }
|
||||
|
||||
bool operator()(uint64 guid)
|
||||
{
|
||||
if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid))
|
||||
{
|
||||
if (summon->GetEntry() == NPC_MUTATED_ABOMINATION_10 || summon->GetEntry() == NPC_MUTATED_ABOMINATION_25)
|
||||
{
|
||||
if (Vehicle* veh = summon->GetVehicleKit())
|
||||
veh->RemoveAllPassengers(); // also despawns the vehicle
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Unit* _owner;
|
||||
};
|
||||
|
||||
class boss_professor_putricide : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -477,8 +504,7 @@ class boss_professor_putricide : public CreatureScript
|
||||
SetPhase(PHASE_COMBAT_3);
|
||||
events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000);
|
||||
events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT);
|
||||
summons.DespawnEntry(NPC_MUTATED_ABOMINATION_10);
|
||||
summons.DespawnEntry(NPC_MUTATED_ABOMINATION_25);
|
||||
summons.remove_if(AbominationDespawner(me));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user