Advertisement
Guest User

Untitled

a guest
Nov 12th, 2013
376
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.  
  7. MouseMovePixels = 40 ; How many pixels you have to move until tooltip disapears.
  8. Menu1 = POE.iLVL And DPS Revealer.
  9. ver = v1.01 Fork
  10.  
  11. ; Some various fancy tray icon stuff.
  12.     Menu, tray, Tip, %Menu1% %ver%`nrevealing your iLVL and DPS since 2013
  13.     Menu, tray, NoStandard
  14.     Menu, tray, add, %Menu1%%ver%, RemoveTooltip
  15.     Menu, tray, disable, %Menu1%%ver%
  16.     Menu, tray, add
  17.     Menu, tray, add, Reload, MyReload
  18.     Menu, tray, add, Edit, MyEdit
  19.     Menu, tray, add
  20.     Menu, tray, add, Exit, ExitSub
  21. return
  22.  
  23.  
  24.  
  25. #IfWinActive, Path of Exile ; May save CPU usage when copying stuff outside of PoE. Hasn't been tested.
  26. OnClipboardChange:
  27.     StopName = 0 ; Stop appending things to the name.
  28.     GotItemlevel = 0 ; Just in case the script doesn't find the itemlevel
  29.         GotDPS = 0
  30.     Name = ; Blank name (for now)
  31.         PhyLow = 0
  32.         PhyHigh = 0
  33.         FireLow = 0
  34.         FireHigh = 0
  35.         ColdLow = 0
  36.         ColdHigh = 0
  37.         LightningLow = 0
  38.         LightningHigh = 0
  39.         ChaosLow = 0
  40.         ChaosHigh = 0
  41.         AttackSpeed = 0
  42.         Quality = 0
  43.         PhyDamageP = 0
  44.  
  45.     Loop, parse, Clipboard, `n, `r ; Goes through a loop with the lines of text found in the clipboard
  46.     {
  47.         if StopName = 0
  48.         {
  49.             if A_Loopfield = -------- ; Checks when to stop appending stuff to the name
  50.             {
  51.                 StopName = 1
  52.                 continue
  53.             }
  54.             if A_Index = 1 ; Starts a check whether it has "Rarity", as well as avoiding appending the rarity to the name.
  55.             {
  56.                 IfNotInString, A_Loopfield, Rarity: ; Checks whether it has "Rarity:" in the first line. If it doesn't...
  57.                     Exit
  58.             }
  59.             else
  60.                 Name = %Name%%A_Loopfield%`n ; Appends the line to the name with a line break.
  61.         }
  62.         IfInString, A_Loopfield, Itemlevel:
  63.         {
  64.             Name = %Name%%A_LoopField%
  65.             GotItemlevel = 1
  66.                         Itemlevel = %A_LoopField%
  67.  
  68.         }
  69.                 IfInString, A_Loopfield, Physical Damage:
  70.         {
  71.             PhyDamage = %A_LoopField%
  72.             IfInString, A_Loopfield, increased
  73.             {
  74.             } Else {
  75.                         GotDPS = 1
  76.                         StringSplit, PhyDamageArray, PhyDamage , %A_Space%,
  77.                         StringSplit, PhyDamageNumArray, PhyDamageArray3 , -,
  78.                         PhyLow = %PhyDamageNumArray1%
  79.                         PhyHigh = %PhyDamageNumArray2%
  80.               }    
  81.  
  82.  
  83.         }
  84.         IfInString, A_Loopfield, Quality:
  85.         {
  86.             Quality = %A_LoopField%
  87.            
  88.                         StringSplit, QualityArray, Quality , %A_Space%,
  89.                         StringTrimLeft, Quality, QualityArray2, 1
  90.                         StringTrimRight, Quality, Quality, 1
  91.                         StringLen, length, Quality
  92.                         If length = 1
  93.                            Quality := "0" + Quality
  94.                         Quality := "0." + Quality
  95.                        
  96.  
  97.     }
  98.    
  99.                 IfInString, A_Loopfield, Attacks per Second:
  100.         {
  101.             AttackSpeed = %A_LoopField%
  102.  
  103.                         StringSplit, ASArray, AttackSpeed , %A_Space%,
  104.                         AttackSpeed = %ASArray4%
  105.  
  106.         }
  107.         IfInString, A_Loopfield, increased Physical Damage
  108.         {
  109.             PhyDamageP = %A_LoopField%
  110.        
  111.             StringSplit, PhyDamagePArray, PhyDamageP , %A_Space%,
  112.                         PhyDamageP = %PhyDamagePArray1%
  113.                         StringTrimRight, PhyDamageP, PhyDamageP, 1
  114.  
  115.  
  116.         }
  117.                 IfInString, A_Loopfield, Fire Damage
  118.         {
  119.             FireDamage = %A_LoopField%
  120.             IfInString, A_Loopfield, increased
  121.             {
  122.             } Else {
  123.                         StringSplit, FireDamageArray, FireDamage , %A_Space%,
  124.                         StringSplit, FireDamageNumArray, FireDamageArray2 , -,
  125.                         FireLow = %FireDamageNumArray1%
  126.                         FireHigh = %FireDamageNumArray2%
  127.             }
  128.  
  129.         }
  130.                 IfInString, A_Loopfield, Cold Damage
  131.         {
  132.             ColdDamage = %A_LoopField%
  133.             IfInString, A_Loopfield, increased
  134.             {
  135.             } Else {
  136.                         StringSplit, ColdDamageArray, ColdDamage , %A_Space%,
  137.                         StringSplit, ColdDamageNumArray, ColdDamageArray2 , -,
  138.                         ColdLow = %ColdDamageNumArray1%
  139.                         ColdHigh = %ColdDamageNumArray2%
  140.               }
  141.         }
  142.                 IfInString, A_Loopfield, Lightning Damage
  143.         {
  144.             LightningDamage = %A_LoopField%
  145.             IfInString, A_Loopfield, increased
  146.             {
  147.             } Else {
  148.                         StringSplit, LightningDamageArray, LightningDamage , %A_Space%,
  149.                         StringSplit, LightningDamageNumArray, LightningDamageArray2 , -,
  150.                         LightningLow = %LightningDamageNumArray1%
  151.                         LightningHigh = %LightningDamageNumArray2%
  152.              }
  153.         }
  154.                 IfInString, A_Loopfield, Chaos Damage
  155.         {
  156.             ChaosDamage = %A_LoopField%
  157.             IfInString, A_Loopfield, increased
  158.             {
  159.             } Else {
  160.                         StringSplit, ChaosDamageArray, ChaosDamage , %A_Space%,
  161.                         StringSplit, ChaosDamageNumArray, ChaosDamageArray2 , -,
  162.                         ChaosLow = %ChaosDamageNumArray1%
  163.                         ChaosHigh = %ChaosDamageNumArray2%
  164.               }
  165.         }
  166.     }
  167.     if GotItemlevel = 0 ; If we didn't get the itemlevel...
  168.         exit
  169.     MouseGetPos, X, Y ; Stores the mouse position when the tooltip was displayed
  170. if GotDPS = 1
  171. {
  172. TotalDamage := ((PhyLow + PhyHigh + FireLow + FireHigh + ColdLow + ColdHigh + LightningLow + LightningHigh + ChaosLow + ChaosHigh) / 2) * AttackSpeed
  173. TotalPhyDamage := ((PhyLow + PhyHigh) / 2) * AttackSpeed
  174. TotalEleDamage := ((FireLow + FireHigh + ColdLow + ColdHigh + LightningLow + LightningHigh + ChaosLow + ChaosHigh) / 2) * AttackSpeed
  175.  
  176. If StrLen(PhyDamageP) = 3
  177.    PutIntoString(PhyDamageP, 1, ".")
  178. If StrLen(PhyDamageP) = 2
  179.    PhyDamageP := "0." + PhyDamageP
  180.  
  181. PhyDamageP1 := PhyDamageP + Quality + 1
  182.  
  183. BasePhy := (PhyLow + PhyHigh) / PhyDamageP1
  184. PhyDamagePQ20 := BasePhy * (PhyDamageP  + 1.20)
  185.  
  186. if Quality < 0.20
  187. {
  188.  
  189. TotalDPSWithQuality := ((PhyDamagePQ20 + FireLow + FireHigh + ColdLow + ColdHigh + LightningLow + LightningHigh + ChaosLow + ChaosHigh) / 2) * AttackSpeed
  190. StringTrimRight, TotalDPSWithQuality, TotalDPSWithQuality, 4
  191. TotalDPSWithQualityDisplay = `nDPSwQ20: %TotalDPSWithQuality%
  192. } Else {
  193. TotalDPSWithQualityDisplay =
  194. }
  195.  
  196.  
  197. StringTrimRight, TotalDamage, TotalDamage, 4
  198. StringTrimRight, TotalPhyDamage, TotalPhyDamage, 4
  199. StringTrimRight, TotalEleDamage, TotalEleDamage, 4
  200.  
  201. Name = %Name%`nPhyDps:%TotalPhyDamage%`nEleDps:%TotalEleDamage%`nTotalDps:%TotalDamage%%TotalDPSWithQualityDisplay%
  202. SwName = %Itemlevel%`nPhyDps:%TotalPhyDamage%`nEleDps:%TotalEleDamage%`nTotalDps:%TotalDamage%%TotalDPSWithQualityDisplay%
  203.  
  204. StringReplace, clipboard, Name, `n, %A_SPACE% , All
  205. }
  206.  
  207.     ToolTip, %Name%, X + 35, Y + 35 ; The name is taken just to confirm what item the user is hovering over.
  208.     Increment := 0 ; Sets the variable to increment
  209.     SetTimer, TimerTick, 100
  210. return
  211.  
  212.  
  213.  
  214. #IfWinActive
  215.  
  216. TimerTick:
  217.     Increment += 1 ; When it hits 75 (7.5 sec), it removes the tool tip just in case of it screwing up
  218.     MouseGetPos, currentX, currentY ; Used for the below expression
  219.     if ((X - CurrentX)**2 + (Y - CurrentY)**2 > MouseMovePixels**2 or Increment >= 75) {
  220.         SetTimer, TimerTick, Off ; When the mouse moves MouseMovePixels pixels, it stops the tooltip.
  221.         ToolTip
  222.     }
  223. return
  224.  
  225. MyListVars:
  226.     ListVars
  227. Return
  228.  
  229. MyReload:
  230.    Reload
  231. Return
  232.  
  233. MyEdit:
  234.    Edit
  235. Return
  236.  
  237. PutIntoString(ByRef Str, AtChar, InsertString)
  238. { While StrLen(Str) < (AtChar-1) ; First, make sure the satring is long enough to insert at 'at'
  239. Str .= " "
  240. Str := % SubStr(Str, 1, AtChar) . InsertString . Substr(Str, (AtChar + StrLen(InsertString))) ; %
  241. }
  242.  
  243. RemoveTooltip: ; exactly what it says on the tin
  244.     ToolTip
  245. return
  246.  
  247.  
  248. ExitSub:
  249.     F12::
  250.     ExitApp
  251. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement