From 19534cdea070df0d9ee152bec217545e08fd3464 Mon Sep 17 00:00:00 2001 From: phantamanta44 Date: Sat, 30 Jan 2021 17:59:53 -0600 Subject: [PATCH] Adv item search: don't use identifiers with '+' so tokenization of addition operator works properly --- options.txt | 4 ++-- query_2.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/options.txt b/options.txt index ec2836e..01be068 100644 --- a/options.txt +++ b/options.txt @@ -98,7 +98,7 @@ Left of colon is what you type into the search bar (sometimes multiple things ca ['spelldmg', 'spelldam', 'spelldmg%', 'spelldam%', 'sdpct']: Spell Damage (%) ['spellrawdmg', 'spellrawdam', 'spellneutraldmg', 'spellneutraldam', 'sdraw']: Spell Damage (Raw) ['attackspeed', 'atkspd']: Item Attack Speed -['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'attackspeed+', 'atkspd+', 'atktier']: Attack Speed Bonus +['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'atktier']: Attack Speed Bonus ['sumattackspeed', 'totalattackspeed', 'sumatkspd', 'totalatkspd', 'sumatktier', 'totalatktier']: Total Attack Speed (Base speed + bonus) ['earthdef', 'edef']: Earth Defense Raw @@ -116,7 +116,7 @@ Left of colon is what you type into the search bar (sometimes multiple things ca ['sumdef%', 'totaldef%', 'sumdefpct', 'totaldefpct']: Total Defense % ['health', 'hp']: Health -['bonushealth', 'healthid', 'bonushp', 'hpid', 'health+', 'hp+', 'hpbonus']: Health bonus +['bonushealth', 'healthid', 'bonushp', 'hpid', 'hpbonus']: Health bonus ['sumhealth', 'sumhp', 'totalhealth', 'totalhp']: Total Health (health + health bonus) ['hpregen', 'hpr', 'hr', 'hprraw']: Raw Health Regen diff --git a/query_2.js b/query_2.js index b5d5bf9..f05fdfd 100644 --- a/query_2.js +++ b/query_2.js @@ -156,7 +156,7 @@ const itemQueryProps = (function() { const atkSpdIndices = { SUPER_SLOW: -3, VERY_SLOW: -2, SLOW: -1, NORMAL: 0, FAST: 1, VERY_FAST: 2, SUPER_FAST: 3 }; prop(['attackspeed', 'atkspd'], (i, ie) => i.atkSpd ? atkSpdIndices[i.atkSpd] : 0); - maxId(['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'attackspeed+', 'atkspd+', 'atktier'], 'atkTier'); + maxId(['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'atktier'], 'atkTier'); sum(['sumattackspeed', 'totalattackspeed', 'sumatkspd', 'totalatkspd', 'sumatktier', 'totalatktier'], props.atkspd, props.atktier); prop(['earthdef', 'edef'], (i, ie) => i.eDef || 0); @@ -174,7 +174,7 @@ const itemQueryProps = (function() { sum(['sumdef%', 'totaldef%', 'sumdefpct', 'totaldefpct'], props.edefpct, props.tdefpct, props.wdefpct, props.fdefpct, props.adefpct); prop(['health', 'hp'], (i, ie) => i.hp || 0); - maxId(['bonushealth', 'healthid', 'bonushp', 'hpid', 'health+', 'hp+', 'hpbonus'], 'hpBonus'); + maxId(['bonushealth', 'healthid', 'bonushp', 'hpid', 'hpbonus'], 'hpBonus'); sum(['sumhealth', 'sumhp', 'totalhealth', 'totalhp'], props.hp, props.hpid); maxId(['hpregen', 'hpr', 'hr', 'hprraw'], 'hprRaw'); @@ -332,7 +332,7 @@ const compileQueryExpr = (function() { continue; } // parse an identifier or boolean literal - if ((m = /^\w[\w\d+%]*/.exec(exprStr.substring(col))) !== null) { + if ((m = /^\w[\w\d%]*/.exec(exprStr.substring(col))) !== null) { switch (m[0]) { case 'true': tokens.push({ type: 'bool', value: true });