NotRanged.github.io icon indicating copy to clipboard operation
NotRanged.github.io copied to clipboard

Auto-read attributes from the game and auto-send macro into the game

Open Limiana opened this issue 2 years ago • 5 comments

Hello. It would be nice if current stats, food could be read directly from the game. Additionally, it would be nice if once a macro is generated, it would be automatically sent into game for further processing as user will configure. Unfortunately I do not know JS so I can not implement these features myself. However, I'm willing to make a backend (Dalamud plugin) that will provide requested data and accept generated macro. Would you be willing to add these functions to the solver?

Limiana avatar Jun 15 '23 11:06 Limiana

I'm willing to work on this. I'm not too familiar with dalamud though

dazemc avatar Jun 16 '23 16:06 dazemc

I would handle the Dalamud part, it will basically be a web server which you can query for stats in JSON format, something like http://127.0.0.1:37914/CRP for carpenter each time before macro generation is started. Output is something like this:

{
    "Level": 90, 
    "Crafting": 3122,
    "Control": 2987,
    "Manipulation": true
}

or empty if not logged in/doesn't have requested class unlocked on this character/doesn't have data for it yet

I don't know JS though so that's where I'd need help with frontend. I imagined it somewhat like that: Basically before macro is generated make a request for stats, if received empty/timed out just keep whatever is there, if received response update stats for job and actions for level and manipulation status and begin solver run. Once solver completes, just send raw macro lines in format like http://127.0.0.1:37914/?item=itemIDOrName&macro=content and whatever to do with received macro user will configure inside the plugin

Limiana avatar Jun 16 '23 22:06 Limiana

I've delved deeper into this code base and it appears that there is already a function that checks for updates made to the stats of the crafter before it generates macros. This makes sense when you think about how the buffs get implemented. If I can pull json data like the one you have above then it should be pretty straight forward to change the stats and output the macro line by line. You are linking to a local host though so I cannot see the desired macro output.

Basically, you want a way to accept new stats (including buffs) on crafters to update within the solver. Then output the macros, as plaintext line by line? Again I'm assuming it's plain text because I can't see it.

It'd be much easier to use something like selenium to import the relevant data from dalamud into the solver though. Could make a headless selenium script that just outputs the macros as plaintext. I'm just throwing ideas out there

dazemc avatar Jul 02 '23 06:07 dazemc

Could make a headless selenium script that just outputs the macros as plaintext

this could also work probably, I'm going to try that once I finish currently ongoing projects

You are linking to a local host though so I cannot see the desired macro output

this is because web server would run inside the game itself

Limiana avatar Aug 16 '23 16:08 Limiana

Check out Dalamud and this repo, https://github.com/WorkingRobot/craftimizer

dazemc avatar Aug 16 '23 17:08 dazemc