diff options
| author | Ovahlord <dreadkiller@gmx.de> | 2020-01-11 23:00:17 +0100 |
|---|---|---|
| committer | Ovahlord <dreadkiller@gmx.de> | 2020-01-11 23:00:38 +0100 |
| commit | 87c79c9485cbb9536912e1566174c717946c1537 (patch) | |
| tree | a74c65c97ce521c263d3adcc200e0dc8b5977a18 /src | |
| parent | 33e4d4cd05148ea02b8723da3c3f49f93632ec90 (diff) | |
Core/Events: allow to override holiday durations and correct Lunar Festival duration down to 2 weeks
* the new field must be set for every new holiday date entry to take effect if you want to override the duration of the given
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Events/GameEventMgr.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 13a08927a3b..910f740341a 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -950,8 +950,8 @@ void GameEventMgr::LoadHolidayDates() { uint32 oldMSTime = getMSTime(); - // 0 1 2 - QueryResult result = WorldDatabase.Query("SELECT id, date_id, date_value FROM holiday_dates"); + // 0 1 2 3 + QueryResult result = WorldDatabase.Query("SELECT id, date_id, date_value, holiday_duration FROM holiday_dates"); if (!result) { TC_LOG_INFO("server.loading", ">> Loaded 0 holiday dates. DB table `holiday_dates` is empty."); @@ -962,6 +962,7 @@ void GameEventMgr::LoadHolidayDates() do { Field* fields = result->Fetch(); + uint32 holidayId = fields[0].GetUInt32(); HolidaysEntry* entry = const_cast<HolidaysEntry*>(sHolidaysStore.LookupEntry(holidayId)); if (!entry) @@ -969,14 +970,19 @@ void GameEventMgr::LoadHolidayDates() TC_LOG_ERROR("sql.sql", "holiday_dates entry has invalid holiday id %u.", holidayId); continue; } + uint8 dateId = fields[1].GetUInt8(); if (dateId >= MAX_HOLIDAY_DATES) { TC_LOG_ERROR("sql.sql", "holiday_dates entry has out of range date_id %u.", dateId); continue; } + entry->Date[dateId] = fields[2].GetUInt32(); + if (uint32 duration = fields[3].GetUInt32()) + entry->Duration[0] = duration; + auto itr = std::lower_bound(modifiedHolidays.begin(), modifiedHolidays.end(), entry->Id); if (itr == modifiedHolidays.end() || *itr != entry->Id) modifiedHolidays.insert(itr, entry->Id); |
