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:
1 parent
02c12f7e77
commit
0e60ed1682
2 files changed
+7
-2
No files matched your search
@@ -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