From f261dc62e9c0c7577012d07718087340eab539c0 Mon Sep 17 00:00:00 2001 From: Eruyome Date: Sat, 22 Apr 2017 17:01:43 +0200 Subject: [PATCH 1/9] basic prophecy parsing; highlighting fixes; flask affix parsing fixes (#84) --- resources/ahk/POE-ItemInfo.ahk | 141 +++++++++++++++++++++--- resources/tests/Test_WinHTTPRequest.ahk | 19 ++-- 2 files changed, 136 insertions(+), 24 deletions(-) diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index c2f96a09..9410436e 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -460,7 +460,8 @@ class Item_ { This.MapLevel := "" This.MapTier := "" This.MaxSockets := "" - This.SubType := "" + This.SubType := "" + This.DifficultyRestriction := "" This.Implicit := [] This.Charges := [] This.AreaMonsterLevelReq := [] @@ -487,6 +488,7 @@ class Item_ { This.IsJewel := False This.IsLeaguestone := False This.IsDivinationCard := False + This.IsProphecy := False This.IsUnique := False This.IsRare := False This.IsCorrupted := False @@ -2235,6 +2237,17 @@ IsValidRange(Bracket) return True } +ParseProphecy(ItemData, ByRef Difficulty = "", ByRef SealingCost = "") +{ + ; Will have to be reworked for 3.0 + For key, part in ItemData.Parts { + RegExMatch(part, "i)(Normal)|(Cruel)|(Merciless) Difficulty", match) + If (match) { + Difficulty := match1 . match2 . match3 + } + } +} + ; Note that while ExtractCompAffixBalance() can be run on processed data ; that has compact affix type declarations (or not) for this function to ; work properly, make sure to run it on data that has compact affix types @@ -2306,7 +2319,19 @@ ParseFlaskAffixes(ItemDataAffixes) } ; Suffixes - + ; "during flask effect" and "Life Recovery to Minions" should suffice + suffixes := ["Dispels", "Removes Bleeding", "Removes Curses on use", "during flask effect", "Adds Knockback", "Life Recovery to Minions"] + For key, suffix in suffixes { + If (RegExMatch(A_LoopField, "i)" suffix, match)) { + If (NumSuffixes < 1) + { + NumSuffixes += 1 + } + Continue + } + } + + /* IfInString, A_LoopField, Dispels { ; Covers Shock, Burning and Frozen and Chilled @@ -2356,9 +2381,21 @@ ParseFlaskAffixes(ItemDataAffixes) } Continue } + */ - ; Prefixes - + ; Prefixes + prefixes := ["Recovery Speed", "Amount Recovered", "Charges", "Instant", "Charge when", "Recovery when", "Mana Recovered", "Mana Recovered", "increased Duration", "increased Charge Recovery", "reduced Charges used"] + For key, prefix in prefixes { + If (RegExMatch(A_LoopField, "i)" prefix, match)) { + If (NumPrefixes < 1) + { + NumPrefixes += 1 + } + Continue + } + } + + /* IfInString, A_LoopField, Recovery Speed { If (NumPrefixes < 1) @@ -2423,6 +2460,31 @@ ParseFlaskAffixes(ItemDataAffixes) } Continue } + IfInString, A_LoopField, increased Duration + { + If (NumPrefixes < 1) + { + NumPrefixes += 1 + } + Continue + } + IfInString, A_LoopField, increased Charge Recovery + { + If (NumPrefixes < 1) + { + NumPrefixes += 1 + } + Continue + } + IfInString, A_LoopField, reduced Charges used + { + If (NumPrefixes < 1) + { + NumPrefixes += 1 + } + Continue + } + */ } AffixTotals.NumPrefixes := NumPrefixes @@ -7485,11 +7547,20 @@ ParseItemData(ItemDataText, ByRef RarityLevel="") Item.IsDivinationCard := True Item.BaseType := "Divination Card" } + + ; Prophecy Orb detection + If (InStr(ItemData.PartsLast, "to add this prophecy to")) + { + Item.IsProphecy := True + Item.BaseType := "Prophecy" + ParseProphecy(ItemData, Difficulty) + Item.DifficultyRestriction := Difficulty + } Item.IsGem := (InStr(ItemData.Rarity, "Gem")) Item.IsCurrency:= (InStr(ItemData.Rarity, "Currency")) - If (Not (InStr(ItemDataText, "Itemlevel:") or InStr(ItemDataText, "Item Level:")) and Not Item.IsGem and Not Item.IsCurrency and Not Item.IsDivinationCard) + If (Not (InStr(ItemDataText, "Itemlevel:") or InStr(ItemDataText, "Item Level:")) and Not Item.IsGem and Not Item.IsCurrency and Not Item.IsDivinationCard and Not Item.IsProphecy) { return Item.Name } @@ -7518,7 +7589,7 @@ ParseItemData(ItemDataText, ByRef RarityLevel="") } ; Don't do this on Divination Cards or this script crashes on trying to do the ParseItemLevel - Else If (Not Item.IsCurrency and Not Item.IsDivinationCard) + Else If (Not Item.IsCurrency and Not Item.IsDivinationCard and Not Item.IsProphecy) { regex := ["^Sacrifice At", "^Fragment of", "^Mortal ", "^Offering to ", "'s Key$", "Ancient Reliquary Key"] For key, val in regex { @@ -7656,6 +7727,7 @@ ParseItemData(ItemDataText, ByRef RarityLevel="") ; Start assembling the text for the tooltip TT := Item.Name + If (Item.TypeName && (Item.TypeName != Item.Name)) { TT := TT . "`n" . Item.TypeName @@ -7762,6 +7834,12 @@ ParseItemData(ItemDataText, ByRef RarityLevel="") TT := TT . "`n--------`n" . CardDescription } + + If (Item.IsProphecy) + { + Restriction := StrLen(Item.DifficultyRestriction) > 0 ? Item.DifficultyRestriction : "None" + TT := TT . "`n--------`nDifficulty Restriction: " Restriction + } If (Item.IsMap) { @@ -9705,7 +9783,7 @@ HighlightItems(broadTerms = false) { Globals.Set("TierRelativeToItemLevelOverride", Opts.TierRelativeToItemLevel) ParsedData := ParseItemData(CBContents) - + If (Item.Name) { rarity := "" If (Item.RarityLevel = 2) { @@ -9729,6 +9807,18 @@ HighlightItems(broadTerms = false) { terms.push(Item.Name) } } + ; prophecies + Else If (Item.IsProphecy) { + If (broadTerms) { + terms.push("this prophecy") + } Else { + terms.push("this prophecy") + If (StrLen(Item.DifficultyRestriction)) { + terms.push(Item.DifficultyRestriction) + } + terms.push(Item.Name) + } + } ; essences Else If (Item.IsEssence) { If (broadTerms) { @@ -9758,6 +9848,7 @@ HighlightItems(broadTerms = false) { ; flasks Else If (Item.IsFlask) { If (broadTerms) { + terms.push("Consumes") terms.push(Item.SubType) } Else { terms.push(Item.TypeName) @@ -9804,10 +9895,18 @@ HighlightItems(broadTerms = false) { } Else If (Item.GripType == "2H") { prefix := "Two Handed" } - ; add a space since all these terms have a preceding one, this reduces the chance of accidental matches - ; for example "Ring" found in "Voidbringers" or "during Flask effect" - terms.push(prefix " " Item.SubType) - } + + ; Handle Talismans, they have SubType "Amulet" but this won't be found ingame. + If (Item.IsTalisman) { + term := "Talisman Tier:" + } Else { + ; add a space since all these terms have a preceding one, this reduces the chance of accidental matches + ; for example "Ring" found in "Voidbringers" or "during Flask effect" + term := " " Item.SubType + } + + terms.push(prefix . term) + } ; armour pieces are a bit special, the ingame information doesn't include "armour/body armour" or something alike. ; we can use the item defenses though to match armour pieces with the same defense types (can't differentiate between "Body Armour" and "Helmet"). Else If (InStr(Item.BaseType, "Armour")) { @@ -9828,12 +9927,24 @@ HighlightItems(broadTerms = false) { } If (terms.length() > 0) { - SendInput ^{sc021} + SendInput ^{sc021} ; sc021 = f + searchText = For key, val in terms { - SendInput "%val%" - SendInput {Space} + searchText = %searchText% "%val%" } - SendInput ^{sc02f}{Enter} ; sc021 = f sc02f = v + + ; the search field has a 50 character limit, we have to close the last term with a quotation mark + If (StrLen(searchText) > 50) { + newString := SubStr(searchText, 1, 50) + temp := RegExReplace(newString, "i)""", Replacement = "", QuotationMarks) + ; make sure we have an equal amount of quotation marks (all terms properly enclosed) + If (QuotationMarks&1) { + searchText := RegExReplace(newString, "i).$", """") + } + } + + SendInput %searchText% + SendInput ^{sc02f}{Enter} ; sc02f = v } Else { ; send ctrl + f in case we don't have information to input SendInput ^{sc021} diff --git a/resources/tests/Test_WinHTTPRequest.ahk b/resources/tests/Test_WinHTTPRequest.ahk index a409303a..ab447f59 100644 --- a/resources/tests/Test_WinHTTPRequest.ahk +++ b/resources/tests/Test_WinHTTPRequest.ahk @@ -13,20 +13,20 @@ FileCreateDir, %A_ScriptDir%\test_temp Class_Console("console",0,335,600,900,,,,9) console.show() -urls := ["https://api.github.com/repos/PoE-TradeMacro/PoE-TradeMacro/releases", "http://poe.trade"] +urls := ["https://api.github.com/repos/PoE-TradeMacro/PoE-TradeMacro/releases", "http://poe.trade", "http://poe.trade/search/seridonomosure"] -Loop, 2 { +Loop, % urls.MaxIndex() { HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1") url := urls[A_Index] - console.log("Download test with url : " url) + console.log("---------------------------------------------------`nDownload test with url : " url) UrlDownloadToFile, %url%, %A_ScriptDir%\test_temp\urlDownloadToFile%A_Index%_output.txt If (!ErrorLevel) { FileRead, file, %A_ScriptDir%\test_temp\urlDownloadToFile%A_Index%_output.txt - console.log("Testing UrlDownloadToFile: No errors.`n Output saved in: " A_ScriptDir "\test_temp\urlDownloadToFile_output.txt" "`nContent Length: " StrLen(file)) + console.log("Testing UrlDownloadToFile: No errors.`n Output saved in: " A_ScriptDir "\test_temp\urlDownloadToFile" A_Index "_output.txt" "`nContent Length: " StrLen(file)) } Else { - console.log("Testing UrlDownloadToFile: Failed.`nTried saving output to " A_ScriptDir "\test_temp\urlDownloadToFile_output.txt") + console.log("Testing UrlDownloadToFile: Failed.`nTried saving output to " A_ScriptDir "\test_temp\urlDownloadToFile" A_Index "_output.txt") } Encoding := "utf-8" @@ -51,14 +51,15 @@ Loop, 2 { oADO.Close() } If (StrLen(html) > 0) { - console.log("First test downloading to variable using WinHTTP adodb.stream successful." "`nContent Length: " StrLen(html)) + console.log("First test downloading to variable using WinHTTP adodb.stream successful. (Catching Errors)" "`nContent Length: " StrLen(html)) } Else { - console.log("First test downloading to variable using WinHTTP adodb.stream returned empty string.") + console.log("First test downloading to variable using WinHTTP adodb.stream returned an empty string.") } } Catch e { console.log("Exception thrown!`n`nwhat: " e.what "`nfile: " e.file "`nline: " e.line "`nmessage: " e.message "`nextra: " e.extra) } + ; Test without catching errors If Encoding { oADO := ComObjCreate("adodb.stream") @@ -74,9 +75,9 @@ Loop, 2 { } If (StrLen(html) > 0) { - console.log("Second test downloading to variable using WinHTTP adodb.stream successful." "`nContent Length: " StrLen(html)) + console.log("Second test downloading to variable using WinHTTP adodb.stream successful. (Not catching Errors)" "`nContent Length: " StrLen(html)) } Else { - console.log("Second test downloading to variable using WinHTTP adodb.stream returned empty string.") + console.log("Second test downloading to variable using WinHTTP adodb.stream returned an empty string.") } console.log("-----------------------------------------") } \ No newline at end of file From 891d0b67acc146f36caa06a7d17f0c79c81dea9f Mon Sep 17 00:00:00 2001 From: aRTy42 Date: Sat, 22 Apr 2017 17:17:27 +0200 Subject: [PATCH 2/9] Removed old flask code --- resources/ahk/POE-ItemInfo.ahk | 145 +-------------------------------- 1 file changed, 1 insertion(+), 144 deletions(-) diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index 9410436e..b4aefcf2 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -2331,60 +2331,8 @@ ParseFlaskAffixes(ItemDataAffixes) } } - /* - IfInString, A_LoopField, Dispels - { - ; Covers Shock, Burning and Frozen and Chilled - If (NumSuffixes < 1) - { - NumSuffixes += 1 - } - Continue - } - IfInString, A_LoopField, Removes Bleeding - { - If (NumSuffixes < 1) - { - NumSuffixes += 1 - } - Continue - } - IfInString, A_LoopField, Removes Curses on use - { - If (NumSuffixes < 1) - { - NumSuffixes += 1 - } - Continue - } - IfInString, A_LoopField, during flask effect - { - If (NumSuffixes < 1) - { - NumSuffixes += 1 - } - Continue - } - IfInString, A_LoopField, Adds Knockback - { - If (NumSuffixes < 1) - { - NumSuffixes += 1 - } - Continue - } - IfInString, A_LoopField, Life Recovery to Minions - { - If (NumSuffixes < 1) - { - NumSuffixes += 1 - } - Continue - } - */ - ; Prefixes - prefixes := ["Recovery Speed", "Amount Recovered", "Charges", "Instant", "Charge when", "Recovery when", "Mana Recovered", "Mana Recovered", "increased Duration", "increased Charge Recovery", "reduced Charges used"] + prefixes := ["Recovery Speed", "Amount Recovered", "Charges", "Instant", "Charge when", "Recovery when", "Mana Recovered", "increased Duration", "increased Charge Recovery", "reduced Charges used"] For key, prefix in prefixes { If (RegExMatch(A_LoopField, "i)" prefix, match)) { If (NumPrefixes < 1) @@ -2394,97 +2342,6 @@ ParseFlaskAffixes(ItemDataAffixes) Continue } } - - /* - IfInString, A_LoopField, Recovery Speed - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Amount Recovered - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Charges - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Instant - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Charge when - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Recovery when - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Mana Recovered - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, Life Recovered - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, increased Duration - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, increased Charge Recovery - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - IfInString, A_LoopField, reduced Charges used - { - If (NumPrefixes < 1) - { - NumPrefixes += 1 - } - Continue - } - */ } AffixTotals.NumPrefixes := NumPrefixes From df4e046bf4734b42b3e7ad62fcafaea307370cae Mon Sep 17 00:00:00 2001 From: Eruyome Date: Tue, 25 Apr 2017 01:25:02 +0200 Subject: [PATCH 3/9] item highlighting improvements and fixes (#85) * item highlighting improvements * added clipboard reversion for highlight item function * more highlighting improvements * removed msgbox * fixed clipboard reversal --- resources/ahk/POE-ItemInfo.ahk | 50 +++++++++++++++++++--- resources/ahk/default_AdditionalMacros.txt | 16 ++++--- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index b4aefcf2..f7ffe44d 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -9624,11 +9624,12 @@ CloseScripts() { ExitApp } -HighlightItems(broadTerms = false) { +HighlightItems(broadTerms = false, leaveSearchField = true, addSpaceAfterQuotationMark = false) { ; Highlights items via stash search (also in vendor search) IfWinActive, Path of Exile ahk_class POEWindowClass { Global Item, Opts, Globals, ItemData + ClipBoardTemp := Clipboard SuspendPOEItemScript = 1 ; This allows us to handle the clipboard change event Send ^{sc02E} ; ^{c} Sleep 100 @@ -9661,6 +9662,11 @@ HighlightItems(broadTerms = false) { terms.push("Rarity: " Item.BaseType) } } Else { + If (Item.IsUnique) { + terms.push("Rarity: Unique") + } Else { + terms.push("Rarity: " Item.BaseType) + } terms.push(Item.Name) } } @@ -9736,7 +9742,7 @@ HighlightItems(broadTerms = false) { } Else { terms.push(Item.Name) } - } + } ; other items (weapons, armour pieces, jewelry etc) Else { If (broadTerms) { @@ -9787,28 +9793,58 @@ HighlightItems(broadTerms = false) { SendInput ^{sc021} ; sc021 = f searchText = For key, val in terms { - searchText = %searchText% "%val%" + ; some keyboard layouts translate special characters like ^ ' " ` ~ combined with e/i/u/o/a into a special character, for example Dutch: ë + ; solution: add a space after every one of those characters + If (addSpaceAfterQuotationMark) { + If (RegExMatch(val, "i)^[eioau]")) { + ; space after opening quotation mark only needed for vowels + searchText = %searchText% " %val%" + } Else { + searchText = %searchText% "%val%" + } + + If (key == terms.Length()) { + ; the last space won't be added/typed so we add a tailing character and remove it again + ; this should result in the string ending with "{Space} + space := " s" + searchText = %searchText% %space% + StringTrimRight, searchText, searchText, 2 + } + } Else { + searchText = %searchText% "%val%" + } } - + ; the search field has a 50 character limit, we have to close the last term with a quotation mark If (StrLen(searchText) > 50) { newString := SubStr(searchText, 1, 50) temp := RegExReplace(newString, "i)""", Replacement = "", QuotationMarks) ; make sure we have an equal amount of quotation marks (all terms properly enclosed) If (QuotationMarks&1) { - searchText := RegExReplace(newString, "i).$", """") + If (addSpaceAfterQuotationMark) { + searchText := RegExReplace(newString, "i).{2}$", """ ") + } Else { + searchText := RegExReplace(newString, "i).$", """") + } } } SendInput %searchText% - SendInput ^{sc02f}{Enter} ; sc02f = v + If (leaveSearchField) { + SendInput {Enter} + } Else { + SendInput ^{A} + } } Else { ; send ctrl + f in case we don't have information to input SendInput ^{sc021} } SuspendPOEItemScript = 0 ; Allow Item info to handle clipboard change event - SetClipboardContents("") + If (Item.Name) { + ; revert the initial clipboard upon succeeding to parse any item (doesn't cause clipboard change events otherwise) + Clipboard := ClipBoardTemp + } } } diff --git a/resources/ahk/default_AdditionalMacros.txt b/resources/ahk/default_AdditionalMacros.txt index 5400cf28..7bf38c76 100644 --- a/resources/ahk/default_AdditionalMacros.txt +++ b/resources/ahk/default_AdditionalMacros.txt @@ -1,8 +1,14 @@ - Pause::TogglePOEItemScript() ;pause item parsing with the pause key (other macros remain). - #D::WinMinimize, A ;Winkey+D minimizes the active PoE window (PoE stays minimized this way). - ^F::HighlightItems() ;Ctrl+F fills search bar in the stash or vendor screens with item's name or info you're hovering over. - ^!F::HighlightItems(true) ;Ctrl+Alt+F uses much broader search terms for the highlight function. -; ^Escape::CloseScripts() ;Ctrl+Esc closes all running scripts specified by (and including) ItemInfo or TradeMacro. + Pause::TogglePOEItemScript() ; pause item parsing with the pause key (other macros remain). + #D::WinMinimize, A ; Winkey+D minimizes the active PoE window (PoE stays minimized this way). + + ^F::HighlightItems(false,true,false) ; Ctrl+F fills search bar in the stash or vendor screens with item's name or info you're hovering over. + ; Function parameters, change if needed or wanted: + ; 1. Use broader terms, default = false. + ; 2. Leave the search field after pasting the search terms, default = true. + ; 3. Add a space after every opening quotation mark, default = false. (Some keyboard layouts need this to prevent adding special characters, Dutch for example.) + ^!F::HighlightItems(true,true,false) ; Ctrl+Alt+F uses much broader search terms for the highlight function. + +; ^Escape::CloseScripts() ; Ctrl+Esc closes all running scripts specified by (and including) ItemInfo or TradeMacro. ; F4::SendInput {Enter}/kick own_char_name{Enter} ; quickly leave a group by kicking yourself. Only works for one specific character name. F5::SendInput {Enter}/hideout{Enter} ; go to hideout with F5 From 49a6223e893b5f241aa0e415ed9df9d6f952334f Mon Sep 17 00:00:00 2001 From: Eruyome Date: Thu, 27 Apr 2017 12:02:08 +0200 Subject: [PATCH 4/9] reworked and formatted some descriptions (mostly additional macros) (#86) --- resources/ahk/POE-ItemInfo.ahk | 8 ++--- resources/ahk/default_AdditionalMacros.txt | 39 +++++++++++++--------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index f7ffe44d..a3653890 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -9624,7 +9624,7 @@ CloseScripts() { ExitApp } -HighlightItems(broadTerms = false, leaveSearchField = true, addSpaceAfterQuotationMark = false) { +HighlightItems(broadTerms = false, leaveSearchField = true, deadKeysWorkaround = false) { ; Highlights items via stash search (also in vendor search) IfWinActive, Path of Exile ahk_class POEWindowClass { @@ -9793,9 +9793,9 @@ HighlightItems(broadTerms = false, leaveSearchField = true, addSpaceAfterQuotati SendInput ^{sc021} ; sc021 = f searchText = For key, val in terms { - ; some keyboard layouts translate special characters like ^ ' " ` ~ combined with e/i/u/o/a into a special character, for example Dutch: ë + ; some keyboard layouts translate special characters like ^ ' " ` ~ combined with e/i/u/o/a into a special character, for example Dutch: ë (dead keys) ; solution: add a space after every one of those characters - If (addSpaceAfterQuotationMark) { + If (deadKeysWorkaround) { If (RegExMatch(val, "i)^[eioau]")) { ; space after opening quotation mark only needed for vowels searchText = %searchText% " %val%" @@ -9821,7 +9821,7 @@ HighlightItems(broadTerms = false, leaveSearchField = true, addSpaceAfterQuotati temp := RegExReplace(newString, "i)""", Replacement = "", QuotationMarks) ; make sure we have an equal amount of quotation marks (all terms properly enclosed) If (QuotationMarks&1) { - If (addSpaceAfterQuotationMark) { + If (deadKeysWorkaround) { searchText := RegExReplace(newString, "i).{2}$", """ ") } Else { searchText := RegExReplace(newString, "i).$", """") diff --git a/resources/ahk/default_AdditionalMacros.txt b/resources/ahk/default_AdditionalMacros.txt index 7bf38c76..5ee18d1e 100644 --- a/resources/ahk/default_AdditionalMacros.txt +++ b/resources/ahk/default_AdditionalMacros.txt @@ -1,26 +1,33 @@ - Pause::TogglePOEItemScript() ; pause item parsing with the pause key (other macros remain). - #D::WinMinimize, A ; Winkey+D minimizes the active PoE window (PoE stays minimized this way). +;###########----------------- Additional Macros -------------------########### +;# Lines/text with a semicolon (;) in front are considered comments. # +;# Remove a semicolon to enable specific hotkeys or add one to disable them. # +;# Hotkeys you can use: https://autohotkey.com/docs/KeyList.htm # +;# Autohotkey Quick Reference: https://autohotkey.com/docs/AutoHotkey.htm # +;###########-------------------------------------------------------########### + + Pause::TogglePOEItemScript() ; Pause item parsing with the pause key (other macros remain). + #D::WinMinimize, A ; Winkey+D minimizes the active PoE window (PoE stays minimized this way). - ^F::HighlightItems(false,true,false) ; Ctrl+F fills search bar in the stash or vendor screens with item's name or info you're hovering over. + ^F::HighlightItems(false,true,false) ; Ctrl+F fills search bars in the stash or vendor screens with the item's name or info you're hovering over. ; Function parameters, change if needed or wanted: ; 1. Use broader terms, default = false. ; 2. Leave the search field after pasting the search terms, default = true. - ; 3. Add a space after every opening quotation mark, default = false. (Some keyboard layouts need this to prevent adding special characters, Dutch for example.) - ^!F::HighlightItems(true,true,false) ; Ctrl+Alt+F uses much broader search terms for the highlight function. + ; 3. Workaround for keyboard layouts with "dead keys", default = false. (Some Layouts need this to prevent adding special characters when using a quotation mark). + ^!F::HighlightItems(true,true,false) ; Ctrl+Alt+F uses much broader search terms for the highlight function. -; ^Escape::CloseScripts() ; Ctrl+Esc closes all running scripts specified by (and including) ItemInfo or TradeMacro. +; ^Escape::CloseScripts() ; Ctrl+Esc closes all running scripts specified by (and including) ItemInfo or TradeMacro. -; F4::SendInput {Enter}/kick own_char_name{Enter} ; quickly leave a group by kicking yourself. Only works for one specific character name. - F5::SendInput {Enter}/hideout{Enter} ; go to hideout with F5 - ^WheelDown::SendInput {Right} ; Ctrl+scroll down scrolls through stash tabs rightward - ^WheelUp::SendInput {Left} ; Ctrl+scroll up scrolls through stash tabs leftward - ~RButton & WheelDown::Send {Right} ; holding right mouse button+scroll down scrolls through stash tabs rightward - ~RButton & WheelUp::Send {Left} ; holding right mouse button+scroll up scrolls through stash tabs leftward +; F4::SendInput {Enter}/kick own_char_name{Enter} ; Quickly leave a group by kicking yourself. Only works for one specific character name. + F5::SendInput {Enter}/hideout{Enter} ; Go to hideout with F5. + ^WheelDown::SendInput {Right} ; Ctrl+scroll down scrolls through stash tabs rightward. + ^WheelUp::SendInput {Left} ; Ctrl+scroll up scrolls through stash tabs leftward. + ~RButton & WheelDown::Send {Right} ; Holding right mouse button+scroll down scrolls through stash tabs rightward + ~RButton & WheelUp::Send {Left} ; Holding right mouse button+scroll up scrolls through stash tabs leftward. -; ^RButton::SendInput ^c ; Ctrl+right mouse button sends ctrl+c -; F9::SendInput {Enter}/remaining{Enter} ; mobs remaining with F9 -; F10::SendInput {Enter}/global 820{Enter} ; join a channel with F10 -; F11::setAfkMessage() ; pastes afk message to your chat and marks "X" so you can type in the estimated time +; ^RButton::SendInput ^c ; Ctrl+right mouse button sends ctrl+c. +; F9::SendInput {Enter}/remaining{Enter} ; Mobs remaining with F9. +; F10::SendInput {Enter}/global 820{Enter} ; Join a channel with F10. +; F11::setAfkMessage() ; Pastes afk message to your chat and marks "X" so you can type in the estimated time. setAfkMessage(){ T1 := A_Now From 201c5888206ac06802866195ae19c41c69aefef4 Mon Sep 17 00:00:00 2001 From: aRTy42 Date: Thu, 27 Apr 2017 20:42:12 +0200 Subject: [PATCH 5/9] GemLevel Chaos/UnsetRing --- data/GemLevel_Chaos.txt | 3 ++- data/GemLevel_UnsetRing.txt | 3 +++ resources/ahk/POE-ItemInfo.ahk | 9 ++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 data/GemLevel_UnsetRing.txt diff --git a/data/GemLevel_Chaos.txt b/data/GemLevel_Chaos.txt index 1cb0814e..d1382e37 100644 --- a/data/GemLevel_Chaos.txt +++ b/data/GemLevel_Chaos.txt @@ -1 +1,2 @@ -40|1 \ No newline at end of file +4|1 +55|2 \ No newline at end of file diff --git a/data/GemLevel_UnsetRing.txt b/data/GemLevel_UnsetRing.txt new file mode 100644 index 00000000..c82e30fe --- /dev/null +++ b/data/GemLevel_UnsetRing.txt @@ -0,0 +1,3 @@ +2|1 +50|2 +76|3 \ No newline at end of file diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index a3653890..b311649f 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -5190,7 +5190,14 @@ ParseAffixes(ItemDataAffixes, Item) } Else If (InStr(A_LoopField, "Socketed Gems")) { - ValueRange := LookupAffixData("data\GemLevel.txt", ItemLevel, CurrValue, "", CurrTier) + If (ItemSubType == "Ring") + { + ValueRange := LookupAffixData("data\GemLevel_UnsetRing.txt", ItemLevel, CurrValue, "", CurrTier) + } + Else + { + ValueRange := LookupAffixData("data\GemLevel.txt", ItemLevel, CurrValue, "", CurrTier) + } } NumPrefixes += 1 AppendAffixInfo(MakeAffixDetailLine(A_LoopField, "Prefix", ValueRange, CurrTier), A_Index) From c9f601f059e2be0ac14ac1bbb269efefc3331f20 Mon Sep 17 00:00:00 2001 From: aRTy42 Date: Thu, 4 May 2017 14:22:37 +0200 Subject: [PATCH 6/9] Update .gitattributes --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitattributes b/.gitattributes index 0208b6bc..4c5e0393 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,9 @@ # Auto detect text files and perform LF normalization * text=auto +*.txt text +*.ini text + # Custom for Visual Studio *.cs diff=csharp From 95003966afdc5894363ab832a3dfb18b50d4d717 Mon Sep 17 00:00:00 2001 From: aRTy42 Date: Thu, 4 May 2017 18:01:03 +0200 Subject: [PATCH 7/9] Update .gitattributes --- .gitattributes | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 4c5e0393..6e44cdbb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,9 @@ # Auto detect text files and perform LF normalization * text=auto -*.txt text -*.ini text +# Declare files that will always have CRLF line endings on checkout +*.txt text eol=crlf +*.ini text eol=crlf # Custom for Visual Studio *.cs diff=csharp From 310525a5b7e6fef92089b32d36fbb59c5f265825 Mon Sep 17 00:00:00 2001 From: Eruyome Date: Sun, 14 May 2017 01:16:38 +0200 Subject: [PATCH 8/9] Item highlighting improvements/fixes (#88) * WIP, use clipboard pasting for item highlighting as a better dead key workaround * removed obsolete deadKeyWorkaround * fixed some item highlighting issue --- resources/ahk/POE-ItemInfo.ahk | 87 ++++++++++------------ resources/ahk/default_AdditionalMacros.txt | 5 +- 2 files changed, 40 insertions(+), 52 deletions(-) diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index b311649f..44dc83d1 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -9631,23 +9631,34 @@ CloseScripts() { ExitApp } -HighlightItems(broadTerms = false, leaveSearchField = true, deadKeysWorkaround = false) { +HighlightItems(broadTerms = false, leaveSearchField = true) { ; Highlights items via stash search (also in vendor search) IfWinActive, Path of Exile ahk_class POEWindowClass { Global Item, Opts, Globals, ItemData + ClipBoardTemp := Clipboard SuspendPOEItemScript = 1 ; This allows us to handle the clipboard change event - Send ^{sc02E} ; ^{c} - Sleep 100 - - CBContents := GetClipboardContents() - CBContents := PreProcessContents(CBContents) - Globals.Set("ItemText", CBContents) - Globals.Set("TierRelativeToItemLevelOverride", Opts.TierRelativeToItemLevel) - - ParsedData := ParseItemData(CBContents) + ; Parse the clipboard contents twice. + ; If the clipboard contains valid item data before we send ctrl + c to try and parse an item via ctrl + f then don't restore that clipboard data later on. + ; This prevents the highlighting funtion to fill search fields with data from previous item parsings/manual data copying since + ; that clipboard data would always be restored again. + Loop, 2 { + If (A_Index = 2) { + Clipboard := + Send ^{sc02E} ; ^{c} + Sleep 100 + } + CBContents := GetClipboardContents() + CBContents := PreProcessContents(CBContents) + Globals.Set("ItemText", CBContents) + Globals.Set("TierRelativeToItemLevelOverride", Opts.TierRelativeToItemLevel) + ParsedData := ParseItemData(CBContents) + If (A_Index = 1 and Item.Name) { + dontRestoreClipboard := true + } + } If (Item.Name) { rarity := "" @@ -9799,27 +9810,8 @@ HighlightItems(broadTerms = false, leaveSearchField = true, deadKeysWorkaround = If (terms.length() > 0) { SendInput ^{sc021} ; sc021 = f searchText = - For key, val in terms { - ; some keyboard layouts translate special characters like ^ ' " ` ~ combined with e/i/u/o/a into a special character, for example Dutch: ë (dead keys) - ; solution: add a space after every one of those characters - If (deadKeysWorkaround) { - If (RegExMatch(val, "i)^[eioau]")) { - ; space after opening quotation mark only needed for vowels - searchText = %searchText% " %val%" - } Else { - searchText = %searchText% "%val%" - } - - If (key == terms.Length()) { - ; the last space won't be added/typed so we add a tailing character and remove it again - ; this should result in the string ending with "{Space} - space := " s" - searchText = %searchText% %space% - StringTrimRight, searchText, searchText, 2 - } - } Else { - searchText = %searchText% "%val%" - } + For key, val in terms { + searchText = %searchText% "%val%" } ; the search field has a 50 character limit, we have to close the last term with a quotation mark @@ -9827,31 +9819,28 @@ HighlightItems(broadTerms = false, leaveSearchField = true, deadKeysWorkaround = newString := SubStr(searchText, 1, 50) temp := RegExReplace(newString, "i)""", Replacement = "", QuotationMarks) ; make sure we have an equal amount of quotation marks (all terms properly enclosed) - If (QuotationMarks&1) { - If (deadKeysWorkaround) { - searchText := RegExReplace(newString, "i).{2}$", """ ") - } Else { - searchText := RegExReplace(newString, "i).$", """") - } + If (QuotationMarks&1) { + searchText := RegExReplace(newString, "i).$", """") } } - - SendInput %searchText% + + Clipboard := searchText + Sleep 10 + SendEvent ^{sc02f} ; ctrl + v If (leaveSearchField) { - SendInput {Enter} - } Else { - SendInput ^{A} + SendInput {sc01c} ; enter + } Else { + SendInput ^{sc01e} ; ctrl + a } - } Else { - ; send ctrl + f in case we don't have information to input - SendInput ^{sc021} + } Else { + SendInput ^{sc021} ; send ctrl + f in case we don't have information to input } - SuspendPOEItemScript = 0 ; Allow Item info to handle clipboard change event - If (Item.Name) { - ; revert the initial clipboard upon succeeding to parse any item (doesn't cause clipboard change events otherwise) + Sleep, 10 + If (!dontRestoreClipboard) { Clipboard := ClipBoardTemp - } + } + SuspendPOEItemScript = 0 ; Allow Item info to handle clipboard change event } } diff --git a/resources/ahk/default_AdditionalMacros.txt b/resources/ahk/default_AdditionalMacros.txt index 5ee18d1e..61ef51b1 100644 --- a/resources/ahk/default_AdditionalMacros.txt +++ b/resources/ahk/default_AdditionalMacros.txt @@ -8,12 +8,11 @@ Pause::TogglePOEItemScript() ; Pause item parsing with the pause key (other macros remain). #D::WinMinimize, A ; Winkey+D minimizes the active PoE window (PoE stays minimized this way). - ^F::HighlightItems(false,true,false) ; Ctrl+F fills search bars in the stash or vendor screens with the item's name or info you're hovering over. + ^F::HighlightItems(false,true) ; Ctrl+F fills search bars in the stash or vendor screens with the item's name or info you're hovering over. ; Function parameters, change if needed or wanted: ; 1. Use broader terms, default = false. ; 2. Leave the search field after pasting the search terms, default = true. - ; 3. Workaround for keyboard layouts with "dead keys", default = false. (Some Layouts need this to prevent adding special characters when using a quotation mark). - ^!F::HighlightItems(true,true,false) ; Ctrl+Alt+F uses much broader search terms for the highlight function. + ^!F::HighlightItems(true,true) ; Ctrl+Alt+F uses much broader search terms for the highlight function. ; ^Escape::CloseScripts() ; Ctrl+Esc closes all running scripts specified by (and including) ItemInfo or TradeMacro. From 2e1cbe86f2a27e15fd0004093a43279408fd98a2 Mon Sep 17 00:00:00 2001 From: Eruyome Date: Mon, 5 Jun 2017 23:24:11 +0200 Subject: [PATCH 9/9] fixed dexterity bonus pseudo mod calculation (#90) --- resources/ahk/POE-ItemInfo.ahk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index 44dc83d1..4908552c 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -8249,7 +8249,7 @@ CreatePseudoMods(mods, returnAllMods := False) { energyShieldPercentGlobal := Floor(intelligenceFlat/5) } If (dexterityFlat) { - accuracyRatingFlat := accuracyRatingFlat + Floor(dexterityFlat/2) + accuracyRatingFlat := accuracyRatingFlat + Floor(dexterityFlat*2) evasionRatingPercentGlobal := Floor(dexterityFlat/5) }