mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
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
This commit is contained in:
2
sql/updates/world/custom/custom_2020_01_11_05_world.sql
Normal file
2
sql/updates/world/custom/custom_2020_01_11_05_world.sql
Normal file
@@ -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;
|
||||
@@ -945,8 +945,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.");
|
||||
@@ -972,6 +972,9 @@ void GameEventMgr::LoadHolidayDates()
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user