diff --git a/includes/types/enchantment.class.php b/includes/types/enchantment.class.php index a23b728f..5219b0b3 100644 --- a/includes/types/enchantment.class.php +++ b/includes/types/enchantment.class.php @@ -123,7 +123,7 @@ class EnchantmentList extends BaseType return $data; } - public function getStatGain() + public function getStatGain($addScalingKeys = false) { $data = []; @@ -134,6 +134,70 @@ class EnchantmentList extends BaseType if (isset($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; } diff --git a/includes/types/item.class.php b/includes/types/item.class.php index f037810b..f95e947e 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -1444,7 +1444,7 @@ class ItemList extends BaseType { $this->rndEnchIds[$eId] = array( 'text' => $enchants->getField('name', true), - 'stats' => $enchants->getStatGain() + 'stats' => $enchants->getStatGain(true) ); } diff --git a/pages/compare.php b/pages/compare.php index 92a2a573..cdd5c6fa 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -1,4 +1,4 @@ -iterate() as $itemId => $__) + if (!empty($data[$itemId]['subitems'])) + foreach ($data[$itemId]['subitems'] as &$si) + $si['enchantment'] = implode(', ', $si['enchantment']); + $result = array( 'type' => TYPE_ITEM, 'appendix' => ' (Item)', diff --git a/pages/utility.php b/pages/utility.php index db09c4ff..8106762c 100644 --- a/pages/utility.php +++ b/pages/utility.php @@ -29,7 +29,9 @@ class UtilityPage extends GenericPage $this->page = $pageCall; $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') { @@ -316,7 +318,7 @@ class UtilityPage extends GenericPage 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() diff --git a/setup/updates/1439924313_01.sql b/setup/updates/1439924313_01.sql index 1450aa97..87ac9aa3 100644 --- a/setup/updates/1439924313_01.sql +++ b/setup/updates/1439924313_01.sql @@ -1,2 +1,2 @@ -UPDATE aowow_dbversion SET `sql`= CONCAT(`sql, ' spawns'); +UPDATE aowow_dbversion SET `sql`= CONCAT(`sql`, ' spawns'); diff --git a/template/bricks/series.tpl.php b/template/bricks/series.tpl.php index 2f04a9b3..fc626bfa 100644 --- a/template/bricks/series.tpl.php +++ b/template/bricks/series.tpl.php @@ -6,7 +6,8 @@ foreach ($list as $idx => $itr): echo ' '.($idx + 1).'
'; - $end = array_pop(array_keys($itr)); + $_ = array_keys($itr); + $end = array_pop($_); foreach ($itr as $k => $i): // itemItr switch ($i['side']): case 1: $wrap = '%s'; break; diff --git a/template/pages/enchantments.tpl.php b/template/pages/enchantments.tpl.php index 4b016e80..66dc55ed 100644 --- a/template/pages/enchantments.tpl.php +++ b/template/pages/enchantments.tpl.php @@ -10,7 +10,7 @@ $f = $this->filter; // shorthand 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]]); ?>