advanced-poe-filter-parser 0.9.2 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/lib/parser.cjs +1345 -1485
- package/lib/parser.d.ts +42 -32
- package/lib/parser.mjs +1346 -1490
- package/package.json +9 -10
- package/src/advanced-poe-filter.pegjs +72 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "advanced-poe-filter-parser",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"path-of-exile",
|
|
6
6
|
"filter-of-kalandra",
|
|
@@ -24,20 +24,19 @@
|
|
|
24
24
|
"lint:fix": "eslint --fix test/**/*.js",
|
|
25
25
|
"prettier": "prettier --write --log-level=warn '**/*.js'",
|
|
26
26
|
"test": "ava --verbose",
|
|
27
|
-
"build:c": "
|
|
28
|
-
"build:m": "
|
|
27
|
+
"build:c": "peggy -o lib/parser.cjs src/advanced-poe-filter.pegjs --format=commonjs",
|
|
28
|
+
"build:m": "peggy -o lib/parser.mjs src/advanced-poe-filter.pegjs --format=es",
|
|
29
29
|
"build": "npm run --silent build:c; npm rum --silent build:m",
|
|
30
30
|
"predeploy": "npm run build",
|
|
31
31
|
"deploy": "npm publish"
|
|
32
32
|
},
|
|
33
|
-
"dependencies": {},
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"ava": "
|
|
36
|
-
"eslint": "8.
|
|
37
|
-
"eslint-config-prettier": "9.
|
|
34
|
+
"ava": "6.0.1",
|
|
35
|
+
"eslint": "8.56.0",
|
|
36
|
+
"eslint-config-prettier": "9.1.0",
|
|
38
37
|
"outdent": "0.8.0",
|
|
39
|
-
"
|
|
40
|
-
"prettier": "3.
|
|
41
|
-
"sinon": "
|
|
38
|
+
"peggy": "3.0.2",
|
|
39
|
+
"prettier": "3.1.1",
|
|
40
|
+
"sinon": "17.0.1"
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -162,8 +162,8 @@ conditionCorruptedMods = attr:'CorruptedMods' __ val:condition
|
|
|
162
162
|
conditionEnchantmentPassiveNum = attr:'EnchantmentPassiveNum' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
|
|
163
163
|
conditionHasExplicitMod = attr:'HasExplicitMod' __ val:conditionValueNumericAndArray { return { lineType: 'condition', attr, val} }
|
|
164
164
|
conditionHasImplicitMod = attr:'HasImplicitMod' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
165
|
-
conditionHasEaterOfWorldsImplicit = attr:'HasEaterOfWorldsImplicit' __ val:
|
|
166
|
-
conditionHasSearingExarchImplicit = attr:'HasSearingExarchImplicit' __ val:
|
|
165
|
+
conditionHasEaterOfWorldsImplicit = attr:'HasEaterOfWorldsImplicit' __ val:conditionValueImplicitModTier { return { lineType: 'condition', attr, val} }
|
|
166
|
+
conditionHasSearingExarchImplicit = attr:'HasSearingExarchImplicit' __ val:conditionValueImplicitModTier { return { lineType: 'condition', attr, val} }
|
|
167
167
|
conditionAnyEnchantment = attr:'AnyEnchantment' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
168
168
|
conditionHasEnchantment = attr:'HasEnchantment' __ val:conditionValueNumericAndArray { return { lineType: 'condition', attr, val} }
|
|
169
169
|
conditionHasInfluence = attr:'HasInfluence' __ val:conditionValueArrayOrNone { return { lineType: 'condition', attr, val} }
|
|
@@ -176,11 +176,22 @@ conditionHasCruciblePassiveTree = attr:'HasCruciblePassiveTree' __ val:condition
|
|
|
176
176
|
// Condition Values
|
|
177
177
|
conditionValueArray = operator:(matchOperator __)? names:names { return operator ? { ope: operator[0], vals: names } : { ope: '=', vals: names } }
|
|
178
178
|
conditionValueArrayOrNone = conditionValueArray / val:'None' { return val ? { ope: undefined, val: 'None' } : { ope, vals } }
|
|
179
|
-
conditionValueNumericAndArray = pre:((numOperator __ num __) / (matchOperator __))? names:names {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
conditionValueNumericAndArray = pre:((numOperator __ num __) / (matchOperator __))? names:names {
|
|
180
|
+
if (pre) {
|
|
181
|
+
if (pre.length === 4) {
|
|
182
|
+
return { numeric: { ope: pre[0], val: pre[2] }, vals: names }
|
|
183
|
+
} else {
|
|
184
|
+
return { ope: pre[0], vals: names }
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
return { ope: '=', vals: names }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
conditionValueNumber = operator:numOperator __ num:num { return { ope: operator, val: num } }
|
|
191
|
+
conditionValueSocketType = operator:(numOperator __)? num:(num)? socketTypes:socketTypes { return operator ? { ope: operator[0], val: `${num ? num : ''}${socketTypes}` } : { ope: '=', val: `${num ? num : ''}${socketTypes}` } }
|
|
192
|
+
conditionValueRarity = operator:(numOperator __)? rarity:rarity { return operator ? { ope: operator[0], val: rarity } : { ope: '=', val: rarity } }
|
|
183
193
|
conditionValueBoolean = boolean
|
|
194
|
+
conditionValueImplicitModTier = operator:numOperator __ modTier:implicitModTier { return { ope: operator, val: modTier } }
|
|
184
195
|
|
|
185
196
|
//
|
|
186
197
|
// Action
|
|
@@ -192,24 +203,30 @@ action =
|
|
|
192
203
|
/ actionSetFontSize
|
|
193
204
|
/ actionPlayAlertSound
|
|
194
205
|
/ actionPlayAlertSoundPositional
|
|
206
|
+
/ actionCustomAlertSound
|
|
207
|
+
/ actionCustomAlertSoundOptional
|
|
208
|
+
/ actionDisableDropSoundIfAlertSound
|
|
209
|
+
/ actionEnableDropSoundIfAlertSound
|
|
195
210
|
/ actionDisableDropSound
|
|
196
211
|
/ actionEnableDropSound
|
|
197
|
-
/ actionCustomAlertSound
|
|
198
212
|
/ actionMinimapIcon
|
|
199
213
|
/ actionPlayEffect
|
|
200
214
|
|
|
201
215
|
// Action Attributes
|
|
202
|
-
actionSetBorderColor
|
|
203
|
-
actionSetTextColor
|
|
204
|
-
actionSetBackgroundColor
|
|
205
|
-
actionSetFontSize
|
|
206
|
-
actionPlayAlertSound
|
|
207
|
-
actionPlayAlertSoundPositional
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
216
|
+
actionSetBorderColor = attr:'SetBorderColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
|
|
217
|
+
actionSetTextColor = attr:'SetTextColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
|
|
218
|
+
actionSetBackgroundColor = attr:'SetBackgroundColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
|
|
219
|
+
actionSetFontSize = attr:'SetFontSize' __ val:actionValueFontSize { return { lineType: 'action', attr, val } }
|
|
220
|
+
actionPlayAlertSound = attr:'PlayAlertSound' __ val:actionValueSound { return { lineType: 'action', attr, val } }
|
|
221
|
+
actionPlayAlertSoundPositional = attr:'PlayAlertSoundPositional' __ val:actionValueSound { return { lineType: 'action', attr, val } }
|
|
222
|
+
actionCustomAlertSound = attr:'CustomAlertSound' __ val:actionValueCustomSound { return { lineType: 'action', attr, val } }
|
|
223
|
+
actionCustomAlertSoundOptional = attr:'CustomAlertSoundOptional' __ val:actionValueCustomSound { return { lineType: 'action', attr, val } }
|
|
224
|
+
actionDisableDropSoundIfAlertSound = attr:'DisableDropSoundIfAlertSound' { return { lineType: 'action', attr, val: true } }
|
|
225
|
+
actionEnableDropSoundIfAlertSound = attr:'EnableDropSoundIfAlertSound' { return { lineType: 'action', attr, val: true } }
|
|
226
|
+
actionDisableDropSound = attr:'DisableDropSound' { return { lineType: 'action', attr, val: true } }
|
|
227
|
+
actionEnableDropSound = attr:'EnableDropSound' { return { lineType: 'action', attr, val: true } }
|
|
228
|
+
actionMinimapIcon = attr:'MinimapIcon' __ val:actionValueMinimapIcon { return { lineType: 'action', attr, val } }
|
|
229
|
+
actionPlayEffect = attr:'PlayEffect' __ val:actionValuePlayEffect { return { lineType: 'action', attr, val } }
|
|
213
230
|
|
|
214
231
|
// Action Functions
|
|
215
232
|
actionFunctionColor =
|
|
@@ -247,8 +264,8 @@ actionFunctionMinus = name:'Minus' '(' num:num ')' &{ return 0 <= num && num <=
|
|
|
247
264
|
// Action Values
|
|
248
265
|
actionValueColor = color / actionFunctionColor
|
|
249
266
|
actionValueFontSize = fontSize / actionFunctionFontSize
|
|
250
|
-
actionValueSound = id:soundId volume:(__ soundVolume)? { return { id, volume: volume ? parseInt(volume[1], 10) :
|
|
251
|
-
actionValueCustomSound = filePath:string volume:(__ soundVolume)? { return { filePath, volume: volume ? parseInt(volume[1], 10) :
|
|
267
|
+
actionValueSound = id:soundId volume:(__ soundVolume)? { return { id, volume: volume ? parseInt(volume[1], 10) : 50 } }
|
|
268
|
+
actionValueCustomSound = filePath:string volume:(__ soundVolume)? { return { filePath, volume: volume ? parseInt(volume[1], 10) : 100 } }
|
|
252
269
|
actionValueBoolean = boolean
|
|
253
270
|
actionValueMinimapIcon = size:minimapIconSize __ color:minimapIconColor __ shape:minimapIconShape { return { size, color, shape } }
|
|
254
271
|
actionValuePlayEffect = color:playEffectColor temp:(__ 'Temp')? { return temp ? { color, temp: true } : { color, temp: false } }
|
|
@@ -261,21 +278,44 @@ color = r:rgbaNum __ g:rgbaNum __ b:rgbaNum alpha:(__ rgbaNum)? { return { rgb:
|
|
|
261
278
|
numOperator = '<=' / '>=' / '<' / '>' / '='
|
|
262
279
|
matchOperator = '==' / '='
|
|
263
280
|
rarity = 'Normal' / 'Magic' / 'Rare' / 'Unique'
|
|
264
|
-
socketType =
|
|
281
|
+
socketType = 'R' / 'G' / 'B' / 'W' / 'A' / 'D'
|
|
282
|
+
socketTypes = vals:socketType|0..6| {
|
|
283
|
+
const order = ['R', 'G', 'B', 'W', 'A', 'D']
|
|
284
|
+
return vals.sort((left, right) => order.indexOf(left) - order.indexOf(right)).join('')
|
|
285
|
+
}
|
|
286
|
+
|
|
265
287
|
rgbaNum = num:num &{ return 0 <= num && num <= 255 } { return num }
|
|
266
|
-
|
|
267
|
-
minimapIconSize = val:('0' / '1' / '2' / 'Largest' / 'Medium' / 'Small') {
|
|
288
|
+
implicitModTier = val:('1' / '2' / '3' / '4' / '5' / '6' / 'Lesser' / 'Greater' / 'Grand' / 'Exceptional' / 'Exquisite' / 'Perfect') {
|
|
268
289
|
switch (val) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
290
|
+
case '1':
|
|
291
|
+
return 'Lesser'
|
|
292
|
+
case '2':
|
|
293
|
+
return 'Greater'
|
|
294
|
+
case '3':
|
|
295
|
+
return 'Grand'
|
|
296
|
+
case '4':
|
|
297
|
+
return 'Exceptional'
|
|
298
|
+
case '5':
|
|
299
|
+
return 'Exquisite'
|
|
300
|
+
case '6':
|
|
301
|
+
return 'Perfect'
|
|
302
|
+
default:
|
|
303
|
+
return val
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
fontSize = num:num &{ return 1 <= num && num <= 45 } { return num }
|
|
307
|
+
minimapIconSize = val:('0' / '1' / '2' / 'Large' / 'Medium' / 'Small') {
|
|
308
|
+
switch (val) {
|
|
309
|
+
case '0':
|
|
310
|
+
return 'Large'
|
|
311
|
+
case '1':
|
|
312
|
+
return 'Medium'
|
|
313
|
+
case '2':
|
|
314
|
+
return 'Small'
|
|
315
|
+
default:
|
|
316
|
+
return val
|
|
278
317
|
}
|
|
318
|
+
}
|
|
279
319
|
minimapIconColor = 'Red' / 'Green' / 'Blue' / 'Brown' / 'White' / 'Yellow' / 'Cyan' / 'Grey' / 'Orange' / 'Pink' / 'Purple'
|
|
280
320
|
minimapIconShape = 'Circle' / 'Diamond' / 'Hexagon' / 'Square' / 'Star' / 'Triangle' / 'Cross' / 'Moon' / 'Raindrop' / 'Kite' / 'Pentagon' / 'UpsideDownHouse'
|
|
281
321
|
playEffectColor = 'Red' / 'Green' / 'Blue' / 'Brown' / 'White' / 'Yellow' / 'Cyan' / 'Grey' / 'Orange' / 'Pink' / 'Purple'
|