Xeverous / filter_spirit

Advanced item filter generator for Path of Exile that uses it's own DSL and online item price APIs
GNU General Public License v3.0
36 stars 7 forks source link

price queries for non-trivial items #10

Closed Xeverous closed 4 years ago

Xeverous commented 5 years ago

The intial syntax idea to query item price looked like this: $divination(10, 100). It is very good for trivial items that have only 1 property (base type name): cards, prophecies, fragments, fossils and few others.

But some items have multiple properies, where each specific combination of them can significantly impact the price:

The current idea is a functional-language-like syntax which allows to apply multiple filters to one query: $bases | ilvl(x) | influence(shaper) | price(10, 100).

Current plans for behaviour:

Things to discuss:

x = 86
BaseType $bases | ilvl(x) | influence(shaper) | price(10, 100)
ShaperItem true # How to avoid this? The same condition is already in the query.
ItemLevel x     # How to avoid this? The same condition is already in the query.
Corrupted false
Xeverous commented 5 years ago

Old syntax idea - getting rid of code duplication, also reusing already present filter condition syntax:

Rarity <= rare {
    ItemLevel 86 {
        ShaperItem true {
            BaseType $bases(100, 999999) { Show }
            BaseType $bases(10, 100) { Show }
            BaseType $bases(0, 10) { Hide }
        }

        ElderItem true {
            BaseType $bases(100, 999999) { Show }
            BaseType $bases(10, 100) { Show }
            BaseType $bases(0, 10) { Hide }
        }
    }

    ItemLevel 85 { [...] }
}

Notes:

Open questions:

Xeverous commented 4 years ago

After some discussions on https://www.reddit.com/r/pathofexiledev/comments/f5113m/, the problem has been solved perfectly by introducing new conditions which follow the syntax of existing conditions:

    Autogen scarabs
    {
        Price >= 20
        {
            SetTextColor $color_sacrifice
            SetBorderColor $color_sacrifice
            SetBackgroundColor $color_white
            SetFontSize $font_scarab_top
            SetAlertSound $alert_scarab_top
            MinimapIcon $icon_scarab_top
            Show
        }

        Price < 20
        Price >= 10
        {
            SetTextColor $color_sacrifice
            SetBorderColor $color_sacrifice
            SetBackgroundColor $color_white
            SetFontSize $font_scarab_mid
            SetAlertSound $alert_scarab_mid
            MinimapIcon $icon_scarab_mid
            Show
        }
    }

The new Autogen and Price conditions work just like real filter conditions (they can be inherited but not overriden), except they fill the filter with data obtained from poe.ninja/poe.watch APIs. Additionally, just after the parse tree is formed all autogenerated conditions can be checked to detect invalid blocks (eg scarabs which has Sockets specified).

This is already implemented and documentation has been updated.