diff options
| -rw-r--r-- | sql/updates/world/3.3.5/2020_01_11_00_world.sql | 2 | ||||
| -rw-r--r-- | src/server/game/Events/GameEventMgr.cpp | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sql/updates/world/3.3.5/2020_01_11_00_world.sql b/sql/updates/world/3.3.5/2020_01_11_00_world.sql new file mode 100644 index 00000000000..62c271ad054 --- /dev/null +++ b/sql/updates/world/3.3.5/2020_01_11_00_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE `holiday_dates` ADD COLUMN `holiday_duration` INT(10) UNSIGNED NOT NULL AFTER `date_value`; +UPDATE `holiday_dates` SET `holiday_duration`= 360 WHERE `id`= 327; 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); |
