Misc/Fixes

* fixed stats when comparing items with scaling random enchantments
 * fixed BOM on compare.php
 * fixed multiple typos and notices
This commit is contained in:
Sarjuuk
2016-01-31 15:36:54 +01:00
parent 2bc85dd109
commit 5abdbe2080
8 changed files with 80 additions and 8 deletions

View File

@@ -123,7 +123,7 @@ class EnchantmentList extends BaseType
return $data; return $data;
} }
public function getStatGain() public function getStatGain($addScalingKeys = false)
{ {
$data = []; $data = [];
@@ -134,6 +134,70 @@ class EnchantmentList extends BaseType
if (isset($this->curTpl['dps'])) if (isset($this->curTpl['dps']))
$data['dps'] = $this->curTpl['dps']; $data['dps'] = $this->curTpl['dps'];
// scaling enchantments are saved as 0 to item_stats, thus return empty
if ($addScalingKeys)
{
$spellStats = [];
if ($this->relSpells)
$spellStats = $this->relSpells->getStatGain();
for ($h = 1; $h <= 3; $h++)
{
$obj = (int)$this->curTpl['object'.$h];
switch ($this->curTpl['type'.$h])
{
case 3: // TYPE_EQUIP_SPELL Spells from ObjectX (use of amountX?)
if (!empty($spellStats[$obj]))
foreach ($spellStats[$obj] as $mod => $_)
if ($str = Util::$itemMods[$mod])
Util::arraySumByKey($data, [$str => 0]);
$obj = null;
break;
case 4: // TYPE_RESISTANCE +AmountX resistance for ObjectX School
switch ($obj)
{
case 0: // Physical
$obj = ITEM_MOD_ARMOR;
break;
case 1: // Holy
$obj = ITEM_MOD_HOLY_RESISTANCE;
break;
case 2: // Fire
$obj = ITEM_MOD_FIRE_RESISTANCE;
break;
case 3: // Nature
$obj = ITEM_MOD_NATURE_RESISTANCE;
break;
case 4: // Frost
$obj = ITEM_MOD_FROST_RESISTANCE;
break;
case 5: // Shadow
$obj = ITEM_MOD_SHADOW_RESISTANCE;
break;
case 6: // Arcane
$obj = ITEM_MOD_ARCANE_RESISTANCE;
break;
default:
$obj = null;
}
break;
case 5: // TYPE_STAT +AmountX for Statistic by type of ObjectX
if ($obj < 2) // [mana, health] are on [0, 1] respectively and are expected on [1, 2] ..
$obj++; // 0 is weaponDmg .. ehh .. i messed up somewhere
break; // stats are directly assigned below
default: // TYPE_NONE dnd stuff; skip assignment below
$obj = null;
}
if ($obj !== null)
if ($str = Util::$itemMods[$obj]) // check if we use these mods
Util::arraySumByKey($data, [$str => 0]);
}
}
return $data; return $data;
} }

View File

@@ -1444,7 +1444,7 @@ class ItemList extends BaseType
{ {
$this->rndEnchIds[$eId] = array( $this->rndEnchIds[$eId] = array(
'text' => $enchants->getField('name', true), 'text' => $enchants->getField('name', true),
'stats' => $enchants->getStatGain() 'stats' => $enchants->getStatGain(true)
); );
} }

View File

@@ -1,4 +1,4 @@
<?php <?php
if (!defined('AOWOW_REVISION')) if (!defined('AOWOW_REVISION'))
die('invalid access'); die('invalid access');

View File

@@ -631,6 +631,11 @@ class SearchPage extends GenericPage
} }
} }
foreach ($items->iterate() as $itemId => $__)
if (!empty($data[$itemId]['subitems']))
foreach ($data[$itemId]['subitems'] as &$si)
$si['enchantment'] = implode(', ', $si['enchantment']);
$result = array( $result = array(
'type' => TYPE_ITEM, 'type' => TYPE_ITEM,
'appendix' => ' (Item)', 'appendix' => ' (Item)',

View File

@@ -29,7 +29,9 @@ class UtilityPage extends GenericPage
$this->page = $pageCall; $this->page = $pageCall;
$this->rss = isset($_GET['rss']); $this->rss = isset($_GET['rss']);
$this->name = Lang::main('utilities', array_search($pageCall, $this->validPages));
if ($this->page != 'random')
$this->name = Lang::main('utilities', array_search($pageCall, $this->validPages));
if ($this->page == 'most-comments') if ($this->page == 'most-comments')
{ {
@@ -316,7 +318,7 @@ class UtilityPage extends GenericPage
array_unshift($this->title, Lang::main('mostComments', 0)); array_unshift($this->title, Lang::main('mostComments', 0));
} }
array_unshift($this->title, Lang::main('utilities', array_search($this->page, $this->validPages))); array_unshift($this->title, $this->name);
} }
protected function generatePath() protected function generatePath()

View File

@@ -1,2 +1,2 @@
UPDATE aowow_dbversion SET `sql`= CONCAT(`sql, ' spawns'); UPDATE aowow_dbversion SET `sql`= CONCAT(`sql`, ' spawns');

View File

@@ -6,7 +6,8 @@
foreach ($list as $idx => $itr): foreach ($list as $idx => $itr):
echo ' <tr><th>'.($idx + 1).'</th><td><div>'; echo ' <tr><th>'.($idx + 1).'</th><td><div>';
$end = array_pop(array_keys($itr)); $_ = array_keys($itr);
$end = array_pop($_);
foreach ($itr as $k => $i): // itemItr foreach ($itr as $k => $i): // itemItr
switch ($i['side']): switch ($i['side']):
case 1: $wrap = '<span class="icon-alliance-padded">%s</span>'; break; case 1: $wrap = '<span class="icon-alliance-padded">%s</span>'; break;

View File

@@ -10,7 +10,7 @@ $f = $this->filter; // shorthand
<?php <?php
$this->brick('announcement'); $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 1]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;">