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:
1 parent
d8ef63040a
commit
1de02764c7
4 files changed
+92
-3
No files matched your search
@@ -145,8 +145,37 @@ class SmartScript
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const
|
||||
void StoreCounter(uint32 id, uint32 value, uint32 reset)
|
||||
{
|
||||
CounterMap::const_iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
{
|
||||
if (reset == 0)
|
||||
value += GetCounterValue(id);
|
||||
mCounterList.erase(id);
|
||||
}
|
||||
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
ProcessEventsFor(SMART_EVENT_COUNTER_SET);
|
||||
}
|
||||
|
||||
uint32 GetCounterId(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->first;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 GetCounterValue(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const {
|
||||
GameObject* gameObject = NULL;
|
||||
|
||||
CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
@@ -205,6 +234,8 @@ class SmartScript
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry);
|
||||
Unit* GetLastInvoker();
|
||||
ObjectGuid mLastInvoker;
|
||||
typedef std::unordered_map<uint32, uint32> CounterMap;
|
||||
CounterMap mCounterList;
|
||||
|
||||
private:
|
||||
void IncPhase(int32 p = 1)
|
||||
|
||||
Reference in new issue
Block a user