Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #50 from PoE-TradeMacro/development
Browse files Browse the repository at this point in the history
Merge Development into Master
  • Loading branch information
Eruyome committed Oct 21, 2016
2 parents 5a3d7b1 + b0c8490 commit 95ba486
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 29 deletions.
38 changes: 38 additions & 0 deletions Run_without_Admin_Elevation.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
; This script merges TradeMacroInit, PoE-ItemInfo and TradeMacro into one script and executes it.
StartSplashScreen()

FileRead, info, POE-ItemInfo.ahk
FileRead, tradeInit, %A_ScriptDir%\trade_data\TradeMacroInit.ahk
FileRead, trade, %A_ScriptDir%\trade_data\TradeMacro.ahk

info := "`n`r`n`r" . info . "`n`r`n`r"
CloseScript("main.ahk")
FileDelete, %A_ScriptDir%\main.ahk
FileCopy, %A_ScriptDir%\trade_data\TradeMacroInit.ahk, %A_ScriptDir%\main.ahk
FileAppend, %info%, %A_ScriptDir%\main.ahk
FileAppend, %trade%, %A_ScriptDir%\main.ahk

Run %A_ScriptDir%\main.ahk
ExitApp

CloseScript(Name)
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
IfWinExist, i)%Name%.* ahk_class AutoHotkey
{
WinClose
WinWaitClose, i)%Name%.* ahk_class AutoHotkey, , 2
If ErrorLevel
return "Unable to close " . Name
else
return "Closed " . Name
}
else
return Name . " not found"
}


StartSplashScreen() {
SplashTextOn, , , Merging and starting Scripts...
}
4 changes: 3 additions & 1 deletion trade_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ AdvancedSearchModValueRange =20
; These min/max values are pre-filled, to calculate them we look at the difference between the mods theoretical max and min value and treat it as 100%.
; We then use AdvancedSearchModValueRange as a percentage of this differences to create a range (min/max value) to search.
RemoveMultipleListingsFromSameAccount =1
; Removes multiple listingf from the same account from the search results (combat market manipulators)
; Removes multiple listings from the same account from the search results (combat market manipulators)
; Default is 0 = off, set to 1 = enabled
PrefillMinValue =1
PrefillMaxValue =1

[Cache]
Expire =3
Expand Down
24 changes: 24 additions & 0 deletions trade_data/TradeMacro.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ CustomInputSearch:
Html := FunctionDoPostRequest(Payload)
ParsedData := FunctionParseHtml(Html, Payload)
SetClipboardContents(ParsedData)
ShowToolTip("")
ShowToolTip(ParsedData)
}
}
Expand Down Expand Up @@ -1187,6 +1188,8 @@ FunctionParseHtml(html, payload, iLvl = "", ench = "")
Title .= (Item.UsedInSearch.Type) ? "| Type (" . Item.UsedInSearch.Type . ") " : ""
Title .= (Item.UsedInSearch.ItemBase and ShowFullNameNote) ? "| Base (" . Item.UsedInSearch.ItemBase . ") " : ""

Title .= (Item.UsedInSearch.SearchType = "Default") ? "`n" . "!! Mod rolls are being ignored !!" : ""

Title .= "`n------------------------------ `n"
}

