harbingerofme / DebugToolkit

Debugging commands for Risk of Rain 2. Previously known as RoR2Cheats.
https://thunderstore.io/package/IHarbHD/DebugToolkit/
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

Refactor stringfinder partial matching methods and normalise list commands #164

Closed SChinchi closed 9 months ago

SChinchi commented 9 months ago

Closes #162. Not sure if this also applies to #61.

Every partial matching method now returns the unique element at some index if the argument can be parsed as an integer, otherwise it tries to match the partial for all available entries. The entries are returned in the order they are encountered in one iteration, without prioritising exact name matches. This also means the list commands can now reuse these methods.

Changes made for highlighting uniformity:

Other small changes made along the way:

list_query_examples

Matching order

I've implemented the simple approach which matches anything in the order it is encountered in the iterable. mostly to imitate how the list commands behaved. However, this means that since "WispMaster" comes after "AncientWispMaster", there is no way to match the latter other than with the index. I'm mentioning it since spawning a wisp might be frequent in testing and using the index could be inconvenient. So maybe switching to the alternative approach mentioned in #162 might make more sense.

Pending issue

I don't know what to do with the alias dictionaries in StringFinder. Since they have not been exposed to the user via the list commands, only those who have read the code may know of their existence. It may make sense to either remove them completely, or show them alongside the invariants in the list commands and similarly allow them to be matched, e.g., [i]Fracture (Collapse), [i]RoboBallBossMaster="Solus Control Unit" (SCU, roboboss). If they are to be kept, I think it makes sense to match them just like the partial/invariant. However, most of the current aliases are redundant either because they are partials of their referenced name, or the object itself now has a friendly name. The only ones still using internal names are buffs and dots, which are also referenced similarly in the wiki. I can see the use for it for "Alloy Worship Unit" -> "AWU", but it seems such cases are few and far between.