Implement SMART_ACTION_GAME_EVENT_STOP (111) and SMART_ACTION_GAME_EVENT_START (112).

This commit is contained in:
xjose93
2013-08-30 01:16:12 +02:00
parent 48783b8606
commit c3afc00571
3 changed files with 74 additions and 1 deletions

View File

@@ -34,6 +34,7 @@
#include "SmartScript.h"
#include "SpellMgr.h"
#include "Vehicle.h"
#include "GameEventMgr.h"
class TrinityStringTextBuilder
{
@@ -2116,6 +2117,28 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
break;
}
case SMART_ACTION_GAME_EVENT_STOP:
{
uint32 eventId = e.action.gameEventStop.id;
if (!sGameEventMgr->IsActiveEvent(eventId))
{
TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId);
return;
}
sGameEventMgr->StopEvent(eventId, true);
break;
}
case SMART_ACTION_GAME_EVENT_START:
{
uint32 eventId = e.action.gameEventStart.id;
if (sGameEventMgr->IsActiveEvent(eventId))
{
TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_START, already activated event (id: %u)", eventId);
return;
}
sGameEventMgr->StartEvent(eventId, true);
break;
}
default:
TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;