Skip to content

Commit

Permalink
league parsing/propecy/fractured item fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eruyome committed May 17, 2019
1 parent 7e78b50 commit 5d8ab41
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 10 deletions.
4 changes: 4 additions & 0 deletions resources/Updates_Trade.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
The following is a list of what has been updated, starting with 1.1.0

2.14.2
================================================================================================
* Fixed event leagues not being parsed and therefore not being available in the league selection.

2.14.1
================================================================================================
* Hotfixed the parsing of crafted mords (advanced search) which was broken in PoE 3.6.
Expand Down
2 changes: 1 addition & 1 deletion resources/VersionTrade.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
TradeReleaseVersion := "v2.14.1"
TradeReleaseVersion := "v2.14.2"
TradeAHKVersionRequired := "1.1.26.00"
10 changes: 9 additions & 1 deletion resources/ahk/POE-ItemInfo.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ class Item_ {
This.GemColor := ""
This.veiledPrefixCount := ""
This.veiledSuffixCount := ""
This.fracturedModsCount := ""

This.HasImplicit := False
This.HasEnchantment := False
Expand Down Expand Up @@ -8096,7 +8097,10 @@ ParseItemData(ItemDataText, ByRef RarityLevel="")
If (Item.IsLeagueStone or Item.IsScarab) {
ItemDataIndexAffixes := ItemDataIndexAffixes - 1
}
If (Item.IsBeast) {
Else If (Item.IsProphecy) {
ItemDataIndexAffixes := ItemDataIndexAffixes - 1
}
Else If (Item.IsBeast) {
ItemDataIndexAffixes := ItemDataIndexAffixes - 1
}
ItemData.Affixes := RegExReplace(ItemDataParts%ItemDataIndexAffixes%, "[\r\n]+([a-z])", " $1")
Expand Down Expand Up @@ -8151,6 +8155,9 @@ ParseItemData(ItemDataText, ByRef RarityLevel="")
{
ParseAffixes(ItemData.Affixes, Item)
}
Else If (Item.IsProphecy) {
ParseAffixes(ItemData.Affixes, Item)
}
Else If (RarityLevel > 1 and RarityLevel < 4 and Item.IsMap = True)
{
MapModWarnings := ParseMapAffixes(ItemData.Affixes)
Expand Down Expand Up @@ -8180,6 +8187,7 @@ ParseItemData(ItemDataText, ByRef RarityLevel="")
Item.BaseName := ItemBaseName

pseudoMods := PreparePseudoModCreation(ItemData.Affixes, Item.Implicit, RarityLevel, Item.isMap)
fracturedModsCount := ; can't be reliably determined that easily since a hybrid mod (which counts as as single ractured mod) gets displayed as two fractured mods in the item data

; Start assembling the text for the tooltip
TT := Item.Name
Expand Down
47 changes: 43 additions & 4 deletions resources/ahk/TradeMacro.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -689,10 +689,10 @@ TradeFunc_Main(openSearchInBrowser = false, isAdvancedPriceCheck = false, isAdva
If (s.mods[A_Index].selected > 0) {
modParam := new _ParamMod()

If (s.mods[A_Index].spawntype = "fractured" and s.inlcudeFractured) {
If (s.mods[A_Index].spawntype = "fractured" and s.includeFractured) {
modParam.mod_name := TradeFunc_FindInModGroup(TradeGlobals.Get("ModsData")["fractured"], s.mods[A_Index])
}

If (not StrLen(modParam.mod_name)) {
modParam.mod_name := s.mods[A_Index].param
}
Expand All @@ -702,6 +702,19 @@ TradeFunc_Main(openSearchInBrowser = false, isAdvancedPriceCheck = false, isAdva
RequestParams.modGroups[1].AddMod(modParam)
}
}
If (s.includeFracturedCount and s.fracturedCount > 0) {
modParam := new _ParamMod()
modParam.mod_name := "(pseudo) # Fractured Modifiers" ; TradeFunc_FindInModGroup(TradeGlobals.Get("ModsData")["pseudo"], "# Fractured Modifiers")
/*
_tmpitem := {}
_tmpitem.mods := []
_tmpitem.mods.push({name : "# Fractured Modifiers"})
modParam.mod_name := TradeFunc_GetItemsPoeTradeMods(_tmpitem)
*/
modParam.mod_min := s.fracturedCount
modParam.mod_max := s.fracturedCount
RequestParams.modGroups[1].AddMod(modParam)
}
Loop % s.stats.Length() {
If (s.stats[A_Index].selected > 0) {
; defense
Expand Down Expand Up @@ -1307,6 +1320,22 @@ TradeFunc_Main(openSearchInBrowser = false, isAdvancedPriceCheck = false, isAdva
;Item.UsedInSearch.abyssJewel := 1
}
}

/*
prophecies
*/
If (Item.IsProphecy and RegExMatch(Item.Name, "i)A Master seeks Help")) {
_tempItem := {}
_tempItem.name_orig := "(prophecy) " ItemData.Affixes
_tempItem.name := "(prophecy) " ItemData.Affixes
_tempItem.param := "(prophecy) " ItemData.Affixes

modParam := new _ParamMod()
modParam.mod_name := _tempItem.param
modParam.mod_min :=
modParam.mod_max :=
RequestParams.modGroups[1].AddMod(modParam)
}

/*
predicted pricing (poeprices.info - machine learning)
Expand Down Expand Up @@ -5101,6 +5130,12 @@ TradeFunc_AdvancedPriceCheckGui(advItem, Stats, Sockets, Links, UniqueStats = ""

GuiAddPicture(A_ScriptDir "\resources\images\info-blue.png", "x+-" 193 " yp+" fracturedImageShift - 1 " w15 h-1 0x0100", "FracturedInfo", "FracturedInfoH", "", "", "SelectModsGui")
AddToolTip(LblFracturedInfoH, "Includes selected fractured mods with their ""fractured"" porperty`n instead of as normal mods.")

GuiAddText("Fractured mods count", "x" RightPosText " y+10 right w130 0x0100", "LblFracturedCount", "LblFracturedCountH", "", "", "SelectModsGui")
Gui, SelectModsGui:Add, CheckBox, x%RightPos% yp+0 vTradeAdvancedSelectedFracturedCount Checked, % " "
Gui, SelectModsGui:Add, Edit , x+1 yp-4 w30 vTradeAdvancedFracturedCount ,
GuiAddPicture(A_ScriptDir "\resources\images\info-blue.png", "x+-" 193 " yp+" 3 " w15 h-1 0x0100", "FracturedCount", "FracturedCountH", "", "", "SelectModsGui")
AddToolTip(LblFracturedCountH, "The correct number of fractured mods can't be determined from the item data reliably.`n`nMake sure to check it by pressing ""Alt"" when hovering over your item, `nwhich requires ""Advanced Mod Descriptions"" to be enabled.")
}

If (ModNotFound) {
Expand Down Expand Up @@ -5266,6 +5301,8 @@ TradeFunc_ResetGUI() {
TradeAdvancedSelectedVeiledSuffix :=
TradeAdvancedVeiledSuffixCount :=
TradeAdvancedSelectedIncludeFractured :=
TradeAdvancedSelectedFracturedCount :=
TradeAdvancedFracturedCount :=

TradeGlobals.Set("AdvancedPriceCheckItem", {})
}
Expand Down Expand Up @@ -5342,7 +5379,9 @@ TradeFunc_HandleGuiSubmit() {
newItem.veiledPrefixCount := TradeAdvancedVeiledPrefixCount
newItem.useVeiledSuffix := TradeAdvancedSelectedVeiledSuffix
newItem.veiledSuffixCount := TradeAdvancedVeiledSuffixCount
newItem.inlcudeFractured := TradeAdvancedSelectedIncludeFractured
newItem.includeFractured := TradeAdvancedSelectedIncludeFractured
newItem.includeFracturedCount := TradeAdvancedSelectedFracturedCount
newItem.fracturedCount := TradeAdvancedFracturedCount

TradeGlobals.Set("AdvancedPriceCheckItem", newItem)
Gui, SelectModsGui:Destroy
Expand Down Expand Up @@ -5645,7 +5684,7 @@ ReadPoeNinjaCurrencyData:
fallBackDir := A_ScriptDir . "\data_trade"
url := "https://poe.ninja/api/Data/GetCurrencyOverview?league=" . league
parsedJSON := CurrencyDataDownloadURLtoJSON(url, sampleValue, false, isFallback, league, "PoE-TradeMacro", file, fallBackDir, usedFallback, loggedCurrencyRequestAtStartup, loggedTempLeagueCurrencyRequest, TradeOpts.CurlTimeout)

; fallback to Standard and Hardcore league if used league seems to not be available
If (!parsedJSON.currencyDetails.length()) {
isFallback := true
Expand Down
18 changes: 14 additions & 4 deletions resources/ahk/TradeMacroInit.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ ReadTradeConfig("", "config_trade.ini", _updateConfigWrite)
TradeGlobals.Set("LeagueName", TradeGlobals.Get("Leagues")[TradeOpts.SearchLeague])

TradeFunc_CheckIfCloudFlareBypassNeeded()
; call it again (TradeFunc_CheckIfCloudFlareBypassNeeded reads poetrades available leagues but can't be called before the first TradeFunc_GetLeagues call at the moment (bad coding))
TradeGlobals.Set("Leagues", TradeFunc_GetLeagues())

; set this variable to skip the update check in "PoE-ItemInfo.ahk"
SkipItemInfoUpdateCall := 1
Expand Down Expand Up @@ -391,7 +393,7 @@ TradeFunc_GetLeagues() {
standard := "standard"

For key, val in LeaguesData {
If (!val.event and not RegExMatch(val.id, "i)^SSF")) {
If (not val.event and not RegExMatch(val.id, "i)^SSF")) {
If (val.id = standard) {
leagues[standard] := val.id
}
Expand All @@ -405,9 +407,17 @@ TradeFunc_GetLeagues() {
leagues["tmp" standard] := val.id
}
}
Else If (val.event and not RegExMatch(val.id, "i)^SSF")) {
If (InStr(val.id, " HC ")) {
leagues["event" hardcore] := val.id
}
Else {
leagues["event" standard] := val.id
}
}
Else {
For i, value in poeTradeLeagues {
If (value = val.id) {
If (value = val.id and not RegExMatch(value, "i)^PS4|^XBOX")) {
trimmedValue := Format("{:L}", RegExReplace(value, "i)\s", ""))
leagues[trimmedValue] := value
}
Expand All @@ -419,7 +429,7 @@ TradeFunc_GetLeagues() {
; make sure there are no duplicate temp leagues (hardcoded keys)
For j, value in poeTradeLeagues {
trimmedValue := Format("{:L}", RegExReplace(value, "i)\s", ""))
If (not leagues[trimmedValue]) {
If (not leagues[trimmedValue] and not RegExMatch(value, "i)^PS4|^XBOX")) {
found := false
For i, l in leagues {
If (value = l) {
Expand All @@ -431,7 +441,7 @@ TradeFunc_GetLeagues() {
}
}
}

Return leagues
}

Expand Down

0 comments on commit 5d8ab41

Please sign in to comment.