xanthics / PoE_Weighted_Search

Code to generate pathofexile.com/trade searches based on dps weights
MIT License
34 stars 2 forks source link

Automating the PoB part #5

Closed coldino closed 5 years ago

coldino commented 5 years ago

I've made a script that allows PoB to calculate all of the DPS weights for GenerateSearch.py automatically. It can be run without PoB's UI showing for full automation. Unfortunately, with the need to copy/paste the output into GenerateSearch.py, the editing of the search terms, and the requirement to have Python installed, this can't really be considered usable by most people.

This would all be a lot more user friendly if you could add the facility to your webpage to allow this script to post data directly to it, to pre-fill all of the numerical fields. Maybe in future the PoB maintainer would accept a new button that fired off this script, taking you directly to your webpage.

At the moment I'm producing output designed to be pasted into the Python:

                "ele as chaos": 881.7,
                "pen fire": 876.1,
                "extra random": 0.0,
                "% generic": 255.1,
                "+1 endurance charge": 1273.3,
                "+1 frenzy charge": 0.0,
                "% elemental": 255.1,
                "flat chaos": 14.5,
                "flat accuracy": 0.0,
                "% chaos": 0.0,
                "% physical": 0.0,
                "flat cold": 54.3,
                "% cold": 2.9,
                "crit chance": 0.0,
                "extra chaos": 881.7,
                "crit multi": 0.0,
                "extra cold": 0.0,
                "flat phys": 25.9,
                "pen cold": 5.7,
                "extra lightning": 0.0,
                "flat lightning": 54.2,
                "attack speed": 548.9,
                "flat fire": 150.8,
                "pen lightning": 0.0,
                "% fire": 252.2,
                "pen all": 881.7,
                "+1 power charge": 0.0,
                "% accuracy": 0.0,
                "extra fire": 0.0,
                "cast speed": 0.0,
                "% lightning": 0.0,

...but it could of course easily be full JSON or even URL-encoded query parameters if that is easier.

Script: https://github.com/VolatilePulse/PoB-Item-Tester/blob/master/ItemTester/SearchDPS.lua

xanthics commented 5 years ago

Interesting. A person here wrote some lua code that generates javascript that you can just paste in to a developer console.

I can run anything on the website that is necessary/helpful. So for example it can be set up to have a text box to paste output from your code to fill in the page. That output could be plain text, or json, or whatever format makes the most sense.

If you'd like to hash out specifics, send me a message on reddit (/u/xanthics) and I'll send you my discord handle.

xanthics commented 5 years ago

I've converted mods.txt to mods.json. that is an array of dictionaries That should allow you to have a dynamic mods list so that I can add more mods later without needing to hardcode.

How does the standard of {"label": <something>, "value": <something>} as an export from your code sound? Also an array of dictionaries.

coldino commented 5 years ago

I've had a look at the the script provided by cm_pony on reddit. It's a great solution for those that like to tinker with code. Certainly nicer to use a flask to generate the options, but expecting a user to modify PoB isn't a good way forward. Here's my take on the solutions, in order of my preference:

1) Best-case: Re-implement all of your code in Lua with PoB and attach it to a simple UI that allows selecting tags/classes/etc, then launching the search in a browser. If accepted by the PoB team this would be ideal for all users. 2) Extension of my external Lua script that runs with PoB's runtime and takes you direct to your website, pre-filled. No Lua/Python runtime required by the user, but still a separate download. 3) Extension of cm_pony's script to generate the site link directly in PoB. Better than copy/paste into the dev console, but still requires editing PoB's source and the associated issue with its update system.

For any solution involving your site you'll need to handle the values as a query parameter. Would a simple format such as this work for you?

http://gw2crafts.net/pobsearch/modsearch.html?cast%20speed=0&...

...which your page could read very simply and auto-fill. It would also be a solution to "saving" data as it could be bookmarked. If you also allow tags to be specified an extension to the PoB interface might be able to provide those, later on.

xanthics commented 5 years ago
  1. I have no experience with writing Lua, so I wouldn't know where to begin with that. I would welcome a rewrite though as I anticipated my website being a temporary solution for generating queries.

2&3. Query parameters are easy to implement with Brython. If 1 doesn't gain any traction I can implement this soon.

xanthics commented 5 years ago

I attempted to run your code and am having issues with "dofile("Launch.lua")" as the file doesn't appear to exist. Do I need to install something for that file?

coldino commented 5 years ago

Apologies... forgot about this for a few days.

The files have been re-arranged to be easier to run. I'll update within the next couple of hours with your newest mod lines. There's a testdps.bat file in the root that shows how it needs to be run (and you can replace the LuaJIT.exe we use with the full Path of Building.exe - only downside is the annoying console window):

