From a7eabb4b9dbb2f713b41c1c7845c1f3ece423405 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 17 Aug 2015 21:42:14 +0200 Subject: [PATCH] Itemsats * fixed an translation issue on itemMod <=> statId causing wrong search results * fixed an sql-error breaking stat-based searches for items --- includes/types/item.class.php | 2 +- includes/types/spell.class.php | 18 ++++++++++++++---- setup/updates/1439840492_01.sql | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 setup/updates/1439840492_01.sql diff --git a/includes/types/item.class.php b/includes/types/item.class.php index e82409ee..4c267b5e 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -1825,7 +1825,7 @@ class ItemListFilter extends Filter if ($select) { - $this->extraOpts['is']['s'][] = ', IF(is.id IS NULL, 0, ('.implode(' + ', $select).') / '.$wtSum.') AS score'; + $this->extraOpts['is']['s'][] = ', IF(is.typeId IS NULL, 0, ('.implode(' + ', $select).') / '.$wtSum.') AS score'; $this->extraOpts['is']['o'][] = 'score DESC'; $this->extraOpts['i']['o'][] = null; // remove default ordering } diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index 6587ab73..69a27cb5 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -175,11 +175,21 @@ class SpellList extends BaseType case 29: // ModStat MiscVal:type if ($mv < 0) // all stats { - for ($j = 0; $j < 5; $j++) - Util::arraySumByKey($stats, [(ITEM_MOD_AGILITY + $j) => $pts]); + for ($iMod = ITEM_MOD_AGILITY; $iMod <= ITEM_MOD_STAMINA; $iMod++) + Util::arraySumByKey($stats, [iMod => $pts]); } - else // one stat - Util::arraySumByKey($stats, [(ITEM_MOD_AGILITY + $mv) => $pts]); + else if ($mv == STAT_STRENGTH) // one stat + Util::arraySumByKey($stats, [ITEM_MOD_STRENGTH => $pts]); + else if ($mv == STAT_AGILITY) + Util::arraySumByKey($stats, [ITEM_MOD_AGILITY => $pts]); + else if ($mv == STAT_STAMINA) + Util::arraySumByKey($stats, [ITEM_MOD_STAMINA => $pts]); + else if ($mv == STAT_INTELLECT) + Util::arraySumByKey($stats, [ITEM_MOD_INTELLECT => $pts]); + else if ($mv == ITEM_MOD_SPIRIT) + Util::arraySumByKey($stats, [ITEM_MOD_SPIRIT => $pts]); + else // one bullshit + trigger_error('AuraId 29 of spell #'.$this->id.' has wrong statId #'.$mv, E_USER_WARNING); break; case 34: // Increase Health diff --git a/setup/updates/1439840492_01.sql b/setup/updates/1439840492_01.sql new file mode 100644 index 00000000..8d0c8583 --- /dev/null +++ b/setup/updates/1439840492_01.sql @@ -0,0 +1 @@ +UPDATE aowow_dbversion SET `sql` = CONCAT(`sql`, ' item_stats');