advanced-poe-filter-parser 0.9.1 → 0.9.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "advanced-poe-filter-parser",
3
- "version": "0.9.1",
3
+ "version": "0.9.9",
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": "pegjs -o lib/parser.cjs src/advanced-poe-filter.pegjs --format=commonjs",
28
- "build:m": "pegjs -o lib/parser.mjs src/advanced-poe-filter.pegjs --format=es",
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": "5.3.1",
36
- "eslint": "8.48.0",
37
- "eslint-config-prettier": "9.0.0",
34
+ "ava": "6.0.1",
35
+ "eslint": "8.56.0",
36
+ "eslint-config-prettier": "9.1.0",
38
37
  "outdent": "0.8.0",
39
- "pegjs": "0.11.0-master.b7b87ea",
40
- "prettier": "3.0.3",
41
- "sinon": "15.2.0"
38
+ "peggy": "3.0.2",
39
+ "prettier": "3.1.1",
40
+ "sinon": "17.0.1"
42
41
  }
43
42
  }
@@ -87,7 +87,7 @@ condition =
87
87
  / conditionItemLevel
88
88
  / conditionAreaLevel
89
89
  / conditionGemLevel
90
- / conditionGemQualityType
90
+ / conditionTransfiguredGem
91
91
  / conditionStackSize
92
92
  / conditionMapTier
93
93
  / conditionQuality
@@ -122,7 +122,6 @@ condition =
122
122
  / conditionHasEnchantment
123
123
  / conditionHasInfluence
124
124
  / conditionEnchantmentPassiveNode
125
- / conditionAlternateQuality
126
125
  / conditionReplica
127
126
  / conditionArchnemesisMod
128
127
  / conditionHasCruciblePassiveTree
@@ -134,13 +133,13 @@ conditionDropLevel = attr:'DropLevel' __ val:condition
134
133
  conditionItemLevel = attr:'ItemLevel' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
135
134
  conditionAreaLevel = attr:'AreaLevel' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
136
135
  conditionGemLevel = attr:'GemLevel' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
137
- conditionGemQualityType = attr:'GemQualityType' __ val:conditionValueArray { return { lineType: 'condition', attr, val} }
136
+ conditionTransfiguredGem = attr:'TransfiguredGem' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
138
137
  conditionStackSize = attr:'StackSize' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
139
138
  conditionMapTier = attr:'MapTier' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
140
139
  conditionQuality = attr:'Quality' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
141
140
  conditionLinkedSockets = attr:'LinkedSockets' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
142
- conditionSockets = attr:'Sockets' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
143
- conditionSocketGroup = attr:'SocketGroup' __ val:conditionValueSocketRGBW { return { lineType: 'condition', attr, val} }
141
+ conditionSockets = attr:'Sockets' __ val:conditionValueSocketType { return { lineType: 'condition', attr, val} }
142
+ conditionSocketGroup = attr:'SocketGroup' __ val:conditionValueSocketType { return { lineType: 'condition', attr, val} }
144
143
  conditionRarity = attr:'Rarity' __ val:conditionValueRarity { return { lineType: 'condition', attr, val} }
145
144
  conditionBaseDefencePercentile = attr:'BaseDefencePercentile' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
146
145
  conditionBaseArmour = attr:'BaseArmour' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
@@ -163,13 +162,12 @@ conditionCorruptedMods = attr:'CorruptedMods' __ val:condition
163
162
  conditionEnchantmentPassiveNum = attr:'EnchantmentPassiveNum' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
164
163
  conditionHasExplicitMod = attr:'HasExplicitMod' __ val:conditionValueNumericAndArray { return { lineType: 'condition', attr, val} }
165
164
  conditionHasImplicitMod = attr:'HasImplicitMod' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
166
- conditionHasEaterOfWorldsImplicit = attr:'HasEaterOfWorldsImplicit' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
167
- conditionHasSearingExarchImplicit = attr:'HasSearingExarchImplicit' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
165
+ conditionHasEaterOfWorldsImplicit = attr:'HasEaterOfWorldsImplicit' __ val:conditionValueImplicitModTier { return { lineType: 'condition', attr, val} }
166
+ conditionHasSearingExarchImplicit = attr:'HasSearingExarchImplicit' __ val:conditionValueImplicitModTier { return { lineType: 'condition', attr, val} }
168
167
  conditionAnyEnchantment = attr:'AnyEnchantment' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
169
168
  conditionHasEnchantment = attr:'HasEnchantment' __ val:conditionValueNumericAndArray { return { lineType: 'condition', attr, val} }
170
169
  conditionHasInfluence = attr:'HasInfluence' __ val:conditionValueArrayOrNone { return { lineType: 'condition', attr, val} }
171
170
  conditionEnchantmentPassiveNode = attr:'EnchantmentPassiveNode' __ val:conditionValueArray { return { lineType: 'condition', attr, val} }
172
- conditionAlternateQuality = attr:'AlternateQuality' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
173
171
  conditionReplica = attr:'Replica' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
174
172
  conditionArchnemesisMod = attr:'ArchnemesisMod' __ val:conditionValueArray { return { lineType: 'condition', attr, val} }
175
173
  conditionHasCruciblePassiveTree = attr:'HasCruciblePassiveTree' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
@@ -178,11 +176,22 @@ conditionHasCruciblePassiveTree = attr:'HasCruciblePassiveTree' __ val:condition
178
176
  // Condition Values
179
177
  conditionValueArray = operator:(matchOperator __)? names:names { return operator ? { ope: operator[0], vals: names } : { ope: '=', vals: names } }
180
178
  conditionValueArrayOrNone = conditionValueArray / val:'None' { return val ? { ope: undefined, val: 'None' } : { ope, vals } }
181
- conditionValueNumericAndArray = pre:((numOperator __ num __) / (matchOperator __))? names:names { return pre ? (pre.length === 4 ? { numeric: { ope: pre[0], val: pre[2] }, vals: names } : { ope: pre[0], vals: names } ) : { ope: '=', vals: names } }
182
- conditionValueNumber = operator:numOperator __ num:num { return `${operator} ${num}` }
183
- conditionValueSocketRGBW = socketRGBW
184
- conditionValueRarity = operator:(numOperator __)? rarity:rarity { return operator ? `${operator[0]} ${rarity}` : rarity }
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 } }
185
193
  conditionValueBoolean = boolean
194
+ conditionValueImplicitModTier = operator:numOperator __ modTier:implicitModTier { return { ope: operator, val: modTier } }
186
195
 
187
196
  //
188
197
  // Action
@@ -194,24 +203,30 @@ action =
194
203
  / actionSetFontSize
195
204
  / actionPlayAlertSound
196
205
  / actionPlayAlertSoundPositional
206
+ / actionCustomAlertSound
207
+ / actionCustomAlertSoundOptional
208
+ / actionDisableDropSoundIfAlertSound
209
+ / actionEnableDropSoundIfAlertSound
197
210
  / actionDisableDropSound
198
211
  / actionEnableDropSound
199
- / actionCustomAlertSound
200
212
  / actionMinimapIcon
201
213
  / actionPlayEffect
202
214
 
203
215
  // Action Attributes
