mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
SmartAI/SpellCasts
* fixed getting spell casts per NPC * fixed spell usage for NPCs when used by Timed Actionlists * added 'used by (smart) areatrigger' to SpellDetailPage * fixed forgotten rename from SmartAI overhaul
This commit is contained in:
@@ -1536,6 +1536,9 @@ define('SAI_ACTION_PLAY_SPELL_VISUAL_KIT', 137); // spellVisualKit
|
||||
define('SAI_ACTION_OVERRIDE_LIGHT', 138); // zoneId, areaLightId, overrideLightID, transitionMilliseconds
|
||||
define('SAI_ACTION_OVERRIDE_WEATHER', 139); // zoneId, weatherId, intensity
|
||||
|
||||
define('SAI_ACTION_ALL_SPELLCASTS', [SAI_ACTION_CAST, SAI_ACTION_ADD_AURA, SAI_ACTION_INVOKER_CAST, SAI_ACTION_SELF_CAST, SAI_ACTION_CROSS_CAST]);
|
||||
define('SAI_ACTION_ALL_TIMED_ACTION_LISTS', [SAI_ACTION_CALL_TIMED_ACTIONLIST, SAI_ACTION_CALL_RANDOM_TIMED_ACTIONLIST, SAI_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST]);
|
||||
|
||||
define('SAI_CAST_FLAG_INTERRUPT_PREV', 0x01);
|
||||
define('SAI_CAST_FLAG_TRIGGERED', 0x02);
|
||||
// define('SAI_CAST_FORCE_CAST', 0x04); // Forces cast even if creature is out of mana or out of range
|
||||
@@ -1587,7 +1590,7 @@ define('SAI_TARGET_CLOSEST_ENEMY', 25); // Any attackable t
|
||||
define('SAI_TARGET_CLOSEST_FRIENDLY', 26); // Any friendly unit (creature, player or pet) within maxDist
|
||||
define('SAI_TARGET_LOOT_RECIPIENTS', 27); // All tagging players
|
||||
define('SAI_TARGET_FARTHEST', 28); // Farthest unit on the threat list
|
||||
define('SAI_TARGET_VEHICLE_ACCESSORY', 29); // Vehicle can target unit in given seat
|
||||
define('SAI_TARGET_VEHICLE_PASSENGER', 29); // Vehicle can target unit in given seat
|
||||
define('SAI_TARGET_CLOSEST_UNSPAWNED_GO', 30); // entry(0any), maxDist
|
||||
|
||||
define('SAI_TEMPLATE_BASIC', 0); //
|
||||
|
||||
@@ -365,7 +365,34 @@ class NpcPage extends GenericPage
|
||||
|
||||
// tab: abilities / tab_controlledabilities (dep: VehicleId)
|
||||
// SMART_SCRIPT_TYPE_CREATURE = 0; SMART_ACTION_CAST = 11; SMART_ACTION_ADD_AURA = 75; SMART_ACTION_INVOKER_CAST = 85; SMART_ACTION_CROSS_CAST = 86
|
||||
$smartSpells = DB::World()->selectCol('SELECT action_param1 FROM smart_scripts WHERE source_type = 0 AND action_type IN (11, 75, 85, 86) AND entryOrGUID = ?d', $this->typeId);
|
||||
$smartScripts = DB::World()->select('SELECT action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6 FROM smart_scripts WHERE source_type = ?d AND action_type IN (?a) AND entryOrGUID = ?d', SAI_SRC_TYPE_CREATURE, array_merge(SAI_ACTION_ALL_SPELLCASTS, SAI_ACTION_ALL_TIMED_ACTION_LISTS), $this->typeId);
|
||||
$smartSpells = [];
|
||||
$smartTALs = [];
|
||||
foreach ($smartScripts as $s)
|
||||
{
|
||||
if (in_array($s['action_type'], SAI_ACTION_ALL_SPELLCASTS))
|
||||
$smartSpells[] = $s['action_param1'];
|
||||
else if ($s['action_type'] == SAI_ACTION_CALL_TIMED_ACTIONLIST)
|
||||
$smartTALs[] = $s['action_param1'];
|
||||
else if ($s['action_type'] == SAI_ACTION_CALL_RANDOM_TIMED_ACTIONLIST)
|
||||
{
|
||||
for ($i = 1; $i < 7; $i++)
|
||||
if ($s['action_param'.$i])
|
||||
$smartTALs[] = $s['action_param'.$i];
|
||||
}
|
||||
else if ($s['action_type'] == SAI_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST)
|
||||
{
|
||||
for ($i = $s['action_param1']; $i <= $s['action_param2']; $i++)
|
||||
$smartTALs[] = $i;
|
||||
}
|
||||
else
|
||||
var_dump($s);
|
||||
}
|
||||
|
||||
if ($smartTALs)
|
||||
if ($_ = DB::World()->selectCol('SELECT action_param1 FROM smart_scripts WHERE source_type = ?d AND action_type IN (?a) AND entryOrGUID IN (?a)', SAI_SRC_TYPE_ACTIONLIST, SAI_ACTION_ALL_SPELLCASTS, $smartTALs))
|
||||
$smartSpells = array_merge($smartSpells, $_);
|
||||
|
||||
$tplSpells = [];
|
||||
$conditions = ['OR'];
|
||||
|
||||
|
||||
@@ -632,6 +632,23 @@ class SpellPage extends GenericPage
|
||||
$this->extendGlobalData($ubObjects->getJSGlobals());
|
||||
}
|
||||
|
||||
// tab: used by - areatrigger
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
{
|
||||
if ($_ = $this->ubSmartScript(TYPE_AREATRIGGER))
|
||||
{
|
||||
$ubTriggers = new AreaTriggerList(array(['id', $_]));
|
||||
if (!$ubTriggers->error)
|
||||
{
|
||||
$this->lvTabs[] = ['areatrigger', array(
|
||||
'data' => array_values($ubTriggers->getListviewData()),
|
||||
'id' => 'used-by-areatrigger',
|
||||
'name' => '$LANG.tab_usedby'
|
||||
), 'areatrigger'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tab: criteria of
|
||||
$conditions = array(
|
||||
['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL,
|
||||
@@ -2226,30 +2243,28 @@ class SpellPage extends GenericPage
|
||||
{
|
||||
$src = -1;
|
||||
if ($type == TYPE_OBJECT)
|
||||
$src = 1;
|
||||
$src = SAI_SRC_TYPE_OBJECT;
|
||||
else if ($type == TYPE_NPC)
|
||||
$src = 0;
|
||||
$src = SAI_SRC_TYPE_CREATURE;
|
||||
else if ($type == TYPE_AREATRIGGER)
|
||||
$src = SAI_SRC_TYPE_AREATRIGGER;
|
||||
else
|
||||
return [];
|
||||
|
||||
/*
|
||||
SMART_SCRIPT_TYPE_CREATURE = 0 => SMART_ACTION_CAST = 11; SMART_ACTION_ADD_AURA = 75; SMART_ACTION_INVOKER_CAST = 85; SMART_ACTION_CROSS_CAST = 86
|
||||
SMART_SCRIPT_TYPE_TIMED_ACTIONLIST = 9 => SMART_ACTION_CALL_TIMED_ACTIONLIST = 80; SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST = 87; SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST = 88
|
||||
*/
|
||||
|
||||
$ids = [];
|
||||
if ($smartS = DB::World()->selectCol('SELECT entryOrGUID AS ARRAY_KEY, source_type FROM smart_scripts WHERE entryorguid > 0 AND source_type IN (?d, 9) AND action_type IN (11, 75, 85, 86) AND action_param1 = ?d', $src, $this->typeId))
|
||||
if ($smartS = DB::World()->select('SELECT entryOrGUID, source_type FROM smart_scripts WHERE entryOrGUID > 0 AND source_type IN (?a) AND action_type IN (?a) AND action_param1 = ?d', [$src, SAI_SRC_TYPE_ACTIONLIST], SAI_ACTION_ALL_SPELLCASTS, $this->typeId))
|
||||
{
|
||||
// filter for timed action list
|
||||
if ($tal = array_filter($smartS, function($x) {return $x == 9;}))
|
||||
if ($tal = array_filter($smartS, function($x) {return $x['source_type'] == SAI_SRC_TYPE_ACTIONLIST;}))
|
||||
{
|
||||
if ($talIds = DB::World()->selectCol('SELECT entryOrGUID FROM smart_scripts WHERE entryorguid > 0 AND source_type = ?d AND action_type IN (80, 87, 88) AND (action_param1 IN (?a) OR action_param2 IN (?a) OR action_param3 IN (?a) OR action_param4 IN (?a) OR action_param5 IN (?a) OR action_param6 IN (?a))', $type, array_keys($tal), array_keys($tal), array_keys($tal), array_keys($tal), array_keys($tal), array_keys($tal)))
|
||||
$ids[] = ['id', $talIds];
|
||||
$talIds = array_column($tal, 'entryOrGUID');
|
||||
if ($_ = DB::World()->selectCol('SELECT entryOrGUID FROM smart_scripts WHERE entryOrGUID > 0 AND source_type = ?d AND action_type IN (?a) AND (action_param1 IN (?a) OR action_param2 IN (?a) OR action_param3 IN (?a) OR action_param4 IN (?a) OR action_param5 IN (?a) OR action_param6 IN (?a))', $src, SAI_ACTION_ALL_TIMED_ACTION_LISTS, $talIds, $talIds, $talIds, $talIds, $talIds, $talIds))
|
||||
$ids = $_;
|
||||
|
||||
$smartS = array_diff($smartS, $tal);
|
||||
}
|
||||
if ($smartS);
|
||||
$ids = array_merge($ids, $smartS);
|
||||
$ids = array_merge($ids, array_column($smartS, 'entryOrGUID'));
|
||||
}
|
||||
|
||||
return $ids;
|
||||
|
||||
Reference in New Issue
Block a user