Core/Events: announce event system improvement. (#1228)

* DB: update timestamps for #1187
This commit is contained in:
Viste(Кирилл)
2019-01-08 16:15:38 +03:00
committed by GitHub
parent 2f5653c24f
commit 31bce00b2a
3 changed files with 18 additions and 10 deletions

View File

@@ -209,8 +209,8 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
// 1 2 3 4 5 6 7 8 9
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, description, world_event FROM game_event");
// 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, description, world_event, announce FROM game_event");
if (!result)
{
mGameEvent.clear();
@@ -243,6 +243,7 @@ void GameEventMgr::LoadFromDB()
pGameEvent.holidayStage = fields[6].GetUInt8();
pGameEvent.description = fields[7].GetString();
pGameEvent.state = (GameEventState)(fields[8].GetUInt8());
pGameEvent.announce = fields[9].GetUInt8();
pGameEvent.nextstart = 0;
++count;
@@ -1189,14 +1190,9 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
void GameEventMgr::ApplyNewEvent(uint16 event_id)
{
switch (sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE))
{
case 0: // disable
break;
case 1: // announce events
sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
break;
}
uint8 announce = mGameEvent[event_id].announce;
if (announce == 1 || (announce == 2 && sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE)))
sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());