diff options
| author | Kittnz <frederik156@hotmail.com> | 2016-10-08 15:49:18 +0200 |
|---|---|---|
| committer | Kittnz <frederik156@hotmail.com> | 2016-10-08 15:49:18 +0200 |
| commit | 963278459a1d9df5aa3c2e1c8b5f5f112f6a370c (patch) | |
| tree | 316152a9effb5aabcef678cd653fb4b22539236e | |
| parent | e3560f3f518ee8a76921b4922292805c03871d4a (diff) | |
Core/Event: Pirate Day Music during the event
| -rw-r--r-- | sql/updates/world/3.3.5/2016_10_08_03_world_335.sql | 2 | ||||
| -rw-r--r-- | src/server/scripts/World/go_scripts.cpp | 57 |
2 files changed, 59 insertions, 0 deletions
diff --git a/sql/updates/world/3.3.5/2016_10_08_03_world_335.sql b/sql/updates/world/3.3.5/2016_10_08_03_world_335.sql new file mode 100644 index 00000000000..a0aa0e659bc --- /dev/null +++ b/sql/updates/world/3.3.5/2016_10_08_03_world_335.sql @@ -0,0 +1,2 @@ +-- Update Pirate Day Music Doodad script +UPDATE `gameobject_template` SET `ScriptName`='go_pirate_day_music' WHERE `entry`=190363; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 5efda908e42..3c4b5e8b36e 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1524,6 +1524,62 @@ public: } }; +/*#### +## go_pirate_day_music +####*/ + +enum PirateDayMusic +{ + MUSIC_PIRATE_DAY_MUSIC = 12845 +}; + +enum PirateDayMusicEvents +{ + EVENT_PDM_START_MUSIC = 1 +}; + +class go_pirate_day_music : public GameObjectScript +{ +public: + go_pirate_day_music() : GameObjectScript("go_pirate_day_music") { } + + struct go_pirate_day_musicAI : public GameObjectAI + { + uint32 rnd; + + go_pirate_day_musicAI(GameObject* go) : GameObjectAI(go) + { + _events.ScheduleEvent(EVENT_PDM_START_MUSIC, 1000); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_PDM_START_MUSIC: + if (!IsHolidayActive(HOLIDAY_PIRATES_DAY)) + break; + go->PlayDirectMusic(MUSIC_PIRATE_DAY_MUSIC); + _events.ScheduleEvent(EVENT_PDM_START_MUSIC, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) + break; + default: + break; + } + } + } + private: + EventMap _events; + }; + + GameObjectAI* GetAI(GameObject* go) const override + { + return new go_pirate_day_musicAI(go); + } +}; + void AddSC_go_scripts() { new go_cat_figurine(); @@ -1564,4 +1620,5 @@ void AddSC_go_scripts() new go_brewfest_music(); new go_midsummer_music(); new go_darkmoon_faire_music(); + new go_pirate_day_music(); } |
