From 6a3162f0ee47f5492802f051363fb7c05b5c44cf Mon Sep 17 00:00:00 2001 From: Charles A Edwards Date: Thu, 28 May 2015 12:07:05 +0100 Subject: [PATCH] Creature sleeping script altered Event 3 from the game_event table now used to test for time to sleep or not (9pm to 4.59am) --- .../scripts/eastern_kingdoms/stranglethorn_vale.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/SD2/scripts/eastern_kingdoms/stranglethorn_vale.cpp b/src/modules/SD2/scripts/eastern_kingdoms/stranglethorn_vale.cpp index 19dab11e..3f888039 100644 --- a/src/modules/SD2/scripts/eastern_kingdoms/stranglethorn_vale.cpp +++ b/src/modules/SD2/scripts/eastern_kingdoms/stranglethorn_vale.cpp @@ -39,6 +39,7 @@ */ #include "precompiled.h" +#include "GameEventMgr.h" /*###### ## mob_yenniku @@ -136,9 +137,16 @@ struct mob_yenniku : public CreatureScript ## PANTHERS: Shadowmaw Panther (684), Elder Shadowmaw Panther (1713), Young Panther (683), Panther (736) ######*/ +enum +{ + SPELL_SLEEP_DND = 25148, // zzzZZZ animation - not implemented yet, due to removal failing! + EVENT_ID = 3, // Nights + +}; + struct mob_sleeping_creature : public CreatureScript { - mob_sleeping_creature() : CreatureScript("mob_sleeping_creature") {} + mob_sleeping_creature() : CreatureScript("mob_sleeping_creature") {} struct mob_sleeping_creatureAI : public ScriptedAI { @@ -154,7 +162,7 @@ struct mob_sleeping_creature : public CreatureScript // go to sleep if it is night time (9pm to 5am) time_t t = sWorld.GetGameTime(); struct tm *tmp = gmtime(&t); - if (tmp->tm_hour >= 21 || tmp->tm_hour < 5) + if (sGameEventMgr.IsActiveEvent(EVENT_ID)) { // search area for nearby player characters Map::PlayerList const& players = m_creature->GetMap()->GetPlayers(); @@ -182,6 +190,7 @@ struct mob_sleeping_creature : public CreatureScript // no players nearby, therefore send the creature to sleep m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->GetMotionMaster()->MoveIdle(); + // DoCastSpellIfCan(m_creature, SPELL_SLEEP_DND); // zzzZZZ animation } }