- fixed line breaks in tooltips
 - fixed typo causing unwanted output when parsing ratings
 - ammunition now always displays dps and some misc items no longer display 0-0 damage

Spells
 - added created items to tooltip (formating is a bit off though)
 - fixed typo in parsing periodic auras

Power
 - use external version of in_array (e.g. prepend $WH.), should fix inclusion of power to external sites
This commit is contained in:
Sarjuuk
2013-03-06 20:04:52 +01:00
parent 895a6478b1
commit b4afea2cda
3 changed files with 34 additions and 22 deletions

View File

@@ -286,8 +286,8 @@ class ItemList extends BaseType
else
$x .= '<br />';
// Weapon Stats
if ($this->curTpl['delay'] > 0)
// Weapon/Ammunition Stats
if (in_array($this->curTpl['class'], [ITEM_CLASS_WEAPON, ITEM_CLASS_AMMUNITION]))
{
$speed = $this->curTpl['delay'] / 1000;
$dmgmin1 = $this->curTpl['dmg_min1'] + $this->curTpl['dmg_min2'];
@@ -295,7 +295,7 @@ class ItemList extends BaseType
$dps = $speed ? ($dmgmin1 + $dmgmax1) / (2 * $speed) : 0;
// regular weapon
if ($this->curTpl['class'] != ITEM_CLASS_AMMUNITION)
if ($this->curTpl['class'] == ITEM_CLASS_WEAPON)
{
$x .= '<table width="100%"><tr>';
$x .= '<td><!--dmg-->'.sprintf($this->curTpl['dmg_type1'] ? Lang::$item['damageMagic'] : Lang::$item['damagePhys'], $this->curTpl['dmg_min1'].' - '.$this->curTpl['dmg_max1'], Lang::$game['sc'][$this->curTpl['dmg_type1']]).'</td>';
@@ -486,7 +486,7 @@ class ItemList extends BaseType
// required spell
if ($this->curTpl['requiredspell'])
$x .= '<br />'.Lang::$game['requires'].' <a class="q1" href="?spell='.$this->curTpl['requiredspell'].'">'.Spell::getName($this->curTpl['requiredspell']).'</a>';
$x .= '<br />'.Lang::$game['requires'].' <a class="q1" href="?spell='.$this->curTpl['requiredspell'].'">'.SpellList::getName($this->curTpl['requiredspell']).'</a>';
// required reputation w/ faction
if ($this->curTpl['RequiredReputationFaction'])
@@ -548,7 +548,6 @@ class ItemList extends BaseType
$x .= '<span class="q2">'.$bonus.'</span><br />';
// Item Set
$tmpX = '';
$pieces = [];
$itemset = DB::Aowow()->selectRow('
SELECT
@@ -572,23 +571,22 @@ class ItemList extends BaseType
$equivalents = ItemList::getEquivalentSetPieces($itemset['item'.$i]);
$pieces[] = '<span><!--si'.implode(':', $equivalents).'--><a href="?item='.$itemset['item'.$i].'">'.ItemList::getName($itemset['item'.$i]).'</a></span>';
}
$tmpX .= implode('<br />', $pieces);
$x .= '<br /><span class="q"><a href="?itemset='.$itemset['id'].'" class="q">'.Util::localizedString($itemset, 'name').'</a> (0/'.$num.')</span>';
$xSet = '<br /><span class="q"><a href="?itemset='.$itemset['id'].'" class="q">'.Util::localizedString($itemset, 'name').'</a> (0/'.$num.')</span>';
if ($itemset['skillID']) // bonus requires skill to activate
{
$name = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillID=?d', $itemset['skillID']);
$x .= '<br />'.Lang::$game['requires'].' <a href="?skills='.$itemset['skillID'].'" class="q1">'.Util::localizedString($name, 'name').'</a>';
$xSet .= '<br />'.Lang::$game['requires'].' <a href="?skills='.$itemset['skillID'].'" class="q1">'.Util::localizedString($name, 'name').'</a>';
if ($itemset['skillLevel'])
$x .= ' ('.$itemset['skillLevel'].')';
$xSet .= ' ('.$itemset['skillLevel'].')';
$x .= '<br />';
$xSet .= '<br />';
}
// list pieces
$x .= '<div class="q0 indent">'.$tmpX.'</div><br />';
$xSet .= '<div class="q0 indent">'.implode('<br />', $pieces).'</div><br />';
// get bonuses
$setSpellsAndIdx = [];
@@ -611,7 +609,7 @@ class ItemList extends BaseType
}
// sort and list bonuses
$x .= '<span class="q0">';
$xSet .= '<span class="q0">';
for ($i = 0; $i < count($itemset['spells']); $i++)
{
for ($j = $i; $j < count($itemset['spells']); $j++)
@@ -623,11 +621,11 @@ class ItemList extends BaseType
$itemset['spells'][$i] = $itemset['spells'][$j];
$itemset['spells'][$j] = $tmp;
}
$x .= '<span>('.$itemset['spells'][$i]['bonus'].') '.Lang::$item['set'].': <a href="?spell='.$itemset['spells'][$i]['entry'].'">'.$itemset['spells'][$i]['tooltip'].'</a></span>';
$xSet .= '<span>('.$itemset['spells'][$i]['bonus'].') '.Lang::$item['set'].': <a href="?spell='.$itemset['spells'][$i]['entry'].'">'.$itemset['spells'][$i]['tooltip'].'</a></span>';
if ($i < count($itemset['spells']) - 1)
$x .= '<br />';
$xSet .= '<br />';
}
$x .= '</span>';
$xSet .= '</span>';
}
// recipe handling (some stray Techniques have subclass == 0), place at bottom of tooltipp
@@ -658,6 +656,10 @@ class ItemList extends BaseType
// misc (no idea, how to organize the <br /> better)
$xMisc = [];
// itemset: pieces and boni
if (isset($xSet))
$xMisc[] = $xSet;
// funny, yellow text at the bottom, omit if we have a recipe
if ($this->curTpl['description'] && !isset($xCraft))
$xMisc[] = '<span class="q">"'.Util::localizedString($this->curTpl, 'description').'"</span>';
@@ -900,7 +902,7 @@ class ItemList extends BaseType
// $js .= Util::setRatingLevel($level, $type, $value);
// $js .= '</a>)</small>';
if ($interactive)
$js = '&nbsp;<small>('.printf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)).')</a>)</small>';
$js = '&nbsp;<small>('.sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)).')</a>)</small>';
else
$js = "&nbsp;<small>(".Util::setRatingLevel($level, $type, $value).")</small>";

