Advertisement
Guest User

Path of Exile DPS tooltip

a guest
Nov 17th, 2013
11,522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. #Warn  ; Enable warnings to assist with detecting common errors.
  3. #Persistent ; Only the user can kill the application
  4. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  5. StringCaseSense, On ; Match strings with case.
  6. SetFormat, FloatFast, 0.2
  7.  
  8. ; ---------------------------------------
  9. ; Created by mcpower - modified by Clif4D
  10. ; ---------------------------------------
  11.  
  12. MouseMovePixels := 5 ; How many pixels you have to move. Edit this if you want.
  13.  
  14. OnClipboardChange:
  15. IfWinActive, Path of Exile ahk_class Direct3DWindowClass ; May save CPU usage when copying stuff outside of PoE. Hasn't been tested.
  16.     {
  17.     ItemLevel := ""
  18.     Name := ""
  19.     Type := ""
  20.     Quality := 0
  21.  
  22.     AttackSpeed := 0
  23.     PhysicalDamageLow := 0
  24.     PhysicalDamageHigh := 0
  25.     IncreasedPhysicalDamage := 0
  26.  
  27.     FireDamageLow := 0
  28.     FireDamageHigh := 0
  29.     ColdDamageLow := 0
  30.     ColdDamageHigh := 0
  31.     LightningDamageLow := 0
  32.     LightningDamageHigh := 0
  33.     ChaosDamageLow := 0
  34.     ChaosDamageHigh := 0
  35.  
  36.     ;ElementalDamageLow := 0
  37.     ;ElementalDamageHigh := 0
  38.  
  39.  
  40.  
  41.     Armour := 0
  42.     EvasionRating := 0
  43.     EnergyShield := 0
  44.  
  45.     Loop, parse, Clipboard, `n, `r      ; Goes through a loop with the lines of text found in the clipboard
  46.     {
  47.         if (A_Index = 1)
  48.         {
  49.             IfNotInString, A_Loopfield, Rarity:     ; Starts a check whether it has "Rarity:" in the first line, otherwise exit
  50.             {
  51.                 Exit
  52.             }
  53.         }
  54.         else if (A_Index = 2)
  55.         {
  56.             Name := A_Loopfield
  57.         }
  58.         else if (A_Index = 3)
  59.         {
  60.             Type := A_Loopfield
  61.         }
  62.         else if (!ItemLevel && RegExMatch(A_Loopfield, "Itemlevel: (\d*)", SubPat))
  63.         {
  64.             ItemLevel := SubPat1
  65.         }
  66.         else if (!Quality && RegExMatch(A_Loopfield, "Quality: \+(\d*)\%", SubPat))
  67.         {
  68.             Quality := SubPat1/100
  69.         }
  70.        
  71.         else if (!AttackSpeed && RegExMatch(A_Loopfield, "Attacks per Second: (\d\.\d*)", SubPat))
  72.         {
  73.             AttackSpeed := SubPat1
  74.         }
  75.         else if (!PhysicalDamageLow && RegExMatch(A_Loopfield, "Physical Damage: (\d*)-(\d*)", SubPat))
  76.         {
  77.             PhysicalDamageLow := SubPat1
  78.             PhysicalDamageHigh := SubPat2
  79.         }
  80.         else if (!IncreasedPhysicalDamage && RegExMatch(A_Loopfield, "(\d*)\% increased Physical Damage", SubPat))
  81.         {
  82.             IncreasedPhysicalDamage := SubPat1/100
  83.         }
  84.        
  85.         else if (!FireDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Fire Damage", SubPat))
  86.         {
  87.             FireDamageLow := SubPat1
  88.             FireDamageHigh := SubPat2
  89.         }
  90.         else if (!ColdDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Cold Damage", SubPat))
  91.         {
  92.             ColdDamageLow := SubPat1
  93.             ColdDamageHigh := SubPat2
  94.         }
  95.         else if (!LightningDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Lightning Damage", SubPat))
  96.         {
  97.             LightningDamageLow := SubPat1
  98.             LightningDamageHigh := SubPat2
  99.         }
  100.         else if (!ChaosDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Chaos Damage", SubPat))
  101.         {
  102.             ChaosDamageLow := SubPat1
  103.             ChaosDamageHigh := SubPat2
  104.         }  
  105.        
  106.         else if (!Armour && RegExMatch(A_Loopfield, "Armour: (\d*)", SubPat))
  107.         {
  108.             Armour:= SubPat1
  109.         }
  110.         else if (!EvasionRating && RegExMatch(A_Loopfield, "Evasion Rating: (\d*)", SubPat))
  111.         {
  112.             EvasionRating:= SubPat1
  113.         }
  114.         else if (!EnergyShield && RegExMatch(A_Loopfield, "Energy Shield: (\d*)", SubPat))
  115.         {
  116.             EnergyShield:= SubPat1
  117.         }  
  118.     }
  119.  
  120.  
  121.     if (!ItemLevel) ; If we didn't get the itemlevel...
  122.         exit
  123.     if (AttackSpeed) ; It's a weapon
  124.     {
  125.         pDPS := (PhysicalDamageLow + PhysicalDamageHigh)/2*AttackSpeed
  126.         q20pDPS := ( round((round((PhysicalDamageLow)/(1+IncreasedPhysicalDamage+Quality))*(1+IncreasedPhysicalDamage+0.2))) + round((round((PhysicalDamageHigh)/(1+IncreasedPhysicalDamage+Quality))*(1+IncreasedPhysicalDamage+0.2))) ) /2*AttackSpeed
  127.         eDPS := (FireDamageLow + FireDamageHigh + ColdDamageLow + ColdDamageHigh + LightningDamageLow + LightningDamageHigh)/2*AttackSpeed
  128.         chaosDPS := (ChaosDamageLow + ChaosDamageHigh)/2*AttackSpeed
  129.         DPS := pDPS + eDPS + chaosDPS
  130.         q20DPS := q20pDPS + eDPS + chaosDPS
  131.    
  132.         Attack := "DPS: " DPS " / " q20DPS "`n"
  133.         if (pDPS)
  134.         {
  135.             Attack := Attack " Physical: " pDPS " / " q20pDPS "`n"
  136.         }
  137.         if (eDPS)
  138.         {
  139.             Attack := Attack " Elemental: " eDPS "`n"
  140.         }
  141.         if (chaosDPS)
  142.         {
  143.             Attack := Attack " Chaos: " chaosDPS "`n"
  144.         }
  145.         ToolTip,%Name%`n%Type%`nItem Level: %ItemLevel%`n%Attack%
  146.     }
  147.     else if(Armour or EvasionRating or EnergyShield)
  148.     {
  149.         Defense := ""
  150.         if (Armour)
  151.         {
  152.             Defense := Defense "Armour: " Armour "/" round(round(Armour/(1+Quality))*1.2) "`n"
  153.         }
  154.         if (EvasionRating)
  155.         {
  156.             Defense := Defense "Evasion Rating: " EvasionRating "/" round(round(EvasionRating/(1+Quality))*1.2) "`n"
  157.         }
  158.         if (EnergyShield)
  159.         {
  160.             Defense := Defense "Energy Shield: " EnergyShield "/" round(round(EnergyShield/(1+Quality))*1.2) "`n"
  161.         }
  162.         ToolTip,%Name%`n%Type%`nItem Level: %ItemLevel%`n%Defense%
  163.     }
  164.     else
  165.     {
  166.         ToolTip,%Name%`n%Type%`nItem Level: %ItemLevel%
  167.     }
  168.    
  169.     MouseGetPos, X, Y ; Stores the mouse position when the tooltip was displayed
  170.     Increment := 0 ; Sets the variable to increment
  171.     SetTimer, TimerTick, 100
  172. }
  173. return
  174.  
  175. TimerTick:
  176. MouseMovePixels = 5 ; How many pixels you have to move. Edit this if you want.
  177. Increment += 1 ; When it hits 75 (7.5 sec), it removes the tool tip just in case of it screwing up
  178. MouseGetPos, currentX, currentY ; Used for the below expression
  179. if ((X - CurrentX)**2 + (Y - CurrentY)**2 > MouseMovePixels**2 or Increment >= 75) {
  180.     SetTimer, TimerTick, Off ; When the mouse moves MouseMovePixels pixels, it stops the tooltip.
  181.     ToolTip
  182. }
  183. return
  184.  
  185. RemoveTooltip: ; exactly what it says on the tin
  186. ToolTip
  187. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement