mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Scripts/VioletHold: Minor improvements (#23961)
* Scripts/VioletHold: Minor improvements * Now we can teleport inside with gossip if event is in progress * Improve HavePlayers() check logic * Remove a pointless comment suggested by shauren * Move CheckWipe function to execute every 3 seconds instead every map update suggested by Riztazz * I supose Riztazz forgot add this to repeat every 3 seconds
This commit is contained in:
@@ -410,6 +410,12 @@ class instance_violet_hold : public InstanceMapScript
|
||||
for (uint8 i = 0; i < ActivationCrystalCount; ++i)
|
||||
if (GameObject* crystal = instance->GetGameObject(ActivationCrystalGUIDs[i]))
|
||||
crystal->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
|
||||
Scheduler.Schedule(Seconds(3), [this](TaskContext task)
|
||||
{
|
||||
CheckEventState();
|
||||
task.Repeat(Seconds(3));
|
||||
});
|
||||
}
|
||||
else if (data == NOT_STARTED)
|
||||
{
|
||||
@@ -852,9 +858,29 @@ class instance_violet_hold : public InstanceMapScript
|
||||
|
||||
void Update(uint32 diff) override
|
||||
{
|
||||
// if we don't have any player in the instance
|
||||
if (!instance->HavePlayers())
|
||||
{
|
||||
if (EventState == IN_PROGRESS) // if event is in progress, mark as fail
|
||||
{
|
||||
EventState = FAIL;
|
||||
CheckEventState();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Scheduler.Update(diff);
|
||||
|
||||
if (EventState == IN_PROGRESS)
|
||||
{
|
||||
// if door is destroyed, event is failed
|
||||
if (!GetData(DATA_DOOR_INTEGRITY))
|
||||
EventState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckEventState()
|
||||
{
|
||||
// if main event is in progress and players have wiped then reset instance
|
||||
if ((EventState == IN_PROGRESS && CheckWipe()) || EventState == FAIL)
|
||||
{
|
||||
@@ -872,15 +898,6 @@ class instance_violet_hold : public InstanceMapScript
|
||||
if (Creature* sinclari = GetCreature(DATA_SINCLARI))
|
||||
sinclari->AI()->EnterEvadeMode();
|
||||
}
|
||||
|
||||
Scheduler.Update(diff);
|
||||
|
||||
if (EventState == IN_PROGRESS)
|
||||
{
|
||||
// if door is destroyed, event is failed
|
||||
if (!GetData(DATA_DOOR_INTEGRITY))
|
||||
EventState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
void ScheduleCyanigosaIntro()
|
||||
|
||||
@@ -472,12 +472,12 @@ class npc_sinclari_vh : public CreatureScript
|
||||
task.Repeat(Seconds(5));
|
||||
break;
|
||||
case 8:
|
||||
me->SetVisible(false);
|
||||
_instance->SetData(DATA_MAIN_EVENT_STATE, IN_PROGRESS);
|
||||
task.Repeat(Seconds(1));
|
||||
break;
|
||||
case 9:
|
||||
_instance->SetData(DATA_MAIN_EVENT_STATE, IN_PROGRESS);
|
||||
// [1] GUID: Full: 0xF1300077C202E6DD Type: Creature Entry: 30658 Low: 190173
|
||||
// We should teleport inside if event is in progress with GOSSIP_MENU_SEND_ME_IN
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user