mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-14 07:53:44 +00:00
feat(Core/Common): add new helpers for time utility (#10207)
This commit is contained in:
@@ -1890,11 +1890,8 @@ public:
|
||||
{
|
||||
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);
|
||||
tm local_tm = Acore::Time::TimeBreakdown();
|
||||
uint8 _rings = (local_tm.tm_hour) % 12;
|
||||
_rings = (_rings == 0) ? 12 : _rings; // 00:00 and 12:00
|
||||
|
||||
|
||||
@@ -119,9 +119,7 @@ public:
|
||||
{
|
||||
case EVENT_CLEARWATER_ANNOUNCE:
|
||||
{
|
||||
time_t curtime = time(nullptr);
|
||||
tm strdate;
|
||||
localtime_r(&curtime, &strdate);
|
||||
tm strdate = Acore::Time::TimeBreakdown();
|
||||
|
||||
if (!preWarning && strdate.tm_hour == 13 && strdate.tm_min == 55)
|
||||
{
|
||||
@@ -268,14 +266,14 @@ public:
|
||||
{
|
||||
case EVENT_RIGGLE_ANNOUNCE:
|
||||
{
|
||||
time_t curtime = time(nullptr);
|
||||
tm strdate;
|
||||
localtime_r(&curtime, &strdate);
|
||||
tm strdate = Acore::Time::TimeBreakdown();
|
||||
|
||||
if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0)
|
||||
{
|
||||
sCreatureTextMgr->SendChat(me, RIGGLE_SAY_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE);
|
||||
startWarning = true;
|
||||
}
|
||||
|
||||
if (!finishWarning && strdate.tm_hour == 16 && strdate.tm_min == 0)
|
||||
{
|
||||
sCreatureTextMgr->SendChat(me, RIGGLE_SAY_END, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE);
|
||||
|
||||
Reference in New Issue
Block a user