2 Commits

Author SHA1 Message Date
Sarjuuk
10ef33f709 Spells/SpellClick
* evaluate npc_spellclick_data and display on Spell and NPC Detail Pages
 * also categorize these spells as NPC-spells
 * closes #438
2025-11-21 22:47:43 +01:00
Sarjuuk
ae1b6c59b1 Quests/Requisites
* fixed case where an exclusiveGroup of 0 wasn't considered
 * closes #456
2025-11-21 21:09:09 +01:00
6 changed files with 42 additions and 2 deletions

View File

@@ -318,6 +318,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
// tab: abilities / tab_controlledabilities (dep: VehicleId) // tab: abilities / tab_controlledabilities (dep: VehicleId)
$tplSpells = []; $tplSpells = [];
$genSpells = []; $genSpells = [];
$spellClick = [];
$conditions = ['OR']; $conditions = ['OR'];
for ($i = 1; $i < 9; $i++) for ($i = 1; $i < 9; $i++)
@@ -339,6 +340,12 @@ class NpcBaseResponse extends TemplateResponse implements ICache
if ($genSpells) if ($genSpells)
$conditions[] = ['id', $genSpells]; $conditions[] = ['id', $genSpells];
if ($spellClick = DB::World()->select('SELECT `spell_id` AS ARRAY_KEY, `cast_flags` AS "0", `user_type` AS "1" FROM npc_spellclick_spells WHERE `npc_entry` = ?d', $this->typeId))
{
$genSpells = array_merge($genSpells, array_keys($spellClick));
$conditions[] = ['id', array_keys($spellClick)];
}
// Pet-Abilities // Pet-Abilities
if (($_typeFlags & NPC_TYPEFLAG_TAMEABLE) && ($_ = $this->subject->getField('family'))) if (($_typeFlags & NPC_TYPEFLAG_TAMEABLE) && ($_ = $this->subject->getField('family')))
{ {
@@ -376,6 +383,9 @@ class NpcBaseResponse extends TemplateResponse implements ICache
foreach ($controled as $id => $values) foreach ($controled as $id => $values)
{ {
if (isset($spellClick[$id]))
$values['spellclick'] = $spellClick[$id];
if (in_array($id, $genSpells)) if (in_array($id, $genSpells))
{ {
$normal[$id] = $values; $normal[$id] = $values;

View File

@@ -1304,7 +1304,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache
['reqQ', array('OR', ['AND', ['nextQuestId', $this->typeId], ['exclusiveGroup', 0, '<']], ['AND', ['id', $this->subject->getField('prevQuestId')], ['nextQuestIdChain', $this->typeId, '!']])], ['reqQ', array('OR', ['AND', ['nextQuestId', $this->typeId], ['exclusiveGroup', 0, '<']], ['AND', ['id', $this->subject->getField('prevQuestId')], ['nextQuestIdChain', $this->typeId, '!']])],
// Requires one of these quests (Requires one of the quests to choose from) // Requires one of these quests (Requires one of the quests to choose from)
['reqOneQ', array('OR', ['AND', ['exclusiveGroup', 0, '>'], ['nextQuestId', $this->typeId]], ['breadCrumbForQuestId', $this->typeId])], ['reqOneQ', array('OR', ['AND', ['exclusiveGroup', 0, '>='], ['nextQuestId', $this->typeId]], ['breadCrumbForQuestId', $this->typeId])],
// Opens Quests (Quests that become available only after complete this quest (optionally only one)) // Opens Quests (Quests that become available only after complete this quest (optionally only one))
['opensQ', array('OR', ['AND', ['prevQuestId', $this->typeId], ['id', $this->subject->getField('nextQuestIdChain'), '!']], ['id', $this->subject->getField('nextQuestId')], ['id', $this->subject->getField('breadcrumbForQuestId')])], ['opensQ', array('OR', ['AND', ['prevQuestId', $this->typeId], ['id', $this->subject->getField('nextQuestIdChain'), '!']], ['id', $this->subject->getField('nextQuestId')], ['id', $this->subject->getField('breadcrumbForQuestId')])],

View File

@@ -835,6 +835,9 @@ class SpellBaseResponse extends TemplateResponse implements ICache
if ($auras = DB::World()->selectCol('SELECT `entry` FROM creature_template_addon WHERE `auras` REGEXP ?', '\\b'.$this->typeId.'\\b')) if ($auras = DB::World()->selectCol('SELECT `entry` FROM creature_template_addon WHERE `auras` REGEXP ?', '\\b'.$this->typeId.'\\b'))
$conditions[] = ['id', $auras]; $conditions[] = ['id', $auras];
if ($spellClick = DB::World()->selectCol('SELECT `npc_entry` FROM npc_spellclick_spells WHERE `spell_id` = ?d', $this->typeId))
$conditions[] = ['id', $spellClick];
$ubCreature = new CreatureList($conditions); $ubCreature = new CreatureList($conditions);
if (!$ubCreature->error) if (!$ubCreature->error)
{ {

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); $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); $WH.ae(td, wrapper);
}, },
getVisibleText: function(spell) { 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 // 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( $world = DB::World()->selectCol(
'SELECT ss.`action_param1` FROM smart_scripts ss WHERE ss.`action_type` IN (?a) UNION '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] [SmartAction::ACTION_CAST, SmartAction::ACTION_ADD_AURA, SmartAction::ACTION_SELF_CAST, SmartAction::ACTION_CROSS_CAST]
); );