Advertisement
Guest User

PoE MultiScript Source 01.10.2014

a guest
Jan 10th, 2014
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. IniRead, ConfigNumber , Config.ini, Config, ConfigNumber, 1
  2.  
  3. If ConfigNumber = 1
  4. {
  5.    IniRead, minLifePercentToQuit , Config.ini, Config1, minLifePercentToQuit, 35
  6.    IniRead, minESPercentToQuit , Config.ini, Config1, minESPercentToQuit, 0
  7.    IniRead, minLifePercentToJade , Config.ini, Config1, minLifePercentToJade, 70
  8.    IniRead, minLifePercentToJade , Config.ini, Config1, minLifePercentToJade, 70
  9.    IniRead, minESPercentToJade , Config.ini, Config1, minESPercentToJade, 0
  10.    IniRead, minLifePercentToGranite , Config.ini, Config1, minLifePercentToGranite, 70
  11.    IniRead, minESPercentToGranite , Config.ini, Config1, minESPercentToGranite, 0
  12.    IniRead, minLifePercentToDrink , Config.ini, Config1, minLifePercentToDrink, 55
  13.    IniRead, minManaPercentToDrink , Config.ini, Config1, minManaPercentToDrink, 25
  14.    IniRead, minManaToDrinkPot , Config.ini, Config1, minManaToDrinkPot, 15
  15.    IniRead, minLifePercentToSpam, Config.ini, Config1, minLifePercentToSpam, 35
  16.    IniRead, ResyncSpam, Config.ini, Config1, ResyncSpam, 0
  17.    Gui, Add, DropDownList, x192 y9 w100 h10 AltSubmit gConfigList vConfigChoice R5 , Configuration 1||Configuration 2|Configuration 3|Configuration 4|Configuration 5
  18. }
  19. else If ConfigNumber = 2
  20. {
  21.    IniRead, minLifePercentToQuit , Config.ini, Config2, minLifePercentToQuit, 35
  22.    IniRead, minESPercentToQuit , Config.ini, Config2, minESPercentToQuit, 0
  23.    IniRead, minLifePercentToJade , Config.ini, Config2, minLifePercentToJade, 70
  24.    IniRead, minLifePercentToJade , Config.ini, Config2, minLifePercentToJade, 70
  25.    IniRead, minESPercentToJade , Config.ini, Config2, minESPercentToJade, 0
  26.    IniRead, minLifePercentToGranite , Config.ini, Config2, minLifePercentToGranite, 70
  27.    IniRead, minESPercentToGranite , Config.ini, Config2, minESPercentToGranite, 0
  28.    IniRead, minLifePercentToDrink , Config.ini, Config2, minLifePercentToDrink, 55
  29.    IniRead, minManaPercentToDrink , Config.ini, Config2, minManaPercentToDrink, 25
  30.    IniRead, minManaToDrinkPot , Config.ini, Config2, minManaToDrinkPot, 15
  31.    IniRead, minLifePercentToSpam, Config.ini, Config2, minLifePercentToSpam, 0
  32.    IniRead, ResyncSpam, Config.ini, Config2, ResyncSpam, 0
  33.    Gui, Add, DropDownList, x192 y9 w100 h10 AltSubmit gConfigList vConfigChoice R5 , Configuration 1|Configuration 2||Configuration 3|Configuration 4|Configuration 5
  34. }
  35. else If ConfigNumber = 3
  36. {
  37.    IniRead, minLifePercentToQuit , Config.ini, Config3, minLifePercentToQuit, 35
  38.    IniRead, minESPercentToQuit , Config.ini, Config3, minESPercentToQuit, 0
  39.    IniRead, minLifePercentToJade , Config.ini, Config3, minLifePercentToJade, 70
  40.    IniRead, minLifePercentToJade , Config.ini, Config3, minLifePercentToJade, 70
  41.    IniRead, minESPercentToJade , Config.ini, Config3, minESPercentToJade, 0
  42.    IniRead, minLifePercentToGranite , Config.ini, Config3, minLifePercentToGranite, 70
  43.    IniRead, minESPercentToGranite , Config.ini, Config3, minESPercentToGranite, 0
  44.    IniRead, minLifePercentToDrink , Config.ini, Config3, minLifePercentToDrink, 55
  45.    IniRead, minManaPercentToDrink , Config.ini, Config3, minManaPercentToDrink, 25
  46.    IniRead, minManaToDrinkPot , Config.ini, Config3, minManaToDrinkPot, 15
  47.    IniRead, minLifePercentToSpam, Config.ini, Config3, minLifePercentToSpam, 0
  48.    IniRead, ResyncSpam, Config.ini, Config3, ResyncSpam, 0
  49.    Gui, Add, DropDownList, x192 y9 w100 h10 AltSubmit gConfigList vConfigChoice R5 , Configuration 1|Configuration 2|Configuration 3||Configuration 4|Configuration 5
  50. }
  51. else If ConfigNumber = 4
  52. {
  53.    IniRead, minLifePercentToQuit , Config.ini, Config4, minLifePercentToQuit, 35
  54.    IniRead, minESPercentToQuit , Config.ini, Config4, minESPercentToQuit, 0
  55.    IniRead, minLifePercentToJade , Config.ini, Config4, minLifePercentToJade, 70
  56.    IniRead, minLifePercentToJade , Config.ini, Config4, minLifePercentToJade, 70
  57.    IniRead, minESPercentToJade , Config.ini, Config4, minESPercentToJade, 0
  58.    IniRead, minLifePercentToGranite , Config.ini, Config4, minLifePercentToGranite, 70
  59.    IniRead, minESPercentToGranite , Config.ini, Config4, minESPercentToGranite, 0
  60.    IniRead, minLifePercentToDrink , Config.ini, Config4, minLifePercentToDrink, 55
  61.    IniRead, minManaPercentToDrink , Config.ini, Config4, minManaPercentToDrink, 25
  62.    IniRead, minManaToDrinkPot , Config.ini, Config4, minManaToDrinkPot, 15
  63.    IniRead, minLifePercentToSpam, Config.ini, Config4, minLifePercentToSpam, 0
  64.    IniRead, ResyncSpam, Config.ini, Config4, ResyncSpam, 0
  65.    Gui, Add, DropDownList, x192 y9 w100 h10 AltSubmit gConfigList vConfigChoice R5 , Configuration 1|Configuration 2|Configuration 3|Configuration 4||Configuration 5
  66. }
  67. else If ConfigNumber = 5
  68. {
  69.    IniRead, minLifePercentToQuit , Config.ini, Config5, minLifePercentToQuit, 35
  70.    IniRead, minESPercentToQuit , Config.ini, Config5, minESPercentToQuit, 0
  71.    IniRead, minLifePercentToJade , Config.ini, Config5, minLifePercentToJade, 70
  72.    IniRead, minLifePercentToJade , Config.ini, Config5, minLifePercentToJade, 70
  73.    IniRead, minESPercentToJade , Config.ini, Config5, minESPercentToJade, 0
  74.    IniRead, minLifePercentToGranite , Config.ini, Config5, minLifePercentToGranite, 70
  75.    IniRead, minESPercentToGranite , Config.ini, Config5, minESPercentToGranite, 0
  76.    IniRead, minLifePercentToDrink , Config.ini, Config5, minLifePercentToDrink, 55
  77.    IniRead, minManaPercentToDrink , Config.ini, Config5, minManaPercentToDrink, 25
  78.    IniRead, minManaToDrinkPot , Config.ini, Config5, minManaToDrinkPot, 15
  79.    IniRead, minLifePercentToSpam, Config.ini, Config5, minLifePercentToSpam, 0
  80.    IniRead, ResyncSpam, Config.ini, Config5, ResyncSpam, 0
  81.    Gui, Add, DropDownList, x192 y9 w100 h10 AltSubmit gConfigList vConfigChoice R5 , Configuration 1|Configuration 2|Configuration 3|Configuration 4|Configuration 5||
  82. }
  83.  
  84. Gui, Add, GroupBox, x12 y39 w220 h60 , Min Life `% to Quit
  85. Gui, Add, Slider, x22 y59 w170 h30 gGuiUpdate vminLifePercentToQuit +ToolTip TickInterval25, %minLifePercentToQuit%
  86. Gui, Add, Text, x192 y59 w20 h30 vminLifePercentToQuitUpdate, %minLifePercentToQuit%
  87. Gui, Add, Text, x212 y59 w10 h30 , `%
  88.  
  89. Gui, Add, GroupBox, x242 y39 w220 h60 , Min Energy Shield `% to Quit
  90. Gui, Add, Slider, x252 y59 w170 h30 gGuiUpdate vminESPercentToQuit +ToolTip TickInterval25, %minESPercentToQuit%
  91. Gui, Add, Text, x422 y59 w20 h30 vminESPercentToQuitUpdate, %minESPercentToQuit%
  92. Gui, Add, Text, x442 y59 w10 h30 , `%
  93.  
  94. Gui, Add, GroupBox, x12 y109 w220 h60 , Min Life `% to Use Jade Flask
  95. Gui, Add, Slider, x22 y129 w170 h30 gGuiUpdate vminLifePercentToJade +ToolTip TickInterval25, %minLifePercentToJade%
  96. Gui, Add, Text, x192 y129 w20 h30 vminLifePercentToJadeUpdate , %minLifePercentToJade%
  97. Gui, Add, Text, x212 y129 w10 h30 , `%
  98.  
  99. Gui, Add, GroupBox, x242 y109 w220 h60 , Min Energy Shield `% to Use Jade Flask
  100. Gui, Add, Slider, x252 y129 w170 h30 gGuiUpdate vminESPercentToJade +ToolTip TickInterval25, %minESPercentToJade%
  101. Gui, Add, Text, x422 y129 w20 h30 vminESPercentToJadeUpdate, %minESPercentToJade%
  102. Gui, Add, Text, x442 y129 w10 h30 , `%
  103.  
  104. Gui, Add, GroupBox, x12 y179 w220 h60 , Min Life `% to Use Granite Flask
  105. Gui, Add, Slider, x22 y199 w170 h30 gGuiUpdate vminLifePercentToGranite +ToolTip TickInterval25, %minLifePercentToGranite%
  106. Gui, Add, Text, x192 y199 w20 h30 vminLifePercentToGraniteUpdate, %minLifePercentToGranite%
  107. Gui, Add, Text, x212 y199 w10 h30 , `%
  108.  
  109. Gui, Add, GroupBox, x242 y179 w220 h60 , Min Energy Shield `% to Use Granite Flask
  110. Gui, Add, Slider, x252 y199 w170 h30 gGuiUpdate vminESPercentToGranite +ToolTip TickInterval25, %minESPercentToGranite%
  111. Gui, Add, Text, x422 y199 w20 h30 vminESPercentToGraniteUpdate, %minESPercentToGranite%
  112. Gui, Add, Text, x442 y199 w10 h30 , `%
  113.  
  114. Gui, Add, GroupBox, x12 y249 w220 h60 , Min Life `% to Drink Health Potion
  115. Gui, Add, Slider, x22 y269 w170 h30 gGuiUpdate vminLifePercentToDrink +ToolTip TickInterval25, %minLifePercentToDrink%
  116. Gui, Add, Text, x192 y269 w20 h30 vminLifePercentToDrinkUpdate, %minLifePercentToDrink%
  117. Gui, Add, Text, x212 y269 w10 h30 , `%
  118.  
  119. Gui, Add, GroupBox, x242 y249 w220 h60 , Min Mana `% to Drink Mana Potion
  120. Gui, Add, Slider, x252 y269 w170 h30 gGuiUpdate vminManaPercentToDrink +ToolTip TickInterval25, %minManaPercentToDrink%
  121. Gui, Add, Text, x422 y269 w20 h30 vminManaPercentToDrinkUpdate, %minManaPercentToDrink%
  122. Gui, Add, Text, x442 y269 w10 h30 , `%
  123.  
  124. Gui, Add, GroupBox, x12 y319 w220 h60 , Min Mana to Drink Mana Potion
  125. Gui, Add, Slider, x22 y339 w170 h30 Range0-300 gGuiUpdate vminManaToDrinkPot +ToolTip TickInterval50, %minManaToDrinkPot%
  126. Gui, Add, Text, x192 y339 w30 h30 vminManaToDrinkPotUpdate, %minManaToDrinkPot%
  127.  
  128. Gui, Add, Text, x2 y-1 w110 h20 , GUI Created by Gurud.
  129. Gui, Add, Text, x362 y-1 w100 h20 vAttached, Waiting for Game...
  130.  
  131. Gui, Add, Button, x52 y599 w150 h40 gDefault, Reset to Default
  132. Gui, Add, Button, x272 y599 w150 h40 gReadMe, ReadMe
  133.  
  134. Gui, Add, GroupBox, x242 y459 w220 h60, Auto Quit Method
  135. IniRead, AutoQuitMethod , Config.ini, Config, AutoQuitMethod, 1
  136. If AutoQuitMethod = 1
  137. {
  138.    Gui, Add, DropDownList, x252 y479 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Fastest)||Kill Process|Exit to Character Selection (On Testing)|Use a Portal (On Testing)|Disabled
  139.    autoQuitMode:=1
  140. }
  141. else If AutoQuitMethod = 2
  142. {
  143.    Gui, Add, DropDownList, x252 y479 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Fastest)|Kill Process||Exit to Character Selection (On Testing)|Use a Portal (On Testing)|Disabled
  144.    autoQuitMode:=0
  145. }
  146. else If AutoQuitMethod = 3
  147. {
  148.    Gui, Add, DropDownList, x252 y479 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Fastest)|Kill Process|Exit to Character Selection (On Testing)||Use a Portal (On Testing)|Disabled
  149.    autoQuitMode:=2
  150. }
  151. else If AutoQuitMethod = 4
  152. {
  153.    Gui, Add, DropDownList, x252 y479 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Fastest)|Kill Process|Exit to Character Selection (On Testing)|Use a Portal (On Testing)||Disabled
  154.    autoQuitMode:=3
  155. }
  156. else If AutoQuitMethod = 5
  157. {
  158.    Gui, Add, DropDownList, x252 y479 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Fastest)|Kill Process|Exit to Character Selection (On Testing)|Use a Portal (On Testing)|Disabled||
  159.    autoQuitMode:=4
  160. }
  161.  
  162. Gui, Add, GroupBox, x12 y529 w220 h60 , Base Pointer (Click Find After New Patch)
  163. Gui, Add, Button, x92 y549 w130 h30 gFind, Find
  164. IniRead, baseMgrPtr , Config.ini, Config, baseMgrPtr, 0
  165. Gui, Add, Text, x22 y559 w70 h20 vbasePtrText , %baseMgrPtr%
  166.  
  167. IniRead, SteamCheck , Config.ini, Config, SteamCheck, 0
  168. If SteamCheck = 0
  169. {
  170.    Gui, Add, CheckBox, x252 y559 w190 h30 vSteamCheckBox gSteamCheck, Using Steam
  171.    global Steam:=false
  172. }
  173. If SteamCheck = 1
  174. {
  175.    Gui, Add, CheckBox, x252 y559 w190 h30  vSteamCheckBox gSteamCheck Checked, Using Steam
  176.    global Steam:=true
  177. }
  178.  
  179. ;display tray notifications about script actions : drinking potions, autoquitting
  180. IniRead, TrayNotificationsCheck , Config.ini, Config, TrayNotificationsCheck, 0
  181. If TrayNotificationsCheck = 0
  182. {
  183.    Gui, Add, CheckBox, x252 y529 w190 h30 vTrayCheckBox gTrayNotificationsCheck, Disable Tray Notifications
  184.    global trayNotifications:=true
  185. }
  186. If TrayNotificationsCheck = 1
  187. {
  188.    Gui, Add, CheckBox, x252 y529 w190 h30 vTrayCheckBox gTrayNotificationsCheck Checked, Disable Tray Notifications
  189.    global trayNotifications:=false
  190. }
  191.  
  192. Gui, Add, GroupBox, x242 y389 w220 h60 , Instant Flask Delay (100 = 1 Second)
  193. IniRead, InstantFlaskDelay , Config.ini, Config, InstantFlaskDelay, 50
  194. Gui, Add, Slider, x252 y409 w170 h30 Range0-200 gGuiUpdate vInstantFlaskDelay +ToolTip TickInterval50, %InstantFlaskDelay%
  195. Gui, Add, Text, x422 y409 w30 h30 vInstantFlaskDelayUpdate, %InstantFlaskDelay%
  196.  
  197. Gui, Add, GroupBox, x12 y459 w220 h60 , Disable AutoFlask on Slot
  198. IniRead, Slot1Disabled, Config.ini, DisableSlot, DisableSlot1, 0
  199. If Slot1Disabled = 0
  200. Gui, Add, CheckBox, x22 y479 w30 h30 vDisableSlot1 gDisableSlot, 1
  201. Else If Slot1Disabled = 1
  202. Gui, Add, CheckBox, x22 y479 w30 h30 checked vDisableSlot1 gDisableSlot, 1
  203. IniRead, Slot2Disabled, Config.ini, DisableSlot, DisableSlot2, 0
  204. If Slot2Disabled = 0
  205. Gui, Add, CheckBox, x62 y479 w30 h30 vDisableSlot2 gDisableSlot, 2
  206. Else If Slot2Disabled = 1
  207. Gui, Add, CheckBox, x62 y479 w30 h30 checked vDisableSlot2 gDisableSlot, 2
  208. IniRead, Slot3Disabled, Config.ini, DisableSlot, DisableSlot3, 0
  209. If Slot3Disabled = 0
  210. Gui, Add, CheckBox, x102 y479 w30 h30 vDisableSlot3 gDisableSlot, 3
  211. Else If Slot3Disabled = 1
  212. Gui, Add, CheckBox, x102 y479 w30 h30 checked vDisableSlot3 gDisableSlot, 3
  213. IniRead, Slot4Disabled, Config.ini, DisableSlot, DisableSlot4, 0
  214. If Slot4Disabled = 0
  215. Gui, Add, CheckBox, x142 y479 w30 h30 vDisableSlot4 gDisableSlot, 4
  216. Else If Slot4Disabled = 1
  217. Gui, Add, CheckBox, x142 y479 w30 h30 checked vDisableSlot4 gDisableSlot, 4
  218. IniRead, Slot5Disabled, Config.ini, DisableSlot, DisableSlot5, 0
  219. If Slot5Disabled = 0
  220. Gui, Add, CheckBox, x182 y479 w30 h30 vDisableSlot5 gDisableSlot, 5
  221. Else If Slot5Disabled = 1
  222. Gui, Add, CheckBox, x182 y479 w30 h30 checked vDisableSlot5 gDisableSlot, 5
  223.  
  224. ;Gui, Add, GroupBox, x12 y389 w220 h60 , Min Life `% to Spam Instant Flasks
  225. ;Gui, Add, Slider, x22 y409 w170 h30 gGuiUpdate vminLifePercentToSpam +ToolTip TickInterval25, %minLifePercentToSpam%
  226. ;Gui, Add, Text, x192 y409 w20 h30 vminLifePercentToSpamUpdate, %minLifePercentToSpam%
  227. ;Gui, Add, Text, x212 y409 w10 h30 , `%
  228.  
  229. IniRead, TradeSpam, Config.ini, Config, TradeSpam, 0
  230. Gui, Add, GroupBox, x12 y389 w220 h60 , Send Trade Message Every X Minutes
  231. Gui, Add, Slider, x22 y409 w170 h30 gGuiUpdate vTradeSpam +ToolTip TickInterval1 Range0-10, %TradeSpam%
  232. Gui, Add, Text, x192 y409 w20 h30 vTradeSpamUpdate, %TradeSpam%
  233. Gui, Add, Text, x212 y409 w10 h30 , m
  234.  
  235.  
  236. Gui, Add, GroupBox, x242 y319 w220 h60 , Use Resync Command Every X Seconds
  237. Gui, Add, Slider, x252 y339 w170 h30 gGuiUpdate vResyncSpam +ToolTip TickInterval30 Range0-120, %ResyncSpam%
  238. Gui, Add, Text, x422 y339 w20 h30 vResyncSpamUpdate, %ResyncSpam%
  239. Gui, Add, Text, x442 y339 w10 h30 , s
  240.  
  241. Menu, Tray, Add, Configuration Window, showgui
  242.  
  243.  
  244. Gui, Submit
  245.  
  246. Gui, Show, x760 y198 h648 w477,
  247.  
  248.  
  249. ;-------GUI-----------------GUI-----------------GUI-----------------GUI-----------------GUI----------
  250.  
  251. SetBatchLines, -1
  252. DetectHiddenWindows, On
  253.  
  254. cliname=Path of Exile
  255.  
  256. if (Steam)
  257. {
  258.    cliexe=PathOfExileSteam.exe
  259. }
  260. else
  261. cliexe=PathOfExile.exe
  262. autoPotionsWatchdogPeriod:=10 ;milliseconds, time to have script recheck life/mana/flasks availability more often/increase chances of getting saved from death in time, increase this if fps drop.
  263. lagCompensation:=50
  264. ; Font size for the tooltip, leave empty for default(part of DPSCalc)
  265. FontSize := 12
  266. ; Create font for later use(part of DPSCalc)
  267. FixedFont := CreateFont()
  268.  
  269. ResyncTimer:= 0
  270. TradeTimer:= 0
  271. TradeChannel:= 0
  272. tradechat:= 0
  273. TradeTimer:= 0
  274. TradeTimer2:= 0
  275. TradeStep:= 3
  276. TradeSpamTimer:= 99999
  277.  
  278. autoQuitPauseBeforeClick:=100
  279. autoQuitSoftToleranceBeforeKill:=2000 ; try to quit to loginscreen at most milliseconds before killing game window(in case we can't quit by clicking menu option for some reason)
  280.  
  281. PlayerConfig:={}
  282.  
  283. PlayerConfig["Default"]:={minLifeRatioToInstant: minLifePercentToSpam/100, IFlaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopGranite: minLifePercentToGranite/100, minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100, minNShieldRatioToQuit: minESPercentToQuit/100, minNShieldRatioToPopGranite: minESPercentToGranite/100, minNShieldRatioToPopJade: minESPercentToJade/100}
  284.  
  285. PlayerConfig["Default"].FlaskConfig:=[]
  286.  
  287. PlayerConfig["Default"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"} ; ,OverrideFlaskDuration: 70, instantRecoveryOnLowLife:true, } ;specify override recovery time in deciseconds, e.g. 7 seconds = 70
  288. PlayerConfig["Default"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
  289. PlayerConfig["Default"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
  290. PlayerConfig["Default"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
  291. PlayerConfig["Default"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
  292.  
  293.  
  294. attachedtext=:false
  295.  
  296. WindowQueuedFlaskEffects:=[] ;keyed by "%hwnd%%CurrPid%", hpQueueEndtime, manaQueueEndtime
  297.  
  298.  
  299. basePtrAoBArray:=[0x53,0x55,0x56,0x57,0x33,0xFF,0x3B,0xC7]
  300. basePtrAobOffset:=-0x0A
  301.  
  302. WindowBasicsCache:=[] ; keyed by "%hwnd%%CurrPid%", entries are objects with properties processHandle, moduleBase, moduleSize, baseFramePtr
  303.  
  304. #Include AutoHotkeyMemoryLib.ahk
  305.  
  306.  
  307. Loop
  308. {
  309.    Main()
  310. }
  311.  
  312. GetWindowBasics(hwnd, byref mB="", byref pH="", byref mS="")
  313. {
  314.    
  315.    global WindowBasicsCache
  316.    global cliexe
  317.    
  318.    WinGet, CurrPid, PID, ahk_id %hwnd%
  319.    
  320.    k="%hwnd%%CurrPid%"
  321.    
  322.    mB:=WindowBasicsCache[k].mBase
  323.    mS:=WindowBasicsCache[k].mSize
  324.    
  325.    if mB=
  326.    {
  327.       WindowBasicsCache[k]:=Object()
  328.       GetModuleInfo(cliexe, CurrPid, mB, mS)
  329.       if (mB="" || mS="")
  330.       {
  331.          MsgBox, Failed to obtain moduleBase or moduleSize for PID %CurrPid%, script will now terminate
  332.          ExitApp
  333.       }      
  334.       WindowBasicsCache[k].mBase:=mB
  335.       WindowBasicsCache[k].mSize:=mS
  336.    }
  337.  
  338.    pH:=WindowBasicsCache[k].ProcessHandle
  339.    if pH=
  340.    {
  341.       pH:=GetProcessHandle(CurrPid)
  342.       if (pH="" || pH=-1)
  343.       {
  344.          MsgBox, Invalid process handle obtained for PID %CurrPid%, script will now terminate
  345.          ExitApp
  346.       }      
  347.       WindowBasicsCache[k].ProcessHandle:=pH
  348.    }
  349. }
  350.  
  351. ScanBaseMgrPtr(mBase,pH,moduleSize)
  352. {
  353.    global basePtrAoBArray
  354.    global basePtrAobOffset
  355.    global baseMgrPtr
  356.    aobResult:=AobScan(pH,mBase,moduleSize,basePtrAoBArray)
  357.  
  358.    if aobResult
  359.    {
  360.       SetFormat, IntegerFast, hex
  361.       baseMgrPtr:=ReadMemUInt(pH,mBase+aobResult+basePtrAobOffset)-mBase
  362.       if (trayNotifications)
  363.      TrayTip, New Base Pointer Found, baseMgrPtr = %baseMgrPtr%
  364.      IniWrite, %baseMgrPtr% , Config.ini, Config, baseMgrPtr
  365.      GuiControl, , basePtrText, %baseMgrPtr%
  366.      SetFormat, IntegerFast, dec
  367.  
  368.    }
  369.    else
  370.    {
  371.       MsgBox, baseMgrPtr not found with AoBScan, script will now terminate
  372.       ExitApp
  373.    }  
  374. }
  375.  
  376. GetFrameBase(hwnd)
  377. {
  378.    global baseMgrPtr
  379.    global WindowBasicsCache
  380.  
  381.    WinGet, CurrPid, PID, ahk_id %hwnd%
  382.    k="%hwnd%%CurrPid%"
  383.  
  384.    fB:=WindowBasicsCache[k].fBase
  385.  
  386.    if fB=
  387.    {
  388.       GetWindowBasics(hwnd, mBase, pH, mSize)
  389.  
  390.       if baseMgrPtr= 0
  391.       {
  392.          ScanBaseMgrPtr(mBase, pH, mSize)
  393.       }
  394.  
  395.       fB:=GetMultilevelPointer(pH,[mBase+baseMgrPtr,4,0x7C,0x94])
  396.       WindowBasicsCache[k].fBase:=fB
  397.    }
  398.    return fB
  399. }
  400.  
  401. GetUiBase(hwnd)
  402. {
  403.    global baseMgrPtr
  404.  
  405.       GetWindowBasics(hwnd, mBase, pH, mSize)
  406.      
  407.       if baseMgrPtr= 0
  408.       {
  409.          ScanBaseMgrPtr(mBase, pH, mSize)
  410.       }
  411.      
  412.    FrameBase:=GetFrameBase(hwnd)
  413.    if (FrameBase="" || FrameBase=0)
  414.       return
  415.    if (Steam)
  416.    {
  417.       uiBase:=GetMultilevelPointer(pH,[FrameBase+0xd8,0xA4,0x50])
  418.    }
  419.    else
  420.    uiBase:=GetMultilevelPointer(pH,[FrameBase+0xBC,0xA4,0x50])
  421.    return uiBase
  422. }
  423.  
  424. ReadClientResolution(hwnd, ByRef w, ByRef h)
  425. {
  426.    GetWindowBasics(hwnd,mBase,pH)
  427.    if (mBase!=0 && pH && pH!=-1)
  428.    {
  429.       FrameBase:=GetFrameBase(hwnd)
  430.       if (Steam)
  431.       {
  432.          w:=ReadMemUInt(pH,FrameBase+0x1470)
  433.          h:=ReadMemUInt(pH,FrameBase+0x1474)
  434.       }
  435.       else
  436.       {
  437.          w:=ReadMemUInt(pH,FrameBase+0x1458)
  438.          h:=ReadMemUInt(pH,FrameBase+0x145C)
  439.       }
  440.       return true
  441.    }  
  442. }
  443.  
  444.  
  445.  
  446. ReadPlayerStats(hwnd, byRef PlayerStats)
  447. {
  448.    GetWindowBasics(hwnd, mBase, pH)
  449.    fBase:=GetFrameBase(hwnd)
  450.    if (Steam)
  451.    {
  452.       PlayerBase:=GetMultilevelPointer(pH,[fBase+0xD8,0x59C])
  453.    }
  454.    else
  455.    PlayerBase:=GetMultilevelPointer(pH,[fBase+0xBC,0x59C])
  456.    PlayerMain:=ReadMemUInt(pH,PlayerBase+4)
  457.    PlayerStatsOffset:=ReadMemUInt(pH,PlayerMain+0xC)
  458.    PlayerStats.MaxHP:=ReadMemUInt(pH,PlayerStatsOffset+0x50)
  459.    PlayerStats.CurrHP:=ReadMemUInt(pH,PlayerStatsOffset+0x54)  
  460.    PlayerStats.ReservedHPFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x5C)
  461.    PlayerStats.ReservedHPPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x60)
  462.    PlayerStats.MaxMana:=ReadMemUInt(pH,PlayerStatsOffset+0x74)
  463.    PlayerStats.ReservedManaFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x80)
  464.    PlayerStats.ReservedManaPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x84)
  465.    PlayerStats.CurrMana:=ReadMemUInt(pH,PlayerStatsOffset+0x78)
  466.    PlayerStats.MaxNShield:=ReadMemUInt(pH,PlayerStatsOffset+0x98)
  467.    PlayerStats.CurrNShield:=ReadMemUInt(pH,PlayerStatsOffset+0x9C)
  468.    
  469. }
  470.  
  471. ReadFlasksData(hwnd, byRef FlasksData)
  472. {
  473.    GetWindowBasics(hwnd, mBase, pH)
  474.    
  475.    UiBase:=GetUiBase(hwnd)
  476.    
  477.    if (!UiBase) ;not InGame
  478.       return
  479.    
  480.    FlaskInvBase:=GetMultilevelPointer(pH,[UiBase+0x968,0x980,0x20])
  481.  
  482.    Loop, 5
  483.    {
  484.       currFlaskPtr:=ReadMemUInt(pH,FlaskInvBase+(A_Index-1)*4)
  485.  
  486.       if (currFlaskPtr!=0) ; there's a flask in said slot
  487.       {
  488.          FlasksData[A_Index]:={}
  489.  
  490.          If A_Index = 1
  491.          {
  492.             IniRead, Slot1Disabled, Config.ini, DisableSlot, DisableSlot1, 0
  493.             If Slot1Disabled = 1
  494.             continue
  495.          }
  496.          else If A_Index = 2
  497.          {
  498.             IniRead, Slot2Disabled, Config.ini, DisableSlot, DisableSlot2, 0
  499.             If Slot2Disabled = 1
  500.             continue
  501.          }
  502.          else If A_Index = 3
  503.          {
  504.             IniRead, Slot3Disabled, Config.ini, DisableSlot, DisableSlot3, 0
  505.             If Slot3Disabled = 1
  506.             continue
  507.          }
  508.          else If A_Index = 4
  509.          {
  510.             IniRead, Slot4Disabled, Config.ini, DisableSlot, DisableSlot4, 0
  511.             If Slot4Disabled = 1
  512.             continue
  513.          }
  514.          else If A_Index = 5
  515.          {
  516.             IniRead, Slot5Disabled, Config.ini, DisableSlot, DisableSlot5, 0
  517.             If Slot5Disabled = 1
  518.             continue
  519.          }
  520.  
  521.  
  522.          FlaskChargesPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0xC])
  523.          FlasksData[A_Index].ChargesCurrent:=ReadMemUInt(pH,FlaskChargesPtr+0xC)
  524.          FlasksData[A_Index].ChargesPerUse:=ReadMemUInt(pH,ReadMemUInt(pH,FlaskChargesPtr+8)+0xC)
  525.  
  526.          FlaskMod1Ptr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0x10,0x34,0x14,0x50])
  527.          FlaskMod1Str:=ReadMemStr(ph,FlaskMod1Ptr,70,"UTF-16")
  528.          FlasksData[A_Index].mod1:=FlaskMod1Str
  529.  
  530.          FlaskMod2Ptr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0x10,0x34,0x2c,0x50])
  531.          FlaskMod2Str:=ReadMemStr(ph,FlaskMod2Ptr,70,"UTF-16")
  532.          FlasksData[A_Index].mod2:=FlaskMod2Str
  533.  
  534.          if (FlasksData[A_Index].ChargesCurrent < FlasksData[A_Index].ChargesPerUse) ; not enough charges in this flask to use it, don't bother
  535.             continue
  536.  
  537.          FlaskMetadataPtr:=GetMultilevelPointer(ph,[currFlaskPtr,0,8])
  538.          FlaskMetadataStr:=ReadMemStr(ph,FlaskMetadataPtr,70,"UTF-16")
  539.          FlaskTypeStr:=SubStr(FlaskMetadataStr,23)
  540.          FlasksData[A_Index].type:=FlaskTypeStr
  541.  
  542.          FlaskLocalstatsPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x18,0x20,0xC])
  543.          
  544.          if InStr(FlaskTypeStr, "FlaskLife")
  545.          {
  546.             FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
  547.            
  548.             if (InStr(FlasksData[A_Index].mod1,"Bubbling"))
  549.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/2.35)
  550.             else if (InStr(FlasksData[A_Index].mod2,"Bubbling"))
  551.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/2.35)
  552.             else if (InStr(FlasksData[A_Index].mod1,"Saturated"))
  553.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/0.67)
  554.             else if (InStr(FlasksData[A_Index].mod2,"Saturated"))
  555.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/0.67)
  556.             else if (InStr(FlasksData[A_Index].mod1,"Catalysed"))
  557.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/1.5)
  558.             else if (InStr(FlasksData[A_Index].mod2,"Catalysed"))
  559.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/1.5)
  560.             else
  561.             FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
  562.  
  563.          }
  564.  
  565.          if InStr(FlaskTypeStr, "FlaskMana")
  566.          {
  567.             FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
  568.  
  569.             if (InStr(FlasksData[A_Index].mod1,"Bubbling"))
  570.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/2.35)
  571.             else if (InStr(FlasksData[A_Index].mod2,"Bubbling"))
  572.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/2.35)
  573.             else if (InStr(FlasksData[A_Index].mod1,"Saturated"))
  574.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/0.67)
  575.             else if (InStr(FlasksData[A_Index].mod2,"Saturated"))
  576.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/0.67)
  577.             else if (InStr(FlasksData[A_Index].mod1,"Catalysed"))
  578.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/1.5)
  579.             else if (InStr(FlasksData[A_Index].mod2,"Catalysed"))
  580.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)/1.5)
  581.             else
  582.             FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
  583.  
  584.          }
  585.          
  586.          if InStr(FlaskTypeStr, "FlaskHybrid")
  587.          {
  588.             FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
  589.             FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
  590.             if (InStr(FlasksData[A_Index].mod1,"Bubbling"))
  591.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  592.             else if (InStr(FlasksData[A_Index].mod2,"Bubbling"))
  593.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  594.             else if (InStr(FlasksData[A_Index].mod1,"Saturated"))
  595.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  596.             else if (InStr(FlasksData[A_Index].mod2,"Saturated"))
  597.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  598.             else if (InStr(FlasksData[A_Index].mod1,"Catalysed"))
  599.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  600.             else if (InStr(FlasksData[A_Index].mod2,"Catalysed"))
  601.             FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  602.             else
  603.             FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
  604.          }
  605.  
  606.          if InStr(FlaskTypeStr, "FlaskUtility")
  607.          {
  608.             FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x4)
  609.          }
  610.       }
  611.    }
  612. }
  613.  
  614. IsInGame(hwnd)
  615. {
  616.    if (hwnd=0 || hwnd="")
  617.       return false
  618.    GetWindowBasics(hwnd,mBase,pH)
  619.    if (mBase="" || mBase=0 || pH="" || pH=-1)
  620.       return false
  621.    fBase:=GetFrameBase(hwnd)
  622.    if (fBase="" || fBase=0)
  623.       return false
  624.    localConnection:=ReadMemUInt(pH,fBase+0xc0)
  625.    if (localConnection=0 || localConnection="")
  626.       return false
  627.    else
  628.       return true
  629. }
  630.  
  631. SetGameStateMenu(hwnd)
  632. {
  633.    if (hwnd=0 || hwnd="")
  634.       return false
  635.    GetWindowBasics(hwnd,mBase,pH)
  636.    if (mBase="" || mBase=0 || pH="" || pH=-1)
  637.       return false
  638.    fBase:=GetFrameBase(hwnd)
  639.    if (fBase="" || fBase=0)
  640.       return false
  641.    if (Steam)
  642.    {
  643.       localConnection:=GetMultilevelPointer(pH,[fBase+0xd8,0x598])
  644.    }
  645.    else
  646.    localConnection:=ReadMemUInt(pH,fBase+0xc0)
  647.    if (localConnection!="" && localConnection!=0)
  648.    {
  649.       WriteMemUInt(pH,localConnection+0x26f8,1)
  650.    }
  651. }
  652.  
  653. ReadHeroPos(hwnd,ByRef x, ByRef y)
  654. {
  655.    GetWindowBasics(hwnd,mBase,pH)
  656.    if (mBase!=0 && pH && pH!=-1)
  657.    {
  658.       FrameBase:=GetFrameBase(hwnd)
  659.       if (Steam)
  660.       {
  661.       x:=ReadMemFloat(pH,FrameBase+0x16c4)
  662.       y:=ReadMemFloat(pH,FrameBase+0x16c8)
  663.       }
  664.       else
  665.       {
  666.       x:=ReadMemFloat(pH,FrameBase+0x16ac)
  667.       y:=ReadMemFloat(pH,FrameBase+0x16b0)
  668.       }
  669.       return true
  670.    }  
  671. }
  672.  
  673. ScreenToClient(hwnd, ByRef x, ByRef y)
  674. {
  675.     VarSetCapacity(pt, 8)
  676.     NumPut(x, pt, 0)
  677.     NumPut(y, pt, 4)
  678.     DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
  679.     x := NumGet(pt, 0, "int")
  680.     y := NumGet(pt, 4, "int")
  681.    VarSetCapacity(pt, 0)
  682. }
  683.  
  684. GetClientCoords(byRef mx, byRef my)
  685. {
  686.    hwnd:=WinActive("A")  
  687.    CoordMode, Mouse, Screen
  688.    MouseGetPos, mx, my
  689.    ScreenToClient(hwnd,mx,my) ;  x 580   y 435
  690. }
  691.  
  692. QuitToLoginScreen(hwnd)
  693. {  
  694.    if (!IsInGame(hwnd))
  695.    {
  696.       return
  697.    }
  698.    SetGameStateMenu(hwnd)
  699. }
  700.  
  701. GetMaxChargesFlaskOfType(ByRef FlasksData,TypeStr)
  702. {
  703.    currMaxCharges:=0
  704.    Loop, 5
  705.       if (InStr(FlasksData[A_Index].type,TypeStr))
  706.       {
  707.          if FlasksData[A_Index].ChargesCurrent>currMaxCharges
  708.          {
  709.             currMaxI:=A_Index
  710.             currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  711.          }
  712.       }
  713.    return currMaxI
  714. }
  715.  
  716.  
  717. Main()
  718. {
  719.    global autoPotionsWatchdogPeriod
  720.    global lagCompensation
  721.    global PlayerConfig
  722.    global WindowQueuedFlaskEffects
  723.    global cliname
  724.    global cliexe
  725.    global trayNotifications
  726.    global autoQuitMode
  727.    global desync
  728.    global remaining
  729.    global tradechat
  730.    global borderless
  731.    global testingame
  732.    global ChatStatus
  733.    global ResyncTimer
  734.    global ResyncSpam
  735.    global tradechat
  736.    global TradeSpam
  737.    global TradeSpamTimer
  738.    global TradeTimer
  739.    global TradeTimer2
  740.    global TradeChannel
  741.    global TradeStep
  742.  
  743.    WinGet, WinID, List, %cliname%
  744.    
  745.    Loop, %WinID%
  746.    {
  747.      
  748.       WinGet, ProcModuleName, ProcessName,  % "ahk_id" WinID%A_Index%
  749.  
  750.       If(ProcModuleName!=cliexe) ; got a window with title "Path of Exile" but exe is not Client.exe, perhaps we have browser window open with PoE site, ignore it
  751.          continue
  752.  
  753.       if attachedtext!=true
  754.       {
  755.          GuiControl,,Attached, Game is Attached.
  756.          attachedtext:=true
  757.       }
  758.            
  759.       if (!IsInGame(WinID%A_Index%)) ;not ingame
  760.          continue
  761.        
  762.    if (WinID%A_Index%=WinActive("A"))
  763.       ThisID:=WinActive("A")
  764.      
  765.       PlayerStats:={}
  766.       ReadPlayerStats(WinID%A_Index%, PlayerStats)
  767.       if (PlayerStats.MaxHP<1 || PlayerStats.CurrHP=0) ;dead, don't bother
  768.          continue
  769.  
  770.       CurrentConfig:=PlayerConfig["Default"]
  771.      
  772.       if PlayerStats.MaxNShield>0
  773.       {
  774.          currNShieldRatio:=PlayerStats.CurrNShield/PlayerStats.MaxNShield
  775.       }
  776.       else
  777.       currNShieldRatio:= 1
  778.      
  779.       if (PlayerStats.MaxHP>1)
  780.       {
  781.          currLifeRatio:=PlayerStats.CurrHP/(PlayerStats.MaxHP-PlayerStats.ReservedHPFlat-PlayerStats.MaxHP*PlayerStats.ReservedHPPercent/100)
  782.       }
  783.       else
  784.       currLifeRatio:= 1
  785.      
  786.       if (PlayerStats.MaxMana>0)
  787.       {
  788.          currManaRatio:=PlayerStats.CurrMana/(PlayerStats.MaxMana-PlayerStats.ReservedManaFlat-PlayerStats.MaxMana*PlayerStats.ReservedManaPercent/100)
  789.       }
  790.      
  791.  
  792.       if (currLifeRatio<CurrentConfig.minLifeRatioToQuit || currNShieldRatio<CurrentConfig.minNShieldRatioToQuit)
  793.       {
  794.          if (autoQuitMode=0)
  795.          {
  796.             TrayTip, PoE autoPotions AutoQuit by closing window, specified min life reached, %A_Space% , 2
  797.             WinKill, % "ahk_id" WinID%A_Index%
  798.             continue
  799.          }
  800.          else if (autoQuitMode=1)
  801.          {
  802.             QuitToLoginScreen(WinID%A_Index%)
  803.             continue
  804.          }
  805.          else if (autoQuitMode=2)
  806.          {
  807.             ExitToCharacterSelection()
  808.             continue
  809.          }
  810.          else if (autoQuitMode=3)
  811.          {
  812.             UsePortal()
  813.             continue
  814.          }
  815.          else if (autoQuitMode=4)
  816.          {
  817.  
  818.          }
  819.       }
  820.      
  821.       if desync = 1
  822.       {
  823.          if (IsInGame(hwnd))
  824.          {
  825.             IfWinActive Path of Exile ahk_class Direct3DWindowClass
  826.             {
  827.                SendInput {NumpadEnter}/oos{NumpadEnter}
  828.             }
  829.          }
  830.          desync = 0
  831.       }
  832.  
  833.       FlasksData:=[]
  834.       ReadFlasksData(WinID%A_Index%,FlasksData)
  835.      
  836.       WinGet, CurrPID, PID,  % "ahk_id" WinID%A_Index%
  837.       hwnd:=WinID%A_Index%
  838.       k="%hwnd%%CurrPid%"
  839.       if (!WindowQueuedFlaskEffects.HasKey(k))
  840.       {
  841.          WindowQueuedFlaskEffects[k]:={}
  842.       }
  843.      
  844.       if (currLifeRatio<CurrentConfig.minLifeRatioToPopGranite || currNShieldRatio<CurrentConfig.minNShieldRatioToPopGranite)
  845.          if ((!WindowQueuedFlaskEffects[k].HasKey("graniteQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].graniteQueueEndtime-lagCompensation)))
  846.             {
  847.                flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility5") ; granite flask
  848.                if (flaskNum!="")
  849.                {
  850.                   if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
  851.                      EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
  852.                   else
  853.                      EffectDuration:=FlasksData[flaskNum].EffectDuration
  854.                      
  855.                   WindowQueuedFlaskEffects[k].graniteQueueEndtime:=A_TickCount+EffectDuration*100
  856.  
  857.                   if (trayNotifications)
  858.                   {
  859.                      TrayTip, PoE autoPotions popping Granite flask %flaskNum%, %A_Space% , 2
  860.                   }
  861.                   hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  862.                   ControlSend,,%hkey%, % "ahk_id" hwnd
  863.                   break
  864.                }
  865.             }
  866.  
  867.       if (currLifeRatio<CurrentConfig.minLifeRatioToPopJade || currNShieldRatio<CurrentConfig.minNShieldRatioToPopJade)
  868.  
  869.          if ((!WindowQueuedFlaskEffects[k].HasKey("jadeQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].jadeQueueEndtime-lagCompensation)))
  870.             {
  871.                flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility9") ; jade flask
  872.                if (flaskNum!="")
  873.                {
  874.                   if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
  875.                      EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
  876.                   else
  877.                      EffectDuration:=FlasksData[flaskNum].EffectDuration
  878.                      
  879.                   WindowQueuedFlaskEffects[k].jadeQueueEndtime:=A_TickCount+EffectDuration*100
  880.  
  881.                   if (trayNotifications)
  882.                   {
  883.                      TrayTip, PoE autoPotions popping Jade flask %flaskNum%, %A_Space% , 2
  884.                   }
  885.                   hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  886.                   ControlSend,,%hkey%, % "ahk_id" hwnd
  887.                   break
  888.                }
  889.             }
  890.  
  891.       if (currLifeRatio>=1)
  892.          WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount
  893.      
  894.       if (currManaRatio>=1)
  895.          WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount
  896.      
  897.       if (currLifeRatio<CurrentConfig.minLifeRatioToDrink)
  898.       {
  899.  
  900.          if ((!WindowQueuedFlaskEffects[k].HasKey("hpQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].hpQueueEndtime-lagCompensation)))
  901.          {
  902.             tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskLife")
  903.             tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
  904.             if ((tflaskNum1!=) && (tflaskNum2!=))
  905.                flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
  906.             else
  907.             {
  908.                if (tflaskNum1!="")
  909.                   flaskNum:=tflaskNum1
  910.                if (tflaskNum2!="")
  911.                   flaskNum:=tflaskNum2
  912.             }
  913.             if (flaskNum!="")
  914.             {  
  915.                EffectDuration:=FlasksData[flaskNum].EffectDuration
  916.  
  917.                IFDelay:= (CurrentConfig.IFlaskDelay*10)
  918.  
  919.                if (InStr(FlasksData[flaskNum].mod1,"Seething"))
  920.                   WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  921.  
  922.                else if (InStr(FlasksData[flaskNum].mod2,"Seething"))
  923.                   WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  924.  
  925.                else if ((InStr(FlasksData[flaskNum].mod1,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
  926.                   WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  927.  
  928.                else if ((InStr(FlasksData[flaskNum].mod2,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
  929.                   WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  930.  
  931.                else
  932.                WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+EffectDuration*100
  933.  
  934.  
  935.                if (trayNotifications)
  936.                {
  937.                   TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  938.                }
  939.                hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  940.                ControlSend,,%hkey%, % "ahk_id" hwnd
  941.                Break
  942.             }
  943.          }
  944.          Else if ((!WindowQueuedFlaskEffects[k].HasKey("hpQueueEndtime")) || (A_TickCount<=(WindowQueuedFlaskEffects[k].hpQueueEndtime-lagCompensation)))
  945.          {
  946.             minLifeRatioToInstant:=0
  947.             if (currLifeRatio<minLifeRatioToInstant)
  948.             {
  949.                tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskLife") ;need to change this
  950.                if (tflaskNum2!="")
  951.                   flaskNum:=tflaskNum2
  952.                if (flaskNum!="")
  953.                {  
  954.                   IFDelay:= (CurrentConfig.IFlaskDelay*10)
  955.                    
  956.                   if (InStr(FlasksData[flaskNum].mod1,"Seething"))
  957.                   {
  958.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  959.                      if (trayNotifications)
  960.                      {
  961.                         TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  962.                      }
  963.                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  964.                      ControlSend,,%hkey%, % "ahk_id" hwnd
  965.                      break
  966.                   }
  967.                   else if (InStr(FlasksData[flaskNum].mod2,"Seething"))
  968.                   {
  969.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  970.                      if (trayNotifications)
  971.                      {
  972.                         TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  973.                      }
  974.                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  975.                      ControlSend,,%hkey%, % "ahk_id" hwnd
  976.                      break
  977.                   }
  978.                   else if (InStr(FlasksData[flaskNum].mod1,"Bubbling"))
  979.                   {
  980.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  981.                      if (trayNotifications)
  982.                      {
  983.                         TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  984.                      }
  985.                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  986.                      ControlSend,,%hkey%, % "ahk_id" hwnd
  987.                      break
  988.                   }
  989.                   else if (InStr(FlasksData[flaskNum].mod2,"Bubbling"))
  990.                   {
  991.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  992.                      if (trayNotifications)
  993.                      {
  994.                         TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  995.                      }
  996.                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  997.                      ControlSend,,%hkey%, % "ahk_id" hwnd
  998.                      break
  999.                   }
  1000.                   else if ((InStr(FlasksData[flaskNum].mod1,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
  1001.                   {
  1002.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  1003.                      if (trayNotifications)
  1004.                      {
  1005.                         TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  1006.                      }
  1007.                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  1008.                      ControlSend,,%hkey%, % "ahk_id" hwnd
  1009.                      break
  1010.                   }
  1011.                   else if ((InStr(FlasksData[flaskNum].mod2,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
  1012.                   {
  1013.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+IFDelay
  1014.                      if (trayNotifications)
  1015.                      {
  1016.                         TrayTip, PoE autoPotions sipping HP flask %flaskNum%, %A_Space% , 2
  1017.                      }
  1018.                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  1019.                      ControlSend,,%hkey%, % "ahk_id" hwnd
  1020.                      break
  1021.                   }
  1022.                }
  1023.             }
  1024.          }
  1025.       }
  1026.  
  1027.       if (PlayerStats.MaxMana>0 && (currManaRatio<CurrentConfig.minManaRatioToDrink || PlayerStats.CurrMana<CurrentConfig.minManaToDrink))      
  1028.          if ((!WindowQueuedFlaskEffects[k].HasKey("ManaQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].ManaQueueEndtime-lagCompensation)))
  1029.          {
  1030.                tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskMana")
  1031.                tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
  1032.                
  1033.                if ((tflaskNum1!=) && (tflaskNum2!=))
  1034.                   flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
  1035.                else
  1036.                {
  1037.                   if (tflaskNum1!="")
  1038.                      flaskNum:=tflaskNum1
  1039.                   if (tflaskNum2!="")
  1040.                      flaskNum:=tflaskNum2
  1041.                }
  1042.  
  1043.                if (flaskNum!="")
  1044.                {
  1045.  
  1046.                   EffectDuration:=FlasksData[flaskNum].EffectDuration
  1047.  
  1048.                   IFDelay:= (CurrentConfig.IFlaskDelay*10)
  1049.                                  
  1050.                   if (InStr(FlasksData[flaskNum].mod1,"Seething"))
  1051.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+IFDelay
  1052.  
  1053.                   else if (InStr(FlasksData[flaskNum].mod2,"Seething"))
  1054.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+IFDelay
  1055.  
  1056.                   else if ((InStr(FlasksData[flaskNum].mod1,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
  1057.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+IFDelay
  1058.  
  1059.                   else if ((InStr(FlasksData[flaskNum].mod2,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
  1060.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+IFDelay
  1061.  
  1062.                   else
  1063.                   WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+EffectDuration*100
  1064.  
  1065.                   if (trayNotifications)
  1066.                   {
  1067.                      TrayTip, PoE autoPotions sipping mana flask %flaskNum%, %A_Space% , 2
  1068.                   }
  1069.                   hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
  1070.                   ControlSend,,%hkey%, % "ahk_id" hwnd
  1071.                   Break
  1072.                }
  1073.          }              
  1074.    }
  1075.    
  1076.     if ((autoQuit=1) && (ThisID!="") && (ThisID!=WinActive("A")))
  1077.       WinActivate, % "ahk_id" ThisID
  1078.    
  1079.  
  1080.    if remaining = 1
  1081.    {
  1082.       if (IsInGame(hwnd))
  1083.       {
  1084.          IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1085.          {
  1086.             SendInput {NumpadEnter}/remaining{NumpadEnter}
  1087.          }
  1088.       }
  1089.       remaining = 0
  1090.    }
  1091.  
  1092.    if testingame = 1
  1093.    {
  1094.       if (IsInGame(hwnd))
  1095.       {
  1096.          IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1097.          {
  1098.             ChatStatus:= !ChatStatus
  1099.             ResyncTimer = 0
  1100.             TradeSpam = 0
  1101.             GuiControl, , TradeSpam, 0
  1102.             GuiControl, , TradeSpamUpdate, 0
  1103.             IniWrite, 0 , Config.ini, Config, TradeSpam
  1104.          }
  1105.       }
  1106.       testingame = 0
  1107.    }
  1108.  
  1109.    If (TradeSpam>0)
  1110.       {
  1111.          TradeSpamTimer++
  1112.          If (TradeSpamTimer>(TradeSpam*6000*0.64))
  1113.          {
  1114.             tradechat = 1
  1115.             TradeSpamTimer = 0
  1116.          }
  1117.       }
  1118.  
  1119.    if tradechat = 1
  1120.    {
  1121.       ++TradeTimer
  1122.       If (TradeTimer>10)
  1123.       {
  1124.          if (!ChatStatus)
  1125.          {
  1126.             if (IsInGame(hwnd))
  1127.             {
  1128.                IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1129.                {
  1130.                   SendMode Input
  1131.                   If (TradeStep = 1)
  1132.                   {
  1133.                      Send {NumpadEnter}
  1134.                      Send {Raw}/trade %TradeChannel%
  1135.                      Send {NumpadEnter}
  1136.                      TradeStep:= 2
  1137.                      TradeTimer = 0
  1138.                   }
  1139.                   else If (TradeStep = 2)
  1140.                   {
  1141.                      Send {NumpadEnter}{Up 3}{NumpadEnter}
  1142.                      TradeStep = 3
  1143.                      TradeTimer = 0
  1144.                   }
  1145.                   else If (TradeStep = 3)
  1146.                   {
  1147.                      Send {NumpadEnter}/trade 111{NumpadEnter}
  1148.                      TradeStep = 4
  1149.                      TradeTimer = 0
  1150.                   }
  1151.                   else If (TradeStep = 4)
  1152.                   {
  1153.                      ++TradeTimer2
  1154.                      If (TradeTimer2>(130))
  1155.                      {
  1156.                         TradeTimer = 0
  1157.                         TradeStep:= 5
  1158.                      }
  1159.                   }
  1160.                   else If (TradeStep = 5)
  1161.                   {
  1162.                      If (TradeChannel<10)
  1163.                      {
  1164.                         TradeChannel++
  1165.                         TradeStep = 1
  1166.                         TradeTimer = 0
  1167.                         TradeTimer2 = 0
  1168.                      }
  1169.                      Else
  1170.                      {
  1171.                         TradeChannel = 0
  1172.                         tradechat = 0
  1173.                         TradeTimer = 0
  1174.                         TradeTimer2 = 0
  1175.                         TradeStep = 3
  1176.                      }
  1177.                   }
  1178.                }
  1179.             }
  1180.             Else
  1181.             {
  1182.                TradeChannel = 0
  1183.                tradechat = 0
  1184.                TradeTimer = 0
  1185.                TradeTimer2 = 0
  1186.                TradeStep = 3
  1187.             }
  1188.          }
  1189.          Else
  1190.          {
  1191.             TradeChannel = 0
  1192.             tradechat = 0
  1193.             TradeTimer = 0
  1194.             TradeTimer2 = 0
  1195.             TradeStep = 3
  1196.          }
  1197.       }
  1198.    }
  1199.    else
  1200.    {
  1201.       If (TradeSpam=0)
  1202.       {
  1203.          ++ResyncTimer
  1204.          If ((ResyncTimer>(ResyncSpam*100*0.65)) And (ResyncSpam>0))
  1205.          {
  1206.             if (!ChatStatus)
  1207.             {
  1208.                if (IsInGame(hwnd))
  1209.                {
  1210.                   IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1211.                   {
  1212.                      Sendinput {NumpadEnter}/oos{NumpadEnter}
  1213.                   }
  1214.                }
  1215.             }
  1216.             ResyncTimer = 0
  1217.          }
  1218.       }
  1219.    }
  1220.  
  1221.    Sleep, %autoPotionsWatchdogPeriod%  
  1222. }
  1223.  
  1224.  
  1225. UsePortal()
  1226. {
  1227.    IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1228.    {
  1229.       BlockInput On
  1230.       SendMode Input
  1231.       hwnd:=WinActive("A")
  1232.       GetKeyState, stateR, RButton, P
  1233.       if stateR = D
  1234.       {
  1235.          Send {RButton up}
  1236.       }
  1237.       GetKeyState, stateL, LButton, P
  1238.       if stateL = D
  1239.       {
  1240.          Send {LButton up}
  1241.       }
  1242.       GetKeyState, stateM, MButton, P
  1243.       if stateM = D
  1244.       {
  1245.          Send {MButton up}
  1246.       }
  1247.       GetKeyState, stateQ, Q, P
  1248.       if stateQ = D
  1249.       {
  1250.          Send {Q up}
  1251.       }
  1252.       GetKeyState, stateW, W, P
  1253.       if stateW = D
  1254.       {
  1255.          Send {W up}
  1256.       }
  1257.       GetKeyState, stateE, E, P
  1258.       if stateE = D
  1259.       {
  1260.          Send {E up}
  1261.       }
  1262.       GetKeyState, stateR, R, P
  1263.       if stateR = D
  1264.       {
  1265.          Send {R up}
  1266.       }
  1267.       GetKeyState, stateT, T, P
  1268.       if stateT = D
  1269.       {
  1270.          Send {T up}
  1271.       }
  1272.       GetKeyState, stateI, I, P
  1273.       if stateI = D
  1274.       {
  1275.          Send {I up}
  1276.       }
  1277.       GetKeyState, stateSP, SPACE, P
  1278.       if stateSP = D
  1279.       {
  1280.          Send {SPACE up}
  1281.       }
  1282.       GetKeyState, stateSH, SHIFT, P
  1283.       if stateSH = D
  1284.       {
  1285.          Send {SHIFT up}
  1286.       }
  1287.       ReadClientResolution(hwnd,w,h)
  1288.       Send {SPACE}
  1289.       Send {NumpadEnter}
  1290.       Send {Raw} /oos
  1291.       Send {NumpadEnter}
  1292.       Send {i}
  1293.       ErrorLevel = 1
  1294.       Sleep, 50
  1295.       ScrollX:= (w/2)
  1296.       ScrollY:= (h/2)
  1297.       PixelSearch, ScrollX, ScrollY, ScrollX, ScrollY, w, h, 0xFFFFFF, 1, fast  ;2b1d35  312238
  1298.       If ErrorLevel = 0
  1299.       {
  1300.          MouseMove, (ScrollX), (ScrollY),0
  1301.          If PortalInvCheck() = true
  1302.          {
  1303.  
  1304.          }
  1305.          Else If PortalInvCheck() = false
  1306.          {
  1307.             ScrollX:= (w/2)
  1308.             Loop
  1309.             {
  1310.                ErrorLevel = 1
  1311.                PixelSearch, ScrollX2, ScrollY2, ScrollX, ScrollY, (ScrollX+50), (ScrollY+10), 0xFFFFFF, 1, fast ;0xFBFBFB, 4, fast  ;2b1d35  312238
  1312.                If ErrorLevel = 0
  1313.                {
  1314.                   MouseMove, (ScrollX2), (ScrollY2),0
  1315.                   If PortalInvCheck() = true
  1316.                      Break
  1317.                   Else If PortalInvCheck() = false
  1318.                   {
  1319.                      Send {SPACE}
  1320.                      MouseMove, (w/2), (h/2), 0                      
  1321.                      BlockInput Off
  1322.                      Return
  1323.                   }
  1324.                }
  1325.                else
  1326.                {
  1327.                   ScrollX:= (ScrollX+50)
  1328.                   Continue
  1329.                }
  1330.             }
  1331.          }
  1332.       }
  1333.       Send {RButton}
  1334.       Send {SPACE}
  1335.       Sleep, 50
  1336.       MouseMove, (w/2), (h/2),0
  1337.       Sleep, 50
  1338.       Send {LButton}
  1339.       sleep, 250
  1340.       Loop
  1341.       {
  1342.          ErrorLevel = 1
  1343.          PixelSearch, PixX, PixY, (w/4), (h/10), ((w/4)*3), h, 0xddbb30, 34, fast  ;0xdcc8c8 text color
  1344.          if ErrorLevel = 0
  1345.          {
  1346.             MouseMove, (PixX), (PixY),0
  1347.             Sleep, 20
  1348.             Send {LButton}
  1349.             Loop ;only search for portals when not moving
  1350.             {  
  1351.                ReadHeroPos(hwnd,PosX1,PosY1)
  1352.                sleep, 30
  1353.                ReadHeroPos(hwnd,PosX2,PosY2)
  1354.                if PosX1 = %PosX2%
  1355.                {
  1356.                   If PosY1 = %PosY2%
  1357.                   {
  1358.                      break
  1359.                   }
  1360.            
  1361.                }
  1362.                else
  1363.                sleep, 30
  1364.             }
  1365.          }
  1366.          else
  1367.          {
  1368.             Break
  1369.          }
  1370.       }
  1371.       Sleep, 50
  1372.       MouseMove, (w/2), (h/2),0
  1373.       Sleep, 50
  1374.       Send {LButton}
  1375.       Sleep, 50
  1376.       BlockInput Off
  1377.    }
  1378.    Else
  1379.    return
  1380. }
  1381.  
  1382.  
  1383. ExitToCharacterSelection()
  1384. {
  1385.    IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1386.    {
  1387.       BlockInput On
  1388.       SendMode Input
  1389.       hwnd:=WinActive("A")
  1390.       GetKeyState, stateR, RButton, P
  1391.       if stateR = D
  1392.       {
  1393.          Send {RButton up}
  1394.       }
  1395.       GetKeyState, stateL, LButton, P
  1396.       if stateL = D
  1397.       {
  1398.          Send {LButton up}
  1399.       }
  1400.       GetKeyState, stateM, MButton, P
  1401.       if stateM = D
  1402.       {
  1403.          Send {MButton up}
  1404.       }
  1405.       GetKeyState, stateQ, Q, P
  1406.       if stateQ = D
  1407.       {
  1408.          Send {Q up}
  1409.       }
  1410.       GetKeyState, stateW, W, P
  1411.       if stateW = D
  1412.       {
  1413.          Send {W up}
  1414.       }
  1415.       GetKeyState, stateE, E, P
  1416.       if stateE = D
  1417.       {
  1418.          Send {E up}
  1419.       }
  1420.       GetKeyState, stateR, R, P
  1421.       if stateR = D
  1422.       {
  1423.          Send {R up}
  1424.       }
  1425.       GetKeyState, stateT, T, P
  1426.       if stateT = D
  1427.       {
  1428.          Send {T up}
  1429.       }
  1430.       GetKeyState, stateI, I, P
  1431.       if stateI = D
  1432.       {
  1433.          Send {I up}
  1434.       }
  1435.       GetKeyState, stateSP, SPACE, P
  1436.       if stateSP = D
  1437.       {
  1438.          Send {SPACE up}
  1439.       }
  1440.       GetKeyState, stateSH, SHIFT, P
  1441.       if stateSH = D
  1442.       {
  1443.          Send {SHIFT up}
  1444.       }
  1445.       Send {SPACE}
  1446.       Send {ESC}
  1447.       ReadClientResolution(hwnd,w,h)
  1448.       MouseMove, (w/2), ((h/2)- ((h-674.4)/6.24))  ;Might have to change the height in this line to work.
  1449.       Send {LButton}
  1450.       Sleep,150
  1451.       Send {LButton}
  1452.       Sleep, 200
  1453.       BlockInput Off
  1454.    }
  1455.    Else
  1456.    return
  1457. }
  1458.  
  1459. Toggle_Window(window)
  1460. {
  1461.    global ClientX, ClientY, ClientW, ClientH
  1462.    IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1463.    {
  1464.       WinGet, S, Style, % "ahk_id " window   ; Get the style of the window
  1465.       If (S & +0x840000)      ; if not borderless
  1466.       {
  1467.          WinGetPos, ClientX, ClientY, ClientW, ClientH
  1468.          hwnd:=WinActive("A")
  1469.          ReadClientResolution(hwnd,w,h)
  1470.          WinMove, % "ahk_id " window,, %ClientX%, %ClientY%, %w%, %h%
  1471.          WinSet, Style, -0x840000, % "ahk_id " window   ; Remove borders
  1472.          WinSet, Style, -0x400000, % "ahk_id " window
  1473.          Confine := !Confine
  1474.          ClipCursor(Confine, (ClientX), (ClientY), (ClientX+w),(ClientY+h))
  1475.          return
  1476.       }
  1477.       If (S & -0x840000)      ; if borderless
  1478.       {
  1479.          WinSet, Style, +0x840000, % "ahk_id " window   ; Reapply borders
  1480.          WinSet, Style, +0x400000, % "ahk_id " window
  1481.          WinMove, % "ahk_id " window,, %ClientX%, %ClientY%, %ClientW%, %ClientW%
  1482.          Confine := !Confine
  1483.          ClipCursor(Confine, 0, 0, A_ScreenWidth, A_ScreenHeight)
  1484.          return
  1485.       }
  1486.    }
  1487. }
  1488.  
  1489. ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 )
  1490. {
  1491.    VarSetCapacity(R,16,0),  NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12)
  1492.    Return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
  1493. }
  1494.  
  1495. F1::
  1496.    desync=1
  1497. return
  1498.  
  1499. F2::
  1500.    remaining = 1
  1501. return
  1502.  
  1503. F3::
  1504.    DPSCalc()
  1505. return
  1506.  
  1507. F4::
  1508.    QuitToLoginScreen(WinActive("A"))
  1509. return
  1510.  
  1511. F10::
  1512.    tradechat = 1
  1513. return
  1514.  
  1515. F11::
  1516.    ExitToCharacterSelection()
  1517. return
  1518.  
  1519. F12::
  1520.    UsePortal()
  1521. return
  1522.  
  1523. !w::
  1524.    WinGet, window, ID, A   ; Use the ID of the active window.
  1525.    Toggle_Window(window)
  1526. return
  1527.  
  1528. Enter::
  1529.    SendInput {NumpadEnter}
  1530.    testingame = 1
  1531. return
  1532.  
  1533. GuiUpdate:
  1534.   Gui, Submit, NoHide
  1535.    GuiControl, , minLifePercentToQuitUpdate, %minLifePercentToQuit%
  1536.    GuiControl, , minESPercentToQuitUpdate, %minESPercentToQuit%
  1537.    GuiControl, , minLifePercentToJadeUpdate, %minLifePercentToJade%
  1538.    GuiControl, , minESPercentToJadeUpdate, %minESPercentToJade%
  1539.    GuiControl, , minLifePercentToGraniteUpdate, %minLifePercentToGranite%
  1540.    GuiControl, , minESPercentToGraniteUpdate, %minESPercentToGranite%
  1541.    GuiControl, , minLifePercentToDrinkUpdate, %minLifePercentToDrink%
  1542.    GuiControl, , minManaPercentToDrinkUpdate, %minManaPercentToDrink%
  1543.    GuiControl, , minManaToDrinkPotUpdate, %minManaToDrinkPot%
  1544.    GuiControl, , InstantFlaskDelayUpdate, %InstantFlaskDelay%
  1545.    GuiControl, , minLifePercentToSpamUpdate, %minLifePercentToSpam%
  1546.    GuiControl, , TradeSpamUpdate, %TradeSpam%
  1547.    GuiControl, , ResyncSpamUpdate, %ResyncSpam%
  1548.    
  1549.    If ConfigChoice = 1
  1550.    {
  1551.       IniWrite, %minLifePercentToQuit% , Config.ini, Config1, minLifePercentToQuit
  1552.       IniWrite, %minESPercentToQuit% , Config.ini, Config1, minESPercentToQuit
  1553.       IniWrite, %minLifePercentToJade% , Config.ini, Config1, minLifePercentToJade
  1554.       IniWrite, %minESPercentToJade% , Config.ini, Config1, minESPercentToJade
  1555.       IniWrite, %minLifePercentToGranite% , Config.ini, Config1, minLifePercentToGranite
  1556.       IniWrite, %minESPercentToGranite% , Config.ini, Config1, minESPercentToGranite
  1557.       IniWrite, %minLifePercentToDrink% , Config.ini, Config1, minLifePercentToDrink
  1558.       IniWrite, %minManaPercentToDrink% , Config.ini, Config1, minManaPercentToDrink
  1559.       IniWrite, %minManaToDrinkPot% , Config.ini, Config1, minManaToDrinkPot
  1560.       IniWrite, %minLifePercentToSpam% , Config.ini, Config1, minLifePercentToSpam
  1561.       IniWrite, %ResyncSpam% , Config.ini, Config1, ResyncSpam
  1562.  
  1563.    }
  1564.    else If ConfigChoice = 2
  1565.    {
  1566.       IniWrite, %minLifePercentToQuit% , Config.ini, Config2, minLifePercentToQuit
  1567.       IniWrite, %minESPercentToQuit% , Config.ini, Config2, minESPercentToQuit
  1568.       IniWrite, %minLifePercentToJade% , Config.ini, Config2, minLifePercentToJade
  1569.       IniWrite, %minESPercentToJade% , Config.ini, Config2, minESPercentToJade
  1570.       IniWrite, %minLifePercentToGranite% , Config.ini, Config2, minLifePercentToGranite
  1571.       IniWrite, %minESPercentToGranite% , Config.ini, Config2, minESPercentToGranite
  1572.       IniWrite, %minLifePercentToDrink% , Config.ini, Config2, minLifePercentToDrink
  1573.       IniWrite, %minManaPercentToDrink% , Config.ini, Config2, minManaPercentToDrink
  1574.       IniWrite, %minManaToDrinkPot% , Config.ini, Config2, minManaToDrinkPot
  1575.       IniWrite, %minLifePercentToSpam% , Config.ini, Config2, minLifePercentToSpam
  1576.       IniWrite, %ResyncSpam% , Config.ini, Config2, ResyncSpam
  1577.    }
  1578.    else If ConfigChoice = 3
  1579.    {
  1580.       IniWrite, %minLifePercentToQuit% , Config.ini, Config3, minLifePercentToQuit
  1581.       IniWrite, %minESPercentToQuit% , Config.ini, Config3, minESPercentToQuit
  1582.       IniWrite, %minLifePercentToJade% , Config.ini, Config3, minLifePercentToJade
  1583.       IniWrite, %minESPercentToJade% , Config.ini, Config3, minESPercentToJade
  1584.       IniWrite, %minLifePercentToGranite% , Config.ini, Config3, minLifePercentToGranite
  1585.       IniWrite, %minESPercentToGranite% , Config.ini, Config3, minESPercentToGranite
  1586.       IniWrite, %minLifePercentToDrink% , Config.ini, Config3, minLifePercentToDrink
  1587.       IniWrite, %minManaPercentToDrink% , Config.ini, Config3, minManaPercentToDrink
  1588.       IniWrite, %minManaToDrinkPot% , Config.ini, Config3, minManaToDrinkPot
  1589.       IniWrite, %minLifePercentToSpam% , Config.ini, Config3, minLifePercentToSpam
  1590.       IniWrite, %ResyncSpam% , Config.ini, Config3, ResyncSpam
  1591.    }
  1592.    else If ConfigChoice = 4
  1593.    {
  1594.       IniWrite, %minLifePercentToQuit% , Config.ini, Config4, minLifePercentToQuit
  1595.       IniWrite, %minESPercentToQuit% , Config.ini, Config4, minESPercentToQuit
  1596.       IniWrite, %minLifePercentToJade% , Config.ini, Config4, minLifePercentToJade
  1597.       IniWrite, %minESPercentToJade% , Config.ini, Config4, minESPercentToJade
  1598.       IniWrite, %minLifePercentToGranite% , Config.ini, Config4, minLifePercentToGranite
  1599.       IniWrite, %minESPercentToGranite% , Config.ini, Config4, minESPercentToGranite
  1600.       IniWrite, %minLifePercentToDrink% , Config.ini, Config4, minLifePercentToDrink
  1601.       IniWrite, %minManaPercentToDrink% , Config.ini, Config4, minManaPercentToDrink
  1602.       IniWrite, %minManaToDrinkPot% , Config.ini, Config4, minManaToDrinkPot
  1603.       IniWrite, %minLifePercentToSpam% , Config.ini, Config4, minLifePercentToSpam
  1604.       IniWrite, %ResyncSpam% , Config.ini, Config4, ResyncSpam
  1605.    }  
  1606.    else If ConfigChoice = 5
  1607.    {
  1608.       IniWrite, %minLifePercentToQuit% , Config.ini, Config5, minLifePercentToQuit
  1609.       IniWrite, %minESPercentToQuit% , Config.ini, Config5, minESPercentToQuit
  1610.       IniWrite, %minLifePercentToJade% , Config.ini, Config5, minLifePercentToJade
  1611.       IniWrite, %minESPercentToJade% , Config.ini, Config5, minESPercentToJade
  1612.       IniWrite, %minLifePercentToGranite% , Config.ini, Config5, minLifePercentToGranite
  1613.       IniWrite, %minESPercentToGranite% , Config.ini, Config5, minESPercentToGranite
  1614.       IniWrite, %minLifePercentToDrink% , Config.ini, Config5, minLifePercentToDrink
  1615.       IniWrite, %minManaPercentToDrink% , Config.ini, Config5, minManaPercentToDrink
  1616.       IniWrite, %minManaToDrinkPot% , Config.ini, Config5, minManaToDrinkPot
  1617.       IniWrite, %minLifePercentToSpam% , Config.ini, Config5, minLifePercentToSpam
  1618.       IniWrite, %ResyncSpam% , Config.ini, Config5, ResyncSpam
  1619.    }
  1620.    
  1621.    IniWrite, %InstantFlaskDelay% , Config.ini, Config, InstantFlaskDelay
  1622.    IFDelay:= InstantFlaskDelay
  1623.  
  1624.    PlayerConfig["Default"]:={minLifeRatioToInstant: minLifePercentToSpam/100, IFlaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopGranite: minLifePercentToGranite/100, minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100, minNShieldRatioToQuit: minESPercentToQuit/100, minNShieldRatioToPopGranite: minESPercentToGranite/100, minNShieldRatioToPopJade: minESPercentToJade/100}
  1625.    PlayerConfig["Default"].FlaskConfig:=[]
  1626.  
  1627.    PlayerConfig["Default"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"} ; ,OverrideFlaskDuration: 70, instantRecoveryOnLowLife:true, } ;specify override recovery time in deciseconds, e.g. 7 seconds = 70
  1628.    PlayerConfig["Default"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
  1629.    PlayerConfig["Default"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
  1630.    PlayerConfig["Default"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
  1631.    PlayerConfig["Default"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
  1632. return
  1633.  
  1634. Default:
  1635.    Gui, Submit, NoHide
  1636.    GuiControl, , minLifePercentToQuit, 35
  1637.    GuiControl, , minLifePercentToQuitUpdate, 35
  1638.    minLifePercentToQuit := 35
  1639.    GuiControl, , minESPercentToQuit, 0
  1640.    GuiControl, , minESPercentToQuitUpdate, 0
  1641.    minESPercentToQuit := 0
  1642.    GuiControl, , minLifePercentToJade, 70
  1643.    GuiControl, , minLifePercentToJadeUpdate, 70
  1644.    minLifePercentToJade := 70
  1645.    GuiControl, , minESPercentToJade, 0
  1646.    GuiControl, , minESPercentToJadeUpdate, 0
  1647.    minESPercentToJade := 0
  1648.    GuiControl, , minLifePercentToGranite, 70
  1649.    GuiControl, , minLifePercentToGraniteUpdate, 70
  1650.    minLifePercentToGranite := 70
  1651.    GuiControl, , minESPercentToGranite, 0
  1652.    GuiControl, , minESPercentToGraniteUpdate, 0
  1653.    minESPercentToGranite := 0
  1654.    GuiControl, , minLifePercentToDrink, 55
  1655.    GuiControl, , minLifePercentToDrinkUpdate, 55
  1656.    minLifePercentToDrink := 55
  1657.    GuiControl, , minManaPercentToDrink, 25
  1658.    GuiControl, , minManaPercentToDrinkUpdate, 25
  1659.    minManaPercentToDrink := 25
  1660.    GuiControl, , minManaToDrinkPot, 15
  1661.    GuiControl, , minManaToDrinkPotUpdate, 15
  1662.    minManaToDrinkPot := 15
  1663.    GuiControl, , InstantFlaskDelay, 50
  1664.    GuiControl, , InstantFlaskDelayUpdate, 50
  1665.    InstantFlaskDelay := 50
  1666.    GuiControl, , ResyncSpam, 0
  1667.    GuiControl, , ResyncSpamUpdate, 0
  1668.    ResyncSpam := 0
  1669.    IniWrite, %InstantFlaskDelay% , Config.ini, Config, InstantFlaskDelay
  1670.  
  1671.    ResyncTimer:= 0
  1672.    TradeTimer:= 0
  1673.    TradeChannel:= 0
  1674.    tradechat:= 0
  1675.    TradeTimer:= 0
  1676.    TradeTimer2:= 0
  1677.    TradeStep:= 3
  1678.    TradeSpamTimer:= 99999
  1679.    TradeSpam = 0
  1680.    GuiControl, , TradeSpam, 0
  1681.    GuiControl, , TradeSpamUpdate, 0
  1682.    IniWrite, 0 , Config.ini, Config, TradeSpam
  1683.  
  1684.    If ConfigChoice = 1
  1685.    {
  1686.       IniWrite, %minLifePercentToQuit% , Config.ini, Config1, minLifePercentToQuit
  1687.       IniWrite, %minESPercentToQuit% , Config.ini, Config1, minESPercentToQuit
  1688.       IniWrite, %minLifePercentToJade% , Config.ini, Config1, minLifePercentToJade
  1689.       IniWrite, %minESPercentToJade% , Config.ini, Config1, minESPercentToJade
  1690.       IniWrite, %minLifePercentToGranite% , Config.ini, Config1, minLifePercentToGranite
  1691.       IniWrite, %minESPercentToGranite% , Config.ini, Config1, minESPercentToGranite
  1692.       IniWrite, %minLifePercentToDrink% , Config.ini, Config1, minLifePercentToDrink
  1693.       IniWrite, %minManaPercentToDrink% , Config.ini, Config1, minManaPercentToDrink
  1694.       IniWrite, %minManaToDrinkPot% , Config.ini, Config1, minManaToDrinkPot
  1695.    }
  1696.    else If ConfigChoice = 2
  1697.    {
  1698.       IniWrite, %minLifePercentToQuit% , Config.ini, Config2, minLifePercentToQuit
  1699.       IniWrite, %minESPercentToQuit% , Config.ini, Config2, minESPercentToQuit
  1700.       IniWrite, %minLifePercentToJade% , Config.ini, Config2, minLifePercentToJade
  1701.       IniWrite, %minESPercentToJade% , Config.ini, Config2, minESPercentToJade
  1702.       IniWrite, %minLifePercentToGranite% , Config.ini, Config2, minLifePercentToGranite
  1703.       IniWrite, %minESPercentToGranite% , Config.ini, Config2, minESPercentToGranite
  1704.       IniWrite, %minLifePercentToDrink% , Config.ini, Config2, minLifePercentToDrink
  1705.       IniWrite, %minManaPercentToDrink% , Config.ini, Config2, minManaPercentToDrink
  1706.       IniWrite, %minManaToDrinkPot% , Config.ini, Config2, minManaToDrinkPot
  1707.    }
  1708.    else If ConfigChoice = 3
  1709.    {
  1710.       IniWrite, %minLifePercentToQuit% , Config.ini, Config3, minLifePercentToQuit
  1711.       IniWrite, %minESPercentToQuit% , Config.ini, Config3, minESPercentToQuit
  1712.       IniWrite, %minLifePercentToJade% , Config.ini, Config3, minLifePercentToJade
  1713.       IniWrite, %minESPercentToJade% , Config.ini, Config3, minESPercentToJade
  1714.       IniWrite, %minLifePercentToGranite% , Config.ini, Config3, minLifePercentToGranite
  1715.       IniWrite, %minESPercentToGranite% , Config.ini, Config3, minESPercentToGranite
  1716.       IniWrite, %minLifePercentToDrink% , Config.ini, Config3, minLifePercentToDrink
  1717.       IniWrite, %minManaPercentToDrink% , Config.ini, Config3, minManaPercentToDrink
  1718.       IniWrite, %minManaToDrinkPot% , Config.ini, Config3, minManaToDrinkPot
  1719.    }
  1720.    else If ConfigChoice = 4
  1721.    {
  1722.       IniWrite, %minLifePercentToQuit% , Config.ini, Config4, minLifePercentToQuit
  1723.       IniWrite, %minESPercentToQuit% , Config.ini, Config4, minESPercentToQuit
  1724.       IniWrite, %minLifePercentToJade% , Config.ini, Config4, minLifePercentToJade
  1725.       IniWrite, %minESPercentToJade% , Config.ini, Config4, minESPercentToJade
  1726.       IniWrite, %minLifePercentToGranite% , Config.ini, Config4, minLifePercentToGranite
  1727.       IniWrite, %minESPercentToGranite% , Config.ini, Config4, minESPercentToGranite
  1728.       IniWrite, %minLifePercentToDrink% , Config.ini, Config4, minLifePercentToDrink
  1729.       IniWrite, %minManaPercentToDrink% , Config.ini, Config4, minManaPercentToDrink
  1730.       IniWrite, %minManaToDrinkPot% , Config.ini, Config4, minManaToDrinkPot
  1731.    }  
  1732.    else If ConfigChoice = 5
  1733.    {
  1734.       IniWrite, %minLifePercentToQuit% , Config.ini, Config5, minLifePercentToQuit
  1735.       IniWrite, %minESPercentToQuit% , Config.ini, Config5, minESPercentToQuit
  1736.       IniWrite, %minLifePercentToJade% , Config.ini, Config5, minLifePercentToJade
  1737.       IniWrite, %minESPercentToJade% , Config.ini, Config5, minESPercentToJade
  1738.       IniWrite, %minLifePercentToGranite% , Config.ini, Config5, minLifePercentToGranite
  1739.       IniWrite, %minESPercentToGranite% , Config.ini, Config5, minESPercentToGranite
  1740.       IniWrite, %minLifePercentToDrink% , Config.ini, Config5, minLifePercentToDrink
  1741.       IniWrite, %minManaPercentToDrink% , Config.ini, Config5, minManaPercentToDrink
  1742.       IniWrite, %minManaToDrinkPot% , Config.ini, Config5, minManaToDrinkPot
  1743.    }
  1744.    
  1745.    PlayerConfig["Default"]:={minLifeRatioToInstant: minLifePercentToSpam/100, IFlaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopGranite: minLifePercentToGranite/100, minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100, minNShieldRatioToQuit: minESPercentToQuit/100, minNShieldRatioToPopGranite: minESPercentToGranite/100, minNShieldRatioToPopJade: minESPercentToJade/100}
  1746.    PlayerConfig["Default"].FlaskConfig:=[]
  1747.  
  1748.    PlayerConfig["Default"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"} ; ,OverrideFlaskDuration: 70, instantRecoveryOnLowLife:true, } ;specify override recovery time in deciseconds, e.g. 7 seconds = 70
  1749.    PlayerConfig["Default"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
  1750.    PlayerConfig["Default"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
  1751.    PlayerConfig["Default"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
  1752.    PlayerConfig["Default"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
  1753. return
  1754.  
  1755. AutoQuitList:
  1756.   Gui, Submit, NoHide
  1757.    If AutoQuitChoice = 1
  1758.    autoQuitMode:=1
  1759.    If AutoQuitChoice = 2
  1760.    autoQuitMode:=0
  1761.    If AutoQuitChoice = 3
  1762.    {
  1763.       MsgBox, Test with [F3] First, This is not coded for all resolutions.
  1764.       autoQuitMode:=2
  1765.    }
  1766.    If AutoQuitChoice = 4
  1767.    {
  1768.       MsgBox, This is still beta. This is only for testing.`nDont use in Harcore`nIt will fail.`nThe only currency in your first line of your`ninventory should be portal scrolls.`nTest With [F2] First`n`nUse Ctrl+Alt+Del to unstuck.
  1769.       autoQuitMode:=3
  1770.    }
  1771.    If AutoQuitChoice = 5
  1772.    autoQuitMode:=4
  1773.  
  1774.    IniWrite, %AutoQuitChoice% , Config.ini, Config, AutoQuitMethod
  1775. return
  1776.  
  1777. ConfigList:
  1778.   Gui, Submit, NoHide
  1779.    If ConfigChoice = 1
  1780.    {
  1781.       IniRead, minLifePercentToQuit , Config.ini, Config1, minLifePercentToQuit, 35
  1782.       IniRead, minESPercentToQuit , Config.ini, Config1, minESPercentToQuit1, 0
  1783.       IniRead, minLifePercentToJade , Config.ini, Config1, minLifePercentToJade, 70
  1784.       IniRead, minESPercentToJade , Config.ini, Config1, minESPercentToJade, 0
  1785.       IniRead, minLifePercentToGranite , Config.ini, Config1, minLifePercentToGranite, 70
  1786.       IniRead, minESPercentToGranite , Config.ini, Config1, minESPercentToGranite, 0
  1787.       IniRead, minLifePercentToDrink , Config.ini, Config1, minLifePercentToDrink, 55
  1788.       IniRead, minManaPercentToDrink , Config.ini, Config1, minManaPercentToDrink, 25
  1789.       IniRead, minManaToDrinkPot1 , Config.ini, Config1, minManaToDrinkPot, 15
  1790.       IniWrite, 1, Config.ini, Config, ConfigNumber
  1791.    }
  1792.    else If ConfigChoice = 2
  1793.    {
  1794.       IniRead, minLifePercentToQuit , Config.ini, Config2, minLifePercentToQuit, 35
  1795.       IniRead, minESPercentToQuit , Config.ini, Config2, minESPercentToQuit, 0
  1796.       IniRead, minLifePercentToJade , Config.ini, Config2, minLifePercentToJade, 70
  1797.       IniRead, minESPercentToJade , Config.ini, Config2, minESPercentToJade, 0
  1798.       IniRead, minLifePercentToGranite , Config.ini, Config2, minLifePercentToGranite, 70
  1799.       IniRead, minESPercentToGranite , Config.ini, Config2, minESPercentToGranite, 0
  1800.       IniRead, minLifePercentToDrink , Config.ini, Config2, minLifePercentToDrink, 55
  1801.       IniRead, minManaPercentToDrink , Config.ini, Config2, minManaPercentToDrink, 25
  1802.       IniRead, minManaToDrinkPot , Config.ini, Config2, minManaToDrinkPot, 15
  1803.       IniWrite, 2, Config.ini, Config, ConfigNumber
  1804.    }
  1805.    else If ConfigChoice = 3
  1806.    {
  1807.       IniRead, minLifePercentToQuit , Config.ini, Config3, minLifePercentToQuit, 35
  1808.       IniRead, minESPercentToQuit , Config.ini, Config3, minESPercentToQuit, 0
  1809.       IniRead, minLifePercentToJade , Config.ini, Config3, minLifePercentToJade, 70
  1810.       IniRead, minESPercentToJade , Config.ini, Config3, minESPercentToJade, 0
  1811.       IniRead, minLifePercentToGranite , Config.ini, Config3, minLifePercentToGranite, 70
  1812.       IniRead, minESPercentToGranite , Config.ini, Config3, minESPercentToGranite, 0
  1813.       IniRead, minLifePercentToDrink , Config.ini, Config3, minLifePercentToDrink, 55
  1814.       IniRead, minManaPercentToDrink , Config.ini, Config3, minManaPercentToDrink, 25
  1815.       IniRead, minManaToDrinkPot , Config.ini, Config3, minManaToDrinkPot, 15
  1816.       IniWrite, 3, Config.ini, Config, ConfigNumber
  1817.    }
  1818.    else If ConfigChoice = 4
  1819.    {
  1820.       IniRead, minLifePercentToQuit , Config.ini, Config4, minLifePercentToQuit, 35
  1821.       IniRead, minESPercentToQuit , Config.ini, Config4, minESPercentToQuit, 0
  1822.       IniRead, minLifePercentToJade , Config.ini, Config4, minLifePercentToJade, 70
  1823.       IniRead, minESPercentToJade , Config.ini, Config4, minESPercentToJade, 0
  1824.       IniRead, minLifePercentToGranite , Config.ini, Config4, minLifePercentToGranite, 70
  1825.       IniRead, minESPercentToGranite , Config.ini, Config4, minESPercentToGranite, 0
  1826.       IniRead, minLifePercentToDrink , Config.ini, Config4, minLifePercentToDrink, 55
  1827.       IniRead, minManaPercentToDrink , Config.ini, Config4, minManaPercentToDrink, 25
  1828.       IniRead, minManaToDrinkPot , Config.ini, Config4, minManaToDrinkPot, 15
  1829.       IniWrite, 4, Config.ini, Config, ConfigNumber
  1830.    }  
  1831.    else If ConfigChoice = 5
  1832.    {
  1833.       IniRead, minLifePercentToQuit , Config.ini, Config5, minLifePercentToQuit, 35
  1834.       IniRead, minESPercentToQuit , Config.ini, Config5, minESPercentToQuit, 0
  1835.       IniRead, minLifePercentToJade , Config.ini, Config5, minLifePercentToJade, 70
  1836.       IniRead, minESPercentToJade , Config.ini, Config5, minESPercentToJade, 0
  1837.       IniRead, minLifePercentToGranite , Config.ini, Config5, minLifePercentToGranite, 70
  1838.       IniRead, minESPercentToGranite , Config.ini, Config5, minESPercentToGranite, 0
  1839.       IniRead, minLifePercentToDrink , Config.ini, Config5, minLifePercentToDrink, 55
  1840.       IniRead, minManaPercentToDrink , Config.ini, Config5, minManaPercentToDrink, 25
  1841.       IniRead, minManaToDrinkPot , Config.ini, Config5, minManaToDrinkPot, 15
  1842.       IniWrite, 5, Config.ini, Config, ConfigNumber
  1843.    }
  1844.  
  1845.    GuiControl, , minLifePercentToQuit, %minLifePercentToQuit%
  1846.    GuiControl, , minLifePercentToQuitUpdate, %minLifePercentToQuit%
  1847.    GuiControl, , minESPercentToQuit, %minESPercentToQuit%
  1848.    GuiControl, , minESPercentToQuitUpdate, %minESPercentToQuit%
  1849.    GuiControl, , minLifePercentToJade, %minLifePercentToJade%
  1850.    GuiControl, , minLifePercentToJadeUpdate, %minLifePercentToJade%
  1851.    GuiControl, , minESPercentToJade, %minESPercentToJade%
  1852.    GuiControl, , minESPercentToJadeUpdate, %minESPercentToJade%
  1853.    GuiControl, , minLifePercentToGranite, %minLifePercentToGranite%
  1854.    GuiControl, , minLifePercentToGraniteUpdate, %minLifePercentToGranite%
  1855.    GuiControl, , minESPercentToGranite, %minESPercentToGranite%
  1856.    GuiControl, , minESPercentToGraniteUpdate, %minESPercentToGranite%
  1857.    GuiControl, , minLifePercentToDrink, %minLifePercentToDrink%
  1858.    GuiControl, , minLifePercentToDrinkUpdate, %minLifePercentToDrink%
  1859.    GuiControl, , minManaPercentToDrink, %minManaPercentToDrink%
  1860.    GuiControl, , minManaPercentToDrinkUpdate, %minManaPercentToDrink%
  1861.    GuiControl, , minManaToDrinkPot, %minManaToDrinkPot%
  1862.    GuiControl, , minManaToDrinkPotUpdate, %minManaToDrinkPot%
  1863.  
  1864.    PlayerConfig["Default"]:={minLifeRatioToInstant: minLifePercentToSpam/100, IFlaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopGranite: minLifePercentToGranite/100, minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100, minNShieldRatioToQuit: minESPercentToQuit/100, minNShieldRatioToPopGranite: minESPercentToGranite/100, minNShieldRatioToPopJade: minESPercentToJade/100}
  1865.    PlayerConfig["Default"].FlaskConfig:=[]
  1866.  
  1867.    PlayerConfig["Default"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"}
  1868.    PlayerConfig["Default"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
  1869.    PlayerConfig["Default"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
  1870.    PlayerConfig["Default"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
  1871.    PlayerConfig["Default"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
  1872. return
  1873.  
  1874. TrayNotificationsCheck:
  1875.   Gui, Submit, NoHide
  1876.    If TrayCheckBox = 0
  1877.    {
  1878.       TrayNotificationsCheck = 0
  1879.       trayNotifications:=true
  1880.    }
  1881.    If TrayCheckBox = 1
  1882.    {
  1883.       TrayNotificationsCheck = 1
  1884.       trayNotifications:=false
  1885.    }
  1886.    IniWrite, %TrayNotificationsCheck% , Config.ini, Config, TrayNotificationsCheck
  1887. return  
  1888.  
  1889. SteamCheck:
  1890.   Gui, Submit, NoHide
  1891.    If SteamCheckBox = 0
  1892.    {
  1893.       IniWrite, 0 , Config.ini, Config, baseMgrPtr
  1894.       IniWrite, 0 , Config.ini, Config, SteamCheck
  1895.       MsgBox, The Base Pointer Has Been Erased,`nNext Time You Open the Script, `nIt Will Search for it Again `n`nThe Script Will now Close.
  1896.  
  1897.    }
  1898.    If SteamCheckBox = 1
  1899.    {
  1900.       IniWrite, 0 , Config.ini, Config, baseMgrPtr
  1901.       IniWrite, 1 , Config.ini, Config, SteamCheck
  1902.       MsgBox, The Base Pointer Has Been Erased,`nNext Time You Open the Script, `nIt Will Search for it Again `n`nThe Script Will now Close.
  1903.    }
  1904. ExitApp  
  1905.  
  1906. showgui:
  1907.   Gui, Show, x760 y198 h582 w473,
  1908. Return
  1909.  
  1910. DisableSlot:
  1911.   Gui, Submit, NoHide
  1912.    If DisableSlot1 = 0
  1913.    {
  1914.       IniWrite, 0 , Config.ini, DisableSlot, DisableSlot1
  1915.    }
  1916.    else If DisableSlot1 = 1
  1917.    {
  1918.       IniWrite, 1 , Config.ini, DisableSlot, DisableSlot1
  1919.    }
  1920.       If DisableSlot2 = 0
  1921.    {
  1922.       IniWrite, 0 , Config.ini, DisableSlot, DisableSlot2
  1923.    }
  1924.    else If DisableSlot2 = 1
  1925.    {
  1926.       IniWrite, 1 , Config.ini, DisableSlot, DisableSlot2
  1927.    }
  1928.       If DisableSlot3 = 0
  1929.    {
  1930.       IniWrite, 0 , Config.ini, DisableSlot, DisableSlot3
  1931.    }
  1932.    else If DisableSlot3 = 1
  1933.    {
  1934.       IniWrite, 1 , Config.ini, DisableSlot, DisableSlot3
  1935.    }
  1936.       If DisableSlot4 = 0
  1937.    {
  1938.       IniWrite, 0 , Config.ini, DisableSlot, DisableSlot4
  1939.    }
  1940.    else If DisableSlot4 = 1
  1941.    {
  1942.       IniWrite, 1 , Config.ini, DisableSlot, DisableSlot4
  1943.    }
  1944.       If DisableSlot5 = 0
  1945.    {
  1946.       IniWrite, 0 , Config.ini, DisableSlot, DisableSlot5
  1947.    }
  1948.    else If DisableSlot5 = 1
  1949.    {
  1950.       IniWrite, 1 , Config.ini, DisableSlot, DisableSlot5
  1951.    }
  1952. return
  1953.  
  1954. Find:
  1955.   Gui, Submit, NoHide  
  1956.    IniWrite, 0 , Config.ini, Config, baseMgrPtr
  1957.    MsgBox, The Base Pointer Has Been Erased,`nNext Time You Open the Script, `nIt Will Search for it Again `n`nThe Script Will now Close.
  1958. ExitApp
  1959.  
  1960. ReadMe:
  1961.   MsgBox, ------------------------------HOTKEYS------------------------------`n`n[F1] --- Use Resync Command`n[F2] --- Use Remaining Command`n[F3] --- Over an Item for DPSCalc`n[F4] --- Test Exit to Log In Screen`n[F10] -- Send Last Chat Message to Trade Channels 1-10`n[F11] -- Test Exit to Character Selection`n[F12] -- Test Use Portal`n[Alt + W] - Change Window to Bordeless, and locks mouse on window.`n`n------------------------------CREDITS------------------------------`n`n Base Script Created by Wrongusername.`n`n GUI and a Few Improvements by Gurud.`n`n DPSCalc By Nipper`n`n----------------------------MORE INFO----------------------------`n`nFor more Info and Updates Go to:`n`n http://www.ownedcore.com/forums`n/mmo/path-of-exile/poe-bots-programs`n/451206-poe-autoflask-autoscript-improvements-updates.html`n`nTip: Press Ctrl+C to copy this MessageBox contents to clipboard.
  1962. return
  1963.  
  1964. GuiClose:
  1965.    Gui, Submit
  1966.    if (trayNotifications)
  1967.    {
  1968.       TrayTip, Script is Still Running in the Background, %A_Space% , 2
  1969.    }
  1970. return
  1971.  
  1972. PortalInvCheck()
  1973. {
  1974. IfWinActive Path of Exile ahk_class Direct3DWindowClass
  1975. {
  1976.          SendMode Input
  1977.          clipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived.
  1978.          ErrorLevel = 0
  1979.          Send ^c
  1980.          ClipWait, 0.05  ; Wait for the clipboard to contain text.
  1981.          If ErrorLevel = 1
  1982.          {
  1983.             return false
  1984.          }
  1985.  
  1986.         ItemLevel := ""
  1987.         Name := ""
  1988.         Type := ""
  1989.         Quality := 0
  1990.         AttackSpeed := 0
  1991.         PhysicalDamageLow := 0
  1992.         PhysicalDamageHigh := 0
  1993.         IncreasedPhysicalDamage := 0
  1994.         FireDamageLow := 0
  1995.         FireDamageHigh := 0
  1996.         ColdDamageLow := 0
  1997.         ColdDamageHigh := 0
  1998.         LightningDamageLow := 0
  1999.         LightningDamageHigh := 0
  2000.         ChaosDamageLow := 0
  2001.         ChaosDamageHigh := 0
  2002.         Armour := 0
  2003.         EvasionRating := 0
  2004.         EnergyShield := 0
  2005.          
  2006.  
  2007.         Loop, parse, Clipboard, `n, `r          ; Goes through a loop with the lines of text found in the clipboard
  2008.         {
  2009.                 if (A_Index = 1)
  2010.                 {
  2011.                         IfNotInString, A_Loopfield, Rarity:            ; Starts a check whether it has "Rarity:" in the first line, otherwise exit
  2012.                         {
  2013.                                 Exit
  2014.                         }
  2015.                 }
  2016.                 else if (A_Index = 2)
  2017.                 {
  2018.                         Name := A_Loopfield
  2019.                 }
  2020.                 else if (A_Index = 3)
  2021.                 {
  2022.                         Type := A_Loopfield
  2023.                 }
  2024.                 else if (!ItemLevel && RegExMatch(A_Loopfield, "Itemlevel: (\d*)", SubPat))
  2025.                 {
  2026.                         ItemLevel := SubPat1
  2027.                 }
  2028.                 else if (!Quality && RegExMatch(A_Loopfield, "Quality: \+(\d*)\%", SubPat))
  2029.                 {
  2030.                         Quality := SubPat1/100
  2031.                 }
  2032.                
  2033.                 else if (!AttackSpeed && RegExMatch(A_Loopfield, "Attacks per Second: (\d\.\d*)", SubPat))
  2034.                 {
  2035.                         AttackSpeed     := SubPat1
  2036.                 }
  2037.                 else if (!PhysicalDamageLow && RegExMatch(A_Loopfield, "Physical Damage: (\d*)-(\d*)", SubPat))
  2038.                 {
  2039.                         PhysicalDamageLow := SubPat1
  2040.                         PhysicalDamageHigh := SubPat2
  2041.                 }
  2042.                 else if (!IncreasedPhysicalDamage && RegExMatch(A_Loopfield, "(\d*)\% increased Physical Damage", SubPat))
  2043.                 {
  2044.                         IncreasedPhysicalDamage := SubPat1/100
  2045.                 }
  2046.                
  2047.                 else if (!FireDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Fire Damage", SubPat))
  2048.                 {
  2049.                         FireDamageLow := SubPat1
  2050.                         FireDamageHigh := SubPat2
  2051.                 }
  2052.                 else if (!ColdDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Cold Damage", SubPat))
  2053.                 {
  2054.                         ColdDamageLow := SubPat1
  2055.                         ColdDamageHigh := SubPat2
  2056.                 }
  2057.                 else if (!LightningDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Lightning Damage", SubPat))
  2058.                 {
  2059.                         LightningDamageLow := SubPat1
  2060.                         LightningDamageHigh := SubPat2
  2061.                 }
  2062.                 else if (!ChaosDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Chaos Damage", SubPat))
  2063.                 {
  2064.                         ChaosDamageLow := SubPat1
  2065.                         ChaosDamageHigh := SubPat2
  2066.                 }      
  2067.                
  2068.                 else if (!Armour && RegExMatch(A_Loopfield, "Armour: (\d*)", SubPat))
  2069.                 {
  2070.                         Armour:= SubPat1
  2071.                 }
  2072.                 else if (!EvasionRating && RegExMatch(A_Loopfield, "Evasion Rating: (\d*)", SubPat))
  2073.                 {
  2074.                         EvasionRating:= SubPat1
  2075.                 }
  2076.                 else if (!EnergyShield && RegExMatch(A_Loopfield, "Energy Shield: (\d*)", SubPat))
  2077.                 {
  2078.                         EnergyShield:= SubPat1
  2079.                 }      
  2080.          }
  2081.    
  2082.       if (!ItemLevel) ; If we didn't get the itemlevel...
  2083.       {
  2084.          Portal := "Portal Scroll"
  2085.          If Portal = %name%
  2086.          return true
  2087.          Else
  2088.          return false
  2089.       }
  2090.    }
  2091. return false
  2092. }
  2093.  
  2094. ; DPS Calculator Script
  2095. ; This script can be found here:
  2096. ; https://www.pathofexile.com/forum/view-thread/594346
  2097. ; If you have any questions or comments please post them there as well. If you think you can help
  2098. ; improve this project. I am looking for contributors. So Pm me if you think you can help.
  2099. ;
  2100. ;
  2101. ; If you have a issue please post what version you are using.
  2102. ; Reason being is that something that might be a issue might already be fixed.
  2103. ; Version: 1.2d
  2104.  
  2105. ;DPSCalc Credits:
  2106. ;Nipper4369, creator of DPSCalc
  2107. ;mcpower for the base iLVL display of the script 5months ago before Immo.
  2108. ;Immo for the base iLVL display of the script.(Which was taken from mcpower.)
  2109. ;olop4444 for helping Nipper4369 figure out the calculations for Q20 items.
  2110. ;Aeons for a rewrite and fancy tooltips.
  2111. ;kongyuyu for base item level display.
  2112. ;Fayted for testing the script.
  2113.  
  2114. ; Creates a font for later use
  2115. CreateFont()
  2116. {
  2117.    global FontSize
  2118.    Options :=
  2119.    If (!(FontSize = ""))
  2120.    {
  2121.       Options = s%FontSize%
  2122.    }
  2123.    Gui Font, %Options%, Courier New
  2124.    Gui Font, %Options%, Consolas
  2125.    Gui Add, Text, HwndHidden,
  2126.    SendMessage, 0x31,,,, ahk_id %Hidden%
  2127.    return ErrorLevel
  2128. }
  2129.  
  2130. ; Sets the font for a created ahk tooltip
  2131. SetFont(Font)
  2132. {
  2133.    SendMessage, 0x30, Font, 1,, ahk_class tooltips_class32 ahk_exe autohotkey.exe
  2134. }
  2135.  
  2136. ; Parse elemental damage
  2137. ParseDamage(String, DmgType, ByRef DmgLo, ByRef DmgHi)
  2138. {
  2139.    IfInString, String, %DmgType% Damage
  2140.    {
  2141.       IfInString, String, Converted to or IfInString, String, taken as
  2142.        Return
  2143.       IfNotInString, String, increased
  2144.       {
  2145.          StringSplit, Arr, String, %A_Space%
  2146.          StringSplit, Arr, Arr2, -
  2147.          DmgLo := Arr1
  2148.          DmgHi := Arr2
  2149.       }
  2150.    }
  2151. }
  2152.  
  2153. ; Parse clipboard content for item level and dps
  2154. DPSCalc()
  2155. {
  2156.    IfWinActive Path of Exile ahk_class Direct3DWindowClass
  2157.    {
  2158.       SendMode Input
  2159.       clipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived.
  2160.       ErrorLevel = 0
  2161.       Send ^c
  2162.       ClipWait, 0.05  ; Wait for the clipboard to contain text.
  2163.       If ErrorLevel = 1
  2164.       {
  2165.          return
  2166.       }
  2167.       NameIsDone := False
  2168.       ItemName :=
  2169.       ItemLevel := -1
  2170.       IsWeapon := False
  2171.       PhysLo := 0
  2172.       PhysHi := 0
  2173.       Quality := 0
  2174.       AttackSpeed := 0
  2175.       PhysMult := 0
  2176.       ChaoLo := 0
  2177.       ChaoHi := 0
  2178.       ColdLo := 0
  2179.       ColdHi := 0
  2180.       FireLo := 0
  2181.       FireHi := 0
  2182.       LighLo := 0
  2183.       LighHi := 0
  2184.  
  2185.       Loop, Parse, Clipboard, `n, `r
  2186.       {
  2187.          ; Clipboard must have "Rarity:" in the first line
  2188.          If A_Index = 1
  2189.          {
  2190.             IfNotInString, A_LoopField, Rarity:
  2191.            {
  2192.                Exit
  2193.             }
  2194.             Else
  2195.             {
  2196.                Continue
  2197.             }
  2198.          }
  2199.    
  2200.          ; Get name
  2201.          If Not NameIsDone
  2202.          {
  2203.             If A_LoopField = --------
  2204.             {
  2205.                NameIsDone := True
  2206.             }
  2207.             Else
  2208.             {
  2209.                ItemName := ItemName . A_LoopField . "`n" ; Add a line of name
  2210.             }
  2211.             Continue
  2212.          }
  2213.    
  2214.          ; Get item level
  2215.          IfInString, A_LoopField, Itemlevel:
  2216.         {
  2217.             StringSplit, ItemLevelArray, A_LoopField, %A_Space%
  2218.             ItemLevel := ItemLevelArray2
  2219.             Continue
  2220.          }
  2221.    
  2222.          ; Get quality
  2223.          IfInString, A_LoopField, Quality:
  2224.         {
  2225.             StringSplit, Arr, A_LoopField, %A_Space%, +`%
  2226.             Quality := Arr2
  2227.             Continue
  2228.          }
  2229.    
  2230.          ; Get total physical damage
  2231.          IfInString, A_LoopField, Physical Damage:
  2232.         {
  2233.             IsWeapon = True
  2234.             StringSplit, Arr, A_LoopField, %A_Space%
  2235.             StringSplit, Arr, Arr3, -
  2236.             PhysLo := Arr1
  2237.             PhysHi := Arr2
  2238.             Continue
  2239.          }
  2240.          ;Fix for Elemental damage only weapons. Like the Oro's Sacrifice
  2241.          IfInString, A_LoopField, Elemental Damage:
  2242.         {
  2243.             IsWeapon = True
  2244.             Continue
  2245.          }
  2246.    
  2247.          ; These only make sense for weapons
  2248.          If IsWeapon
  2249.          {
  2250.             ; Get attack speed
  2251.             IfInString, A_LoopField, Attacks per Second:
  2252.            {
  2253.                StringSplit, Arr, A_LoopField, %A_Space%
  2254.                AttackSpeed := Arr4
  2255.                Continue
  2256.             }
  2257.    
  2258.             ; Get percentage physical damage increase
  2259.             IfInString, A_LoopField, increased Physical Damage
  2260.             {
  2261.                StringSplit, Arr, A_LoopField, %A_Space%, `%
  2262.                PhysMult := Arr1
  2263.                Continue
  2264.             }
  2265.          
  2266.          ;Lines to skip fix for converted type damage. Like the Voltaxic Rift
  2267.          IfInString, A_LoopField, Converted to
  2268.           Goto, SkipDamageParse
  2269.          IfInString, A_LoopField, can Shock
  2270.           Goto, SkipDamageParse
  2271.          
  2272.             ; Parse elemental damage
  2273.             ParseDamage(A_LoopField, "Chaos", ChaoLo, ChaoHi)
  2274.             ParseDamage(A_LoopField, "Cold", ColdLo, ColdHi)
  2275.             ParseDamage(A_LoopField, "Fire", FireLo, FireHi)
  2276.             ParseDamage(A_LoopField, "Lightning", LighLo, LighHi)
  2277.            
  2278.            SkipDamageParse:
  2279.         }
  2280.       }
  2281.       If ItemLevel = -1 ; Something without an itemlevel
  2282.       {  
  2283.          Exit
  2284.       }
  2285.       ; Get position of mouse cursor
  2286.       global X
  2287.       global Y
  2288.       MouseGetPos, X, Y
  2289.    
  2290.       ; All items should show name and item level
  2291.       ; Pad to 3 places
  2292.       ItemLevel := "   " + ItemLevel
  2293.       StringRight, ItemLevel, ItemLevel, 3
  2294.       TT = %ItemName%Item lvl: %ItemLevel%
  2295.    
  2296.       ; DPS calculations
  2297.       If IsWeapon {
  2298.          SetFormat, FloatFast, 5.1
  2299.    
  2300.          PhysDps := ((PhysLo + PhysHi) / 2) * AttackSpeed
  2301.          EleDps := ((ChaoLo + ChaoHi + ColdLo + ColdHi + FireLo + FireHi + LighLo + LighHi) / 2) * AttackSpeed
  2302.          TotalDps := PhysDps + EleDps
  2303.    
  2304.          TT = %TT%`nPhys DPS: %PhysDps%`nElem DPS: %EleDps%`nTotal DPS: %TotalDps%
  2305.    
  2306.          ; Only show Q20 values if item is not Q20
  2307.          If Quality < 20
  2308.          {
  2309.             TotalPhysMult := (PhysMult + Quality + 100) / 100
  2310.             BasePhysDps := PhysDps / TotalPhysMult
  2311.             Q20Dps := BasePhysDps * ((PhysMult + 120) / 100) + EleDps
  2312.    
  2313.             TT = %TT%`nQ20 DPS:  %Q20Dps%
  2314.          }
  2315.       }
  2316.    
  2317.            ; Replaces Clipboard with tooltip data
  2318.            StringReplace, clipboard, TT, `n, %A_SPACE% , All
  2319.  
  2320.       ; Show tooltip, with fixed width font
  2321.       ToolTip, %TT%, X + 35, Y + 35
  2322.       global FixedFont
  2323.       SetFont(FixedFont)
  2324.       ; Set up count variable and start timer for tooltip timeout
  2325.       global ToolTipTimeout := 0
  2326.       SetTimer, ToolTipTimer, 100
  2327.    }
  2328. }
  2329.  
  2330. ; Tick every 100 ms
  2331. ; Remove tooltip if mouse is moved or 5 seconds pass
  2332. ToolTipTimer:
  2333. ToolTipTimeout += 1
  2334. MouseGetPos, CurrX, CurrY
  2335. MouseMoved := (CurrX - X)**2 + (CurrY - Y)**2 > 40**2
  2336. If (MouseMoved or ToolTipTimeout >= 50)
  2337. {
  2338.    SetTimer, ToolTipTimer, Off
  2339.    ToolTip
  2340. }
  2341. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement