Spells/SpellClick

* evaluate npc_spellclick_data and display on Spell and NPC Detail Pages
 * also categorize these spells as NPC-spells
 * closes #438
This commit is contained in:
Sarjuuk 2025-11-21 22:30:28 +01:00
parent ae1b6c59b1
commit 10ef33f709
5 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,2 @@
UPDATE `aowow_dbversion` SET `build` = CONCAT(IFNULL(`build`, ''), ' globaljs');
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' spell');

View file

@ -2635,6 +2635,30 @@ Listview.templates = {
}
$WH.ae(wrapper, d);
}
else if (spell.spellclick) {
td.style.position = 'relative';
[flags, who] = spell.spellclick;
let buff = 'onClick';
if (who == 1) // Friendly
buff += $WH.sprintf(LANG.qty, g_reputation_standings[4]);
else if (who == 2) // Raid
buff += $WH.sprintf(LANG.qty, g_quest_types[62]);
else if (who == 3) // Party
buff += $WH.sprintf(LANG.qty, g_quest_types[1]);
buff += LANG.colon + '<span class="breadcrumb-arrow">' + (flags & 0x1 ? g_world_object_types[4] : g_pageInfo.name) + '</span>';
buff += flags & 0x2 ? g_world_object_types[4] : g_pageInfo.name;
$(td).append($('<div>', {class: 'small'})
.css('fontStyle', 'italic')
.css('position', 'absolute')
.css('right', '3px')
.css('bottom', '3px')
.html(buff)
);
}
$WH.ae(td, wrapper);
},
getVisibleText: function(spell) {

View file

@ -600,7 +600,8 @@ CLISetup::registerSetup("sql", new class extends SetupScript
// npc spells (-8) (run as last! .. missing from npc_scripts? "enum Spells { \s+(\w\d_)+\s+=\s(\d+) }" and "#define SPELL_(\d\w_)+\s+(\d+)") // RAID_MODE(1, 2[, 3, 4]) - macro still not considered
$world = DB::World()->selectCol(
'SELECT ss.`action_param1` FROM smart_scripts ss WHERE ss.`action_type` IN (?a) UNION
SELECT cts.`Spell` FROM creature_template_spell cts',
SELECT cts.`Spell` FROM creature_template_spell cts UNION
SELECT nscs.`spell_id` FROM npc_spellclick_spells nscs',
[SmartAction::ACTION_CAST, SmartAction::ACTION_ADD_AURA, SmartAction::ACTION_SELF_CAST, SmartAction::ACTION_CROSS_CAST]
);