Expand Down Expand Up @@ -1797,6 +1800,13 @@ AdvancedPriceCheckGui(advItem, Stats, Sockets, Links, UniqueStats = "", ChangedI
statValueMin := Floor((statValueMin < stat.min) ? stat.min : statValueMin)
statValueMax := Floor((statValueMax > stat.max) ? stat.max : statValueMax)

if (not TradeOpts.PrefillMinValue) {
statValueMin :=
}
if (not TradeOpts.PrefillMaxValue) {
statValueMax :=
}

minLabelFirst := "(" Floor(statValueMin)
minLabelSecond := ")"
maxLabelFirst := "(" Floor(statValueMax)
Expand Down Expand Up @@ -1839,6 +1849,13 @@ AdvancedPriceCheckGui(advItem, Stats, Sockets, Links, UniqueStats = "", ChangedI
statValueMin := Floor((statValueMin < stat.min) ? stat.min : statValueMin)
statValueMax := Floor((statValueMax > stat.max) ? stat.max : statValueMax)

if (not TradeOpts.PrefillMinValue) {
statValueMin :=
}
if (not TradeOpts.PrefillMaxValue) {
statValueMax :=
}

minLabelFirst := "(" Floor(stat.min)
minLabelSecond := ")"
maxLabelFirst := "(" Floor(stat.max)
Expand Down Expand Up @@ -1958,6 +1975,13 @@ AdvancedPriceCheckGui(advItem, Stats, Sockets, Links, UniqueStats = "", ChangedI
maxLabelFirst := "(" zerotrimmer(advItem.mods[A_Index].ranges[1][2]) ")"
}

if (not TradeOpts.PrefillMinValue) {
modValueMin :=
}
if (not TradeOpts.PrefillMaxValue) {
modValueMax :=
}

yPosFirst := ( l > 1 ) ? 45 : 20
; increment index if the item has an enchantment
index := A_Index + e
Expand Down
70 changes: 44 additions & 26 deletions trade_data/TradeMacroInit.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class TradeUserOptions {
Corrupted := "Either" ; 1 = yes; 0 = no; 2 = either, This setting gets ignored when you use the search on corrupted items.
AdvancedSearchModValueRange := 20 ;
RemoveMultipleListingsFromSameAccount := 0 ;
PrefillMinValue := 1 ;
PrefillMaxValue := 1 ;

Expire := 3 ; cache expire min
}
Expand Down Expand Up @@ -155,6 +157,8 @@ ReadTradeConfig(TradeConfigPath="trade_config.ini")

TradeOpts.AdvancedSearchModValueRange := ReadIniValue(TradeConfigPath, "Search", "AdvancedSearchModValueRange", TradeOpts.AdvancedSearchModValueRange)
TradeOpts.RemoveMultipleListingsFromSameAccount := ReadIniValue(TradeConfigPath, "Search", "RemoveMultipleListingsFromSameAccount", TradeOpts.RemoveMultipleListingsFromSameAccount)
TradeOpts.PrefillMinValue := ReadIniValue(TradeConfigPath, "Search", "PrefillMinValue", TradeOpts.PrefillMinValue)
TradeOpts.PrefillMaxValue := ReadIniValue(TradeConfigPath, "Search", "PrefillMaxValue", TradeOpts.PrefillMaxValue)

; Cache
TradeOpts.Expire := ReadIniValue(TradeConfigPath, "Cache", "Expire", TradeOpts.Expire)
Expand Down Expand Up @@ -198,6 +202,8 @@ WriteTradeConfig(TradeConfigPath="trade_config.ini")
TradeOpts.Corrupted := Corrupted
TradeOpts.AdvancedSearchModValueRange := AdvancedSearchModValueRange
TradeOpts.RemoveMultipleListingsFromSameAccount := RemoveMultipleListingsFromSameAccount
TradeOpts.PrefillMinValue := PrefillMinValue
TradeOpts.PrefillMaxValue := PrefillMaxValue
}
SavedTradeSettings := false

Expand Down Expand Up @@ -225,7 +231,9 @@ WriteTradeConfig(TradeConfigPath="trade_config.ini")
WriteIniValue(TradeOpts.Corrupted, TradeConfigPath, "Search", "Corrupted")
WriteIniValue(TradeOpts.AdvancedSearchModValueRange, TradeConfigPath, "Search", "AdvancedSearchModValueRange")
WriteIniValue(TradeOpts.RemoveMultipleListingsFromSameAccount, TradeConfigPath, "Search", "RemoveMultipleListingsFromSameAccount")

WriteIniValue(TradeOpts.PrefillMinValue, TradeConfigPath, "Search", "PrefillMinValue")
WriteIniValue(TradeOpts.PrefillMaxValue, TradeConfigPath, "Search", "PrefillMaxValue")

; Cache
WriteIniValue(TradeOpts.Expire, TradeConfigPath, "Cache", "Expire")
}
Expand Down Expand Up @@ -468,32 +476,37 @@ FunctionGetLatestRelease() {
user := TradeGlobals.Get("GithubUser")
HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
url := "https://api.github.com/repos/" . user . "/" . repo . "/releases/latest"
;https://api.github.com/repos/thirdy/POE-TradeMacro/releases/latest
HttpObj.Open("GET",url)
HttpObj.SetRequestHeader("Content-type","application/html")
HttpObj.Send("")
HttpObj.WaitForResponse()
html := HttpObj.ResponseText

RegExMatch(html, "i)""tag_name"":""(.*?)""", tag)
RegExMatch(html, "i)""name"":""(.*?)""", vName)
RegExMatch(html, "i)""html_url"":""(.*?)""", url)

tag := tag1
vName := vName1
url := url1

RegExReplace(tag, "^v", tag)
; works only in x.x.x format
RegExMatch(tag, "(\d+).(\d+).(\d+)(.*)", latestVersion)
RegExMatch(TradeGlobals.Get("ReleaseVersion"), "(\d+).(\d+).(\d+)(.*)", currentVersion)
;https://api.github.com/repos/thirdy/POE-TradeMacro/releases/latest
Try {
HttpObj.Open("GET",url)
HttpObj.SetRequestHeader("Content-type","application/html")
HttpObj.Send("")
HttpObj.WaitForResponse()
html := HttpObj.ResponseText

RegExMatch(html, "i)""tag_name"":""(.*?)""", tag)
RegExMatch(html, "i)""name"":""(.*?)""", vName)
RegExMatch(html, "i)""html_url"":""(.*?)""", url)

tag := tag1
vName := vName1
url := url1

If (latestVersion > currentVersion) {
Gui, UpdateNotification:Add, Text, cGreen, Update available!
Gui, UpdateNotification:Add, Text, , Your installed version is <%currentVersion%>, the lastest version is <%latestVersion%>.
Gui, UpdateNotification:Add, Link, cBlue, <a href="%url%">Download it here</a>
Gui, UpdateNotification:Add, Button, gCloseUpdateWindow, Close
Gui, UpdateNotification:Show, w300 , Update
RegExReplace(tag, "^v", tag)
; works only in x.x.x format
RegExMatch(tag, "(\d+).(\d+).(\d+)(.*)", latestVersion)
RegExMatch(TradeGlobals.Get("ReleaseVersion"), "(\d+).(\d+).(\d+)(.*)", currentVersion)

If (latestVersion > currentVersion) {
Gui, UpdateNotification:Add, Text, cGreen, Update available!
Gui, UpdateNotification:Add, Text, , Your installed version is <%currentVersion%>, the lastest version is <%latestVersion%>.
Gui, UpdateNotification:Add, Link, cBlue, <a href="%url%">Download it here</a>
Gui, UpdateNotification:Add, Button, gCloseUpdateWindow, Close
Gui, UpdateNotification:Show, w300 , Update
}
} catch e {
MsgBox % "Update-Check failed, Github is probably down."
}
return
}
Expand Down Expand Up @@ -585,7 +598,12 @@ CreateTradeSettingsUI()
GuiAddCheckbox("Remove multiple Listings from same Account", "x827 y223 w230 h40", TradeOpts.RemoveMultipleListingsFromSameAccount, "RemoveMultipleListingsFromSameAccount", "RemoveMultipleListingsFromSameAccountH")
AddToolTip(RemoveMultipleListingsFromSameAccountH, "Removes multiple listings from the same account from`nyour search results (to combat market manipulators).`n`nThe removed items are also removed from the average and`nmedian price calculations.")

Gui, Add, Link, x827 y263 w230 cBlue, <a href="https://github.com/thirdy/POE-TradeMacro/wiki/Options">Options Wiki-Page</a>
GuiAddCheckbox("Pre-Fill Min-Values", "x827 y253 w230 h40", TradeOpts.PrefillMinValue, "PrefillMinValue", "PrefillMinValueH")
AddToolTip(PrefillMinValueH, "Automatically fill the min-values in the advanced search GUI.")
GuiAddCheckbox("Pre-Fill Max-Values", "x827 y283 w230 h40", TradeOpts.PrefillMinValue, "PrefillMaxValue", "PrefillMaxValueH")
AddToolTip(PrefillMaxValueH, "Automatically fill the max-values in the advanced search GUI.")

Gui, Add, Link, x827 y323 w230 cBlue, <a href="https://github.com/thirdy/POE-TradeMacro/wiki/Options">Options Wiki-Page</a>

GuiAddText("Mouse over settings to see what these settings do exactly.", "x827 y585 w250 h30")

Expand Down
2 changes: 1 addition & 1 deletion trade_data/Version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
TradeReleaseVersion := "1.1.3.2"
TradeReleaseVersion := "1.1.3.3"
TradeAHKVersionRequired := "1.1.24.00"
4 changes: 3 additions & 1 deletion trade_data/trade_defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ AdvancedSearchModValueRange =20
; These min/max values are pre-filled, to calculate them we look at the difference between the mods theoretical max and min value and treat it as 100%.
; We then use AdvancedSearchModValueRange as a percentage of this differences to create a range (min/max value) to search.
RemoveMultipleListingsFromSameAccount =1
; Removes multiple listingf from the same account from the search results (combat market manipulators)
; Removes multiple listings from the same account from the search results (combat market manipulators)
; Default is 0 = off, set to 1 = enabled
PrefillMinValue =1
PrefillMaxValue =1

[Cache]
Expire =3
Expand Down

0 comments on commit 95ba486

Please sign in to comment.