public
Last active

POE Tooltip Script w/ Sockets for /u/jZampage

  • Download Gist
poeDisplay.ahk
AutoHotkey
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
; This script is a cleaned up and enhanced version of the one found here:
; https://www.pathofexile.com/forum/view-thread/594346
 
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent ; Stay open in background
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
StringCaseSense, On ; Match strings with case.
 
; Options
; Pixels mouse must move to auto-dismiss tooltip
MouseMoveThreshold := 40
; Font size for the tooltip, leave empty for default
FontSize :=
 
; Menu tooltip
Menu, tray, Tip, Path of Exile Itemlevel and DPS Display (fork by Aeons)
 
; Create font for later use
FixedFont := CreateFont()
 
; Creates a font for later use
CreateFont()
{
global FontSize
Options :=
If (!(FontSize = ""))
{
Options = s%FontSize%
}
Gui Font, %Options%, Courier New
Gui Font, %Options%, Consolas
Gui Add, Text, HwndHidden,
SendMessage, 0x31,,,, ahk_id %Hidden%
return ErrorLevel
}
 
; Sets the font for a created ahk tooltip
SetFont(Font)
{
SendMessage, 0x30, Font, 1,, ahk_class tooltips_class32 ahk_exe autohotkey.exe
}
 
; Parse elemental damage
ParseDamage(String, DmgType, ByRef DmgLo, ByRef DmgHi)
{
IfInString, String, %DmgType% Damage
{
IfNotInString, String, increased
{
StringSplit, Arr, String, %A_Space%
StringSplit, Arr, Arr2, -
DmgLo := Arr1
DmgHi := Arr2
}
}
}
 
; Parse clipboard content for item level and dps
ParseClipBoardChanges()
{
NameIsDone := False
ItemName :=
ItemLevel := -1
IsWeapon := False
HasSockets := False
ItemSockets :=
PhysLo := 0
PhysHi := 0
Quality := 0
AttackSpeed := 0
PhysMult := 0
ChaoLo := 0
ChaoHi := 0
ColdLo := 0
ColdHi := 0
FireLo := 0
FireHi := 0
LighLo := 0
LighHi := 0
 
Loop, Parse, Clipboard, `n, `r
{
; Clipboard must have "Rarity:" in the first line
If A_Index = 1
{
IfNotInString, A_LoopField, Rarity:
{
Exit
}
Else
{
Continue
}
}
 
; Get name
If Not NameIsDone
{
If A_LoopField = --------
{
NameIsDone := True
}
Else
{
ItemName := ItemName . A_LoopField . "`n" ; Add a line of name
}
Continue
}
 
; Get item level
IfInString, A_LoopField, Itemlevel:
{
StringSplit, ItemLevelArray, A_LoopField, %A_Space%
ItemLevel := ItemLevelArray2
Continue
}
 
; Get quality
IfInString, A_LoopField, Quality:
{
StringSplit, Arr, A_LoopField, %A_Space%, +`%
Quality := Arr2
Continue
}
 
; Get total physical damage
IfInString, A_LoopField, Physical Damage:
{
IsWeapon = True
StringSplit, Arr, A_LoopField, %A_Space%
StringSplit, Arr, Arr3, -
PhysLo := Arr1
PhysHi := Arr2
Continue
}
 
; Sockets
IfInString, A_LoopField, Sockets:
{
ItemSockets := A_LoopField
HasSockets = True
Continue
}
 
; These only make sense for weapons
If IsWeapon
{
; Get attack speed
IfInString, A_LoopField, Attacks per Second:
{
StringSplit, Arr, A_LoopField, %A_Space%
AttackSpeed := Arr4
Continue
}
 
; Get percentage physical damage increase
IfInString, A_LoopField, increased Physical Damage
{
StringSplit, Arr, A_LoopField, %A_Space%, `%
PhysMult := Arr1
Continue
}
 
; Parse elemental damage
ParseDamage(A_LoopField, "Chaos", ChaoLo, ChaoHi)
ParseDamage(A_LoopField, "Cold", ColdLo, ColdHi)
ParseDamage(A_LoopField, "Fire", FireLo, FireHi)
ParseDamage(A_LoopField, "Lightning", LightLo, LightHi)
}
}
If ItemLevel = -1 ; Something without an itemlevel
{
Exit
}
; Get position of mouse cursor
global X
global Y
MouseGetPos, X, Y
 
; All items should show name and item level
; Pad to 3 places
ItemLevel := " " + ItemLevel
StringRight, ItemLevel, ItemLevel, 3
TT = %ItemName%Item lvl: %ItemLevel%
 
If HasSockets {
TT = %TT%`n%ItemSockets%
}
 
; DPS calculations
If IsWeapon {
SetFormat, FloatFast, 5.1
 
PhysDps := ((PhysLo + PhysHi) / 2) * AttackSpeed
EleDps := ((ChaoLo + ChaoHi + ColdLo + ColdHi + FireLo + FireHi + LighLo + LighHi) / 2) * AttackSpeed
TotalDps := PhysDps + EleDps
 
ItemLevel := " " + ItemLevel
StringRight, ItemLevel, ItemLevel, 3
 
TT = %TT%`nPhys DPS: %PhysDps%`nElem DPS: %EleDps%`nTotal DPS: %TotalDps%
 
; Only show Q20 values if item is not Q20
If Quality < 20
{
TotalPhysMult := (PhysMult + Quality + 100) / 100
BasePhysDps := PhysDps / TotalPhysMult
Q20Dps := BasePhysDps * ((PhysMult + 120) / 100) + EleDps
 
TT = %TT%`nQ20 DPS: %Q20Dps%
}
}
 
; Show tooltip, with fixed width font
ToolTip, %TT%, X + 35, Y + 35
global FixedFont
SetFont(FixedFont)
; Set up count variable and start timer for tooltip timeout
global ToolTipTimeout := 0
SetTimer, ToolTipTimer, 100
}
 
; Tick every 100 ms
; Remove tooltip if mouse is moved or 5 seconds pass
ToolTipTimer:
ToolTipTimeout += 1
MouseGetPos, CurrX, CurrY
MouseMoved := (CurrX - X)**2 + (CurrY - Y)**2 > MouseMoveThreshold**2
If (MouseMoved or ToolTipTimeout >= 50)
{
SetTimer, ToolTipTimer, Off
ToolTip
}
return
 
OnClipBoardChange:
ParseClipBoardChanges()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.