Giter Site home page Giter Site logo

project-path-of-exile-wiki / pypoe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brather1ng/pypoe

23.0 0.0 20.0 3.88 MB

Collection of Python Tools for Path of Exile

License: GNU General Public License v3.0

Python 99.81% kvlang 0.03% Shell 0.14% Dockerfile 0.02%

pypoe's Introduction

PyPoE - Wiki Fork

Collection of Python Tools for Path of Exile.

As of Aug 2021, the PoE Wiki project had forked from RePoE which itself was a fork of the discontinued OmegaK2/PyPoE repo and exists solely to keep the Community Wiki updated. The tooling in here serves to help with datamining efforts for Path of Exile and as a result any development and contributions are welcome and encouraged. Please chat to us on Discord #tools-dev channel or leave us a issue here on the repository.

How does this work?

Each new Path of Exile league has an updated game data file, which has to be parsed out and mined for information about the items, monsters, league mechanics and changes to the core and secondary/tertiary game mechanics which then need to make their way into the PoE Wiki.

These tools rely on specification files which are able to parse and read the *.dat files contained in the main game data file in order to determine what type of data holds what value at any given time and how to translate this into a format the Wiki can understand. These change patch to patch and have to be updated.

More detailed docs: http://omegak2.net/poe/PyPoE/

Overview

  • Library toolkit for programmers (PyPoE/poe)
  • UI based on Qt for browsing the game files (currently not working) -- marked for deprecation
  • CLI interface for extracting/exporting data (for the wiki, more TBD)

Getting Started

  1. Install:

  2. Clone:

    git clone https://github.com/Project-Path-of-Exile-Wiki/PyPoE

  3. Setup:

    • In the cloned folder run - poetry install to set up all dependencies and install project.
    • To run under the virtual environment that Poetry will make for you simply call poetry shell once for the lifetime of your terminal session. For the remainder of this documentation just assume you should always be in the active venv which Poetry will active for you using that command.
    • To exit the virtual environment Poetry activated simply type deactivate in the terminal window where you ran poetry shell.
    • to activate pre-commit hooks for your local repository, run pre-commit install while in the poetry shell.
  4. Testing:

    pytest -s -v .

  5. Updating the specification from the source-of-truth schema:

    • Update the generated schema:
      pypoe_schema_import -a stable

    • Use the generated schema by default:
      pypoe_exporter config set version GENERATED

    • Column aliases can be edited in PyPoE/poe/file/specification/generation/virtual_fields.py

  6. Running:

    • Configure output directory:
      pypoe_exporter config set out_dir ../out/

    • Configure temp directory (images will be output here):
      pypoe_exporter config set temp_dir ../tmp/

    • Configure ggpk path:
      pypoe_exporter config set ggpk_path '.../Path of Exile/'

    • Perform dry run:
      ./export.bash --threads 30 -u <wiki-username> -p <wiki-password> --dry-run

    • Check exported data in the output directory, especially the ./diff/ subdirectory which will show all changes that would made to the wiki

    • Update the wiki (Caution! Updates the live site!):
      ./export.bash --threads 30 -u <wiki-username> -p <wiki-password> --export

  7. Installing as a dependency

    • To install PyPoE as a dependency of a project that doesn't use poetry, run poetry build, then pip install ./dist/pypoe-*.*.*.tar.gz.
  8. Running in docker

    • Build the docker image with:
      docker build . -t pypoe

    • Run a command within the docker image:
      docker run pypoe pypoe_exporter wiki items item name "Silver Flask" --print

    • Run the full export script:
      docker run pypoe ./export.bash --threads 30 -u <wiki-username> -p <wiki-password> --dry-run

    • Mount a volume within the docker (for instance you could mount a local directory to /pypoe/out to save exporter output, or mount your local code to the PyPoE module location to test local changes without rebuilding the docker image):
      docker run -v "$PWD"/out:/pypoe/out -v "$PWD"/PyPoE:$(docker run pypoe python -c "import PyPoE; print(PyPoE.__path__[0])") pypoe ./export.bash --write

    • The image reads game content from patchcdn.pathofexile.com by default. To mount your local ggpk dir you will need to open a shell and configure pypoe before running your commands:

    docker run -v /path/to/ggpk:/ggpk_path -it pypoe bash
    pypoe_exporter config set ggpk_path /ggpk_path
    pypoe_exporter setup perform
    # ...
    

Setting up on VSCode

VSCode has some great integrations with all this tooling. In order for you to benefit from them, please ensure you adjust your settings to the following..

VSCode Extensions

  • Python
  • isort
  • Pylance

VSCode user-settings.json

