Core/SmartScripts: added SMART_ACTION_SET_COUNTER and SMART_EVENT_COUNTER_SET

as per request of DB developers
This commit is contained in:
MitchesD
2015-04-02 18:02:34 +02:00
parent 06b75d8fa7
commit 23b1c042ad
4 changed files with 92 additions and 2 deletions
@@ -695,6 +695,22 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
break;
case SMART_EVENT_COUNTER_SET:
if (!IsMinMaxValid(e, e.event.counter.cooldownMin, e.event.counter.cooldownMax))
return false;
if (e.event.counter.id == 0)
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid counter id %u, skipped.", e.event.counter.id);
return false;
}
if (e.event.counter.value == 0)
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid value %u, skipped.", e.event.counter.value);
return false;
}
break;
case SMART_EVENT_LINK:
case SMART_EVENT_GO_STATE_CHANGED:
case SMART_EVENT_GO_EVENT_INFORM:
@@ -997,6 +1013,20 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
return false;
}
break;
case SMART_ACTION_SET_COUNTER:
if (e.action.setCounter.counterId == 0)
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses wrong counterId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setCounter.counterId);
return false;
}
if (e.action.setCounter.value == 0)
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses wrong value %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setCounter.value);
return false;
}
break;
case SMART_ACTION_INSTALL_AI_TEMPLATE:
if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END)