Skip to content

Commit 7a81364

Browse files
authored
Item parsing fixes; various improvements (#1033)
* hotkey switch WIP * fixed blighted maps not working correctly * fixed the "nearby enemies have -res" mod not working with the advanced search * increased matching priority for crafted mods (poetrade mod matching) * added button to restore old main hotkey defaults (hidden/debug) * added a "prettyfied" key combination name to hotkey lists * data file update * fixed warstaves not being parsed correctly * update/notes * notes
1 parent 5c02d59 commit 7a81364

File tree

10 files changed

+197
-125
lines changed

10 files changed

+197
-125
lines changed

data_trade/item_bases_armour.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

data_trade/prophecy_details.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

data_trade/uniques.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/ConvertKeyToKeyCode.ahk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,22 @@ KeyNameToKeyCode(Key, SC:=true) {
133133
Return _Result
134134
}
135135

136+
PrettyKeyName(KeyName) {
137+
_Result := KeyName
138+
_Result := RegExReplace(_Result, "i)[#]", "Win|")
139+
_Result := RegExReplace(_Result, "i)[!]", "alt|")
140+
_Result := RegExReplace(_Result, "i)[+]", "shift|")
141+
_Result := RegExReplace(_Result, "i)[~]", "(non blocking) ")
142+
_Result := RegExReplace(_Result, "i)[&]", "+")
143+
_Result := RegExReplace(_Result, "i)[\^]", "ctrl|")
144+
_Result := RegExReplace(_Result, "i)[<]", "(left) ")
145+
_Result := RegExReplace(_Result, "i)[>]", "(right) ")
146+
147+
_Result := Trim(RegExReplace(_Result, "i)[|]", " + "))
148+
_Result := Trim(RegExReplace(_Result, "i)[+]$", ""))
149+
150+
Return _Result
151+
}
136152

137153
KeyToSC(Key) {
138154
Return KeyNameToKeyCode(Key, true)

resources/Updates_Trade.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
The following is a list of what has been updated, starting with 1.1.0
22

3+
2.15.3
4+
================================================================================================
5+
* Changed the default (main) hotkeys from using "ctrl" to using "alt" to prevent conflicts with PoEs new second skillbar hotkeys. This will not change any settings of existing TradeMacro installations.
6+
* Fixed blighted maps not being parsed correctly.
7+
* Fixed Warstaves not being parsed correctly and therefore not working with the advanced search.
8+
* Fixed the "nearby enemies have -x% <element> Resistance" mod not working with the advanced search.
9+
* Improved the matching of parsed mods to poe.trade search options.
10+
* Various small improvements.
11+
* Updated data files (uniques etc.).
12+
313
2.15.2
414
================================================================================================
515
* Fixed an issue where it wasn't possible to disable the "Set Currency Ratio" hotkey.

resources/VersionTrade.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
TradeReleaseVersion := "v2.15.2"
1+
TradeReleaseVersion := "v2.15.3"
22
TradeAHKVersionRequired := "1.1.26.00"

resources/ahk/POE-ItemInfo.ahk

Lines changed: 51 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -712,15 +712,15 @@ ParseItemType(ItemDataStats, ItemDataNamePlate, ByRef BaseType, ByRef SubType, B
712712
; Check stats section first as weapons usually have their sub type as first line
713713
Loop, Parse, ItemDataStats, `n, `r
714714
{
715-
If (RegExMatch(A_LoopField, "i)\b((One Handed|Two Handed) (Axe|Sword|Mace)|Sceptre|Staff|Dagger|Claw|Bow|Wand)\b", match))
715+
If (RegExMatch(A_LoopField, "i)\b((One Handed|Two Handed) (Axe|Sword|Mace)|Sceptre|Warstaff|Staff|Dagger|Claw|Bow|Wand)\b", match))
716716
{
717717
BaseType := "Weapon"
718718
If (RegExMatch(match1, "i)(Sword|Axe|Mace)", subMatch)) {
719719
SubType := subMatch1
720720
} Else {
721721
SubType := match1
722722
}
723-
GripType := (RegExMatch(match1, "i)\b(Two Handed|Staff|Bow)\b")) ? "2H" : "1H"
723+
GripType := (RegExMatch(match1, "i)\b(Two Handed|Warstaff|Staff|Bow)\b")) ? "2H" : "1H"
724724
return
725725
}
726726
}
@@ -768,12 +768,10 @@ ParseItemType(ItemDataStats, ItemDataNamePlate, ByRef BaseType, ByRef SubType, B
768768
mapMatch := mapMatchList[A_Index]
769769
IfInString, LoopField, %mapMatch%
770770
{
771-
If (RegExMatch(LoopField, "\bShaped " . mapMatch))
772-
{
773-
SubType = Shaped %mapMatch%
771+
If (RegExMatch(LoopField, "\b(Shaped|Blighted|Elder) " . mapMatch, subTypeMatch)) {
772+
SubType = %subTypeMatch1% %mapMatch%
774773
}
775-
Else
776-
{
774+
Else {
777775
SubType = %mapMatch%
778776
}
779777
return
@@ -8644,7 +8642,7 @@ ModStringToObject(string, isImplicit) {
86448642
StringReplace, val, val, `n,, All
86458643
values := []
86468644

8647-
RegExMatch(val, "i) \((fractured)\)$", sType)
8645+
RegExMatch(val, "i) \((fractured|crafted)\)$", sType)
86488646
spawnType := sType1
86498647

86508648
val := RegExReplace(val, "i) \((fractured|crafted)\)$")
@@ -8667,7 +8665,7 @@ ModStringToObject(string, isImplicit) {
86678665

86688666
type := ""
86698667
; Matching "x% fire and cold resistance" or "x% to cold resist", excluding "to maximum cold resistance" and "damage penetrates x% cold resistance" and minion/totem related mods
8670-
If (RegExMatch(val, "i)to ((cold|fire|lightning)( and (cold|fire|lightning))?) resistance") and not RegExMatch(val, "i)Minion|Totem")) {
8668+
If (RegExMatch(val, "i)to ((cold|fire|lightning)( and (cold|fire|lightning))?) resistance") and not RegExMatch(val, "i)Minion|Totem|Enemies")) {
86718669
type := "Resistance"
86728670
If (RegExMatch(val, "i)fire")) {
86738671
Matches.push("Fire")
@@ -8680,7 +8678,7 @@ ModStringToObject(string, isImplicit) {
86808678
}
86818679
}
86828680
; Matching "x% fire/cold/lgitning and chaos resistance"
8683-
If (RegExMatch(val, "i)to (cold|fire|lightning) and (chaos) resistance") and not RegExMatch(val, "i)Minion|Totem")) {
8681+
If (RegExMatch(val, "i)to (cold|fire|lightning) and (chaos) resistance") and not RegExMatch(val, "i)Minion|Totem|Enemies")) {
86848682
type := "Resistance"
86858683
If (RegExMatch(val, "i)fire")) {
86868684
Matches.push("Fire")
@@ -8725,7 +8723,7 @@ ModStringToObject(string, isImplicit) {
87258723
Matches[A_Index] := match1 ? sign . "#% to " . Matches[A_Index] . " " . match1 : sign . "#" . type . "" . Matches[A_Index]
87268724
}
87278725

8728-
If (RegExMatch(val, "i)to all attributes|to all elemental (Resistances)", match) and not RegExMatch(val, "i)Minion|Totem")) {
8726+
If (RegExMatch(val, "i)to all attributes|to all elemental (Resistances)", match) and not RegExMatch(val, "i)Minion|Totem|Enemies")) {
87298727
resist := match1 ? true : false
87308728
Matches[1] := resist ? "+#% to Fire Resistance" : "+# to Strength"
87318729
Matches[2] := resist ? "+#% to Lightning Resistance" : "+# to Intelligence"
@@ -8843,7 +8841,7 @@ CreatePseudoMods(mods, returnAllMods := False) {
88438841
; Note that at this point combined mods/attributes have already been separated into two mods
88448842
; like '+ x % to fire and lightning resist' would be '+ x % to fire resist' AND '+ x % to lightning resist' as 2 different mods
88458843
For key, mod in mods {
8846-
RegExMatch(mod.name, "i) \((fractured)\)$", spawnType)
8844+
RegExMatch(mod.name, "i) \((fractured|crafted)\)$", spawnType)
88478845
If (StrLen(spawnType1)) {
88488846
mod.spawnType := spawnType1
88498847
}
@@ -8907,16 +8905,16 @@ CreatePseudoMods(mods, returnAllMods := False) {
89078905

89088906
; ### Resistances
89098907
; % to all resistances ( careful about 'max all resistances' )
8910-
Else If (RegExMatch(mod.name, "i)to all Elemental Resistances$") and not RegExMatch(mod.name, "i)Minion|Totem")) {
8908+
Else If (RegExMatch(mod.name, "i)to all Elemental Resistances$") and not RegExMatch(mod.name, "i)Minion|Totem|Enemies")) {
89118909
toAllElementalResist := toAllElementalResist + mod.values[1]
89128910
mod.simplifiedName := "xToAllElementalResistances"
89138911
}
89148912
; % to base resistances
8915-
Else If (RegExMatch(mod.name, "i)to (Cold|Fire|Lightning|Chaos) Resistance$", resistType) and not RegExMatch(mod.name, "i)Minion|Totem")) {
8913+
Else If (RegExMatch(mod.name, "i)to (Cold|Fire|Lightning|Chaos) Resistance$", resistType) and not RegExMatch(mod.name, "i)Minion|Totem|Enemies")) {
89168914
%resistType1%Resist := %resistType1%Resist + mod.values[1]
89178915
mod.simplifiedName := "xTo" resistType1 "Resistance"
89188916
}
8919-
Else If (RegExMatch(mod.name, "i)to (Cold|Fire|Lightning) and (Chaos) Resistances$") and not RegExMatch(mod.name, "i)Minion|Totem")) {
8917+
Else If (RegExMatch(mod.name, "i)to (Cold|Fire|Lightning) and (Chaos) Resistances$") and not RegExMatch(mod.name, "i)Minion|Totem|Enemies")) {
89208918
%resistType1%Resist := %resistType1%Resist + mod.values[1]
89218919
mod.simplifiedName := "xTo" resistType1 "Resistance"
89228920

@@ -10603,22 +10601,26 @@ ShowAssignedHotkeys(returnList = false) {
1060310601
For key, val in hotkeys {
1060410602
If (key = 1) {
1060510603
val.Push("NameENG")
10604+
val.Push("NameENGPretty")
1060610605
}
1060710606
Else {
10608-
val.Push(KeyCodeToKeyName(val[5]))
10607+
_keyName := KeyCodeToKeyName(val[5])
10608+
val.Push(_keyName)
10609+
val.Push(PrettyKeyName(_keyName))
1060910610
}
1061010611
}
10611-
10612+
10613+
1061210614
If (returnList) {
1061310615
Return hotkeys
1061410616
}
10615-
10617+
1061610618
Gui, ShowHotkeys:Color, ffffff, ffffff
1061710619
Gui, ShowHotkeys:Add, Text, , List of this scripts assigned hotkeys.
1061810620
Gui, ShowHotkeys:Default
1061910621
Gui, ShowHotkeys:Font, , Courier New
1062010622
Gui, ShowHotkeys:Font, , Consolas
10621-
Gui, ShowHotkeys:Add, ListView, r25 w800 NoSortHdr Grid ReadOnly, Type | Enabled | Level | Running | Key combination (Code) | Key combination (ENG name)
10623+
Gui, ShowHotkeys:Add, ListView, r25 w800 NoSortHdr Grid ReadOnly, Type | Enabled | Level | Running | Key combination (Code) | Key combination (ENG name) | Key combination (ENG pretty name)
1062210624
For key, val in hotkeys {
1062310625
If (key != 1) {
1062410626
LV_Add("", val*)
@@ -10643,7 +10645,8 @@ ShowAssignedHotkeys(returnList = false) {
1064310645
text .= "Enabled: Hotkey is assigned but enabled/disabled [on/off] via the Hotkey command." . "`n"
1064410646

1064510647
Gui, ShowHotkeys:Add, Text, , % text
10646-
10648+
Gui, ShowHotkeys:Add, Link, x10 y+10 w210 h20 cBlue BackgroundTrans, <a href="http://www.autohotkey.com/docs/Hotkeys.htm">Hotkey Options</a>
10649+
1064710650
Gui, ShowHotkeys:Show, w820 xCenter yCenter, Assigned Hotkeys
1064810651
Gui, SettingsUI:Default
1064910652
Gui, Font
@@ -12590,7 +12593,7 @@ ParseItemLootFilter(filter, item, parsingNeeded, advanced = false) {
1259012593
rules[rules.MaxIndex()].conditions.push(condition)
1259112594
}
1259212595

12593-
Else If (RegExMatch(line, "i)^.*?(Identified|Corrupted|ElderItem|SynthesisedItem|FracturedItem|ShaperItem|ShapedMap|ElderMap)\s")) {
12596+
Else If (RegExMatch(line, "i)^.*?(Identified|Corrupted|ElderItem|SynthesisedItem|FracturedItem|ShaperItem|ShapedMap|ElderMap|BlightedMap)\s")) {
1259412597
RegExMatch(line, "i)(.*?)\s(.*)", match)
1259512598

1259612599
condition := {}
@@ -12638,10 +12641,10 @@ ParseItemLootFilter(filter, item, parsingNeeded, advanced = false) {
1263812641
If (CompareNumValues(item[match1], condition.value, condition.operator)) {
1263912642
matchingConditions++
1264012643
matching_rules.push(condition.name)
12641-
}
12642-
}
12644+
}
12645+
}
1264312646
}
12644-
Else If (RegExMatch(condition.name, "i)(Identified|Corrupted|ElderItem|SynthesisedItem|FracturedItem|ShaperItem|ShapedMap)", match1)) {
12647+
Else If (RegExMatch(condition.name, "i)(Identified|Corrupted|ElderItem|SynthesisedItem|FracturedItem|ShaperItem|ShapedMap|BlightedMap|ElderMap)", match1)) {
1264512648
If (item[match1] == condition.value) {
1264612649
matchingConditions++
1264712650
matching_rules.push(condition.name)
@@ -12919,7 +12922,7 @@ FHex( int, pad=0 ) {
1291912922
Return h
1292012923
}
1292112924

12922-
CheckForGameHotkeyConflicts() {
12925+
CheckForGameHotkeyConflicts() {
1292312926
iniPath := A_MyDocuments . "\My Games\Path of Exile\"
1292412927
configs := []
1292512928
productionIni := iniPath . "production_Config.ini"
@@ -12949,62 +12952,50 @@ CheckForGameHotkeyConflicts() {
1294912952
For aKey, assignedKey in assignedKeyList {
1295012953
For cKey, convertedKey in convertedKeys {
1295112954
If (assignedKey[5] = convertedKey.value) {
12952-
obj := {"vk":assignedKey[5], "name": assignedKey[6], "game_label": convertedKey.label}
12955+
obj := {"vk":assignedKey[5], "name": assignedKey[6], "game_label": convertedKey.label, "pretty_name": assignedKey[7]}
1295312956
conflicts.push(obj)
1295412957
}
1295512958
}
1295612959
}
1295712960
}
1295812961

12959-
If (conflicts.MaxIndex() > 10) {
12960-
project := Globals.Get("ProjectName")
12961-
msg := project " detected a hotkey conflict with the Path of Exile keybindings, "
12962-
msg .= "which should be resolved before playing the game."
12963-
msg .= "`n`n" "Conflicting hotkey(s):"
12964-
For key, val in conflicts {
12965-
msg .= "`n" "- Path of Exile function: """ val.game_label """ (Virtual Key: " val.vk ", ENG name: " val.name ")"
12966-
}
12967-
12968-
MsgBox, 16, Path of Exile - %project% hotkey conflict, %msg%
12969-
}
12970-
1297112962
If (conflicts.MaxIndex()) {
1297212963
project := Globals.Get("ProjectName")
1297312964

1297412965
Gui, ShowGameHotkeyConflicts:Color, ffffff, ffffff
1297512966
msg := project " detected a hotkey conflict with the Path of Exile keybindings, "
12976-
msg .= "which should be resolved before playing the game."
12967+
msg .= "which should be resolved before playing the game. "
1297712968
msg .= "Otherwise " project " may block some of the games functions."
1297812969
Gui, ShowGameHotkeyConflicts:Add, Text, w600, % msg
1297912970

1298012971
Gui, ShowGameHotkeyConflicts:Default
1298112972
Gui, ShowGameHotkeyConflicts:Font, , Courier New
1298212973
Gui, ShowGameHotkeyConflicts:Font, , Consolas
12983-
Gui, ShowGameHotkeyConflicts:Add, ListView, r15 w600 NoSortHdr Grid ReadOnly, Game function name | Key combination (Code) | Key combination (ENG name)
12974+
12975+
Gui, ShowGameHotkeyConflicts:Font, bold
12976+
Gui, ShowGameHotkeyConflicts:Add, Text, x20 y55 h20 w200, Game function name
12977+
Gui, ShowGameHotkeyConflicts:Add, Text, x+20 yp+0 h20 w150, Key combination (Code)
12978+
Gui, ShowGameHotkeyConflicts:Add, Text, x+20 yp+0 h20 w200, Key combination (ENG name)
12979+
Gui, ShowGameHotkeyConflicts:Add, Text, x+20 yp+0 h20 w250, Key combination (pretty name)
12980+
Gui, ShowGameHotkeyConflicts:Font, norm
12981+
12982+
_height := 35
1298412983
For key, val in conflicts {
12985-
eng_name := val.name
12986-
eng_name := RegExReplace(eng_name, "i)\^", " control ")
12987-
eng_name := RegExReplace(eng_name, "i)\!", " alt ")
12988-
eng_name := RegExReplace(eng_name, "i)\+", " shift ")
12989-
eng_name := RegExReplace(eng_name, "i)(shift|control|alt)", "$1 +")
12990-
LV_Add("", val.game_label, val.vk, eng_name)
12991-
LV_ModifyCol()
12984+
_height := _height + 25
12985+
Gui, ShowGameHotkeyConflicts:Add, Text, x20 y+2 h20 w200, % val.game_label
12986+
Gui, ShowGameHotkeyConflicts:Add, Text, x+20 yp+0 h20 w150, % val.vk
12987+
Gui, ShowGameHotkeyConflicts:Add, Text, x+20 yp+0 h20 w200, % val.name
12988+
Gui, ShowGameHotkeyConflicts:Add, Text, x+20 yp+0 h20 w250, % val.pretty_name
1299212989
}
12993-
12994-
i := 0
12995-
Loop % LV_GetCount("Column")
12996-
{
12997-
i++
12998-
LV_ModifyCol(a_index,"AutoHdr")
12999-
}
13000-
12990+
Gui, ShowGameHotkeyConflicts:Add, GroupBox, w850 h%_height% y40 x10, Conflicts
12991+
1300112992
text := " ^ : ctrl key modifier" . "`n"
1300212993
text .= " ! : alt key modifier" . "`n"
1300312994
text .= " + : shift key modifier" . "`n"
1300412995
text .= "`n" . "VK : Virtual Key Code"
13005-
Gui, ShowGameHotkeyConflicts:Add, Text, , % text
13006-
13007-
Gui, ShowGameHotkeyConflicts:Show, w620 xCenter yCenter, Path of Exile - %project% keybinding conflicts
12996+
Gui, ShowGameHotkeyConflicts:Add, Text, x10 y+15, % text
12997+
Gui, ShowGameHotkeyConflicts:Add, Button, x770 y+-25 h25 w90 gShowSettingsUI, Open Settings
12998+
Gui, ShowGameHotkeyConflicts:Show, w870 xCenter yCenter, Path of Exile - %project% keybinding conflicts
1300812999
Gui, SettingsUI:Default
1300913000
Gui, Font
1301013001
}
@@ -13082,12 +13073,12 @@ AssignHotKey(Label, key, vkey, enabledState = "on") {
1308213073
; only assign it when it's enabled
1308313074
Hotkey, %VKey%, %Label%, UseErrorLevel %stateValue%
1308413075
SaveAssignedHotkey(Label, key, vkey, enabledState)
13085-
}
13076+
}
1308613077
}
1308713078

1308813079
If (ErrorLevel) {
1308913080
If (errorlevel = 1)
13090-
str := str . "`nASCII " . VKey . " - 1) The Label parameter specifies a nonexistent label name."
13081+
str := str . "`nASCII " . VKey . " - 1) The Label parameter (" Label ") specifies a nonexistent label name."
1309113082
Else If (errorlevel = 2)
1309213083
str := str . "`nASCII " . VKey . " - 2) The KeyName parameter specifies one or more keys that are either not recognized or not supported by the current keyboard layout/language. Switching to the english layout should solve this for now."
1309313084
Else If (errorlevel = 3)

0 commit comments

Comments
 (0)