mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -893,6 +894,17 @@ struct SmartAction
|
||||
uint32 id;
|
||||
} sendTargetToTarget;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 standState;
|
||||
} setStandState;
|
||||
|
||||
struct
|
||||
{
|
||||
float distance;
|
||||
float angle;
|
||||
} setRangedMovement;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 param1;
|
||||
|
||||
Reference in New Issue
Block a user