mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-14 04:02:53 -04:00
Core/SmartScripts: added SMART_ACTION_SET_COUNTER and SMART_EVENT_COUNTER_SET
as per request of DB developers
(cherry picked from commit 23b1c042ad)
Conflicts:
src/server/game/AI/SmartScripts/SmartScript.h
This commit is contained in:
@@ -60,6 +60,7 @@ SmartScript::~SmartScript()
|
||||
delete itr->second;
|
||||
|
||||
delete mTargetStorage;
|
||||
mCounterList.clear();
|
||||
}
|
||||
|
||||
void SmartScript::OnReset()
|
||||
@@ -76,6 +77,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)
|
||||
@@ -1317,6 +1319,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())
|
||||
@@ -3206,6 +3213,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;
|
||||
|
||||
Reference in New Issue
Block a user