fix(Core/DB/Events): Game Event on Calendar (#2890)

* Game events will now show on Calendar

* Implement holiday_duration in holiday_dates (holiday_duration is the number of hours of how long the holiday may last (visible in the calendar))

* Fix all Start Dates of all events

Co-authored-by: Ovah <ovahlord@users.noreply.github.com>
Co-authored-by: natnat201193 <natnat201193@users.noreply.github.com>
Co-authored-by: Eridium <killyana@users.noreply.github.com>
This commit is contained in:
Kitzunu
2020-04-24 14:13:44 +02:00
committed by GitHub
parent c1fb6dd6a1
commit 93e7814af5
2 changed files with 102 additions and 2 deletions

View File

@@ -982,8 +982,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)
{
@@ -995,6 +995,7 @@ void GameEventMgr::LoadHolidayDates()
do
{
Field* fields = result->Fetch();
uint32 holidayId = fields[0].GetUInt32();
HolidaysEntry* entry = const_cast<HolidaysEntry*>(sHolidaysStore.LookupEntry(holidayId));
if (!entry)
@@ -1002,6 +1003,7 @@ void GameEventMgr::LoadHolidayDates()
sLog->outErrorDb("holiday_dates entry has invalid holiday id %u.", holidayId);
continue;
}
uint8 dateId = fields[1].GetUInt8();
if (dateId >= MAX_HOLIDAY_DATES)
{
@@ -1009,6 +1011,10 @@ void GameEventMgr::LoadHolidayDates()
continue;
}
entry->Date[dateId] = fields[2].GetUInt32();
if (uint32 duration = fields[3].GetUInt32())
entry->Duration[0] = duration;
modifiedHolidays.insert(entry->Id);
++count;