Spells/Fixup

* skillLines can be empty for unused glyphs etc.
This commit is contained in:
Sarjuuk
2025-10-06 15:20:54 +02:00
parent 045c16c241
commit 704894c1e3

View File

@@ -2203,6 +2203,7 @@ class SpellBaseResponse extends TemplateResponse implements ICache
{ {
$cat = $this->subject->getField('typeCat'); $cat = $this->subject->getField('typeCat');
$cf = $this->subject->getField('cuFlags'); $cf = $this->subject->getField('cuFlags');
$sl = $this->subject->getField('skillLines');
$this->breadcrumb[] = $cat; $this->breadcrumb[] = $cat;
@@ -2224,14 +2225,15 @@ class SpellBaseResponse extends TemplateResponse implements ICache
if ($cat == -13) if ($cat == -13)
$this->breadcrumb[] = ($cf & (SPELL_CU_GLYPH_MAJOR | SPELL_CU_GLYPH_MINOR)) >> 6; $this->breadcrumb[] = ($cf & (SPELL_CU_GLYPH_MAJOR | SPELL_CU_GLYPH_MINOR)) >> 6;
else else if ($sl)
$this->breadcrumb[] = $this->subject->getField('skillLines')[0]; $this->breadcrumb[] = $sl[0];
break; break;
case 9: case 9:
case -3: case -3:
case 11: case 11:
$this->breadcrumb[] = $this->subject->getField('skillLines')[0]; if ($sl)
$this->breadcrumb[] = $sl[0];
if ($cat == 11) if ($cat == 11)
if ($_ = $this->subject->getField('reqSpellId')) if ($_ = $this->subject->getField('reqSpellId'))
@@ -2240,7 +2242,7 @@ class SpellBaseResponse extends TemplateResponse implements ICache
break; break;
case -11: case -11:
foreach (SpellList::$skillLines as $line => $skills) foreach (SpellList::$skillLines as $line => $skills)
if (in_array($this->subject->getField('skillLines')[0], $skills)) if (in_array($sl[0] ?? [], $skills))
$this->breadcrumb[] = $line; $this->breadcrumb[] = $line;
break; break;
case -7: // only spells unique in skillLineAbility will always point to the right skillLine :/ case -7: // only spells unique in skillLineAbility will always point to the right skillLine :/
@@ -2311,11 +2313,11 @@ class SpellBaseResponse extends TemplateResponse implements ICache
if (in_array($typeCat, [9, 11])) if (in_array($typeCat, [9, 11]))
{ {
// skill // skill
if ($_ = $this->subject->getField('skillLines')[0]) if ($_ = $this->subject->getField('skillLines'))
{ {
$this->extendGlobalIds(Type::SKILL, $_); $this->extendGlobalIds(Type::SKILL, $_[0]);
$bar = Lang::game('requires', [' [skill='.$_.']']); $bar = Lang::game('requires', [' [skill='.$_[0].']']);
if ($_ = $this->subject->getField('learnedAt')) if ($_ = $this->subject->getField('learnedAt'))
$bar .= ' ('.$_.')'; $bar .= ' ('.$_.')';