mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[11077] Game event fixes and condition improvments.
* At game events table loading checked not only allowed event ids range but also event existance. * Renamed CONDITION_ACTIVE_EVENT -> CONDITION_ACTIVE_GAME_EVENT * Implemented new conditions: - CONDITION_NOT_ACTIVE_GAME_EVENT - CONDITION_ACTIVE_HOLIDAY - CONDITION_NOT_ACTIVE_HOLIDAY Recomended use holiday version where possible as more portable.
This commit is contained in:
parent
84dd2e4393
commit
2fd536fe43
9 changed files with 90 additions and 62 deletions
|
|
@ -4114,10 +4114,12 @@ bool ChatHandler::HandleLookupEventCommand(char* args)
|
|||
uint32 counter = 0;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
||||
|
||||
for(uint32 id = 0; id < events.size(); ++id)
|
||||
for(uint32 id = 1; id < events.size(); ++id)
|
||||
{
|
||||
if (!sGameEventMgr.IsValidEvent(id))
|
||||
continue;
|
||||
|
||||
GameEventData const& eventData = events[id];
|
||||
|
||||
std::string descr = eventData.description;
|
||||
|
|
@ -4126,7 +4128,7 @@ bool ChatHandler::HandleLookupEventCommand(char* args)
|
|||
|
||||
if (Utf8FitTo(descr, wnamepart))
|
||||
{
|
||||
char const* active = activeEvents.find(id) != activeEvents.end() ? GetMangosString(LANG_ACTIVE) : "";
|
||||
char const* active = sGameEventMgr.IsActiveEvent(id) ? GetMangosString(LANG_ACTIVE) : "";
|
||||
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
|
||||
|
|
@ -4152,7 +4154,6 @@ bool ChatHandler::HandleEventListCommand(char* args)
|
|||
all = true;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
||||
|
||||
char const* active = GetMangosString(LANG_ACTIVE);
|
||||
char const* inactive = GetMangosString(LANG_FACTION_INACTIVE);
|
||||
|
|
@ -4160,7 +4161,10 @@ bool ChatHandler::HandleEventListCommand(char* args)
|
|||
|
||||
for (uint32 event_id = 0; event_id < events.size(); ++event_id)
|
||||
{
|
||||
if (activeEvents.find(event_id) == activeEvents.end())
|
||||
if (!sGameEventMgr.IsValidEvent(event_id))
|
||||
continue;
|
||||
|
||||
if (!sGameEventMgr.IsActiveEvent(event_id))
|
||||
{
|
||||
if (!all)
|
||||
continue;
|
||||
|
|
@ -4197,7 +4201,7 @@ bool ChatHandler::HandleEventInfoCommand(char* args)
|
|||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||
|
||||
if (event_id >=events.size())
|
||||
if (!sGameEventMgr.IsValidEvent(event_id))
|
||||
{
|
||||
SendSysMessage(LANG_EVENT_NOT_EXIST);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4205,16 +4209,8 @@ bool ChatHandler::HandleEventInfoCommand(char* args)
|
|||
}
|
||||
|
||||
GameEventData const& eventData = events[event_id];
|
||||
if (!eventData.isValid())
|
||||
{
|
||||
SendSysMessage(LANG_EVENT_NOT_EXIST);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
||||
bool active = activeEvents.find(event_id) != activeEvents.end();
|
||||
char const* activeStr = active ? GetMangosString(LANG_ACTIVE) : "";
|
||||
char const* activeStr = sGameEventMgr.IsActiveEvent(event_id) ? GetMangosString(LANG_ACTIVE) : "";
|
||||
|
||||
std::string startTimeStr = TimeToTimestampStr(eventData.start);
|
||||
std::string endTimeStr = TimeToTimestampStr(eventData.end);
|
||||
|
|
@ -4244,7 +4240,7 @@ bool ChatHandler::HandleEventStartCommand(char* args)
|
|||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||
|
||||
if (event_id < 1 || event_id >= events.size())
|
||||
if (!sGameEventMgr.IsValidEvent(event_id))
|
||||
{
|
||||
SendSysMessage(LANG_EVENT_NOT_EXIST);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4259,8 +4255,7 @@ bool ChatHandler::HandleEventStartCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
||||
if (activeEvents.find(event_id) != activeEvents.end())
|
||||
if (sGameEventMgr.IsActiveEvent(event_id))
|
||||
{
|
||||
PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE,event_id);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4284,7 +4279,7 @@ bool ChatHandler::HandleEventStopCommand(char* args)
|
|||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||
|
||||
if (event_id < 1 || event_id >= events.size())
|
||||
if (!sGameEventMgr.IsValidEvent(event_id))
|
||||
{
|
||||
SendSysMessage(LANG_EVENT_NOT_EXIST);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4299,9 +4294,7 @@ bool ChatHandler::HandleEventStopCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
||||
|
||||
if (activeEvents.find(event_id) == activeEvents.end())
|
||||
if (!sGameEventMgr.IsActiveEvent(event_id))
|
||||
{
|
||||
PSendSysMessage(LANG_EVENT_NOT_ACTIVE,event_id);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue