mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Core/SAI: Add actions to set/add/remove (104/105/106) gameobject flags
This commit is contained in:
@@ -2028,6 +2028,45 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_GO_FLAG:
|
||||
{
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
break;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->SetUInt32Value(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_ADD_GO_FLAG:
|
||||
{
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
break;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->SetFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_REMOVE_GO_FLAG:
|
||||
{
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
break;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->RemoveFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
break;
|
||||
|
||||
@@ -907,6 +907,9 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_SET_HOME_POS:
|
||||
case SMART_ACTION_SET_HEALTH_REGEN:
|
||||
case SMART_ACTION_SET_ROOT:
|
||||
case SMART_ACTION_SET_GO_FLAG:
|
||||
case SMART_ACTION_ADD_GO_FLAG:
|
||||
case SMART_ACTION_REMOVE_GO_FLAG:
|
||||
break;
|
||||
default:
|
||||
sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
|
||||
@@ -426,7 +426,6 @@ enum SMART_ACTION
|
||||
SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue(+pct, -flat)
|
||||
SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to dismount)
|
||||
SMART_ACTION_SET_INGAME_PHASE_MASK = 44, // mask
|
||||
|
||||
SMART_ACTION_SET_DATA = 45, // Field, Data (only creature TODO)
|
||||
SMART_ACTION_MOVE_FORWARD = 46, // distance
|
||||
SMART_ACTION_SET_VISIBILITY = 47, // on/off
|
||||
@@ -449,7 +448,6 @@ enum SMART_ACTION
|
||||
SMART_ACTION_STORE_TARGET_LIST = 64, // varID,
|
||||
SMART_ACTION_WP_RESUME = 65, // none
|
||||
SMART_ACTION_SET_ORIENTATION = 66, //
|
||||
|
||||
SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance
|
||||
SMART_ACTION_PLAYMOVIE = 68, // entry
|
||||
SMART_ACTION_MOVE_TO_POS = 69, // PointId, xyz
|
||||
@@ -487,8 +485,11 @@ enum SMART_ACTION
|
||||
SMART_ACTION_SET_HOME_POS = 101, // none
|
||||
SMART_ACTION_SET_HEALTH_REGEN = 102, // 0/1
|
||||
SMART_ACTION_SET_ROOT = 103, // off/on
|
||||
SMART_ACTION_SET_GO_FLAG = 104, // Flags
|
||||
SMART_ACTION_ADD_GO_FLAG = 105, // Flags
|
||||
SMART_ACTION_REMOVE_GO_FLAG = 106, // Flags
|
||||
|
||||
SMART_ACTION_END = 104
|
||||
SMART_ACTION_END = 107
|
||||
};
|
||||
|
||||
struct SmartAction
|
||||
@@ -925,6 +926,11 @@ struct SmartAction
|
||||
uint32 root;
|
||||
} setRoot;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 flag;
|
||||
} goFlag;
|
||||
|
||||
//! Note for any new future actions
|
||||
//! All parameters must have type uint32
|
||||
|
||||
|
||||
Reference in New Issue
Block a user