Skip to content

Commit

Permalink
predicted search (ML), wiki alternative, map hihglighting fix (#614)
Browse files Browse the repository at this point in the history
* predicted search (#611)

* added option for the intelligent item search (poeprices.info)

* preparations to request poeprices and parse the response

* preparations

* added gui cancel via escape to all guis

* initial predicted pricing implementation

* added predicted pricing gui (disabled)

* added feedback request

* renamed intelligent search to predicted pricing

* small UI changes

* feedback request cahnges

* fixed feedback request

* added min/max/currency and debug parameter

* improved predicted search error handling

* disabled predicted search for unique items

* poeprices request improvements

* improved predicted search response error handling

* added wiki alternative (poedb.tw)

* fixed predicted search browser url

* updated notes/version/fallback
  • Loading branch information
Eruyome authored Dec 15, 2017
1 parent 9292ba8 commit ba33de3
Show file tree
Hide file tree
Showing 11 changed files with 599 additions and 112 deletions.
Binary file modified Fallback.exe
Binary file not shown.
4 changes: 4 additions & 0 deletions lib/Class_ColorPicker.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ class ColorPicker
GuiControl, % ( showImage ) ? "hide" : "show", Pbg
showImage := showImage ? false : true
Return

GDIColorPickerPreviewGuiEscape:
Gui, GDIColorPickerPreview:Destroy
Return
}

rgbaToARGBHex(r, g, b, a) {
Expand Down
7 changes: 4 additions & 3 deletions lib/Class_GdipTooltip.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class GdipTooltip
this.CalculateToolTipDimensions(String, fontSize, ttWidth, ttLineHeight, ttheight)

renderingOffset := this.renderingHack ? 0.3999 : 0
textAreaWidth := ttWidth + (2 * this.padding.width) + renderingOffset
;textAreaWidth := ttWidth + (Floor(this.padding.width / 2)) + renderingOffset
textAreaWidth := ttWidth + renderingOffset
textAreaHeight := ttHeight + (2 * this.padding.height) + renderingOffset

this.window.Clear()
Expand Down Expand Up @@ -192,12 +193,12 @@ class GdipTooltip
StringArray := StrSplit(String, "`n")
Loop % StringArray.MaxIndex()
{
element := StringArray[a_index]
element := StringArray[A_Index]
dim := this.MeasureText(element, fontSize + 1, "Consolas")
len := dim["W"] * (fontSize / 10)
hi := dim["H"] * ((fontSize - 1) / 10)

if (len > ttWidth)
If (len > ttWidth)
{
ttWidth := len
}
Expand Down
4 changes: 4 additions & 0 deletions lib/DebugPrintArray.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ DebugPrintArray(Array, Display=1, Level=0, guiWidth=800, guiHeight=900)
DebugPrintArrayGuiClose:
Gui, DebugPrintArray:Destroy
Return

DebugPrintArrayGuiEscape:
Gui, DebugPrintArray:Destroy
Return
}

/*
Expand Down
77 changes: 51 additions & 26 deletions lib/PoEScripts_Download.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,31 @@
redirect := "L"
PreventErrorMsg := false
If (StrLen(options)) {
If (RegExMatch(options, "i)SaveAs:[ \t]*\K[^\r\n]+", SavePath)) {
commandData .= " " options " "
commandHdr .= ""
}
If (RegExMatch(options, "i)Redirect:\sFalse")) {
redirect := ""
}
If (RegExMatch(options, "i)PreventErrorMsg")) {
PreventErrorMsg := true
}
Loop, Parse, options, `n
{
If (RegExMatch(A_LoopField, "i)SaveAs:[ \t]*\K[^\r\n]+", SavePath)) {
commandData .= " " A_LoopField " "
commandHdr .= ""
}
If (RegExMatch(A_LoopField, "i)Redirect:\sFalse")) {
redirect := ""
}
If (RegExMatch(A_LoopField, "i)PreventErrorMsg")) {
PreventErrorMsg := true
}
If (RegExMatch(A_LoopField, "i)RequestType:(.*)", match)) {
requestType := Trim(match1)
}
If (RegExMatch(A_LoopField, "i)ReturnHeaders:(.*skip.*)")) {
skipRetHeaders := true
}
If (RegExMatch(A_LoopField, "i)TimeOut:(.*)", match)) {
timeout := Trim(match1)
}
}
}
If (not timeout) {
timeout := 30
}

e := {}
Expand All @@ -58,40 +73,49 @@
commandData .= "-o """ SavePath """ " ; set target destination and name
}
} Else {
commandData .= " -" redirect "ks --compressed "
commandHdr .= " -I" redirect "ks "
}
commandData .= " -" redirect "ks --compressed "
If (requestType = "GET") {
commandHdr .= " -k" redirect "s "
} Else {
commandHdr .= " -I" redirect "ks "
}
}

If (StrLen(headers)) {
commandData .= headers
commandHdr .= headers
If (not requestType = "GET") {
commandData .= headers
commandHdr .= headers
}
If (StrLen(cookies)) {
commandData .= cookies
commandHdr .= cookies
}
}
If (StrLen(ioData)) {
If (StrLen(ioData) and not requestType = "GET") {
If (requestType = "POST") {
commandData .= "-X POST "
}
commandData .= "--data """ ioData """ "
} Else If (StrLen(ioData)) {
url := url "?" ioData
}

If (binaryDL) {
commandData .= "--connect-timeout 30 "
commandData .= "--connect-timeout 30 "
commandData .= "--connect-timeout " timeout " "
commandData .= "--connect-timeout " timeout " "
} Else {
commandData .= "--max-time 30 "
commandHdr .= "--max-time 30 "
commandData .= "--max-time " timeout " "
commandHdr .= "--max-time " timeout " "
}

; get data
html := StdOutStream(curl """" url """" commandData)
if (instr(url, "cdn")) {
;msgbox % curl """" url """" commandData
}
;html := ReadConsoleOutputFromFile(commandData """" url """", "commandData") ; alternative function

; get return headers in seperate request
If (not binaryDL) {
If (StrLen(ioData)) {
commandHdr := curl """" url "?" ioData """" commandHdr ; add payload to url since you can't use the -I argument with POST requests
If (not binaryDL and not skipRetHeaders) {
If (StrLen(ioData) and not requestType = "GET") {
commandHdr := curl """" url "?" ioData """" commandHdr ; add payload to url since you can't use the -I argument with POST requests
} Else {
commandHdr := curl """" url """" commandHdr
}
Expand All @@ -100,6 +124,7 @@
} Else {
ioHdr := html
}

reqHeadersCurl := commandHdr
} Catch e {

Expand Down
10 changes: 10 additions & 0 deletions resources/Updates_Trade.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
The following is a list of what has been updated, starting with 1.1.0

2.7.0
================================================================================================
Implemented a predicted item pricing/search using machine learning algorithms:
This feature uses the ML pricing from poeprices.info.
For the moment it will only work with rare items, magic items will likely be enabled in the near future.
This feature replaces the default search (ctrl + d) but is optional and can be disabled again in the settings.
Be aware that this feature could return correct prices, but also be completely off the mark, improving it needs the help of the community.
Added poedb.tw as an alternative to the PoE Wiki (open item on wiki hoteky). This is a toggle option and has to be enabled in the settings ("general" section).
Fixed the new maps not working with the stash highlight hotkey.

2.6.3
================================================================================================
Fixed an issue that caused the new maps not being searched correctly.
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.6.3"
TradeReleaseVersion := "v2.7.0"
TradeAHKVersionRequired := "1.1.26.00"
53 changes: 41 additions & 12 deletions resources/ahk/POE-ItemInfo.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6441,8 +6441,7 @@ ParseClipBoardChanges(debug = false)
/*
;Item Data Translation, won't be used for now.
CBContents := PoEScripts_TranslateItemData(CBContents, translationData, currentLocale, retObj, retCode)
*/

*/
Globals.Set("ItemText", CBContents)

ParsedData := ParseItemData(CBContents)
Expand Down Expand Up @@ -10030,23 +10029,33 @@ AdvancedItemInfoExt() {
Globals.Set("ItemText", CBContents)
ParsedData := ParseItemData(CBContents)

If (Item.Name) {
itemTextBase64 := ""
FileDelete, %A_ScriptDir%\temp\itemText.txt
FileAppend, %CBContents%, %A_ScriptDir%\temp\itemText.txt, utf-8
command := "certutil -encode -f ""%cd%\temp\itemText.txt"" ""%cd%\temp\base64ItemText.txt"" & type ""%cd%\temp\base64ItemText.txt"""
itemTextBase64 := ReadConsoleOutputFromFile(command, "encodeToBase64.txt")
itemTextBase64 := Trim(RegExReplace(itemTextBase64, "i)-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----|77u/", ""))
itemTextBase64 := UriEncode(itemTextBase64)
itemTextBase64 := RegExReplace(itemTextBase64, "i)^(%0D)?(%0A)?|((%0D)?(%0A)?)+$", "")
url := "http://pathof.info/?item=" itemTextBase64
If (Item.Name) {
url := "http://pathof.info/?item=" StringToBase64UriEncoded(CBContents)
openWith := AssociatedProgram("html")
OpenWebPageWith(openWith, Url)
}
SuspendPOEItemScript = 0
}
}

StringToBase64UriEncoded(stringIn, noUriEncode = false) {
stringBase64 := ""
FileDelete, %A_ScriptDir%\temp\itemText.txt
FileAppend, %stringIn%, %A_ScriptDir%\temp\itemText.txt, utf-8
command := "certutil -encode -f ""%cd%\temp\itemText.txt"" ""%cd%\temp\base64ItemText.txt"" & type ""%cd%\temp\base64ItemText.txt"""
stringBase64 := ReadConsoleOutputFromFile(command, "encodeToBase64.txt")
stringBase64 := Trim(RegExReplace(stringBase64, "i)-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----|77u/", ""))

If (not noUriEncode) {
stringBase64 := UriEncode(stringBase64)
stringBase64 := RegExReplace(stringBase64, "i)^(%0D)?(%0A)?|((%0D)?(%0A)?)+$", "")
} Else {
stringBase64 := RegExReplace(stringBase64, "i)\r|\n", "")
}

Return stringBase64
}

OpenWebPageWith(application, url) {
If (InStr(application, "iexplore")) {
ie := ComObjCreate("InternetExplorer.Application")
Expand Down Expand Up @@ -10653,6 +10662,26 @@ ShowAssignedHotkeys:
Gui, 3:Cancel
return

GuiEscape:
; settings
Gui, Cancel
Return

AboutGuiEscape:
Gui, About:Cancel
Return

ShowHotkeysGuiEscape:
Gui, ShowHotkeys:Cancel
Return

TranslateGuiEscape:
Gui, Translate:Cancel
Return

UpdateNotesGuiEscape:
Gui, UpdateNotes:Cancel
Return

CheckForUpdates:
If (not globalUpdateInfo.repo) {
Expand Down
Loading

0 comments on commit ba33de3

Please sign in to comment.