Merge pull request #9647 from xjose93/GameEventAnnounce

Core/Events: announce event system improvement.
This commit is contained in:
Shauren
2013-04-16 02:43:31 -07:00
3 changed files with 8 additions and 3 deletions
@@ -0,0 +1,2 @@
ALTER TABLE `game_event`
ADD COLUMN `announce` tinyint(3) unsigned NULL DEFAULT 2 COMMENT '0 dont announce, 1 announce, 2 value from config' AFTER `world_event`;
+5 -3
View File
@@ -205,8 +205,8 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event");
// 0 1 2 3 4 5 6 7 8
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event, announce FROM game_event");
if (!result)
{
mGameEvent.clear();
@@ -237,6 +237,7 @@ void GameEventMgr::LoadFromDB()
pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
pGameEvent.nextstart = 0;
pGameEvent.announce = fields[8].GetUInt8();
if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
{
@@ -1104,7 +1105,8 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
void GameEventMgr::ApplyNewEvent(uint16 event_id)
{
if (sWorld->getBoolConfig(CONFIG_EVENT_ANNOUNCE))
uint8 announce = mGameEvent[event_id].announce;
if (announce == 1 || (announce == 2 && sWorld->getBoolConfig(CONFIG_EVENT_ANNOUNCE)))
sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
+1
View File
@@ -66,6 +66,7 @@ struct GameEventData
GameEventConditionMap conditions; // conditions to finish
std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event
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; }
};