advanced-poe-filter-parser 0.9.0 → 0.9.2

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/lib/parser.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ type Activity = "Show" | "Hide" | "Unset" | "Ignore"
2
+
3
+ type BranchType = "Fork" | "Mixin"
4
+
1
5
  type MatchOperator = "==" | "="
2
6
  type NumOperator = "<=" | ">=" | "<" | ">" | "="
3
7
 
@@ -6,8 +10,10 @@ type Influence = "Shaper" | "Elder" | "Crusader" | "Hunter" | "Redeemer" | "Warl
6
10
  type GemQualityType = "Superior" | "Divergent" | "Anomalous" | "Phantasmal"
7
11
  type SocketType = "R" | "G" | "B" | "W" | "A" | "D"
8
12
 
13
+ type ColorName = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
14
+
9
15
  type MinimapIconSize = 0 | 1 | 2 | "0" | "1" | "2" | "Largest" | "Medium" | "Small"
10
- type MinimapIconColor = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
16
+ type MinimapIconColor = ColorName
11
17
  type MinimapIconShape =
12
18
  | "Circle"
13
19
  | "Diamond"
@@ -21,24 +27,8 @@ type MinimapIconShape =
21
27
  | "Kite"
22
28
  | "Pentagon"
23
29
  | "UpsideDownHouse"
24
- type PlayEffectColor = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
30
+ type PlayEffectColor = ColorName
25
31
  type SoundId =
26
- | 1
27
- | 2
28
- | 3
29
- | 4
30
- | 5
31
- | 6
32
- | 7
33
- | 8
34
- | 9
35
- | 10
36
- | 11
37
- | 12
38
- | 13
39
- | 14
40
- | 15
41
- | 16
42
32
  | "1"
43
33
  | "2"
44
34
  | "3"
@@ -55,6 +45,22 @@ type SoundId =
55
45
  | "14"
56
46
  | "15"
57
47
  | "16"
48
+ | "Sh01"
49
+ | "Sh02"
50
+ | "Sh03"
51
+ | "Sh04"
52
+ | "Sh05"
53
+ | "Sh06"
54
+ | "Sh07"
55
+ | "Sh08"
56
+ | "Sh09"
57
+ | "Sh10"
58
+ | "Sh11"
59
+ | "Sh12"
60
+ | "Sh13"
61
+ | "Sh14"
62
+ | "Sh15"
63
+ | "Sh16"
58
64
  | "ShAlchemy"
59
65
  | "ShBlessed"
60
66
  | "ShChaos"
@@ -66,14 +72,17 @@ type SoundId =
66
72
  | "ShRegal"
67
73
  | "ShVaal"
68
74
 
75
+ type RGBA = { rgb: { r: number; g: number; b: number }; alpha: number }
76
+ type Sound = { id: SoundId; volume: number | undefined }
77
+
69
78
  type AdvancedBlock = {
70
79
  id: string
71
80
  name: string
72
- activity: string
81
+ activity: Activity
73
82
  conditions: {
74
83
  Class?: { ope: MatchOperator; vals: string[] }
75
84
  BaseType?: { ope: MatchOperator; vals: string[] }
76
- Rarity?: `${MatchOperator} ${Rarity}`
85
+ Rarity?: `${MatchOperator} ${Rarity}` | Rarity
77
86
  BaseDefencePercentile?: `${NumOperator} ${number}`
78
87
  BaseArmour?: `${NumOperator} ${number}`
79
88
  BaseEnergyShield?: `${NumOperator} ${number}`
@@ -83,13 +92,13 @@ type AdvancedBlock = {
83
92
  ItemLevel?: `${NumOperator} ${number}`
84
93
  AreaLevel?: `${NumOperator} ${number}`
85
94
  GemLevel?: `${NumOperator} ${number}`
86
- GemQualityType?: { ope: MatchOperator; vals: GemQualityType[] }
95
+ TransfiguredGem?: boolean
87
96
  StackSize?: `${NumOperator} ${number}`
88
97
  MapTier?: `${NumOperator} ${number}`
89
98
  Quality?: `${NumOperator} ${number}`
90
99
  LinkedSockets?: `${NumOperator} ${number}`
91
- Sockets?: `${NumOperator} ${number}`
92
- SocketGroup?: `${NumOperator} ${string}` | string
100
+ Sockets?: `${NumOperator} ${number}${string}`
101
+ SocketGroup?: `${NumOperator} ${number}${string}`
93
102
  FracturedItem?: boolean
94
103
  SynthesisedItem?: boolean
95
104
  Corrupted?: boolean
@@ -112,20 +121,19 @@ type AdvancedBlock = {
112
121
  HasEnchantment?: { ope: MatchOperator; vals: string[] }
113
122
  HasInfluence?: { ope: MatchOperator; vals: Influence[] }
114
123
  EnchantmentPassiveNode?: { ope: MatchOperator; vals: string[] }
115
- AlternateQuality?: boolean
116
124
  Replica?: boolean
117
125
  ArchnemesisMod?: { ope: MatchOperator; vals: string[] }
118
126
  HasCruciblePassiveTree?: boolean
119
127
  }
120
128
  actions: {
121
129
  SetFontSize?: number
122
- SetTextColor?: { rgb: { r: number; g: number; b: number }; alpha: number }
123
- SetBackgroundColor?: { rgb: { r: number; g: number; b: number }; alpha: number }
124
- SetBorderColor?: { rgb: { r: number; g: number; b: number }; alpha: number }
130
+ SetTextColor?: RGBA
131
+ SetBackgroundColor?: RGBA
132
+ SetBorderColor?: RGBA
125
133
  MinimapIcon?: { size: MinimapIconSize; color: MinimapIconColor; shape: MinimapIconShape }
126
134
  PlayEffect?: { color: PlayEffectColor; temp: boolean }
127
- PlayAlertSound?: { id: SoundId; volume: number | undefined }
128
- PlayAlertSoundPositional?: { id: SoundId; volume: number | undefined }
135
+ PlayAlertSound?: Sound
136
+ PlayAlertSoundPositional?: Sound
129
137
  CustomAlertSound?: {
130
138
  filePath: string
131
139
  volume: number | undefined
@@ -133,7 +141,7 @@ type AdvancedBlock = {
133
141
  DisableDropSound?: boolean
134
142
  EnableDropSound?: boolean
135
143
  }
136
- branches: Array<Branch>
144
+ branches: Branch[]
137
145
  location: {
138
146
  start: { line: number; column: number; offset: number }
139
147
  end: { line: number; column: number; offset: number }
@@ -142,18 +150,28 @@ type AdvancedBlock = {
142
150
 
143
151
  type Branch = {
144
152
  name: string
145
- type: string
146
- blocks: Array<AdvancedBlock>
153
+ type: BranchType
154
+ blocks: AdvancedBlock[]
147
155
  }
148
156
 
149
157
  type Condition = keyof AdvancedBlock["conditions"]
150
158
  type Action = keyof AdvancedBlock["actions"]
151
159
 
152
- export function parse(input: string): AdvancedBlock[]
153
-
154
- export class SyntaxError {
155
- public message: any
156
- public expected: any
157
- public found: any
158
- public location: any
160
+ type SyntaxError = {
161
+ message: string
162
+ found?: string
163
+ location: {
164
+ start: {
165
+ offset: number
166
+ line: number
167
+ column: number
168
+ }
169
+ end: {
170
+ offset: number
171
+ line: number
172
+ column: number
173
+ }
174
+ }
159
175
  }
176
+
177
+ export function parse(input: string): AdvancedBlock[]