mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
Core/Events: announce event system improvement. (#1228)
* DB: update timestamps for #1187
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
INSERT INTO version_db_world (`sql_rev`) VALUES ('1546538959760274673');
|
||||||
|
|
||||||
|
ALTER TABLE `game_event`
|
||||||
|
ADD COLUMN `announce` tinyint(3) unsigned NOT NULL DEFAULT 2 COMMENT '0 dont announce, 1 announce, 2 value from config' AFTER `world_event`;
|
||||||
|
|
||||||
|
ALTER TABLE `game_event`
|
||||||
|
CHANGE `start_time` `start_time` TIMESTAMP NULL DEFAULT NULL COMMENT 'Absolute start date, the event will never start before',
|
||||||
|
CHANGE `end_time` `end_time` TIMESTAMP NULL DEFAULT NULL COMMENT 'Absolute end date, the event will never start after';
|
||||||
|
|
||||||
|
UPDATE `game_event` SET `start_time`=NULL WHERE `start_time`='0000-00-00 00:00:00';
|
||||||
|
UPDATE `game_event` SET `end_time`=NULL WHERE `end_time`='0000-00-00 00:00:00';
|
||||||
@@ -209,8 +209,8 @@ void GameEventMgr::LoadFromDB()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
// 1 2 3 4 5 6 7 8 9
|
// 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 FROM game_event");
|
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)
|
if (!result)
|
||||||
{
|
{
|
||||||
mGameEvent.clear();
|
mGameEvent.clear();
|
||||||
@@ -243,6 +243,7 @@ void GameEventMgr::LoadFromDB()
|
|||||||
pGameEvent.holidayStage = fields[6].GetUInt8();
|
pGameEvent.holidayStage = fields[6].GetUInt8();
|
||||||
pGameEvent.description = fields[7].GetString();
|
pGameEvent.description = fields[7].GetString();
|
||||||
pGameEvent.state = (GameEventState)(fields[8].GetUInt8());
|
pGameEvent.state = (GameEventState)(fields[8].GetUInt8());
|
||||||
|
pGameEvent.announce = fields[9].GetUInt8();
|
||||||
pGameEvent.nextstart = 0;
|
pGameEvent.nextstart = 0;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
@@ -1189,14 +1190,9 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
|
|||||||
|
|
||||||
void GameEventMgr::ApplyNewEvent(uint16 event_id)
|
void GameEventMgr::ApplyNewEvent(uint16 event_id)
|
||||||
{
|
{
|
||||||
switch (sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE))
|
uint8 announce = mGameEvent[event_id].announce;
|
||||||
{
|
if (announce == 1 || (announce == 2 && sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE)))
|
||||||
case 0: // disable
|
sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
|
||||||
break;
|
|
||||||
case 1: // announce events
|
|
||||||
sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||||
sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
|
sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ struct GameEventData
|
|||||||
GameEventConditionMap conditions; // conditions to finish
|
GameEventConditionMap conditions; // conditions to finish
|
||||||
std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event
|
std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event
|
||||||
std::string description;
|
std::string description;
|
||||||
|
uint8 announce; // if 0 dont announce, if 1 announce, if 2 take config value
|
||||||
|
|
||||||
bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; }
|
bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user