cd %POBPATH%
"Path of Building.exe" %SCRIPTPATH%\SearchDPS.lua CURRENT

I think it would be easiest if you go ahead and add the querystring processing to your website. I'll change the script to launch the browser directly then.

Edit: new modlines added, tested and committed.

xanthics commented 5 years ago

http://gw2crafts.net/pobsearch/modsearch.html?Cold=True&flat%20accuracy=100

All of the table values accept numbers, all of the check boxes can be set with "True"


Also I am still unable to get your script to work. I have PoB installed via the exe from releases which does not create a launch.lua. If I download the PoB source then I get " module 'xml' not found".


I realized also that attaching the mods to a flask may not be the best approach because some of the mods will be affected by flask effectiveness(EG % cold damage) but I don't know if all the mods that are being used to get values will scale.

coldino commented 5 years ago

Great, I'll update my script to post to your page directly.


Sadly, it appears you are right about installing PoB from the setup exe. When extracting from the (binary) zip, there's a launch.lua present. The xml module is in the a subdirectory and requires LUA_PATH to be set correctly. Sorry, I missed that part of the bat file out of the snippet:

set LUA_PATH=%POBPATH%\lua\?.lua;%BASEDIR%\ItemTester\?.lua

I'm not sure how to solve the missing launch.lua issue. Might be time to talk to the PoB team. It has to be built into the exe somehow, but I don't know if we can use it at all.


The flask issue seems likely to be true. A separate, detached jewel socket might be a better option and not require you to empty an existing socket, but I don't know how that might be possible.

coldino commented 5 years ago

Script updated. Adds all mod effects to the URL and launches it. For example a Whispering Ice build's output.

I haven't looked at ways to generate the flags/tags from the main skill yet, but it would never be complete or perfect anyway.

There's another problem with using flasks. With this Whispering Ice build damage scales from INT, yet INT doesn't seem to apply to a flask at all.

coldino commented 5 years ago

Found a way to avoid using a flask by using a pretend passive node and fixed +attr and +%attr stats. You were just missing the initial +. See VolatilePulse/PoB-Item-Tester@949da6ccc76efb1fc9c2c8df1ec7e4fb741dda51.

You should be able to run it from the AHK script (as long as launch.lua is present) by pressing Ctrl-Windows-D. Also, Ctrl-Windows-C runs a comparison on the PoE item currently on your clipboard.

xanthics commented 5 years ago

Interesting on the +. I took the mod description directly from the trade site api. Just means I'll have to add a translation layer.

coldino commented 5 years ago

Now added flag extraction from PoB directly. As it turns out this can be quite extensive.

A Molten Strike build Using your current flags breakdown we get: Tags: Attack Weapons: Sword, Two Handed Sword Tags: Melee, Area, Projectile, Fire, Elemental Hands: Two Handed Weapon Charges: Frenzy, Endurance Recently: Crit <- does not work You have/are: Flasked Enemy is: Taunted, Ignited, Intimidated. Burning, Blinded (most not supported by the website yet)

I've tested it on a few different types of build. Significant flags that are missing support on your end would be DamageOverTime and the various other enemy effects like burning. Setting Crit=True does not appear to work at all. I can open different issues for these if you would prefer.

Not tested with minion builds, yet.

xanthics commented 5 years ago

There are currently 4 mods that should have support for 'crit recently'. In addition to fixing the 'too long' uri issue, I'm going to set up some tests so I can make sure all the mods are selectable.

xanthics commented 5 years ago

I've added instructions to the page for your script(links/etc). I added a few mods today and will be adding some mods tomorrow(will be support for bleeding, poison, generic dot). After tomorrow, if you would like, make a new issue with mods that my page doesn't support.

coldino commented 5 years ago

You could replace those instructions with just "Run the AHK script and press Ctrl-Windows-D". Sadly it still relies on the zip-install of PoB, of course.

AHK FYIs:

I'm working on getting charge counts included.

xanthics commented 5 years ago

Updated coldino script instructions to use the AHK script.

coldino commented 5 years ago

Charge counts, skill name and character (build) name included.

xanthics commented 5 years ago

Added new mods:

Added new flags: enemy is

coldino commented 5 years ago

Added 👍

xanthics commented 5 years ago

Updated mods.json for life/es mods. Going to add all the minion stuff tomorrow. With your script I guess I don't really have to worry too much about clutter.

coldino commented 5 years ago

Added, but I can't test as I haven't been able to get to pathofexile.com for a couple of days now.

coldino commented 5 years ago

I'll try to work out a way to get mods directly from your mods file.

When the AHK script is properly released it'll only be bundled with the Lua runtime and will download the required files on first use - so could download your mods.json directly. Only problem is, there's no JSON reader available in PoB.

Not sure if it would be best to download your mods file directly or have a tested one checked in to the other repo.