..Activated by CTRL(CMD) + SHIFT + P and by typing > Open user settings (JSON). Ensure you have the below in your settings JSON.

    ...
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
    },
    "flake8.args": [
        "--config",
        ".flake8"
    ],
    "editor.formatOnSave": true,
    ...

Common problems & advisory


  • GUI code: UI will be reworked for bundle support and is not functional at the moment

  • Running on Windows: On Windows 10 machines there seems to a be bug in the Python installation that prevents arguments being passed to the command line interface; you can identify this issue if you get a "help" listing if you supplied more then 1 argument. See this on stack overflow for possible solutions

  • Merging older branches: merging branches created before the repository was formatted will result in a lot of merge conflicts. The following process can help to reduce conflicts:

# merge the last commit before the repository was formatted
git merge 0f61251e463b3a43780a0e019e008c9ab0cdd35a

# follow the steps above to setup to setup poetry,
# or if poetry has already been set up in this directory
# just run:
poetry shell

# run the formatter on the merged code and create a new commit:
pre-commit run --all-files
git commit -am 'format all'

# merge with the formatted commit
git merge 1319a525c2f165c6b0f9f389717e8bce35e00083

# merge with the target branch
git merge dev

Further Reading

Credits - People


Credits - Libraries


pypoe's People

Contributors

aang521 avatar acbeaumo avatar angelic-knight avatar bgorven avatar brather1ng avatar chuanhsing avatar d07riv avatar eps1lon avatar gloorf avatar ifry avatar john-paul-r avatar john-tho avatar journeytojah avatar lvlvllvlvllvlvl avatar markliu06 avatar maxbachmann avatar moonovermira avatar nickryder avatar norepro avatar novynn avatar omegak2 avatar pm5k avatar ppoelzl avatar ruba87 avatar shirohana avatar temmings avatar theatomicoption avatar wires77 avatar zaafar avatar zao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pypoe's Issues

Tidy up local dev and codebase

Proposal

  • Enact a code freeze and notify all devs that no dev is to take place between 23rd Dec and 2nd Jan

In separate PRs:

  • Move project to Poetry and Python 3.11
  • Apply isort / black / flake8 fixes
  • Add mkdocs/mkdocstrings and use github actions to build a public github pages app to host the docs
  • Consider applying Typer as the new CLI handler for the project
  • Review some of the current code for various tidy actions like typing, DRYness and other basic stuff

Acceptance criteria

  • New state of codebase is cleaner, easier to maintain and document, better to understand, uses more modern tooling

DelveLevelScaling.dat: MoreMonsterLife and MoreMonsterDamage are swapped

From: https://www.poewiki.net/wiki/Module:Delve/delve_level_scaling

		depth = 1000, 
		monster_level = 83, 
		sulphite_cost = 1100, 
		darkness_resistance = -801, 
		light_radius = -801, 
		monster_life = 169, 
		monster_damage = 3811, 

In: https://github.com/Project-Path-of-Exile-Wiki/PyPoE/blob/dev/PyPoE/poe/file/specification/data/stable.py

For reference, prior to the delve rework the depth 1000 values looked like this:

        depth = 1000, 
        monster_level = 83, 
        sulphite_cost = 1100, 
        darkness_resistance = -801, 
        light_radius = -801, 
        monster_life = 300, 
        monster_damage = 600, 

GGG definitely did not quintuple monster damage at depth 1000, if anything it's significantly easier to survive in delve now (unless you're zHP -- in which case new sources of unavoidable damage wreck you).

Need help exporting images

Hi, thank you for maintaining this wonderful repository.

I'm trying to extract images of unique items, bases, and skills. I repeat the same steps you mention in the readme, however all I'm geting is inventory icon png's. Tried a number of filters, queries, also looked up dat files json exports but couldn't find a way to export image arts. Can you help me with this?

copykey does not work for more than 5 quest/vendor reward parameter

Summary

I think my code has problem as it only covers the first 4 set of parameter but item may have more than

Reproduction steps

Using pypoe on any pages that have more than 5 sets of quest/vendor reward parameters

https://www.poewiki.net/w/index.php?title=Chance_to_Poison_Support&diff=1099729&oldid=602431

Expected outcome

pypoe does not override it

Actual outcome

pypoe does override it

Other info

