From 1c7660316d1e56412be9bdf87cfc5001484e699c Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Fri, 14 Feb 2020 15:37:14 +0100 Subject: [PATCH] Items/Gems * fixed indexing error when calculating item enchantments introduced in c7fe84b7e0fd56337e01cc967a0e82c71e1d7cf5 --- includes/types/item.class.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/includes/types/item.class.php b/includes/types/item.class.php index 9fea7665..b37f62c1 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -1240,15 +1240,8 @@ class ItemList extends BaseType $this->itemMods[$this->id] = []; foreach (Game::$itemMods as $mod) - { - if (isset($this->curTpl[$mod]) && ($_ = floatVal($this->curTpl[$mod]))) - { - if (!isset($this->itemMods[$this->id][$mod])) - $this->itemMods[$this->id][$mod] = 0; - - $this->itemMods[$this->id][$mod] += $_; - } - } + if ($_ = floatVal($this->curTpl[$mod])) + Util::arraySumByKey($this->itemMods[$this->id], [$mod => $_]); // fetch and add socketbonusstats if (!empty($this->json[$this->id]['socketbonus'])) @@ -1275,7 +1268,7 @@ class ItemList extends BaseType if ($item > 0) // apply socketBonus $this->json[$item]['socketbonusstat'] = array_filter($eStats[$eId]); else /* if ($item < 0) */ // apply gemEnchantment - Util::arraySumByKey($this->json[-$item][$mod], array_filter($eStats[$eId])); + Util::arraySumByKey($this->json[-$item], array_filter($eStats[$eId])); } } }