Core/SmartScripts: added SMART_ACTION_SET_COUNTER and SMART_EVENT_COUNTER_SET

as per request of DB developers

(cherry picked from commit 23b1c042adbe3a460457aa11f017c90e6600bfa2)

Conflicts:
	src/server/game/AI/SmartScripts/SmartScript.h
This commit is contained in:
MitchesD committed 2015-04-02 18:52:19 +02:00
1 parent f87dbb6426
commit 1103f0889d
4 files changed
+92 -2

No files matched your search

@@ -61,6 +61,7 @@ SmartScript::~SmartScript()
delete itr->second;
delete mTargetStorage;
mCounterList.clear();
}
void SmartScript::OnReset()
@@ -77,6 +78,7 @@ void SmartScript::OnReset()
}
ProcessEventsFor(SMART_EVENT_RESET);
mLastInvoker.Clear();
mCounterList.clear();
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
@@ -1321,6 +1323,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
ENSURE_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim != 0);
break;
}
case SMART_ACTION_SET_COUNTER:
{
StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset);
break;
}
case SMART_ACTION_WP_START:
{
if (!IsSmart())
@@ -3209,6 +3216,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
break;
}
case SMART_EVENT_COUNTER_SET:
if (GetCounterId(e.event.counter.id) != 0 && GetCounterValue(e.event.counter.id) == e.event.counter.value)
ProcessTimedAction(e, e.event.counter.cooldownMax, e.event.counter.cooldownMax);
break;
default:
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
break;