mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Script/GO: Alliance Bell, Horde Bell and Karazhan Bell will now send a bell sound on the start of each hour. (#19145)
* Script/GO: Alliance Bell, Horde Bell and Karazhan Bell will now send a bell sound on the start of each hour.
How many times it rings depence on the hour.
* fix little things from pr comments
* Added OnGameEvent
* Fix braces
* almost finished
* fix enum
* Add gameobjects to the game event
Fix override for InitializeAI
* enum squash
* remove braces
* Rename 9999_99_99_99_world.sql to 2017_02_19_01_world.sql
(cherrypicked from 495339a2c7)
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
UPDATE `gameobject_template` SET `ScriptName`='go_bells' WHERE `entry` IN (175885, 176573, 182064);
|
||||
|
||||
DELETE FROM `game_event` WHERE `eventEntry`=73;
|
||||
INSERT INTO `game_event` (`eventEntry`, `start_time`, `end_time`, `occurence`, `length`, `holiday`, `description`, `world_event`, `announce`) VALUES
|
||||
(73, '2010-01-01 01:00:00', '2025-01-01 01:00:00', 60, 1, 0, 'Hourly Bells', 0, 2);
|
||||
|
||||
DELETE FROM `game_event_gameobject` WHERE `eventEntry`=73;
|
||||
INSERT INTO `game_event_gameobject` (`eventEntry`, `guid`) VALUES
|
||||
-- (73, 45022), -- Horde Bell
|
||||
-- (73, 20802),
|
||||
-- (73, 18103),
|
||||
-- (73, 18102),
|
||||
-- (73, 18101),
|
||||
-- (73, 18100),
|
||||
-- (73, 18099),
|
||||
-- (73, 18098),
|
||||
-- (73, 18097),
|
||||
-- (73, 15508),
|
||||
-- (73, 12439),
|
||||
-- (73, 12438),
|
||||
-- (73, 12437),
|
||||
(73, 18683),
|
||||
-- (73, 12436),
|
||||
-- (73, 12435),
|
||||
-- (73, 42666), -- Alliance Bell
|
||||
-- (73, 42905),
|
||||
-- (73, 42906),
|
||||
-- (73, 42924),
|
||||
-- (73, 48107),
|
||||
-- (73, 49811),
|
||||
-- (73, 94),
|
||||
-- (73, 619),
|
||||
-- (73, 870),
|
||||
-- (73, 1140),
|
||||
-- (73, 4841),
|
||||
-- (73, 6867),
|
||||
-- (73, 20801),
|
||||
-- (73, 9114),
|
||||
-- (73, 9104),
|
||||
-- (73, 14562),
|
||||
(73, 18894),
|
||||
-- (73, 18901),
|
||||
-- (73, 18906),
|
||||
-- (73, 26283),
|
||||
-- (73, 26414),
|
||||
-- (73, 26426),
|
||||
-- (73, 26435),
|
||||
-- (73, 26469),
|
||||
-- (73, 26743),
|
||||
(73, 24539); -- Karazhan Bell
|
||||
@@ -42,6 +42,7 @@ go_amberpine_outhouse
|
||||
go_hive_pod
|
||||
go_veil_skith_cage
|
||||
go_toy_train_set
|
||||
go_bells
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
@@ -56,6 +57,7 @@ EndContentData */
|
||||
#include "ScriptedGossip.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "WorldSession.h"
|
||||
#include "World.h"
|
||||
#include "GameEventMgr.h"
|
||||
|
||||
/*######
|
||||
@@ -1496,6 +1498,117 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/*####
|
||||
## go_bells
|
||||
####*/
|
||||
|
||||
enum BellHourlySoundFX
|
||||
{
|
||||
BELLTOLLHORDE = 6595, // Horde
|
||||
BELLTOLLTRIBAL = 6675,
|
||||
BELLTOLLALLIANCE = 6594, // Alliance
|
||||
BELLTOLLNIGHTELF = 6674,
|
||||
BELLTOLLDWARFGNOME = 7234,
|
||||
BELLTOLLKHARAZHAN = 9154 // Kharazhan
|
||||
};
|
||||
|
||||
enum BellHourlySoundAreas
|
||||
{
|
||||
UNDERCITY_AREA = 1497,
|
||||
IRONFORGE_1_AREA = 809,
|
||||
IRONFORGE_2_AREA = 1,
|
||||
DARNASSUS_AREA = 1657,
|
||||
TELDRASSIL_ZONE = 141,
|
||||
KHARAZHAN_MAPID = 532
|
||||
};
|
||||
|
||||
enum BellHourlyObjects
|
||||
{
|
||||
GO_HORDE_BELL = 175885,
|
||||
GO_ALLIANCE_BELL = 176573,
|
||||
GO_KHARAZHAN_BELL = 182064
|
||||
};
|
||||
|
||||
enum BellHourlyMisc
|
||||
{
|
||||
GAME_EVENT_HOURLY_BELLS = 73,
|
||||
EVENT_RING_BELL = 1
|
||||
};
|
||||
|
||||
class go_bells : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
go_bells() : GameObjectScript("go_bells") { }
|
||||
|
||||
struct go_bellsAI : public GameObjectAI
|
||||
{
|
||||
go_bellsAI(GameObject* go) : GameObjectAI(go) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_HORDE_BELL:
|
||||
_soundId = go->GetAreaId() == UNDERCITY_AREA ? BELLTOLLHORDE : BELLTOLLTRIBAL;
|
||||
break;
|
||||
case GO_ALLIANCE_BELL:
|
||||
{
|
||||
if (go->GetAreaId() == IRONFORGE_1_AREA || go->GetAreaId() == IRONFORGE_2_AREA)
|
||||
_soundId = BELLTOLLDWARFGNOME;
|
||||
else if (go->GetAreaId() == DARNASSUS_AREA || go->GetZoneId() == TELDRASSIL_ZONE)
|
||||
_soundId = BELLTOLLNIGHTELF;
|
||||
else
|
||||
_soundId = BELLTOLLALLIANCE;
|
||||
|
||||
break;
|
||||
}
|
||||
case GO_KHARAZHAN_BELL:
|
||||
_soundId = BELLTOLLKHARAZHAN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGameEvent(bool start, uint16 eventId) override
|
||||
{
|
||||
if (eventId == GAME_EVENT_HOURLY_BELLS && start)
|
||||
{
|
||||
time_t time = sWorld->GetGameTime();
|
||||
tm localTm;
|
||||
localtime_r(&time, &localTm);
|
||||
uint8 _rings = (localTm.tm_hour - 1) % 12 + 1;
|
||||
|
||||
for (auto i = 0; i < _rings; ++i)
|
||||
_events.ScheduleEvent(EVENT_RING_BELL, Seconds(i * 4 + 1));
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_RING_BELL:
|
||||
go->PlayDirectSound(_soundId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
EventMap _events;
|
||||
uint32 _soundId;
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* go) const override
|
||||
{
|
||||
return new go_bellsAI(go);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_go_scripts()
|
||||
{
|
||||
new go_cat_figurine();
|
||||
@@ -1537,4 +1650,5 @@ void AddSC_go_scripts()
|
||||
new go_midsummer_music();
|
||||
new go_darkmoon_faire_music();
|
||||
new go_pirate_day_music();
|
||||
new go_bells();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user