Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Warn ; Enable warnings to assist with detecting common errors.
- #Persistent ; Only the user can kill the application
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- StringCaseSense, On ; Match strings with case.
- SetFormat, FloatFast, 0.2
- ; ---------------------------------------
- ; Created by mcpower - modified by Clif4D
- ; ---------------------------------------
- MouseMovePixels := 5 ; How many pixels you have to move. Edit this if you want.
- OnClipboardChange:
- IfWinActive, Path of Exile ahk_class Direct3DWindowClass ; May save CPU usage when copying stuff outside of PoE. Hasn't been tested.
- {
- ItemLevel := ""
- Name := ""
- Type := ""
- Quality := 0
- AttackSpeed := 0
- PhysicalDamageLow := 0
- PhysicalDamageHigh := 0
- IncreasedPhysicalDamage := 0
- FireDamageLow := 0
- FireDamageHigh := 0
- ColdDamageLow := 0
- ColdDamageHigh := 0
- LightningDamageLow := 0
- LightningDamageHigh := 0
- ChaosDamageLow := 0
- ChaosDamageHigh := 0
- ;ElementalDamageLow := 0
- ;ElementalDamageHigh := 0
- Armour := 0
- EvasionRating := 0
- EnergyShield := 0
- Loop, parse, Clipboard, `n, `r ; Goes through a loop with the lines of text found in the clipboard
- {
- if (A_Index = 1)
- {
- IfNotInString, A_Loopfield, Rarity: ; Starts a check whether it has "Rarity:" in the first line, otherwise exit
- {
- Exit
- }
- }
- else if (A_Index = 2)
- {
- Name := A_Loopfield
- }
- else if (A_Index = 3)
- {
- Type := A_Loopfield
- }
- else if (!ItemLevel && RegExMatch(A_Loopfield, "Itemlevel: (\d*)", SubPat))
- {
- ItemLevel := SubPat1
- }
- else if (!Quality && RegExMatch(A_Loopfield, "Quality: \+(\d*)\%", SubPat))
- {
- Quality := SubPat1/100
- }
- else if (!AttackSpeed && RegExMatch(A_Loopfield, "Attacks per Second: (\d\.\d*)", SubPat))
- {
- AttackSpeed := SubPat1
- }
- else if (!PhysicalDamageLow && RegExMatch(A_Loopfield, "Physical Damage: (\d*)-(\d*)", SubPat))
- {
- PhysicalDamageLow := SubPat1
- PhysicalDamageHigh := SubPat2
- }
- else if (!IncreasedPhysicalDamage && RegExMatch(A_Loopfield, "(\d*)\% increased Physical Damage", SubPat))
- {
- IncreasedPhysicalDamage := SubPat1/100
- }
- else if (!FireDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Fire Damage", SubPat))
- {
- FireDamageLow := SubPat1
- FireDamageHigh := SubPat2
- }
- else if (!ColdDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Cold Damage", SubPat))
- {
- ColdDamageLow := SubPat1
- ColdDamageHigh := SubPat2
- }
- else if (!LightningDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Lightning Damage", SubPat))
- {
- LightningDamageLow := SubPat1
- LightningDamageHigh := SubPat2
- }
- else if (!ChaosDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Chaos Damage", SubPat))
- {
- ChaosDamageLow := SubPat1
- ChaosDamageHigh := SubPat2
- }
- else if (!Armour && RegExMatch(A_Loopfield, "Armour: (\d*)", SubPat))
- {
- Armour:= SubPat1
- }
- else if (!EvasionRating && RegExMatch(A_Loopfield, "Evasion Rating: (\d*)", SubPat))
- {
- EvasionRating:= SubPat1
- }
- else if (!EnergyShield && RegExMatch(A_Loopfield, "Energy Shield: (\d*)", SubPat))
- {
- EnergyShield:= SubPat1
- }
- }
- if (!ItemLevel) ; If we didn't get the itemlevel...
- exit
- if (AttackSpeed) ; It's a weapon
- {
- pDPS := (PhysicalDamageLow + PhysicalDamageHigh)/2*AttackSpeed
- q20pDPS := ( round((round((PhysicalDamageLow)/(1+IncreasedPhysicalDamage+Quality))*(1+IncreasedPhysicalDamage+0.2))) + round((round((PhysicalDamageHigh)/(1+IncreasedPhysicalDamage+Quality))*(1+IncreasedPhysicalDamage+0.2))) ) /2*AttackSpeed
- eDPS := (FireDamageLow + FireDamageHigh + ColdDamageLow + ColdDamageHigh + LightningDamageLow + LightningDamageHigh)/2*AttackSpeed
- chaosDPS := (ChaosDamageLow + ChaosDamageHigh)/2*AttackSpeed
- DPS := pDPS + eDPS + chaosDPS
- q20DPS := q20pDPS + eDPS + chaosDPS
- Attack := "DPS: " DPS " / " q20DPS "`n"
- if (pDPS)
- {
- Attack := Attack " Physical: " pDPS " / " q20pDPS "`n"
- }
- if (eDPS)
- {
- Attack := Attack " Elemental: " eDPS "`n"
- }
- if (chaosDPS)
- {
- Attack := Attack " Chaos: " chaosDPS "`n"
- }
- ToolTip,%Name%`n%Type%`nItem Level: %ItemLevel%`n%Attack%
- }
- else if(Armour or EvasionRating or EnergyShield)
- {
- Defense := ""
- if (Armour)
- {
- Defense := Defense "Armour: " Armour "/" round(round(Armour/(1+Quality))*1.2) "`n"
- }
- if (EvasionRating)
- {
- Defense := Defense "Evasion Rating: " EvasionRating "/" round(round(EvasionRating/(1+Quality))*1.2) "`n"
- }
- if (EnergyShield)
- {
- Defense := Defense "Energy Shield: " EnergyShield "/" round(round(EnergyShield/(1+Quality))*1.2) "`n"
- }
- ToolTip,%Name%`n%Type%`nItem Level: %ItemLevel%`n%Defense%
- }
- else
- {
- ToolTip,%Name%`n%Type%`nItem Level: %ItemLevel%
- }
- MouseGetPos, X, Y ; Stores the mouse position when the tooltip was displayed
- Increment := 0 ; Sets the variable to increment
- SetTimer, TimerTick, 100
- }
- return
- TimerTick:
- MouseMovePixels = 5 ; How many pixels you have to move. Edit this if you want.
- Increment += 1 ; When it hits 75 (7.5 sec), it removes the tool tip just in case of it screwing up
- MouseGetPos, currentX, currentY ; Used for the below expression
- if ((X - CurrentX)**2 + (Y - CurrentY)**2 > MouseMovePixels**2 or Increment >= 75) {
- SetTimer, TimerTick, Off ; When the mouse moves MouseMovePixels pixels, it stops the tooltip.
- ToolTip
- }
- return
- RemoveTooltip: ; exactly what it says on the tin
- ToolTip
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement