-
Notifications
You must be signed in to change notification settings - Fork 380
Auto-detect and use character specific hotkeys via key file #905
base: master
Are you sure you want to change the base?
Conversation
f086892
to
59f7681
Compare
src/template_finder.py
Outdated
@@ -60,10 +60,37 @@ def stored_templates() -> dict[Template]: | |||
) | |||
return templates | |||
|
|||
@cache | |||
def stored_templates_by_dir() -> dict[Template]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont like that we bascially copy the stored_templates() functionality here. I'd rather go for adding the dir normally to TEMPLATE_PATHS and to get all the specific template names loop through folder and get names of the files in a list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we also can ditch the search_all_templates() function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stored_templates_by_dir and search_all_templates have been removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ezro would you be willing to create a new test case for the new functionality? Just add here https://github.com/aeon0/botty/blob/master/test/template_finder_test.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mgleed I added some asserts but they're very basic; please validate
One thing that needs to be tested here is localization. Botty currently allows users to select characters that have names that aren't in English alphabet. Not sure if this will break things if people have a keyfile with kanji, for example. |
@Ezro left a few comments earlier |
From my side it looks good. I leave it to gleed since he seems to still have some topics. |
Also, why'd you choose to stick with precise keyfile name rather than use regexp with character name like we discussed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall very well done! See comments. Thanks for doing this.
Last wish list item for this PR would be basic validation.
There are some hotkeys that simply cannot be unset. Like force move, etc. Do you think it'd be hard to implement some basic validation for required hotkeys?
src/template_finder.py
Outdated
@@ -60,10 +60,37 @@ def stored_templates() -> dict[Template]: | |||
) | |||
return templates | |||
|
|||
@cache | |||
def stored_templates_by_dir() -> dict[Template]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ezro would you be willing to create a new test case for the new functionality? Just add here https://github.com/aeon0/botty/blob/master/test/template_finder_test.py
I think we can implement that very easily (at some point). Here's the current spot for parsing the key block into actual hotkeys |
I haven't tested this but I think it's better to be explicit; I have a feeling that the hash is there for multi-account handling; e.g., if account A has character 'Paladin' and account B has character 'Paladin' and both were played online on the same PC then we wouldn't actually be able to determine which Paladin file to use. This adds a bit of overhead for the users (to find and enter the explicit key file name) but I think the trade-off is that Botty wouldn't have to do decision making logic for choosing / erroring. |
That's a good point and I'd bet your theory is correct. |
fa84dff
to
eef2a92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing locally. if it works well I'll merge today ™️
813a6c1
to
df2e5ac
Compare
d463ed2
to
c1d0ddf
Compare
Are you able to recover my test that I wrote in template_finder_test.py for this? Looks like that got overwritten with a force push. |
007c463
to
4e18c84
Compare
This implementation will read the provided 'key_file' param (which should map to the exact name in the saved_games_folder) and parse the hotkeys for the provided character. Once Botty goes into game it will then run a "discovery" to try to determine what skills are bound to the discovered hotkeys.
The PR should auto-detect sorc, pally, barb, necro, sin, and druid skill. The existing char scripts should be updated to use the proposed hotkey solution.
An important thing to note is that the implementation currently assumes that Quick Casting is disabled; if we plan on shifting to using Quick Casting then I think this solution can be tweaked to hold the keybind prior to taking the screenshot.