Skip to content

Commit

Permalink
predicted pricing url fixes, gem xp options (#636)
Browse files Browse the repository at this point in the history
* fixed a possible JSON parse error

* added gem xp options

* updated version/notes/fallback
  • Loading branch information
Eruyome authored Dec 29, 2017
1 parent 773d2f0 commit d98a5d6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
Binary file modified Fallback.exe
Binary file not shown.
1 change: 1 addition & 0 deletions resources/Updates_Trade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ The following is a list of what has been updated, starting with 1.1.0
2.7.4
================================================================================================
Fixed the predicted pricing request for the hardcore abyss league.
Added some options to use and set Gem XP in searches.

2.7.3
================================================================================================
Expand Down
23 changes: 16 additions & 7 deletions resources/ahk/POE-ItemInfo.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -11137,8 +11137,6 @@ CurrencyDataDowloadURLtoJSON(url, sampleValue, critical = false, league = "", pr
errorMsg := "Parsing the currency data (json) from poe.ninja failed.`n"
errorMsg .= "This should only happen when the servers are down / unavailable."
errorMsg .= "`n`n"
errorMsg .= "Using archived data from a fallback file. League: """ league """."
errorMsg .= "`n`n"
errorMsg .= "This can fix itself when the servers are up again and the data gets updated automatically or if you restart the script at such a time."

errors := 0
Expand All @@ -11162,13 +11160,24 @@ CurrencyDataDowloadURLtoJSON(url, sampleValue, critical = false, league = "", pr
}
}

If (errors and critical and not sampleValue) {
MsgBox, 16, %project% - Error, %errorMsg%
Try {
parsedJSON := JSON.Load(parsedJSON)
} Catch e {
parsingError := true
}

If ((errors and critical and not sampleValue) or parsingError) {
FileRead, JSONFile, %fallbackDir%\currencyData_Fallback_%league%.json
parsedJSON := JSON.Load(JSONFile)
Try {
parsedJSON := JSON.Load(JSONFile)
errorMsg .= "Using archived data from a fallback file. League: """ league """."
errorMsg .= "`n`n"
} Catch e {
errorMsg .= "Using archived fallback data failed (JSON parse error)."
errorMsg .= "`n`n"
}
MsgBox, 16, %project% - Error, %errorMsg%
usedFallback := true
} Else {
parsedJSON := JSON.Load(parsedJSON)
}

Return parsedJSON
Expand Down
10 changes: 6 additions & 4 deletions resources/ahk/TradeMacro.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,12 @@ TradeFunc_Main(openSearchInBrowser = false, isAdvancedPriceCheck = false, isAdva
}

; experiment with values and maybe add an option
If (Item.Experience > 70 and Item.Level >= 19) {
RequestParams.progress_min := Item.Experience
RequestParams.progress_max := ""
Item.UsedInSearch.ItemXP := Item.Experience
If ((RegExMatch(Item.Name, "i)Empower|Enhance|Enlighten") or Item.Level >= 19) and TradeOpts.UseGemXP) {
If (Item.Experience >= TradeOpts.GemXPThreshold) {
RequestParams.progress_min := Item.Experience
RequestParams.progress_max := ""
Item.UsedInSearch.ItemXP := Item.Experience
}
}
}

Expand Down
13 changes: 11 additions & 2 deletions resources/ahk/TradeMacroInit.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,15 @@ CreateTradeSettingsUI()
AddToolTip(LblGemQualityRangeH, "Use this to set a range to quality Gem searches. For example a range of 1`n searches 14% - 16% when you have a 15% Quality Gem.`nSetting it to 0 (default) uses your Gems quality as min_quality`nwithout max_quality in your search.")
GuiAddEdit(TradeOpts.GemQualityRange, "x+1 yp-2 w33 h20", "GemQualityRange", "GemQualityRangeH")
; gem section end

; gem xp section start
GuiAddCheckbox("Use Gem XP", "x337 yp+24 w100 h30 0x0100", TradeOpts.UseGemXP, "UseGemXP", "UseGemXPH")
AddToolTip(UseGemXP, "Use gem experience in the search.`n`nWorks for gems with a level of 19 and higher or`nEnhance, Empower and Enlighten.")

GuiAddText("Gem XP threshold:", "x467 yp+8 w115 h20 0x0100", "LblGemXPThreshold", "LblGemXPThresholdH")
AddToolTip(LblGemXPThresholdH, "Gem experience won't be used in the search if`nlower than this value.")
GuiAddEdit(TradeOpts.GemXPThreshold, "x+10 yp-2 w35 h20", "GemXPThreshold", "GemXPThresholdH")
; gem xp section end

GuiAddText("Mod Range Modifier (%):", "x337 yp+32 w190 h20 0x0100", "LblAdvancedSearchModValueRange", "LblAdvancedSearchModValueRangeH")
AddToolTip(LblAdvancedSearchModValueRangeH, "Advanced search lets you select the items mods to include in your`nsearch and lets you set their min/max values.`n`nThese min/max values are pre-filled, to calculate them we look at`nthe difference between the mods theoretical max and min value and`ntreat it as 100%.`n`nWe then use this modifier as a percentage of this differences to`ncreate a range (min/max value) to search in. ")
Expand Down Expand Up @@ -657,8 +666,8 @@ CreateTradeSettingsUI()
GuiAddCheckbox("Item Base", "x482 yp0 w135 h40", TradeOpts.AdvancedSearchCheckBase, "AdvancedSearchCheckBase", "AdvancedSearchCheckBaseH")
AddToolTip(AdvancedSearchCheckBaseH, "Selects the item base`nwhen creating the advanced search GUI.")


Gui, Add, Link, x337 yp+43 w280 cBlue BackgroundTrans, <a href="https://github.com/POE-TradeMacro/POE-TradeMacro/wiki/Options">Options Wiki-Page</a>
;Gui, Add, Link, x337 yp+43 w280 cBlue BackgroundTrans, <a href="https://github.com/POE-TradeMacro/POE-TradeMacro/wiki/Options">Options Wiki-Page</a>


; Hotkeys

Expand Down
2 changes: 2 additions & 0 deletions resources/default_UserFiles/config_trade.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ GemLevelRange=0
GemQualityRange=0
; Use this to set a range to quality Gem searches; for example a range of 1 searches 14% - 16% when you have a 15% Quality Gem.
; Setting it to 0 (default) uses your Gems quality as min_quality without max_quality in your search.
UseGemXP=0
GemXPThreshold=70
OnlineOnly=1
BuyoutOnly=1
; 1 = search online only; 0 = search offline, too.
Expand Down

0 comments on commit d98a5d6

Please sign in to comment.