mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/Blood Furnace: Broggok improvements (#23300)
* 23285 Fixed lever respawn and future encounters after it respawns.
* Removed unnecessary additional container.
Made lever not to despawn and respawn but rather change flags only.
* Made one conditional branch easier to debug.
(cherry picked from commit c71e36acae)
This commit is contained in:
committed by
Shauren
parent
fdb43e41a8
commit
fa9683fc68
@@ -58,6 +58,13 @@ class boss_broggok : public CreatureScript
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
|
||||
if (GameObject * lever = instance->GetGameObject(DATA_BROGGOK_LEVER))
|
||||
{
|
||||
lever->RemoveFlag(GameObjectFlags(GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE));
|
||||
lever->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
|
||||
DoAction(ACTION_RESET_BROGGOK);
|
||||
}
|
||||
|
||||
@@ -144,12 +151,14 @@ class go_broggok_lever : public GameObjectScript
|
||||
if (instance->GetBossState(DATA_BROGGOK) != DONE && instance->GetBossState(DATA_BROGGOK) != IN_PROGRESS)
|
||||
{
|
||||
instance->SetBossState(DATA_BROGGOK, IN_PROGRESS);
|
||||
if (Creature* broggok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BROGGOK)))
|
||||
if (Creature* broggok = instance->GetCreature(DATA_BROGGOK))
|
||||
broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
|
||||
}
|
||||
|
||||
me->UseDoorOrButton();
|
||||
return false;
|
||||
me->AddFlag(GameObjectFlags(GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE));
|
||||
me->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,18 @@ DoorData const doorData[] =
|
||||
{ 0, 0, DOOR_TYPE_ROOM } // END
|
||||
};
|
||||
|
||||
ObjectData const creatureData[] =
|
||||
{
|
||||
{ NPC_BROGGOK, DATA_BROGGOK },
|
||||
{ 0, 0 } // END
|
||||
};
|
||||
|
||||
ObjectData const gameObjectData[] =
|
||||
{
|
||||
{ GO_BROGGOK_LEVER, DATA_BROGGOK_LEVER },
|
||||
{ 0, 0 } //END
|
||||
};
|
||||
|
||||
class instance_blood_furnace : public InstanceMapScript
|
||||
{
|
||||
public:
|
||||
@@ -45,6 +57,7 @@ class instance_blood_furnace : public InstanceMapScript
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadDoorData(doorData);
|
||||
LoadObjectData(creatureData, gameObjectData);
|
||||
|
||||
PrisonerCounter5 = 0;
|
||||
PrisonerCounter6 = 0;
|
||||
@@ -54,6 +67,8 @@ class instance_blood_furnace : public InstanceMapScript
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
InstanceScript::OnCreatureCreate(creature);
|
||||
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_THE_MAKER:
|
||||
@@ -160,8 +175,6 @@ class instance_blood_furnace : public InstanceMapScript
|
||||
break;
|
||||
case NOT_STARTED:
|
||||
ResetPrisons();
|
||||
if (GameObject* lever = instance->GetGameObject(BroggokLeverGUID))
|
||||
lever->Respawn();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -176,28 +189,35 @@ class instance_blood_furnace : public InstanceMapScript
|
||||
|
||||
void ResetPrisons()
|
||||
{
|
||||
PrisonerCounter5 = PrisonersCell5.size();
|
||||
ResetPrisoners(PrisonersCell5);
|
||||
PrisonerCounter5 = PrisonersCell5.size();
|
||||
HandleGameObject(PrisonCellGUIDs[DATA_PRISON_CELL5 - DATA_PRISON_CELL1], false);
|
||||
|
||||
PrisonerCounter6 = PrisonersCell6.size();
|
||||
ResetPrisoners(PrisonersCell6);
|
||||
PrisonerCounter6 = PrisonersCell6.size();
|
||||
HandleGameObject(PrisonCellGUIDs[DATA_PRISON_CELL6 - DATA_PRISON_CELL1], false);
|
||||
|
||||
PrisonerCounter7 = PrisonersCell7.size();
|
||||
ResetPrisoners(PrisonersCell7);
|
||||
PrisonerCounter7 = PrisonersCell7.size();
|
||||
HandleGameObject(PrisonCellGUIDs[DATA_PRISON_CELL7 - DATA_PRISON_CELL1], false);
|
||||
|
||||
PrisonerCounter8 = PrisonersCell8.size();
|
||||
ResetPrisoners(PrisonersCell8);
|
||||
PrisonerCounter8 = PrisonersCell8.size();
|
||||
HandleGameObject(PrisonCellGUIDs[DATA_PRISON_CELL8 - DATA_PRISON_CELL1], false);
|
||||
}
|
||||
|
||||
void ResetPrisoners(GuidSet const& prisoners)
|
||||
void ResetPrisoners(GuidSet& prisoners)
|
||||
{
|
||||
for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
|
||||
if (Creature* prisoner = instance->GetCreature(*i))
|
||||
for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end();)
|
||||
if (Creature * prisoner = instance->GetCreature(*i))
|
||||
{
|
||||
if (!prisoner->IsAlive())
|
||||
i = prisoners.erase(i);
|
||||
else
|
||||
++i;
|
||||
|
||||
ResetPrisoner(prisoner);
|
||||
}
|
||||
}
|
||||
|
||||
void ResetPrisoner(Creature* prisoner)
|
||||
|
||||
Reference in New Issue
Block a user