From deba5325a7bec3631841c6a461fa13f2a6678de3 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 7 Oct 2023 18:09:26 +0200 Subject: [PATCH] Spells/DetailPage * display proc info for dummy auras --- includes/types/spell.class.php | 2 +- pages/spell.php | 40 +++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index a876eaef..a7cad3b2 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -878,7 +878,7 @@ class SpellList extends BaseType $idx = []; for ($i = 1; $i < 4; $i++) if (in_array($this->curTpl['effect'.$i.'Id'], SpellList::$effects['trigger']) || in_array($this->curTpl['effect'.$i.'AuraId'], SpellList::$auras['trigger'])) - if ($this->curTpl['effect'.$i.'TriggerSpell'] > 0 || ($this->curTpl['effect'.$i.'Id'] == 155 && $this->curTpl['effect'.$i.'MiscValue'] > 0)) + if ($this->curTpl['effect'.$i.'AuraId'] == 4 || $this->curTpl['effect'.$i.'TriggerSpell'] > 0 || ($this->curTpl['effect'.$i.'Id'] == 155 && $this->curTpl['effect'.$i.'MiscValue'] > 0)) $idx[] = $i; return $idx; diff --git a/pages/spell.php b/pages/spell.php index 8578dfa6..6dc33491 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -1557,9 +1557,15 @@ class SpellPage extends GenericPage private function createEffects(&$infobox, &$redButtons) { // proc data .. maybe use more information..? - $procData = DB::World()->selectRow('SELECT IF(ProcsPerMinute > 0, -ProcsPerMinute, Chance) AS chance, Cooldown AS cooldown FROM spell_proc WHERE ABS(SpellId) = ?d', $this->firstRank); - if (!isset($procData['cooldown'])) - $procData['cooldown'] = 0; + $procData = array( + 'chance' => $this->subject->getField('procChance'), + 'cooldown' => 0 + ); + + if ($procCustom = DB::World()->selectRow('SELECT IF(ProcsPerMinute > 0, -ProcsPerMinute, Chance) AS chance, Cooldown AS cooldown FROM spell_proc WHERE ABS(SpellId) = ?d', $this->firstRank)) + foreach ($procCustom as $k => $v) + if ($v) + $procData[$k] = $v; $effects = []; $spellIdx = array_unique(array_merge($this->subject->canTriggerSpell(), $this->subject->canTeachSpell())); @@ -1635,19 +1641,22 @@ class SpellPage extends GenericPage else if (in_array($i, $spellIdx) || in_array($effId, [133, 140, 141])) { if ($effId == 155) - $_ = $effMV; + $triggeredSpell = $effMV; else - $_ = $this->subject->getField('effect'.$i.'TriggerSpell'); + $triggeredSpell = $this->subject->getField('effect'.$i.'TriggerSpell'); - $trig = new SpellList(array(['s.id', (int)$_])); + if ($triggeredSpell > 0) // Dummy Auras are probably scripted + { + $trig = new SpellList(array(['s.id', (int)$triggeredSpell])); - $foo['icon'] = array( - 'id' => $_, - 'name' => $trig->error ? Util::ucFirst(Lang::game('spell')).' #'.$_ : $trig->getField('name', true), - 'count' => 0 - ); + $foo['icon'] = array( + 'id' => $triggeredSpell, + 'name' => $trig->error ? Util::ucFirst(Lang::game('spell')).' #'.$triggeredSpell : $trig->getField('name', true), + 'count' => 0 + ); - $this->extendGlobalData($trig->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); + $this->extendGlobalData($trig->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); + } } // Effect Name @@ -1670,16 +1679,11 @@ class SpellPage extends GenericPage if ($_ = $this->subject->getField('effect'.$i.'Mechanic')) $foo['mechanic'] = Lang::game('me', $_); - if (in_array($i, $this->subject->canTriggerSpell()) && !empty($procData['chance'])) + if (in_array($i, $this->subject->canTriggerSpell()) && $procData['chance']) $foo['procData'] = array( $procData['chance'], $procData['cooldown'] ? Util::formatTime($procData['cooldown'], true) : null ); - else if (in_array($i, $this->subject->canTriggerSpell()) && $this->subject->getField('procChance')) - $foo['procData'] = array( - $this->subject->getField('procChance'), - $procData['cooldown'] ? Util::formatTime($procData['cooldown'], true) : null - ); // parse masks and indizes switch ($effId)