View File

@@ -475,8 +475,8 @@ class SpellList extends BaseType
$periode = 3000;
$tick = $duration / $periode;
$min = abs($base + 1) * tick;
$max = abs($base + $add) * tick;
$min = abs($base + 1) * $tick;
$max = abs($base + $add) * $tick;
$equal = $min == $max;
if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
@@ -1004,7 +1004,7 @@ class SpellList extends BaseType
$reagents[] = array(
'id' => $this->curTpl['reagent'.$j],
'name' => Util::getItemName($this->curTpl['reagent'.$j]),
'name' => ItemList::getName($this->curTpl['reagent'.$j]),
'count' => $this->curTpl['reagentCount'.$j] // if < 0 : require, but don't use
);
}
@@ -1016,7 +1016,7 @@ class SpellList extends BaseType
{
// Tools
if ($this->curTpl['tool'.$i])
$tools[$i-1] = array('itemId' => $this->curTpl['tool'.$i], 'name' => Util::getItemName($this->curTpl['tool'.$i]));
$tools[$i-1] = array('itemId' => $this->curTpl['tool'.$i], 'name' => ItemList::getName($this->curTpl['tool'.$i]));
// TotemCategory
if ($this->curTpl['toolCategory'.$i])
@@ -1170,6 +1170,16 @@ class SpellList extends BaseType
if ($reqWrapper2)
$x .= "</table>";
// append created items (may need improvement)
for ($i = 1; $i <= 3; $i++)
{
if ($cId = $this->curTpl['effect'.$i.'CreateItemId'])
{
$x .= '<br />'.(new ItemList(array(['i.entry', (int)$cId])))->renderTooltip();
break;
}
}
$this->tooltips[$this->id] = $x;
}

View File

@@ -271,7 +271,7 @@ if (typeof $WowheadPower == "undefined") {
locale = $WH.g_getLocaleFromDomain(domain);
/* edit start */
if (in_array(['fr', 'de', 'es', 'ru', 'en'], domain) == -1) {
if ($WH.in_array(['fr', 'de', 'es', 'ru', 'en'], domain) == -1) {
for (i in document.scripts) {
if (!document.scripts[i].src)
continue;