mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[8607] more userfriendly eventcommands
.event start/stop will now output the started/stopped eventame+id .event activelist got renamed to .event list with optional parameter "all" so .event list - will list all active events and .event list all - will list all events including inactive ones
This commit is contained in:
parent
f591211538
commit
ed5130c1c1
10 changed files with 48 additions and 12 deletions
|
|
@ -3717,24 +3717,38 @@ bool ChatHandler::HandleLookupEventCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleEventActiveListCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleEventListCommand(const char* args)
|
||||
{
|
||||
uint32 counter = 0;
|
||||
bool all = false;
|
||||
std::string arg = args;
|
||||
if (arg == "all")
|
||||
all = true;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap();
|
||||
GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList();
|
||||
|
||||
char const* active = GetMangosString(LANG_ACTIVE);
|
||||
char const* inactive = GetMangosString(LANG_FACTION_INACTIVE);
|
||||
char const* state = "";
|
||||
|
||||
for(GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr )
|
||||
for (uint32 event_id = 0; event_id < events.size(); ++event_id)
|
||||
{
|
||||
uint32 event_id = *itr;
|
||||
if (activeEvents.find(event_id) == activeEvents.end())
|
||||
{
|
||||
if (!all)
|
||||
continue;
|
||||
state = inactive;
|
||||
}
|
||||
else
|
||||
state = active;
|
||||
|
||||
GameEventData const& eventData = events[event_id];
|
||||
|
||||
if(m_session)
|
||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active );
|
||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, event_id, event_id, eventData.description.c_str(), state);
|
||||
else
|
||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active );
|
||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), state);
|
||||
|
||||
++counter;
|
||||
}
|
||||
|
|
@ -3831,6 +3845,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_EVENT_STARTED, event_id, eventData.description.c_str());
|
||||
gameeventmgr.StartEvent(event_id,true);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3873,6 +3888,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_EVENT_STOPPED, event_id, eventData.description.c_str());
|
||||
gameeventmgr.StopEvent(event_id,true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue