aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGildor <gildor55@gmail.com>2019-12-11 15:01:27 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-19 01:27:48 +0100
commit5004a8a4ec26d1f0934a598c016f9026321d176f (patch)
treee7649ecfb6768184483e37cb0ea44a4e168b9f2f /src
parent8bf64f1be03e5fdfe27632d36f67183a9fbfbfa8 (diff)
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 (cherry picked from commit f661bc6c39596666da692297ef3fac13264f5840)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp35
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp6
2 files changed, 29 insertions, 12 deletions
diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
index 233b3d7f301..fdf81936765 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -413,6 +413,12 @@ class instance_violet_hold : public InstanceMapScript
for (uint8 i = 0; i < ActivationCrystalCount; ++i)
if (GameObject* crystal = instance->GetGameObject(ActivationCrystalGUIDs[i]))
crystal->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
+
+ Scheduler.Schedule(Seconds(3), [this](TaskContext task)
+ {
+ CheckEventState();
+ task.Repeat(Seconds(3));
+ });
}
else if (data == NOT_STARTED)
{
@@ -855,9 +861,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)
{
@@ -875,15 +901,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()
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index 7e705934f96..9dc0526a8dd 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -473,12 +473,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->AddNpcFlag(UNIT_NPC_FLAG_GOSSIP);
break;
default:
break;