Spell/Tooltips

* added an exception for a bugged tooltip
 * better handle refs to unknown spells
This commit is contained in:
Sarjuuk
2015-08-07 19:46:43 +02:00
parent 63756b23d9
commit 00f53fbb09
3 changed files with 16 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
<?php
define('AOWOW_REVISION', 13);
define('AOWOW_REVISION', 14);
define('CLI', PHP_SAPI === 'cli');

View File

@@ -825,6 +825,8 @@ class SpellList extends BaseType
$this->refSpells[$lookup] = new SpellList(array(['s.id', $lookup]));
$srcSpell = $lookup ? $this->refSpells[$lookup] : $this;
if ($srcSpell->error)
return $result;
switch ($var)
{
@@ -1116,6 +1118,12 @@ class SpellList extends BaseType
$formula = substr_replace($formula, $formOutStr, $formStartPos, ($formCurPos - $formStartPos));
}
// note: broken tooltip on this one
// ${58644m1/-10} gets matched as a formula (ok), 58644m1 has no $ prefixed (not ok)
// the client scraps the m1 and prints -5864
if ($this->id == 58644)
$formula = '$'.$formula;
// step 2: resolve variables
$pos = 0; // continue strpos-search from this offset
$str = '';
@@ -1304,7 +1312,7 @@ class SpellList extends BaseType
$data = $this->handleFormulas($data, $scaling, true);
// step 4: find and eliminate regular variables
$data = $this->handleVariables($data, $scaling/*, true*/);
$data = $this->handleVariables($data, $scaling, true);
// step 5: variable-dependant variable-text
// special case $lONE:ELSE;
@@ -1376,7 +1384,7 @@ class SpellList extends BaseType
return $data;
}
private function handleVariables($data, &$scaling/*, $topLevel = false*/)
private function handleVariables($data, &$scaling, $topLevel = false)
{
$pos = 0; // continue strpos-search from this offset
$str = '';
@@ -1418,6 +1426,9 @@ class SpellList extends BaseType
$resolved .= isset($var[3]) ? sprintf($var[3], $_) : $_;
}
if ($var[0] === null && $topLevel) // {Unknown}
$resolved .= '{'.Lang::game('sources', 0).'}';
$str .= $resolved;
}
$str .= substr($data, $pos);

View File

@@ -133,8 +133,8 @@ class SpellPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// level
if (!in_array($_cat, [-5, -6])) // not mount or vanity pet
// level
if (!in_array($_cat, [-5, -6])) // not mount or vanity pet
{
if ($_ = $this->subject->getField('talentLevel'))
$infobox[] = (in_array($_cat, [-2, 7, -13]) ? sprintf(Lang::game('reqLevel'), $_) : Lang::game('level').Lang::main('colon').$_);