Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated chat command handler #4163

Merged
merged 4 commits into from
Nov 9, 2024
Merged

Conversation

syrifgit
Copy link
Collaborator

@syrifgit syrifgit commented Nov 8, 2024

Generalized chat command handling

Goals

  • Scalable
    • With the way toggles are accessed, any future toggles that are properly created should function automatically with the chat commands
    • This also applies to spec options
  • Dynamic
    • Less hardcoding
  • Modular
    • Break out the function into many helper functions
  • Good comments
    • :)
  • Strong input validation
    • Where reasonable, input is restricted
  • Useful user feedback chat prints
    • Related to above point, give good feedback to the user when they do bad inputs
  • Fast UI Updating
    • les UI building, more self:ForceUpdate("CLI_TOGGLE") and self:UpdateDisplayVisibility()

Fixes

  • Initialized some missing setting values in GetDefaults() so that they are always accessible by the chat command handler
  • Made CountPriorities() less local to re-use it
  • I don't think potion override actually did anything, it does now though.

Overall Design Notes

  • Broke the original command line handler into a function that simply trims input and redirects it to other functions based on the 2nd parameter (called arg[1] from this point on, as we trim off the /hek or /hekili)
  • Added aliases for some stuff, such as cds = cooldowns
    • /hek set cooldowns infusion is a valid command
    • /hek set cds pi is also a valid command
  • The Hekili:CmdLine ( input ) is the new function that redirects the input to other functions
    • /hek set and /hek help will skip to the Hekili:DisplayChatCommandList( list ) function
    • Adds a lot of modularity to this part of the code
  • Tried to make very strong input validation

Functions

Hekili:HandleSetCommand( args )

  • Handles all commands in the form /hek set, such as
    • /hek set mode automatic
    • /hek set cycle on
    • /hek set cooldowns separate off
    • /hek set spec pet_healing 50 (this calls another function)
    • If only
  • Spec options now must have the prefix "spec"
    • `/hek set spec [spec_option_name] [value_if_applicable]
  • Leverages the existing SetMode() and FireToggle() functions, which are slightly updated to support more generalized commands

Hekili:HandleSpecSetting( specSetting, specValue )

  • Handles all spec related settings

Hekili:DisplayChatCommandList( list )

  • This is the old /hek set
    • Now modular
    • Can display specific pieces at specific times
    • Modularity allows users to actually scroll the big info block in-game (it is now multiple prints)

Hekili:HandleSkeletonCommand( input )

  • Does skeleton stuff, essentially unchanged from your skeleton code

Hekili:RunStressTest()

  • Moved into its own function, it can now be called from other stuff (maybe automatically upon importing a string/APL?)

Hekili:HandleProfileCommand( args )

  • For swapping settings profiles

Hekili:HandleEnableDisableCommand( args )

  • Enabling and disabling the addon via chat

Hekili:HandleMoveCommand( args )

  • Handles unlock, lock, move

Hekili:HandleRecoverCommand()

  • Recover function
  • I am interested in revisiting to make a gentler version for people who say "why is Hekili not showing up"

Hekili:HandlePriorityCommand( args )

  • For swapping your current pack
  • Added an option to supply default as a parameter which swaps you back to the built-in pack (if it hasn't been deleted)

Test cases

I will provide a large swath of test cases in the comments

....
....

fixes #3962 :)

@syrifgit
Copy link
Collaborator Author

syrifgit commented Nov 8, 2024

Test cases that should work

/hekili enable
/hekili disable
/hekili enable 123
/hekili disable extraArgument
/hekili enable "extra text"

/hekili stress
/hekili stress 123
/hekili stress extraArgument

/hekili skeleton

/hek prio
/hekili priority
/hekili priority priorityName
/hekili priority "complex priority name"

/hekili move
/hekili unlock
/hekili lock
/hekili move extraArgument
/hekili unlock 123
/hekili lock "extra text"


/hek set cooldowns
/hek set cooldowns on
/hek set cooldowns off
/hek set cooldowns separate
/hek set cooldowns separate on
/hek set cooldowns separate off
/hek set cooldowns override
/hek set cooldowns override on
/hek set cooldowns override off
/hek set cooldowns infusion
/hek set cooldowns infusion on
/hek set cooldowns infusion off
/hek set cds pi
/hek set cds pi on
/hek set cds pi off

/hek set pot 
/hek set pot on
/hek set pot off
/hek set potions
/hek set potions on
/hek set potions off
/hek set potions override
/hek set potions override on
/hek set potions override off

/hek set interrupts
/hek set interrupts on
/hek set interrupts off
/hek set interrupts separate
/hek set interrupts separate on
/hek set interrupts separate off
/hek set interrupts filterCasts
/hek set interrupts filterCasts on
/hek set interrupts filterCasts off

/hek set defensives
/hek set defensives on
/hek set defensives off
/hek set defensives separate
/hek set defensives separate on
/hek set defensives separate off

/hek set custom1
/hek set custom1 on
/hek set custom1 off

/hek set custom2
/hek set custom2 on
/hek set custom2 off

/hek set funnel
/hek set funnel on
/hek set funnel off

/hek set target_swap on
/hek set target_swap off
/hek set target_swap
/hek set target_swap 5
/hek set target_swap 3

/hek set swap on
/hek set swap off
/hek set swap
/hek set swap 10
/hek set swap 7

/hek set cycle on
/hek set cycle off
/hek set cycle
/hek set cycle 2
/hek set cycle 1

/hek set mode automatic
/hek set mode single
/hek set mode aoe
/hek set mode dual
/hek set mode reactive

/hekili profile
/hekili profile profileName

(replace these with examples from your own spec, this is Beast Mastery)

/hek set spec barbed_shot_grace_period 0
/hek set spec barbed_shot_grace_period 1
/hek set spec barbed_shot_grace_period 2
/hek set spec pet_healing 0
/hek set spec pet_healing 50
/hek set spec pet_healing 100
/hek set spec avoid_bw_overlap
/hek set spec avoid_bw_overlap on
/hek set spec avoid_bw_overlap off
/hek set spec mark_any
/hek set spec mark_any on
/hek set spec mark_any off
/hek set spec check_pet_range
/hek set spec check_pet_range on
/hek set spec check_pet_range off

@syrifgit
Copy link
Collaborator Author

syrifgit commented Nov 8, 2024

Test cases that should fail

/hekili skeleton extraArgument
/hekili skeleton 123

/hekili priority invalidPriorityName
/hekili priority 123
/hekili priority ""

/hek set cooldowns separate z
/hek set cooldowns override boop
/hek set cooldowns infusion foo
/hek set cooldowns randomtoggle
/hek set cooldowns infusion 0

/hek set potions override z
/hek set potions randomtoggle
/hek set potions override foo

/hek set interrupts separate z
/hek set interrupts filterCasts foo
/hek set interrupts randomtoggle

/hek set defensives separate z
/hek set defensives randomtoggle
/hek set defensives separate foo

/hek set custom1 randomtoggle
/hek set custom1 foo

/hek set custom2 randomtoggle
/hek set custom2 foo

/hek set funnel randomtoggle
/hek set funnel foo

/hek set target_swap abc
/hek set target_swap -5
/hek set target_swap 0

/hek set swap toggle
/hek set swap -1
/hek set swap abcdef

/hek set cycle xyz
/hek set cycle -10

/hekili profile invalidProfileName
/hekili profile 12345
/hekili profile ""

(replace these with examples from your own spec, this is Beast Mastery)

/hek set spec barbed_shot_grace_period -1
/hek set spec barbed_shot_grace_period 3
/hek set spec barbed_shot_grace_period z
/hek set spec pet_healing -10
/hek set spec pet_healing 110
/hek set spec pet_healing z
/hek set spec avoid_bw_overlap z
/hek set spec mark_any foo
/hek set spec check_pet_range bar
/hek set spec pet_healing
/hek set spec barbed_shot_grace_period

@syrifgit
Copy link
Collaborator Author

syrifgit commented Nov 9, 2024

Full reference page for macros: https://github.com/Hekili/hekili/wiki/Hekili,-Macros-and-You

@Hekili Hekili changed the base branch from thewarwithin to cmdline November 9, 2024 20:28
@Hekili Hekili merged commit 19ef9e7 into Hekili:cmdline Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add a keybind to toggle show major cooldowns in separate cd's display or primary display
2 participants