Probably i need help to write that part of the code by using implicit[0-9]+_(?:text

as similar to

r'^(recipe|(ex|im)plicit[0-9]+_(?:text|random_list)).*'

Outdated boss information not updating

The Solaris Temple Level 2 (Act 3)'s area subpage https://www.poewiki.net/wiki/Area:1~3~8~2

incorrectly retains old boss information and is not cleared on export:

|boss_monster_ids = Metadata/Monsters/Guardians/GuardianBossHeadFire, Metadata/Monsters/Guardians/GuardianBossHeadCold, Metadata/Monsters/Guardians/GuardianBossHeadLightning

is this a bug or is the field obsolete and therefore no longer checked on export?

Finish 3.20 Exports / Changes

Proposal

  • Bring PyPoE up to date with the current 3.20 patch in terms of parsing.
  • Apply Novyn and Zao's updates in the ORB patch

Update docs and docstrings

Proposal

Talk to Omega2K about some of the functionality and clarify it's use via documentation / docstrings so newer users can pick things up better

PyPoE: Dev To-Do (If you want to contribute, look here).

What's this?

This is the non-exhaustive list of things new dev's can pick up and run with in order to make meaningful contributions to the repo. If you have questions, ping the #tools-dev channel on our discord.

To-Do (In order of priority)

If you want to grab one of these, message us on discord or comment on this issue @'ing one of the maintainers and they will add your name to the assigned to. Please only take this on if you're serious about contributing, holding onto a piece of work will prevent someone else from doing it. If no progress is seen within a week or two, we will unassign you and give it to someone else.

  1. Finish the 3.10 and Poetry move as described in #80

    • Assigned to:
    • Completed
  2. Change the setup / installation instructions for DEV in the wiki detailed here
    This requires you to ensure the instructions clearly state how to install Poetry, how to set up the project using Poetry, how to ensure it uses Python 3.10 (and how to set up python 3.10). Running tests, linters, formatters, etc. If you grab this one, ping @pm5k in the discord #tools-dev channel.

    • Assigned to:
    • Completed
  3. Refactor the repo according to flake8 by ensuring that running flake8 results in no errors at all.

    • Assigned to:
    • Completed
  4. Set up pre-commit hooks for the repo so that no changes can be pushed or merges made without tests or linters passing. This can only be done after 3. is done.

    • Assigned to:
    • Completed
  5. Change all occurrences of with open(...) as ... to use pathlib.Path because it uses an in-built context manager which removes the need to use with open() its also a specialised library for handling paths in a OO way and handles Posix paths as well as making it easy for us to consolidate windows/nix/osx pathing and forget about OS specificity (hopefully). Also change things like os.walk, os.path and so on. Anything path related should be changed to use pathlib unless pathlib does not have equivalent functionality in a given case.

    • Assigned to:
    • Completed
  6. Change any and all commonly used parametric string literals to be enums instead. It prevents manual entry fuck-ups common to string literal use in arguments or params and promotes DRY and re-use as well as lends to typing like so:

    # Before
    def something():
      response = get_response("http://some.constant.url.com", 123)
      return response
    
    def something_else():
      response = get_second_response("http://some.constant.url.com", 123)
      return response
    
    # After
    from enum import Enum
    
    
    class CommonURLs(str, Enum):
      SOMECONST = "http://some.constant.url.com"
      POE = "https://www.pathofexile.com"
    
    def something(url: CommonURLs):
      response = get_response(url, 123)
      return response
    
    def something_else(url: CommonURLs):
      response = get_second_response(url, 123)
      return response
    
    something(CommonURLs.SOMECONST)
    something_else(CommonURLs.POE)
    • Assigned to: krayskiy on Fri, 22 May 2022
    • Completed
  7. Write out proper type hints for all methods, classes, collections and return types so that we can trust the data flowing around the codebase and don't have to rely on guesswork. This will help new and existing devs grasp how the methods we use work and what they pass around.

    def add_two(one: int, two: int) -> int:
        return one + two
  8. TAKEN Replace all occurrences of "{} something {}".format(a, b) to use f-strings like f"{a} something {b}" in the codebase.

    • Assigned to: ashrasmun on Wed, 18 May 2022
    • Completed

More to come...

Improve make_inter_wiki_links mappings

The the Essence of Horror wiki seems to be generated so I hope this is the correct place to mention this.

On the Essence of Horror wiki page, a lot the keywords in the modifier lines have links to the corresponding Wiki pages (for example, in the Boots modifier line the Elemental Damage links to the Elemental_Damage page in the Wiki).

I am unsure if these types of links should be in the item description, but if the should, the following are missing or incorrect:

Missing links:

Mod line Keyword Wiki page
Weapon Power Power_Charge
Boots Stationary Stationary
Shield Chill Chill
Shield Nearby Nearby (redirects to Distance#"Nearby")
Amulet Crush Crushed
Belt Alchemist's Genius Alchemist%27s_Genius
Belt Flask Flask

Incorrect links:

  • Weapon: keyword Frenzy links to Frenzy skill gem, but should link to Frenzy_Charge.

Add map boss data

Currently, the schema does not include any map boss data. This means that Cargo queries cannot duplicate the results of manually-created map lists that include a link to the boss(es) of the map.

Remaining Crashes for 3.15 Item Exports

There are a few remaining crash-level issues in the dev branch for exporting items (and saving them to files).

  1. The MapFragmentMods.dat spec is out of sync with the length of the data.
  2. The MAP_FRAGMENT_FAMILIES constant in constants.py does not contain 14 or 15, which are used in MapFragmentMods.dat
  3. At least when writing to text files, items with double quotes in their names cause issues when python tries to open the file.

[Item export - 3.16] Some base types fail due to conflicts

Some base types fail due to conflicts. I'm suspicious this has to do with royale items.
image
This needs investigation as to what items are conflicting with these that are failing, and a conflict resolver written to rename or exclude (is this possible?) the duplicates that we don't care about.

[Dev] Change map exports to Map namespace

Maps exports need to be exported to the Map: namespace.

For example https://www.poewiki.net/wiki/Basilica_Map_(Scourge) needs to be https://www.poewiki.net/wiki/Map:Basilica_Map_(Scourge)

Error when exporting Currency Cyclone Effect

For some reason I get an error when trying to export the Currency Cyclone Effect. This error doesn't appear when exporting any other cosmetic items.

Screenshot 2021-11-09 155245

This is low priority, but maybe someone could help me debug this.

Plague Bearer stat description contains unnecessary line break

Plague Bearer stat description contains an unnecessary line break between "40% of the Expected Poison" & "Damage to Plague Value"

+(0-0.3) metres to radius<br>20% less Damage with Poison while Incubating and not at Maximum Plague Value<br>When you inflict Poison while Incubating, adds 40% of the Expected Poison<br>Damage to Plague Value<br>While Infecting, deals Chaos Damage per second equal to 12% of the Plague Value when Infecting began, and loses Plague Value at the same rate

Exporting Passive Icons is Slow. It Exports Duplicates.

We should add logic to the icon exporting of the passives exporter that makes it so it won't try to export the same image path multiple times.
The majority of nodes in the passive tree do not have unique icons, but we're exporting icons per-node instead of per-icon.

PyPoE Export Issues 3.20.1

  1. Items listed under Quest Rewards having fields being deleted by bot:

Example: Etched Kite Shield

|quest_reward1_item_level = 44
|quest_reward1_rarity_id = rare

Deleted by bot on export.

  1. Microtransaction "Cosmetic_theme" field being deleted by bot:

Example: Delve Core Gloves

|cosmetic_theme = Core 2021

Deleted by bot on export.

  1. Ivory Watchstone and Platinum X Watchstones having "class_id" modified by bot:

Example: Ivory Watchstone
Was changed from
|class_id = AtlasRegionUpgradeItem
to
|class_id = AtlasUpgradeItem
Also includes unique versions. These items should be skipped for next export.

Inconsistent gem quality effects with integer breakpoints (e.g. additional projectile)

Certain quality effects that provide projectiles correctly scale to 1% quality effects (typically on a 0.1% scale) but the following qualities state "Fires an additional arrow" or "Fires an additional projectile" instead of 0.05 per 1% quality, giving off the impression of adding 20 projectiles at 20% quality.
In-game, these quality texts only appear at quality 20%.

Examples:

  • Anomalous Split Arrow
  • Anomalous Volcanic Fissure
  • Divergent Artillery Ballista
  • Anomalous Frenzy
  • Divergent Spectral Throw
  • Divergent Creeping Frost
  • Anomalous Power Siphon
  • Divergent Shattering Steel

Freezing Pulse's Divergent quality also has a similar issue with boolean stat, providing "Cannot Pierce Enemies" instead of "5% chance not to Pierce Enemies". Note that this stat is NOT a breakpoint, and does actually scale per 1% quality.

  • Divergent Freezing Pulse

Not sure if this is able to be solved from our level or if this is a GGPK issue with 0.05 value qualities. In the interim, I've added small notes to the quality sections of related pages reflecting same.

[Item export - 3.16] Add new stat ranges for armors

We need to update base types to the new system.

  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\cli\core.py", line 145, in run
    code = args.func(args)
  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\cli\exporter\wiki\handler.py", line 286, in wrapper     
    result = func(parser, pargs, *args, **kwargs)
  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\cli\exporter\wiki\parsers\item.py", line 3548, in by_rowid
    return self._export(
  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\cli\exporter\wiki\parsers\item.py", line 3725, in _export
    if not f(self, infobox, base_item_type):
  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\cli\exporter\wiki\parsers\item.py", line 86, in func    
    _apply_column_map(infobox, data_mapping, data)
  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\cli\exporter\wiki\parsers\item.py", line 61, in _apply_column_map
    value = list_object[k]
  File "c:\users\journey\desktop\dev\poe-tools\wiki-fork\pypoe\PyPoE\poe\file\dat.py", line 407, in __getitem__
    raise KeyError(item)
KeyError: 'Armour'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.