diff options
author | Discover- <amort11@hotmail.com> | 2012-05-29 12:19:46 +0200 |
---|---|---|
committer | Discover- <amort11@hotmail.com> | 2012-05-29 12:19:46 +0200 |
commit | 013fe44b9229469e142bd152b43e80841dc9cb0e (patch) | |
tree | 2b2200efa2f43c347c92e477fe3a591a158b1472 | |
parent | e83f913fc501a84d57bb96b308a747e4fce468cb (diff) |
Core/SAI: Implement SMART_ACTION_SET_RANGED_MOVEMENT (79) and SMART_ACTION_SET_STAND_STATE (101). Updated wiki accordingly. These were required in order to properly be able to convert EventAI to SmartAI.
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 2 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 27 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 16 |
3 files changed, 42 insertions, 3 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index bfd1c7b9d41..435aa176d4d 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -62,6 +62,7 @@ class SmartAI : public CreatureAI void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; } void SetAutoAttack(bool on) { mCanAutoAttack = on; } void SetCombatMove(bool on); + bool CanCombatMove() { return mCanCombatMove; } void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0); void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); @@ -224,7 +225,6 @@ class SmartAI : public CreatureAI bool mCanCombatMove; bool mForcedPaused; uint32 mInvincibilityHpLevel; - bool AssistPlayerInCombat(Unit* who); uint32 mDespawnTime; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 85b117ccd8c..bb5b54829b8 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1534,6 +1534,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_CALL_SCRIPT_RESET: OnReset(); break; + case SMART_ACTION_SET_RANGED_MOVEMENT: + { + float attackDistance = (float)e.action.setRangedMovement.distance; + float attackAngle = e.action.setRangedMovement.angle / 180.0f * M_PI; + + if (CAST_AI(SmartAI, me->AI())->CanCombatMove()) + me->GetMotionMaster()->MoveChase(me->getVictim(), attackDistance, attackAngle); + break; + } case SMART_ACTION_CALL_TIMED_ACTIONLIST: { if (e.GetTargetType() == SMART_TARGET_NONE) @@ -1924,6 +1933,24 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; break; } + case SMART_ACTION_SET_STAND_STATE: + { + ObjectList* targets = GetTargets(e, unit); + if (!targets) + break; + + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (IsUnit(*itr)) + { + (*itr)->ToUnit()->SetStandState(e.action.setStandState.standState); + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set standstate to %u", (*itr)->GetGUIDLow(), e.action.emote.emote); + } + } + + delete targets; + break; + } default: sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index bde7768f036..7efc137205e 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -451,7 +451,7 @@ enum SMART_ACTION SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // WARNING: CAN CRASH CORE, do not use if you dont know what you are doing SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // none SMART_ACTION_CALL_SCRIPT_RESET = 78, // none - // Unused = 79, + SMART_ACTION_SET_RANGED_MOVEMENT = 79, // Distance, angle SMART_ACTION_CALL_TIMED_ACTIONLIST = 80, // ID (overwrites already running actionlist), stop after combat?(0/1), timer update type(0-OOC, 1-IC, 2-ALWAYS) SMART_ACTION_SET_NPC_FLAG = 81, // Flags SMART_ACTION_ADD_NPC_FLAG = 82, // Flags @@ -473,8 +473,9 @@ enum SMART_ACTION SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId SMART_ACTION_GO_SET_LOOT_STATE = 99, // state SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id + SMART_ACTION_SET_STAND_STATE = 101, // standState - SMART_ACTION_END = 101, + SMART_ACTION_END = 102, }; struct SmartAction @@ -895,6 +896,17 @@ struct SmartAction struct { + uint32 standState; + } setStandState; + + struct + { + float distance; + float angle; + } setRangedMovement; + + struct + { uint32 param1; uint32 param2; uint32 param3; |