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.
- MouseMovePixels = 40 ; How many pixels you have to move until tooltip disapears.
- Menu1 = POE.iLVL And DPS Revealer.
- ver = v1.01 Fork
- ; Some various fancy tray icon stuff.
- Menu, tray, Tip, %Menu1% %ver%`nrevealing your iLVL and DPS since 2013
- Menu, tray, NoStandard
- Menu, tray, add, %Menu1%%ver%, RemoveTooltip
- Menu, tray, disable, %Menu1%%ver%
- Menu, tray, add
- Menu, tray, add, Reload, MyReload
- Menu, tray, add, Edit, MyEdit
- Menu, tray, add
- Menu, tray, add, Exit, ExitSub
- return
- #IfWinActive, Path of Exile ; May save CPU usage when copying stuff outside of PoE. Hasn't been tested.
- OnClipboardChange:
- StopName = 0 ; Stop appending things to the name.
- GotItemlevel = 0 ; Just in case the script doesn't find the itemlevel
- GotDPS = 0
- Name = ; Blank name (for now)
- PhyLow = 0
- PhyHigh = 0
- FireLow = 0
- FireHigh = 0
- ColdLow = 0
- ColdHigh = 0
- LightningLow = 0
- LightningHigh = 0
- ChaosLow = 0
- ChaosHigh = 0
- AttackSpeed = 0
- Quality = 0
- PhyDamageP = 0
- Loop, parse, Clipboard, `n, `r ; Goes through a loop with the lines of text found in the clipboard
- {
- if StopName = 0
- {
- if A_Loopfield = -------- ; Checks when to stop appending stuff to the name
- {
- StopName = 1
- continue
- }
- if A_Index = 1 ; Starts a check whether it has "Rarity", as well as avoiding appending the rarity to the name.
- {
- IfNotInString, A_Loopfield, Rarity: ; Checks whether it has "Rarity:" in the first line. If it doesn't...
- Exit
- }
- else
- Name = %Name%%A_Loopfield%`n ; Appends the line to the name with a line break.
- }
- IfInString, A_Loopfield, Itemlevel:
- {
- Name = %Name%%A_LoopField%
- GotItemlevel = 1
- Itemlevel = %A_LoopField%
- }
- IfInString, A_Loopfield, Physical Damage:
- {
- PhyDamage = %A_LoopField%
- IfInString, A_Loopfield, increased
- {
- } Else {
- GotDPS = 1
- StringSplit, PhyDamageArray, PhyDamage , %A_Space%,
- StringSplit, PhyDamageNumArray, PhyDamageArray3 , -,
- PhyLow = %PhyDamageNumArray1%
- PhyHigh = %PhyDamageNumArray2%
- }
- }
- IfInString, A_Loopfield, Quality:
- {
- Quality = %A_LoopField%
- StringSplit, QualityArray, Quality , %A_Space%,
- StringTrimLeft, Quality, QualityArray2, 1
- StringTrimRight, Quality, Quality, 1
- StringLen, length, Quality
- If length = 1
- Quality := "0" + Quality
- Quality := "0." + Quality
- }
- IfInString, A_Loopfield, Attacks per Second:
- {
- AttackSpeed = %A_LoopField%
- StringSplit, ASArray, AttackSpeed , %A_Space%,
- AttackSpeed = %ASArray4%
- }
- IfInString, A_Loopfield, increased Physical Damage
- {
- PhyDamageP = %A_LoopField%
- StringSplit, PhyDamagePArray, PhyDamageP , %A_Space%,
- PhyDamageP = %PhyDamagePArray1%
- StringTrimRight, PhyDamageP, PhyDamageP, 1
- }
- IfInString, A_Loopfield, Fire Damage
- {
- FireDamage = %A_LoopField%
- IfInString, A_Loopfield, increased
- {
- } Else {
- StringSplit, FireDamageArray, FireDamage , %A_Space%,
- StringSplit, FireDamageNumArray, FireDamageArray2 , -,
- FireLow = %FireDamageNumArray1%
- FireHigh = %FireDamageNumArray2%
- }
- }
- IfInString, A_Loopfield, Cold Damage
- {
- ColdDamage = %A_LoopField%
- IfInString, A_Loopfield, increased
- {
- } Else {
- StringSplit, ColdDamageArray, ColdDamage , %A_Space%,
- StringSplit, ColdDamageNumArray, ColdDamageArray2 , -,
- ColdLow = %ColdDamageNumArray1%
- ColdHigh = %ColdDamageNumArray2%
- }
- }
- IfInString, A_Loopfield, Lightning Damage
- {
- LightningDamage = %A_LoopField%
- IfInString, A_Loopfield, increased
- {
- } Else {
- StringSplit, LightningDamageArray, LightningDamage , %A_Space%,
- StringSplit, LightningDamageNumArray, LightningDamageArray2 , -,
- LightningLow = %LightningDamageNumArray1%
- LightningHigh = %LightningDamageNumArray2%
- }
- }
- IfInString, A_Loopfield, Chaos Damage
- {
- ChaosDamage = %A_LoopField%
- IfInString, A_Loopfield, increased
- {
- } Else {
- StringSplit, ChaosDamageArray, ChaosDamage , %A_Space%,
- StringSplit, ChaosDamageNumArray, ChaosDamageArray2 , -,
- ChaosLow = %ChaosDamageNumArray1%
- ChaosHigh = %ChaosDamageNumArray2%
- }
- }
- }
- if GotItemlevel = 0 ; If we didn't get the itemlevel...
- exit
- MouseGetPos, X, Y ; Stores the mouse position when the tooltip was displayed
- if GotDPS = 1
- {
- TotalDamage := ((PhyLow + PhyHigh + FireLow + FireHigh + ColdLow + ColdHigh + LightningLow + LightningHigh + ChaosLow + ChaosHigh) / 2) * AttackSpeed
- TotalPhyDamage := ((PhyLow + PhyHigh) / 2) * AttackSpeed
- TotalEleDamage := ((FireLow + FireHigh + ColdLow + ColdHigh + LightningLow + LightningHigh + ChaosLow + ChaosHigh) / 2) * AttackSpeed
- If StrLen(PhyDamageP) = 3
- PutIntoString(PhyDamageP, 1, ".")
- If StrLen(PhyDamageP) = 2
- PhyDamageP := "0." + PhyDamageP
- PhyDamageP1 := PhyDamageP + Quality + 1
- BasePhy := (PhyLow + PhyHigh) / PhyDamageP1
- PhyDamagePQ20 := BasePhy * (PhyDamageP + 1.20)
- if Quality < 0.20
- {
- TotalDPSWithQuality := ((PhyDamagePQ20 + FireLow + FireHigh + ColdLow + ColdHigh + LightningLow + LightningHigh + ChaosLow + ChaosHigh) / 2) * AttackSpeed
- StringTrimRight, TotalDPSWithQuality, TotalDPSWithQuality, 4
- TotalDPSWithQualityDisplay = `nDPSwQ20: %TotalDPSWithQuality%
- } Else {
- TotalDPSWithQualityDisplay =
- }
- StringTrimRight, TotalDamage, TotalDamage, 4
- StringTrimRight, TotalPhyDamage, TotalPhyDamage, 4
- StringTrimRight, TotalEleDamage, TotalEleDamage, 4
- Name = %Name%`nPhyDps:%TotalPhyDamage%`nEleDps:%TotalEleDamage%`nTotalDps:%TotalDamage%%TotalDPSWithQualityDisplay%
- SwName = %Itemlevel%`nPhyDps:%TotalPhyDamage%`nEleDps:%TotalEleDamage%`nTotalDps:%TotalDamage%%TotalDPSWithQualityDisplay%
- StringReplace, clipboard, Name, `n, %A_SPACE% , All
- }
- ToolTip, %Name%, X + 35, Y + 35 ; The name is taken just to confirm what item the user is hovering over.
- Increment := 0 ; Sets the variable to increment
- SetTimer, TimerTick, 100
- return
- #IfWinActive
- TimerTick:
- 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
- MyListVars:
- ListVars
- Return
- MyReload:
- Reload
- Return
- MyEdit:
- Edit
- Return
- PutIntoString(ByRef Str, AtChar, InsertString)
- { While StrLen(Str) < (AtChar-1) ; First, make sure the satring is long enough to insert at 'at'
- Str .= " "
- Str := % SubStr(Str, 1, AtChar) . InsertString . Substr(Str, (AtChar + StrLen(InsertString))) ; %
- }
- RemoveTooltip: ; exactly what it says on the tin
- ToolTip
- return
- ExitSub:
- F12::
- ExitApp
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement