fix(Script/Ulduar): Freya spawning multiple chests (#11794)
This commit is contained in:
@@ -316,46 +316,49 @@ public:
|
|||||||
{
|
{
|
||||||
if (damage >= me->GetHealth())
|
if (damage >= me->GetHealth())
|
||||||
{
|
{
|
||||||
Talk(SAY_DEATH);
|
|
||||||
|
|
||||||
damage = 0;
|
damage = 0;
|
||||||
me->SetReactState(REACT_PASSIVE);
|
if (m_pInstance->GetData(TYPE_FREYA) != DONE)
|
||||||
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
|
|
||||||
me->SetFaction(FACTION_FRIENDLY);
|
|
||||||
me->RemoveAllAuras();
|
|
||||||
me->AttackStop();
|
|
||||||
events.Reset();
|
|
||||||
|
|
||||||
summons.DespawnAll();
|
|
||||||
events.Reset();
|
|
||||||
|
|
||||||
uint8 _elderCount = 0;
|
|
||||||
for (uint8 i = 0; i < 3; ++i)
|
|
||||||
{
|
{
|
||||||
if (!_elderGUID[i])
|
Talk(SAY_DEATH);
|
||||||
continue;
|
|
||||||
|
|
||||||
if (Creature* e = ObjectAccessor::GetCreature(*me, _elderGUID[i]))
|
me->SetReactState(REACT_PASSIVE);
|
||||||
e->DespawnOrUnsummon();
|
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
|
||||||
|
me->SetFaction(FACTION_FRIENDLY);
|
||||||
|
me->RemoveAllAuras();
|
||||||
|
me->AttackStop();
|
||||||
|
events.Reset();
|
||||||
|
|
||||||
++_elderCount;
|
summons.DespawnAll();
|
||||||
}
|
events.Reset();
|
||||||
|
|
||||||
uint32 chestId = RAID_MODE(GO_FREYA_CHEST, GO_FREYA_CHEST_HERO);
|
uint8 _elderCount = 0;
|
||||||
chestId -= 2 * _elderCount; // offset
|
for (uint8 i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
if (!_elderGUID[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
me->DespawnOrUnsummon(5000);
|
if (Creature* e = ObjectAccessor::GetCreature(*me, _elderGUID[i]))
|
||||||
if (GameObject* go = me->SummonGameObject(chestId, 2345.61f, -71.20f, 425.104f, 3.0f, 0, 0, 0, 0, 0))
|
e->DespawnOrUnsummon();
|
||||||
{
|
|
||||||
go->ReplaceAllGameObjectFlags((GameObjectFlags)0);
|
|
||||||
go->SetLootRecipient(me->GetMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defeat credit
|
++_elderCount;
|
||||||
if (m_pInstance)
|
}
|
||||||
{
|
|
||||||
me->CastSpell(me, 65074, true); // credit
|
uint32 chestId = RAID_MODE(GO_FREYA_CHEST, GO_FREYA_CHEST_HERO);
|
||||||
m_pInstance->SetData(TYPE_FREYA, DONE);
|
chestId -= 2 * _elderCount; // offset
|
||||||
|
|
||||||
|
me->DespawnOrUnsummon(5000);
|
||||||
|
if (GameObject* go = me->SummonGameObject(chestId, 2345.61f, -71.20f, 425.104f, 3.0f, 0, 0, 0, 0, 0))
|
||||||
|
{
|
||||||
|
go->ReplaceAllGameObjectFlags((GameObjectFlags)0);
|
||||||
|
go->SetLootRecipient(me->GetMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defeat credit
|
||||||
|
if (m_pInstance)
|
||||||
|
{
|
||||||
|
me->CastSpell(me, 65074, true); // credit
|
||||||
|
m_pInstance->SetData(TYPE_FREYA, DONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user