mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Core/SAI): Implement SMART_TARGET_INSTANCE_STORAGE (#14981)
This commit is contained in:
@@ -3367,6 +3367,33 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_INSTANCE_STORAGE:
|
||||
{
|
||||
if (InstanceScript* instance = GetBaseObject()->GetInstanceScript())
|
||||
{
|
||||
if (e.target.instanceStorage.type == 1)
|
||||
{
|
||||
if (Creature* creature = instance->GetCreature(e.target.instanceStorage.index))
|
||||
{
|
||||
targets.push_back(creature);
|
||||
}
|
||||
}
|
||||
else if (e.target.instanceStorage.type == 2)
|
||||
{
|
||||
if (GameObject* go = instance->GetGameObject(e.target.instanceStorage.index))
|
||||
{
|
||||
targets.push_back(go);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("scripts.ai.sai", "SMART_TARGET_INSTANCE_STORAGE: Entry {} SourceType {} Event {} Action {} Target {} called outside an instance map.",
|
||||
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_NONE:
|
||||
case SMART_TARGET_POSITION:
|
||||
default:
|
||||
|
||||
@@ -422,6 +422,16 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_INSTANCE_STORAGE:
|
||||
{
|
||||
if (e.target.instanceStorage.type != 1 && e.target.instanceStorage.type != 2)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has invalid instance storage type as target ({}).",
|
||||
e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType(), e.target.instanceStorage.type);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_HOSTILE_SECOND_AGGRO:
|
||||
case SMART_TARGET_HOSTILE_LAST_AGGRO:
|
||||
case SMART_TARGET_HOSTILE_RANDOM:
|
||||
|
||||
@@ -1426,6 +1426,7 @@ enum SMARTAI_TARGETS
|
||||
SMART_TARGET_RANDOM_POINT = 202, // range, amount (for summoning creature), self als middle (0/1) else use xyz
|
||||
SMART_TARGET_ROLE_SELECTION = 203, // Range Max, TargetMask (Tanks (1), Healer (2) Damage (4)), resize list
|
||||
SMART_TARGET_SUMMONED_CREATURES = 204, // Entry
|
||||
SMART_TARGET_INSTANCE_STORAGE = 205, // Instance data index, Type (creature (1), gameobject (2))
|
||||
|
||||
SMART_TARGET_AC_END = 205 // placeholder
|
||||
};
|
||||
@@ -1595,6 +1596,12 @@ struct SmartTarget
|
||||
uint32 param3;
|
||||
uint32 param4;
|
||||
} raw;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 index;
|
||||
uint32 type;
|
||||
} instanceStorage;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user