204
- actionSetBorderColor = attr:'SetBorderColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
205
- actionSetTextColor = attr:'SetTextColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
206
- actionSetBackgroundColor = attr:'SetBackgroundColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
207
- actionSetFontSize = attr:'SetFontSize' __ val:actionValueFontSize { return { lineType: 'action', attr, val } }
208
- actionPlayAlertSound = attr:'PlayAlertSound' __ val:actionValueSound { return { lineType: 'action', attr, val } }
209
- actionPlayAlertSoundPositional = attr:'PlayAlertSoundPositional' __ val:actionValueSound { return { lineType: 'action', attr, val } }
210
- actionDisableDropSound = attr:'DisableDropSound' { return { lineType: 'action', attr, val: true } }
211
- actionEnableDropSound = attr:'EnableDropSound' { return { lineType: 'action', attr, val: true } }
212
- actionCustomAlertSound = attr:'CustomAlertSound' __ val:actionValueCustomSound { return { lineType: 'action', attr, val } }
213
- actionMinimapIcon = attr:'MinimapIcon' __ val:actionValueMinimapIcon { return { lineType: 'action', attr, val } }
214
- actionPlayEffect = attr:'PlayEffect' __ val:actionValuePlayEffect { return { lineType: 'action', attr, val } }
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 } }
215
230
 
216
231
  // Action Functions
217
232
  actionFunctionColor =
@@ -249,8 +264,8 @@ actionFunctionMinus = name:'Minus' '(' num:num ')' &{ return 0 <= num && num <=
249
264
  // Action Values
250
265
  actionValueColor = color / actionFunctionColor
251
266
  actionValueFontSize = fontSize / actionFunctionFontSize
252
- actionValueSound = id:soundId volume:(__ soundVolume)? { return { id, volume: volume ? parseInt(volume[1], 10) : undefined } }
253
- actionValueCustomSound = filePath:string volume:(__ soundVolume)? { return { filePath, volume: volume ? parseInt(volume[1], 10) : undefined } }
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 } }
254
269
  actionValueBoolean = boolean
255
270
  actionValueMinimapIcon = size:minimapIconSize __ color:minimapIconColor __ shape:minimapIconShape { return { size, color, shape } }
256
271
  actionValuePlayEffect = color:playEffectColor temp:(__ 'Temp')? { return temp ? { color, temp: true } : { color, temp: false } }
@@ -263,21 +278,44 @@ color = r:rgbaNum __ g:rgbaNum __ b:rgbaNum alpha:(__ rgbaNum)? { return { rgb:
263
278
  numOperator = '<=' / '>=' / '<' / '>' / '='
264
279
  matchOperator = '==' / '='
265
280
  rarity = 'Normal' / 'Magic' / 'Rare' / 'Unique'
266
- socketRGBW = $('R'* 'G'* 'B'* 'W'*)
281
+ socketType = 'R' / 'G' / 'B' / 'W' / 'A' / 'D'
282
+ socketTypes = vals:socketType|1..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
+
267
287
  rgbaNum = num:num &{ return 0 <= num && num <= 255 } { return num }
268
- fontSize = num:num &{ return 18 <= num && num <= 45 } { return num }
269
- minimapIconSize = val:('0' / '1' / '2' / 'Largest' / 'Medium' / 'Small') {
288
+ implicitModTier = val:('1' / '2' / '3' / '4' / '5' / '6' / 'Lesser' / 'Greater' / 'Grand' / 'Exceptional' / 'Exquisite' / 'Perfect') {
270
289
  switch (val) {
271
- case '0':
272
- return 'Largest'
273
- case '1':
274
- return 'Medium'
275
- case '2':
276
- return 'Small'
277
- default:
278
- return val
279
- }
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
280
317
  }
318
+ }
281
319
  minimapIconColor = 'Red' / 'Green' / 'Blue' / 'Brown' / 'White' / 'Yellow' / 'Cyan' / 'Grey' / 'Orange' / 'Pink' / 'Purple'
282
320
  minimapIconShape = 'Circle' / 'Diamond' / 'Hexagon' / 'Square' / 'Star' / 'Triangle' / 'Cross' / 'Moon' / 'Raindrop' / 'Kite' / 'Pentagon' / 'UpsideDownHouse'
283
321
  playEffectColor = 'Red' / 'Green' / 'Blue' / 'Brown' / 'White' / 'Yellow' / 'Cyan' / 'Grey' / 'Orange' / 'Pink' / 'Purple'