From 2ec4809c7fe3564e4961f6c2d313b0fa4cb4a3bc Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 5 Jan 2022 23:27:44 +0100 Subject: [PATCH 1/3] Spells/Reagents * try to fix wrong reagent amount in cases where one reagent requires multiples of itself and is triggered by an item --- pages/spell.php | 16 +++++++--------- static/css/global.css | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pages/spell.php b/pages/spell.php index 4e803ff1..34ab28c5 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -1234,12 +1234,7 @@ class SpellPage extends GenericPage return false; $item = DB::Aowow()->selectRow(' - SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, i.id, ic.name AS iconString, quality, - IF ( (spellId1 > 0 AND spellCharges1 < 0) OR - (spellId2 > 0 AND spellCharges2 < 0) OR - (spellId3 > 0 AND spellCharges3 < 0) OR - (spellId4 > 0 AND spellCharges4 < 0) OR - (spellId5 > 0 AND spellCharges5 < 0), 1, 0) AS consumed + SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, i.id, ic.name AS iconString, quality FROM ?_items i LEFT JOIN ?_icons ic ON ic.id = i.iconId WHERE i.id = ?d', @@ -1253,9 +1248,6 @@ class SpellPage extends GenericPage $_level++; - if ($item['consumed']) - $_qty++; - $data = array( 'type' => TYPE_ITEM, 'typeId' => $item['id'], @@ -1286,6 +1278,7 @@ class SpellPage extends GenericPage SELECT reagent1, reagent2, reagent3, reagent4, reagent5, reagent6, reagent7, reagent8, reagentCount1, reagentCount2, reagentCount3, reagentCount4, reagentCount5, reagentCount6, reagentCount7, reagentCount8, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, + iconIdBak, s.id AS ARRAY_KEY, ic.name AS iconString FROM ?_spell s JOIN ?_icons ic ON s.iconId = ic.id @@ -1327,6 +1320,11 @@ class SpellPage extends GenericPage if ($row['reagent'.$i] <= 0 || $row['reagentCount'.$i] <= 0) continue; + // handle edge case elemental crafting material: Mote of X + Crystalized X + // on use items, that has require more reagents of itself + if ($row['reagentCount'.$i] == 9 && ($row['iconIdBak'] == 140 || $row['iconIdBak'] == 1921)) + $row['reagentCount'.$i]++; + if ($this->appendReagentItem($reagentResult, $row['reagent'.$i], $row['reagentCount'.$i], $data['qty'], $data['level'], $data['path'], $_aU)) { $hasUnusedReagents = true; diff --git a/static/css/global.css b/static/css/global.css index 4fce05cc..0c79ae17 100644 --- a/static/css/global.css +++ b/static/css/global.css @@ -477,7 +477,7 @@ } .iconlist td { - padding: 4px 0 6px 0 !important; + padding: 4px 0 6px 0; } .iconlist var { From dcb8995b1acc193fd210a6980e23ff5f65738aff Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 5 Jan 2022 23:29:35 +0100 Subject: [PATCH 2/3] Markup * allow 'auto' as width for tables * db tag 'money' may include currency AND items --- includes/markup.class.php | 3 ++- static/js/Markup.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/markup.class.php b/includes/markup.class.php index 8a4f3fc8..cb69efc5 100644 --- a/includes/markup.class.php +++ b/includes/markup.class.php @@ -31,7 +31,8 @@ class Markup $match[1] = 'achievement'; else if ($match[1] == 'icondb') $match[1] = 'icon'; - else if ($match[1] == 'money') + + if ($match[1] == 'money') { if (stripos($match[0], 'items')) { diff --git a/static/js/Markup.js b/static/js/Markup.js index 72b7cab9..c3c2f052 100644 --- a/static/js/Markup.js +++ b/static/js/Markup.js @@ -2798,7 +2798,7 @@ var Markup = { border: { req: false, valid: /^[0-9]+$/ }, cellspacing: { req: false, valid: /^[0-9]+$/ }, cellpadding: { req: false, valid: /^[0-9]+$/ }, - width: { req: false, valid: /^[0-9]+(px|em|\%)$/ } + width: { req: false, valid: /^([0-9]+(px|em|\%)|auto)$/ } }, toHtml: function(attr) { From 541224f87bca88995b9721ced0b270d91b73015c Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 6 Jan 2022 14:17:27 +0100 Subject: [PATCH 3/3] Markup/Misc * fixed ajax fulltext sanitizer eating \s instead of \n after 57864d25442dc94cee0b98a2a9bc9e88d40569e9 * happy new year --- includes/ajaxHandler.class.php | 2 +- template/pages/home.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/ajaxHandler.class.php b/includes/ajaxHandler.class.php index 9790c37d..a55c6e8a 100644 --- a/includes/ajaxHandler.class.php +++ b/includes/ajaxHandler.class.php @@ -113,7 +113,7 @@ class AjaxHandler protected static function checkFulltext(string $val) : string { // trim non-printable chars - return preg_replace('/[\p{Cf} \p{Co} \p{Cs} \p{Cn}]/ui', '', $val); + return preg_replace('/[\p{Cf}\p{Co}\p{Cs}\p{Cn}]/ui', '', $val); } } ?> diff --git a/template/pages/home.tpl.php b/template/pages/home.tpl.php index 30beec2c..5517798e 100644 --- a/template/pages/home.tpl.php +++ b/template/pages/home.tpl.php @@ -85,7 +85,7 @@ endif; |Github|