Skip to content

Commit

Permalink
feat: support 'CustomAlertSoundOptional' 'DisableDropSoundIfAlertSoun…
Browse files Browse the repository at this point in the history
…d' and 'EnableDropSoundIfAlertSound'
  • Loading branch information
isuke committed Jan 7, 2024
1 parent d134488 commit 8cff29b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
30 changes: 18 additions & 12 deletions src/advanced-poe-filter.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,24 +192,30 @@ action =
/ actionSetFontSize
/ actionPlayAlertSound
/ actionPlayAlertSoundPositional
/ actionCustomAlertSound
/ actionCustomAlertSoundOptional
/ actionDisableDropSoundIfAlertSound
/ actionEnableDropSoundIfAlertSound
/ actionDisableDropSound
/ actionEnableDropSound
/ actionCustomAlertSound
/ actionMinimapIcon
/ actionPlayEffect

// Action Attributes
actionSetBorderColor = attr:'SetBorderColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
actionSetTextColor = attr:'SetTextColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
actionSetBackgroundColor = attr:'SetBackgroundColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
actionSetFontSize = attr:'SetFontSize' __ val:actionValueFontSize { return { lineType: 'action', attr, val } }
actionPlayAlertSound = attr:'PlayAlertSound' __ val:actionValueSound { return { lineType: 'action', attr, val } }
actionPlayAlertSoundPositional = attr:'PlayAlertSoundPositional' __ val:actionValueSound { return { lineType: 'action', attr, val } }
actionDisableDropSound = attr:'DisableDropSound' { return { lineType: 'action', attr, val: true } }
actionEnableDropSound = attr:'EnableDropSound' { return { lineType: 'action', attr, val: true } }
actionCustomAlertSound = attr:'CustomAlertSound' __ val:actionValueCustomSound { return { lineType: 'action', attr, val } }
actionMinimapIcon = attr:'MinimapIcon' __ val:actionValueMinimapIcon { return { lineType: 'action', attr, val } }
actionPlayEffect = attr:'PlayEffect' __ val:actionValuePlayEffect { return { lineType: 'action', attr, val } }
actionSetBorderColor = attr:'SetBorderColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
actionSetTextColor = attr:'SetTextColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
actionSetBackgroundColor = attr:'SetBackgroundColor' __ val:actionValueColor { return { lineType: 'action', attr, val } }
actionSetFontSize = attr:'SetFontSize' __ val:actionValueFontSize { return { lineType: 'action', attr, val } }
actionPlayAlertSound = attr:'PlayAlertSound' __ val:actionValueSound { return { lineType: 'action', attr, val } }
actionPlayAlertSoundPositional = attr:'PlayAlertSoundPositional' __ val:actionValueSound { return { lineType: 'action', attr, val } }
actionCustomAlertSound = attr:'CustomAlertSound' __ val:actionValueCustomSound { return { lineType: 'action', attr, val } }
actionCustomAlertSoundOptional = attr:'CustomAlertSoundOptional' __ val:actionValueCustomSound { return { lineType: 'action', attr, val } }
actionDisableDropSoundIfAlertSound = attr:'DisableDropSoundIfAlertSound' { return { lineType: 'action', attr, val: true } }
actionEnableDropSoundIfAlertSound = attr:'EnableDropSoundIfAlertSound' { return { lineType: 'action', attr, val: true } }
actionDisableDropSound = attr:'DisableDropSound' { return { lineType: 'action', attr, val: true } }
actionEnableDropSound = attr:'EnableDropSound' { return { lineType: 'action', attr, val: true } }
actionMinimapIcon = attr:'MinimapIcon' __ val:actionValueMinimapIcon { return { lineType: 'action', attr, val } }
actionPlayEffect = attr:'PlayEffect' __ val:actionValuePlayEffect { return { lineType: 'action', attr, val } }

// Action Functions
actionFunctionColor =
Expand Down
12 changes: 8 additions & 4 deletions test/parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ Show "Section1"
SetBackgroundColor 106 107 108
SetFontSize 30
PlayAlertSound 16 300
EnableDropSound
CustomAlertSound "C\\foobar\\sound.mp3" 300
EnableDropSound
MinimapIcon 0 Red Circle
PlayEffect Red
ArchnemesisMod "Toxic"
Expand All @@ -167,8 +167,8 @@ Show "Section2"
SetTextColor 103 104 105 201
SetBackgroundColor 106 107 108 202
PlayAlertSound 2
DisableDropSound
CustomAlertSound "C\\foobar\\sound.mp3"
DisableDropSound
MinimapIcon Medium Red Circle
PlayEffect Blue Temp
Show "Section3"
Expand All @@ -192,9 +192,11 @@ Hide "Section5"
SetBorderColor Saturate(42%)
SetTextColor Desaturate(53%)
SetBackgroundColor Hex(123)
DisableDropSoundIfAlertSound
Unset "Section6"
SetBorderColor Saturation(64%)
SetTextColor Lightness(75%)
EnableDropSoundIfAlertSound
`

Expand Down Expand Up @@ -258,8 +260,8 @@ Unset "Section6"
SetBackgroundColor: { rgb: { r: 106, g: 107, b: 108 }, alpha: 255 },
SetFontSize: 30,
PlayAlertSound: { id: "16", volume: 300 },
EnableDropSound: true,
CustomAlertSound: { filePath: "C\\foobar\\sound.mp3", volume: 300 },
EnableDropSound: true,
MinimapIcon: { size: "Largest", color: "Red", shape: "Circle" },
PlayEffect: { color: "Red", temp: false },
},
Expand Down Expand Up @@ -290,11 +292,11 @@ Unset "Section6"
SetTextColor: { rgb: { r: 103, g: 104, b: 105 }, alpha: 201 },
SetBackgroundColor: { rgb: { r: 106, g: 107, b: 108 }, alpha: 202 },
PlayAlertSound: { id: "2", volume: undefined },
DisableDropSound: true,
CustomAlertSound: {
filePath: "C\\foobar\\sound.mp3",
volume: undefined,
},
DisableDropSound: true,
MinimapIcon: { size: "Medium", color: "Red", shape: "Circle" },
PlayEffect: { color: "Blue", temp: true },
},
Expand Down Expand Up @@ -349,6 +351,7 @@ Unset "Section6"
SetBorderColor: { function: "Saturate", val: 0.42 },
SetTextColor: { function: "Desaturate", val: 0.53 },
SetBackgroundColor: { function: "Hex", val: 123 },
DisableDropSoundIfAlertSound: true,
},
branches: [],
},
Expand All @@ -360,6 +363,7 @@ Unset "Section6"
actions: {
SetBorderColor: { function: "Saturationv", val: 64 },
SetTextColor: { function: "Lightness", val: 75 },
EnableDropSoundIfAlertSound: true,
},
branches: [],
},
Expand Down

0 comments on commit 8cff29b

Please sign in to comment.