fix(Core/Script): add hourly bell event (#9151)
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1636718487600176900');
|
||||||
|
|
||||||
|
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`,`holidayStage`, `description`, `world_event`, `announce`) VALUES
|
||||||
|
(73, '2010-01-01 01:00:00', '2030-01-01 01:00:00', 60, 1, 0, 0, 'Hourly Bells', 0, 2);
|
||||||
|
|
||||||
|
DELETE FROM `game_event_gameobject` WHERE `eventEntry`=73;
|
||||||
|
|
||||||
|
-- Horde bells
|
||||||
|
INSERT INTO `game_event_gameobject` (`eventEntry`, `guid`) VALUES
|
||||||
|
(73, 12435), -- Orgrimmar
|
||||||
|
(73, 12436), -- Orgrimmar
|
||||||
|
(73, 12437), -- Orgrimmar
|
||||||
|
(73, 12438), -- Orgrimmar
|
||||||
|
(73, 12439), -- Orgrimmar
|
||||||
|
(73, 15508), -- Darkshire
|
||||||
|
(73, 18097), -- Thunder Bluff
|
||||||
|
(73, 18098), -- Thunder Bluff
|
||||||
|
(73, 18099), -- Thunder Bluff
|
||||||
|
(73, 18100), -- Thunder Bluff
|
||||||
|
(73, 18101), -- Thunder Bluff
|
||||||
|
(73, 18102), -- Thunder Bluff
|
||||||
|
(73, 18103), -- Thunder Bluff
|
||||||
|
(73, 18683), -- Stonebreaker Hold
|
||||||
|
(73, 20802), -- Tarren Mill
|
||||||
|
(73, 45022); -- Brill
|
||||||
|
|
||||||
|
-- Alliance bells
|
||||||
|
INSERT INTO `game_event_gameobject` (`eventEntry`, `guid`) VALUES
|
||||||
|
(73, 94), -- Ironforge
|
||||||
|
(73, 619), -- Ironforge
|
||||||
|
(73, 870), -- Ironforge
|
||||||
|
(73, 1140), -- Kharanos
|
||||||
|
(73, 4841), -- Ironforge
|
||||||
|
(73, 6867), -- Ironforge
|
||||||
|
(73, 9104), -- Alcaz Island
|
||||||
|
(73, 9114), -- Theramore
|
||||||
|
(73, 14562), -- Menethil
|
||||||
|
(73, 18894), -- Allerian Stronghold
|
||||||
|
(73, 18901), -- Stormwind
|
||||||
|
(73, 18896), -- Shattrath
|
||||||
|
(73, 20801), -- Hillsbrad
|
||||||
|
(73, 26283), -- Stormwind
|
||||||
|
(73, 26414), -- Stormwind
|
||||||
|
(73, 26435), -- Stormwind
|
||||||
|
(73, 26469), -- Stormwind
|
||||||
|
(73, 26743), -- Northshire Abbey
|
||||||
|
(73, 42666), -- Westfall Lighthouse
|
||||||
|
(73, 42905), -- Stormwind
|
||||||
|
(73, 42906), -- Stormwind
|
||||||
|
(73, 42924), -- Stormwind
|
||||||
|
(73, 48107), -- Astranaar
|
||||||
|
(73, 49811); -- Darnassus
|
||||||
|
|
||||||
|
-- karazhan bell
|
||||||
|
INSERT INTO `game_event_gameobject` (`eventEntry`, `guid`) VALUES
|
||||||
|
(73, 24539);
|
||||||
@@ -1625,6 +1625,190 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*####
|
||||||
|
## go_bells
|
||||||
|
####*/
|
||||||
|
|
||||||
|
enum BellHourlySoundFX
|
||||||
|
{
|
||||||
|
BELLTOLLHORDE = 6595,
|
||||||
|
BELLTOLLTRIBAL = 6675,
|
||||||
|
BELLTOLLALLIANCE = 6594,
|
||||||
|
BELLTOLLNIGHTELF = 6674,
|
||||||
|
BELLTOLLDWARFGNOME = 7234,
|
||||||
|
BELLTOLLKHARAZHAN = 9154,
|
||||||
|
LIGHTHOUSEFOGHORN = 7197
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BellHourlySoundZones
|
||||||
|
{
|
||||||
|
TIRISFAL_ZONE = 85,
|
||||||
|
UNDERCITY_ZONE = 1497,
|
||||||
|
DUN_MOROGH_ZONE = 1,
|
||||||
|
IRONFORGE_ZONE = 1537,
|
||||||
|
TELDRASSIL_ZONE = 141,
|
||||||
|
DARNASSUS_ZONE = 1657,
|
||||||
|
ASHENVALE_ZONE = 331,
|
||||||
|
HILLSBRAD_FOOTHILLS_ZONE = 267,
|
||||||
|
DUSKWOOD_ZONE = 10,
|
||||||
|
WESTFALL_ZONE = 40,
|
||||||
|
DUSTWALLOW_MARSH_ZONE = 15,
|
||||||
|
SHATTRATH_ZONE = 3703
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LightHouseAreas
|
||||||
|
{
|
||||||
|
AREA_ALCAZ_ISLAND = 2079,
|
||||||
|
AREA_WESTFALL_LIGHTHOUSE = 115
|
||||||
|
};
|
||||||
|
|
||||||
|
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,
|
||||||
|
EVENT_TIME = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
class go_bells : public GameObjectScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
go_bells() : GameObjectScript("go_bells") {}
|
||||||
|
|
||||||
|
struct go_bellsAI : public GameObjectAI
|
||||||
|
{
|
||||||
|
go_bellsAI(GameObject* go) : GameObjectAI(go), _soundId(0), once(true)
|
||||||
|
{
|
||||||
|
uint32 zoneId = go->GetZoneId();
|
||||||
|
|
||||||
|
switch (go->GetEntry())
|
||||||
|
{
|
||||||
|
case GO_HORDE_BELL:
|
||||||
|
{
|
||||||
|
switch (zoneId)
|
||||||
|
{
|
||||||
|
case TIRISFAL_ZONE:
|
||||||
|
case UNDERCITY_ZONE:
|
||||||
|
case HILLSBRAD_FOOTHILLS_ZONE:
|
||||||
|
case DUSKWOOD_ZONE:
|
||||||
|
_soundId = BELLTOLLHORDE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_soundId = BELLTOLLTRIBAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GO_ALLIANCE_BELL:
|
||||||
|
{
|
||||||
|
switch (zoneId)
|
||||||
|
{
|
||||||
|
case IRONFORGE_ZONE:
|
||||||
|
case DUN_MOROGH_ZONE:
|
||||||
|
_soundId = BELLTOLLDWARFGNOME;
|
||||||
|
break;
|
||||||
|
case DARNASSUS_ZONE:
|
||||||
|
case TELDRASSIL_ZONE:
|
||||||
|
case ASHENVALE_ZONE:
|
||||||
|
case SHATTRATH_ZONE:
|
||||||
|
_soundId = BELLTOLLNIGHTELF;
|
||||||
|
break;
|
||||||
|
case WESTFALL_ZONE:
|
||||||
|
if (go->GetAreaId() == AREA_WESTFALL_LIGHTHOUSE)
|
||||||
|
{
|
||||||
|
_soundId = LIGHTHOUSEFOGHORN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_soundId = BELLTOLLALLIANCE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DUSTWALLOW_MARSH_ZONE:
|
||||||
|
if (go->GetAreaId() == AREA_ALCAZ_ISLAND)
|
||||||
|
{
|
||||||
|
_soundId = LIGHTHOUSEFOGHORN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_soundId = BELLTOLLALLIANCE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_soundId = BELLTOLLALLIANCE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GO_KHARAZHAN_BELL:
|
||||||
|
{
|
||||||
|
_soundId = BELLTOLLKHARAZHAN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateAI(uint32 const diff) override
|
||||||
|
{
|
||||||
|
_events.Update(diff);
|
||||||
|
|
||||||
|
if (sGameEventMgr->IsActiveEvent(GAME_EVENT_HOURLY_BELLS) && once)
|
||||||
|
{
|
||||||
|
// Reset
|
||||||
|
once = false;
|
||||||
|
_events.ScheduleEvent(EVENT_TIME, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (uint32 eventId = _events.ExecuteEvent())
|
||||||
|
{
|
||||||
|
switch (eventId)
|
||||||
|
{
|
||||||
|
case EVENT_TIME:
|
||||||
|
{
|
||||||
|
// Get how many times it should ring
|
||||||
|
time_t t = time(nullptr);
|
||||||
|
tm local_tm;
|
||||||
|
tzset(); // set timezone for localtime_r() -> fix issues due to daylight time
|
||||||
|
localtime_r(&t, &local_tm);
|
||||||
|
uint8 _rings = (local_tm.tm_hour) % 12;
|
||||||
|
_rings = (_rings == 0) ? 12 : _rings; // 00:00 and 12:00
|
||||||
|
|
||||||
|
// Schedule ring event
|
||||||
|
for (auto i = 0; i < _rings; ++i)
|
||||||
|
{
|
||||||
|
_events.ScheduleEvent(EVENT_RING_BELL, (i * 4 + 1) * 1000);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EVENT_RING_BELL:
|
||||||
|
{
|
||||||
|
me->PlayDirectSound(_soundId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventMap _events;
|
||||||
|
uint32 _soundId;
|
||||||
|
bool once;
|
||||||
|
};
|
||||||
|
|
||||||
|
GameObjectAI* GetAI(GameObject* go) const override
|
||||||
|
{
|
||||||
|
return new go_bellsAI(go);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_go_scripts()
|
void AddSC_go_scripts()
|
||||||
{
|
{
|
||||||
// Ours
|
// Ours
|
||||||
@@ -1667,4 +1851,5 @@ void AddSC_go_scripts()
|
|||||||
new go_hive_pod();
|
new go_hive_pod();
|
||||||
new go_massive_seaforium_charge();
|
new go_massive_seaforium_charge();
|
||||||
new go_veil_skith_cage();
|
new go_veil_skith_cage();
|
||||||
|
new go_bells();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user