arthasdk

Untitled

Mar 13th, 2017
9,706
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;██████╗ ██╗   ██╗     ██████╗ ██╗   ██╗██████╗ ██╗   ██╗██████╗
  2. ;██╔══██╗╚██╗ ██╔╝    ██╔════╝ ██║   ██║██╔══██╗██║   ██║██╔══██╗
  3. ;██████╔╝ ╚████╔╝     ██║  ███╗██║   ██║██████╔╝██║   ██║██║  ██║
  4. ;██╔══██╗  ╚██╔╝      ██║   ██║██║   ██║██╔══██╗██║   ██║██║  ██║
  5. ;██████╔╝   ██║       ╚██████╔╝╚██████╔╝██║  ██║╚██████╔╝██████╔╝
  6. ;╚═════╝    ╚═╝        ╚═════╝  ╚═════╝ ╚═╝  ╚═╝ ╚═════╝ ╚═════╝
  7.                                                                
  8. ;-------GUI-----------------GUI-----------------GUI-----------------GUI-----------------GUI----------
  9.  
  10. #SingleInstance force
  11.  
  12. IniRead, LastTab, Config.ini, Config, LastTab, Settings
  13.  
  14. If LastTab = AutoFlask
  15. {
  16.    Gui,Add,Tab2, x0 y0 w474 h595 gTabFunc vTabChoice,AutoFlask||AutoQuit|Others|Settings|
  17. }
  18. Else If LastTab = AutoQuit
  19. {
  20.    Gui,Add,Tab2, x0 y0 w474 h595 gTabFunc vTabChoice,AutoFlask|AutoQuit||Others|Settings|
  21. }
  22. Else If LastTab = Others
  23. {
  24.    Gui,Add,Tab2, x0 y0 w474 h595 gTabFunc vTabChoice,AutoFlask|AutoQuit|Others||Settings|
  25. }
  26. Else If LastTab = Settings
  27. {
  28.    Gui,Add,Tab2, x0 y0 w474 h595 gTabFunc vTabChoice,AutoFlask|AutoQuit|Others|Settings||
  29. }
  30.  
  31. Gui, Tab, Settings
  32.  
  33. Gui, Add, GroupBox, x12 y110 w220 h60, AutoFlask/AutoQuit Profile
  34.  
  35. IniRead, ConfigNumber , Config.ini, Config, ConfigNumber, 1
  36.  
  37. If ConfigNumber = 1
  38. {
  39.    Gui, Add, DropDownList, x22 y130 w200 h21 AltSubmit gConfigList vConfigChoice R5 , Profile 1||Profile 2|Profile 3|Profile 4|Profile 5
  40. }
  41. Else If ConfigNumber = 2
  42. {
  43.    Gui, Add, DropDownList, x22 y130 w200 h21 AltSubmit gConfigList vConfigChoice R5 , Profile 1|Profile 2||Profile 3|Profile 4|Profile 5
  44. }
  45. Else If ConfigNumber = 3
  46. {
  47.    Gui, Add, DropDownList, x22 y130 w200 h21 AltSubmit gConfigList vConfigChoice R5 , Profile 1|Profile 2|Profile 3||Profile 4|Profile 5
  48. }
  49. Else If ConfigNumber = 4
  50. {
  51.    Gui, Add, DropDownList, x22 y130 w200 h21 AltSubmit gConfigList vConfigChoice R5 , Profile 1|Profile 2|Profile 3|Profile 4||Profile 5
  52. }
  53. Else If ConfigNumber = 5
  54. {
  55.    Gui, Add, DropDownList, x22 y130 w200 h21 AltSubmit gConfigList vConfigChoice R5 , Profile 1|Profile 2|Profile 3|Profile 4|Profile 5||
  56. }
  57.  
  58. Loop, 5
  59. {
  60.     If ConfigNumber = %A_Index%
  61.     {
  62.         IniRead, minLifePercentToQuit , Config.ini, Config%A_Index%, minLifePercentToQuit, 35
  63.         IniRead, minESPercentToQuit , Config.ini, Config%A_Index%, minESPercentToQuit, 0
  64.         IniRead, maxLifePercentPerHitToQuit , Config.ini, Config%A_Index%, maxLifePercentPerHitToQuit, 50
  65.         IniRead, maxESPercentPerHitToQuit , Config.ini, Config%A_Index%, maxESPercentPerHitToQuit, 0
  66.         IniRead, minLifePercentToJade , Config.ini, Config%A_Index%, minLifePercentToJade, 70
  67.         IniRead, minLifePercentToJade , Config.ini, Config%A_Index%, minLifePercentToJade, 70
  68.         IniRead, minESPercentToJade , Config.ini, Config%A_Index%, minESPercentToJade, 0
  69.         IniRead, minLifePercentToElementalResist , Config.ini, Config%A_Index%, minLifePercentToElementalResist, 70
  70.         IniRead, minESPercentToElementalResist , Config.ini, Config%A_Index%, minESPercentToElementalResist, 0
  71.         IniRead, minLifePercentToDrink , Config.ini, Config%A_Index%, minLifePercentToDrink, 55
  72.         IniRead, minManaPercentToDrink , Config.ini, Config%A_Index%, minManaPercentToDrink, 25
  73.         IniRead, minManaToDrinkPot , Config.ini, Config%A_Index%, minManaToDrinkPot, 15
  74.         IniRead, minLifePercentToSpam, Config.ini, Config%A_Index%, minLifePercentToSpam, 35
  75.         IniRead, ResyncSpam, Config.ini, Config%A_Index%, ResyncSpam, 0
  76.       IniRead, RemainingSpam, Config.ini, Config%A_Index%, RemainingSpam, 0
  77.         IniRead, InstantFlaskDelay, Config.ini, Config%A_Index%, InstantFlaskDelay, 0
  78.         IniRead, QuickSilverMovementTimer , Config.ini, Config%A_Index%, QuickSilverMovementTimer, 15
  79.         IniRead, RemoveAilmentsTimer , Config.ini, Config%A_Index%, RemoveAilmentsTimer, 10
  80.       IniRead, RemoveCorruptedBloodCharges , Config.ini, Config%A_Index%, RemoveCorruptedBloodCharges, 10
  81.     }  
  82. }
  83.  
  84. IniRead, QuickSilverCheck , Config.ini, Config, QuickSilverCheck, 0
  85.  
  86. IniRead, QuickSilverCheck2 , Config.ini, Config, QuickSilverCheck2, 0
  87.  
  88. IniRead, FlaskOnFrozenCheck , Config.ini, Config, FlaskOnFrozenCheck, 0
  89.  
  90. IniRead, FlaskOnShockedCheck , Config.ini, Config, FlaskOnShockedCheck, 0
  91.  
  92. IniRead, FlaskOnIgnitedCheck , Config.ini, Config, FlaskOnIgnitedCheck, 0
  93.  
  94. IniRead, AttackInPlaceCheck , Config.ini, Config, AttackInPlaceCheck, 0
  95.  
  96. IniRead, HoldCtrlCheck , Config.ini, Config, HoldCtrlCheck, 0
  97.  
  98. IniRead, FlaskOnCurseCheck , Config.ini, Config, FlaskOnCurseCheck, 0
  99.  
  100. IniRead, FlaskOnCorruptedBloodCheck , Config.ini, Config, FlaskOnCorruptedBloodCheck, 0
  101.  
  102. Gui, Tab, AutoFlask
  103.  
  104. Gui, Add, GroupBox, x12 y250 w220 h60 , Min Life `% to Use Jade/Granite Flask
  105. Gui, Add, Slider, x22 y270 w170 h30 gGuiUpdate vminLifePercentToJade +ToolTip TickInterval25, %minLifePercentToJade%
  106. Gui, Add, Text, x192 y270 w20 h30 vminLifePercentToJadeUpdate , %minLifePercentToJade%
  107. Gui, Add, Text, x212 y270 w10 h30 vminLifePercentToJadeUpdatePercent, `%
  108.  
  109. Gui, Add, GroupBox, x242 y250 w220 h60 , Min E.Shield `% to Use Jade/Granite Flask
  110. Gui, Add, Slider, x252 y270 w170 h30 gGuiUpdate vminESPercentToJade +ToolTip TickInterval25, %minESPercentToJade%
  111. Gui, Add, Text, x422 y270 w20 h30 vminESPercentToJadeUpdate, %minESPercentToJade%
  112. Gui, Add, Text, x442 y270 w10 h30 vminESPercentToJadeUpdatePercent, `%
  113.  
  114. Gui, Add, GroupBox, x12 y320 w220 h60 , Min Life `% to Use Elemental Resist Flask
  115. Gui, Add, Slider, x22 y340 w170 h30 gGuiUpdate vminLifePercentToElementalResist +ToolTip TickInterval25, %minLifePercentToElementalResist%
  116. Gui, Add, Text, x192 y340 w20 h30 vminLifePercentToElementalResistUpdate, %minLifePercentToElementalResist%
  117. Gui, Add, Text, x212 y340 w10 h30 vminLifePercentToElementalResistUpdatePercent, `%
  118.  
  119. Gui, Add, GroupBox, x242 y320 w220 h60 , Min E.Shield `% to Use Element. Resist Flask
  120. Gui, Add, Slider, x252 y340 w170 h30 gGuiUpdate vminESPercentToElementalResist +ToolTip TickInterval25, %minESPercentToElementalResist%
  121. Gui, Add, Text, x422 y340 w20 h30 vminESPercentToElementalResistUpdate, %minESPercentToElementalResist%
  122. Gui, Add, Text, x442 y340 w10 h30 vminESPercentToElementalResistUpdatePercent, `%
  123.  
  124. Gui, Add, GroupBox, x12 y40 w220 h60 , Min Life `% to Drink Health Potion
  125. Gui, Add, Slider, x22 y60 w170 h30 gGuiUpdate vminLifePercentToDrink +ToolTip TickInterval25, %minLifePercentToDrink%
  126. Gui, Add, Text, x192 y60 w20 h30 vminLifePercentToDrinkUpdate, %minLifePercentToDrink%
  127. Gui, Add, Text, x212 y60 w10 h30 vminLifePercentToDrinkUpdatePercent, `%
  128.  
  129. Gui, Add, GroupBox, x242 y40 w220 h60 , Min Mana `% to Drink Mana Potion
  130. Gui, Add, Slider, x252 y60 w170 h30 gGuiUpdate vminManaPercentToDrink +ToolTip TickInterval25, %minManaPercentToDrink%
  131. Gui, Add, Text, x422 y60 w20 h30 vminManaPercentToDrinkUpdate, %minManaPercentToDrink%
  132. Gui, Add, Text, x442 y60 w10 h30 vminManaPercentToDrinkUpdatePercent, `%
  133.  
  134. Gui, Add, GroupBox, x12 y180 w220 h60 , Min Life `% to Spam Instant Flasks
  135. Gui, Add, Slider, x22 y200 w170 h30 gGuiUpdate vminLifePercentToSpam +ToolTip TickInterval25, %minLifePercentToSpam%
  136. Gui, Add, Text, x192 y200 w20 h30 vminLifePercentToSpamUpdate, %minLifePercentToSpam%
  137. Gui, Add, Text, x212 y200 w10 h30 vminLifePercentToSpamUpdatePercent, `%
  138.  
  139. Gui, Add, GroupBox, x242 y110 w220 h60 , Min Mana to Drink Mana Potion
  140. Gui, Add, Slider, x252 y130 w170 h30 Range0-300 gGuiUpdate vminManaToDrinkPot +ToolTip TickInterval50, %minManaToDrinkPot%
  141. Gui, Add, Text, x422 y130 w30 h30 vminManaToDrinkPotUpdate, %minManaToDrinkPot%
  142.  
  143. Gui, Add, GroupBox, x242 y180 w220 h60 , Instant Flask Spam Delay  ;x12 y149 w220 h60
  144. IniRead, InstantFlaskDelay , Config.ini, Config, InstantFlaskDelay, 0
  145. Gui, Add, Slider, x252 y200 w170 h30 Range0-50 gGuiUpdate vInstantFlaskDelay +ToolTip TickInterval50, %InstantFlaskDelay%
  146. Gui, Add, Text, x422 y200 w25 h30 vInstantFlaskDelayUpdate, % Round(InstantFlaskDelay/100,2)
  147. Gui, Add, Text, x447 y200 w10 h30 vInstantFlaskDelayUpdatePercent, s
  148.  
  149. Gui, Add, GroupBox, x12 y390 w220 h60 , Only QuickSilver If Moving for X Seconds
  150. Gui, Add, Slider, x22 y410 w170 h30 Range0-100 gGuiUpdate vQuickSilverMovementTimer +ToolTip TickInterval20, %QuickSilverMovementTimer%
  151. Gui, Add, Text, x192 y410 w22 h30 vQuickSilverMovementTimerUpdate, % Round(QuickSilverMovementTimer/10,1)
  152. Gui, Add, Text, x214 y410 w10 h30 , s
  153.  
  154. Gui, Add, GroupBox, x12 y460 w220 h60 , Only Remove Ailments If They Are Over
  155. Gui, Add, Slider, x22 y480 w170 h30 Range0-50 gGuiUpdate vRemoveAilmentsTimer +ToolTip TickInterval10, %RemoveAilmentsTimer%
  156. Gui, Add, Text, x192 y480 w22 h30 vRemoveAilmentsTimerUpdate, % Round(RemoveAilmentsTimer/10,1)
  157. Gui, Add, Text, x214 y480 w10 h30 , s
  158.  
  159. Gui, Add, GroupBox, x12 y530 w220 h60 , Only Remove Corrupted Blood If X Charges
  160. Gui, Add, Slider, x22 y550 w170 h30 Range1-20 gGuiUpdate vRemoveCorruptedBloodCharges +ToolTip, %RemoveCorruptedBloodCharges%
  161. Gui, Add, Text, x192 y550 w12 h30 vRemoveCorruptedBloodChargesUpdate, %RemoveCorruptedBloodCharges%
  162. Gui, Add, Text, x210 y550 w20 h30 , ch
  163.  
  164. Gui, Add, GroupBox, x12 y110 w220 h60 , Disable AutoFlask on Slot ;x12 y359 w220 h60
  165.  
  166. Loop, 5
  167. {
  168.     IniRead, Slot%A_Index%Disabled, Config.ini, DisableSlot, DisableSlot%A_Index%, 0
  169.     XSlot:=((A_Index*40)-18)
  170.     X=x%XSlot%
  171.     If (Slot%A_Index%Disabled = 0)
  172.     Gui, Add, CheckBox, %X% y130 w30 h30 vDisableSlot%A_Index% gDisableSlot, %A_Index%
  173.     Else If (Slot%A_Index%Disabled = 1)
  174.     Gui, Add, CheckBox, %X% y130 w30 h30 checked vDisableSlot%A_Index% gDisableSlot, %A_Index%
  175. }
  176.  
  177. If QuickSilverCheck = 0
  178. {
  179.    Gui, Add, CheckBox, x242 y389 w220 h30 vQuickSilverCheckBox gQuickSilverCheck, Use QuickSilver Flask When 40+ Charges
  180. }
  181. If QuickSilverCheck = 1
  182. {
  183.    Gui, Add, CheckBox, x242 y389 w220 h30  vQuickSilverCheckBox gQuickSilverCheck Checked, Use QuickSilver Flask When 40+ Charges
  184. }
  185.  
  186. If QuickSilverCheck2 = 0
  187. {
  188.    Gui, Add, CheckBox, x242 y418 w220 h30 vQuickSilverCheckBox2 gQuickSilverCheck2, Use QuickSilver Flask When 20+ Charges
  189. }
  190. If QuickSilverCheck2 = 1
  191. {
  192.    Gui, Add, CheckBox, x242 y418 w220 h30  vQuickSilverCheckBox2 gQuickSilverCheck2 Checked, Use QuickSilver Flask When 20+ Charges
  193. }
  194.  
  195. If FlaskOnFrozenCheck = 0
  196. {
  197.    Gui, Add, CheckBox, x242 y447 w220 h30 vFlaskOnFrozenCheckBox gFlaskOnFrozenCheck, Use Flask to Remove Frozen Ailment
  198. }
  199. If FlaskOnFrozenCheck = 1
  200. {
  201.    Gui, Add, CheckBox, x242 y447 w220 h30  vFlaskOnFrozenCheckBox gFlaskOnFrozenCheck Checked, Use Flask to Remove Frozen Ailment
  202. }
  203.  
  204. If FlaskOnShockedCheck = 0
  205. {
  206.    Gui, Add, CheckBox, x242 y475 w220 h30 vFlaskOnShockedCheckBox gFlaskOnShockedCheck, Use Flask to Remove Shocked Ailment
  207. }
  208. If FlaskOnShockedCheck = 1
  209. {
  210.    Gui, Add, CheckBox, x242 y475 w220 h30  vFlaskOnShockedCheckBox gFlaskOnShockedCheck Checked, Use Flask to Remove Shocked Ailment
  211. }
  212.  
  213. If FlaskOnIgnitedCheck = 0
  214. {
  215.    Gui, Add, CheckBox, x242 y503 w220 h30 vFlaskOnIgnitedCheckBox gFlaskOnIgnitedCheck, Use Flask to Remove Burning Ailment
  216. }
  217. If FlaskOnIgnitedCheck = 1
  218. {
  219.    Gui, Add, CheckBox, x242 y503 w220 h30  vFlaskOnIgnitedCheckBox gFlaskOnIgnitedCheck Checked, Use Flask to Remove Burning Ailment
  220. }
  221.  
  222. If FlaskOnCurseCheck = 0
  223. {
  224.    Gui, Add, CheckBox, x242 y531 w220 h30 vFlaskOnCurseCheckBox gFlaskOnCurseCheck, Use Flask to Remove Curses
  225. }
  226. If FlaskOnCurseCheck = 1
  227. {
  228.    Gui, Add, CheckBox, x242 y531 w220 h30  vFlaskOnCurseCheckBox gFlaskOnCurseCheck Checked, Use Flask to Remove Curses
  229. }
  230.  
  231. If FlaskOnCorruptedBloodCheck = 0
  232. {
  233.    Gui, Add, CheckBox, x242 y558 w220 h30 vFlaskOnCorruptedBloodCheckBox gFlaskOnCorruptedBloodCheck, Use Flask to Remove Corrupted Blood
  234. }
  235. If FlaskOnCorruptedBloodCheck = 1
  236. {
  237.    Gui, Add, CheckBox, x242 y558 w220 h30  vFlaskOnCorruptedBloodCheckBox gFlaskOnCorruptedBloodCheck Checked, Use Flask to Remove Corrupted Blood
  238. }
  239.  
  240.  
  241. Gui, Tab, AutoQuit
  242.  
  243. Gui, Add, GroupBox, x12 y180 w220 h60, Auto Quit Method
  244. IniRead, AutoQuitMethod , Config.ini, Config, AutoQuitMethod, 1
  245. If AutoQuitMethod = 1
  246. {
  247.    Gui, Add, DropDownList, x22 y200 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Using cports)||Exit to Login Screen (Writes to Memory)|Alt+F4 (Fastest according to Chris)|Disabled
  248.    autoQuitMode:=1
  249. }
  250. Else If AutoQuitMethod = 2
  251. {
  252.    Gui, Add, DropDownList, x22 y200 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Using cports)|Exit to Login Screen (Writes to Memory)||Alt+F4 (Fastest according to Chris)|Disabled
  253.    autoQuitMode:=0
  254. }
  255. Else If AutoQuitMethod = 3
  256. {
  257.    Gui, Add, DropDownList, x22 y200 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Using cports)|Exit to Login Screen (Writes to Memory)|Alt+F4 (Fastest according to Chris)||Disabled
  258.    autoQuitMode:=3
  259. }
  260. Else If AutoQuitMethod = 4
  261. {
  262.    Gui, Add, DropDownList, x22 y200 w200 h21 AltSubmit gAutoQuitList vAutoQuitChoice R5, Exit to Login Screen (Using cports)|Exit to Login Screen (Writes to Memory)|Alt+F4 (Fastest according to Chris)|Disabled||
  263.    autoQuitMode:=4
  264. }
  265.  
  266. Gui, Add, GroupBox, x12 y40 w220 h60 , Min Life `% to Quit
  267. Gui, Add, Slider, x22 y60 w170 h30 gGuiUpdate vminLifePercentToQuit +ToolTip TickInterval25, %minLifePercentToQuit%
  268. Gui, Add, Text, x192 y60 w20 h30 vminLifePercentToQuitUpdate, %minLifePercentToQuit%
  269. Gui, Add, Text, x212 y60 w10 h30 vminLifePercentToQuitUpdatePercent, `%
  270.  
  271. Gui, Add, GroupBox, x242 y40 w220 h60 , Min Energy Shield `% to Quit
  272. Gui, Add, Slider, x252 y60 w170 h30 gGuiUpdate vminESPercentToQuit +ToolTip TickInterval25, %minESPercentToQuit%
  273. Gui, Add, Text, x422 y60 w20 h30 vminESPercentToQuitUpdate, %minESPercentToQuit%
  274. Gui, Add, Text, x442 y60 w10 h30 vminESPercentToQuitUpdatePercent, `%
  275.  
  276. Gui, Add, GroupBox, x12 y110 w220 h60 , Max Life `% Per Hit to Quit
  277. Gui, Add, Slider, x22 y130 w170 h30 gGuiUpdate vmaxLifePercentPerHitToQuit +ToolTip TickInterval25, %maxLifePercentPerHitToQuit%
  278. Gui, Add, Text, x192 y130 w20 h30 vmaxLifePercentPerHitToQuitUpdate, %maxLifePercentPerHitToQuit%
  279. Gui, Add, Text, x212 y130 w10 h30 vmaxLifePercentPerHitToQuitUpdatePercent, `%
  280.  
  281. Gui, Add, GroupBox, x242 y110 w220 h60 , Max Energy Shield `% Per Hit to Quit
  282. Gui, Add, Slider, x252 y130 w170 h30 gGuiUpdate vmaxESPercentPerHitToQuit +ToolTip TickInterval25, %maxESPercentPerHitToQuit%
  283. Gui, Add, Text, x422 y130 w20 h30 vmaxESPercentPerHitToQuitUpdate, %maxESPercentPerHitToQuit%
  284. Gui, Add, Text, x442 y130 w10 h30 vmaxESPercentPerHitToQuitUpdatePercent, `%
  285.  
  286. Gui, Tab, Settings
  287.  
  288. IniRead, DPSCheck , Config.ini, Config, DPSCheck, 0
  289. If DPSCheck = 0
  290. {
  291.    Gui, Add, CheckBox, x272 y70 w190 h30 vDPSCheckBox gDPSCheck, Disable DPS Calculator
  292.    global DPS:=false
  293. }
  294. If DPSCheck = 1
  295. {
  296.    Gui, Add, CheckBox, x272 y70 w190 h30  vDPSCheckBox gDPSCheck Checked, Disable DPS Calculator
  297.    global DPS:=true
  298. }
  299.  
  300. ;display tray notIfications about script actions : drinking potions, autoquitting
  301. IniRead, TrayNotIficationsCheck , Config.ini, Config, TrayNotIficationsCheck, 0
  302. If TrayNotIficationsCheck = 0
  303. {
  304.    Gui, Add, CheckBox, x272 y40 w190 h30 vTrayCheckBox gTrayNotIficationsCheck, Disable Tray NotIfications
  305.    global trayNotIfications:=true
  306. }
  307. If TrayNotIficationsCheck = 1
  308. {
  309.    Gui, Add, CheckBox, x272 y40 w190 h30 vTrayCheckBox gTrayNotIficationsCheck Checked, Disable Tray NotIfications
  310.    global trayNotIfications:=false
  311. }
  312.  
  313. Gui, Add, GroupBox, x12 y40 w220 h60 , Base Pointer
  314. Gui, Add, Text, x92 y60 w130 h30, Will Automatically Find Itself On New Client/Patch
  315. IniRead, baseMgrPtr , Config.ini, Config, baseMgrPtr, 0
  316. Gui, Add, Text, x22 y70 w70 h20 vbasePtrText , %baseMgrPtr%
  317.  
  318. Gui, Add, Button, x262 y120 w180 h40 gshowgui2, Configure Hotkeys
  319.  
  320. Gui, Add, Button, x32 y190 w180 h40 gshowgui4, Debug Window
  321.  
  322. Gui, Add, Button, x262 y190 w180 h40 gDefaultHotkeys, Restore Default Hotkeys
  323.  
  324. Gui, Add, GroupBox, x12 y250 w220 h60, Client Server
  325. IniRead, ClientServer , Config.ini, Config, ClientServer, 1
  326. If ClientServer = 1
  327. {
  328.    Gui, Add, DropDownList, x22 y270 w200 h21 AltSubmit gClientServerList vClientServerChoice R5, Global||Steam|Singapore/Malasya|Taiwan
  329.    ClientServerMode:=1
  330. }
  331. Else If ClientServer = 2
  332. {
  333.    Gui, Add, DropDownList, x22 y270 w200 h21 AltSubmit gClientServerList vClientServerChoice R5, Global|Steam||Singapore/Malasya|Taiwan
  334.    ClientServerMode:=2
  335. }
  336. Else If ClientServer = 3
  337. {
  338.    Gui, Add, DropDownList, x22 y270 w200 h21 AltSubmit gClientServerList vClientServerChoice R5, Global|Steam|Singapore/Malasya||Taiwan
  339.    ClientServerMode:=3
  340. }
  341. Else If ClientServer = 4
  342. {
  343.    Gui, Add, DropDownList, x22 y270 w200 h21 AltSubmit gClientServerList vClientServerChoice R5, Global|Steam|Singapore/Malasya|Taiwan||
  344.    ClientServerMode:=4
  345. }
  346.  
  347.  
  348. Gui, Tab, Others
  349.  
  350. IniRead, TradeSpam, Config.ini, Config, TradeSpam, 0
  351. Gui, Add, GroupBox, x12 y40 w220 h60 , Send Trade Message Every X Minutes*
  352. Gui, Add, Slider, x22 y60 w170 h30 gGuiUpdate vTradeSpam +ToolTip TickInterval1 Range0-10, %TradeSpam%
  353. Gui, Add, Text, x192 y60 w20 h30 vTradeSpamUpdate, %TradeSpam%
  354. Gui, Add, Text, x212 y60 w10 h30 vTradeSpamUpdatePercent, m
  355.  
  356. Gui, Add, Text,  x22 y565 w400 h21, *Opening the chat will stop and reset the trade spam.
  357.  
  358. Gui, Add, GroupBox, x242 y40 w220 h60 , Send Resync Command Every X Seconds
  359. Gui, Add, Slider, x252 y60 w170 h30 gGuiUpdate vResyncSpam +ToolTip TickInterval30 Range0-120, %ResyncSpam%
  360. Gui, Add, Text, x422 y60 w20 h30 vResyncSpamUpdate, %ResyncSpam%
  361. Gui, Add, Text, x442 y60 w10 h30 vResyncSpamUpdatePercent, s
  362.  
  363. Gui, Add, GroupBox, x242 y110 w220 h60 , Send Remaining Command Every X Secs
  364. Gui, Add, Slider, x252 y130 w170 h30 gGuiUpdate vRemainingSpam +ToolTip TickInterval30 Range0-120, %RemainingSpam%
  365. Gui, Add, Text, x422 y130 w20 h30 vRemainingSpamUpdate, %RemainingSpam%
  366. Gui, Add, Text, x442 y130 w10 h30 vRemainingSpamUpdatePercent, s
  367.  
  368. If AttackInPlaceCheck = 0
  369. {
  370.    Gui, Add, CheckBox, x22 y110 w200 h30 vAttackInPlaceCheckBox gAttackInPlaceCheck, Auto Hold In Place When Attacking
  371. }
  372. If AttackInPlaceCheck = 1
  373. {
  374.    Gui, Add, CheckBox, x22 y110 w200 h30  vAttackInPlaceCheckBox gAttackInPlaceCheck Checked, Auto Hold In Place When Attacking
  375. }
  376.  
  377. If HoldCtrlCheck = 0
  378. {
  379.    Gui, Add, CheckBox, x22 y140 w200 h30 vHoldCtrlCheckBox gHoldCtrlCheck, Auto Hold Ctrl On Waypoint Panel
  380. }
  381. If HoldCtrlCheck = 1
  382. {
  383.    Gui, Add, CheckBox, x22 y140 w200 h30  vHoldCtrlCheckBox gHoldCtrlCheck Checked, Auto Hold Ctrl On Waypoint Panel
  384. }
  385.  
  386.  
  387. Gui, Tab
  388.  
  389. Gui, Add, Button, x22 y609 w130 h40 gDefault, Reset Profile
  390. Gui, Add, Button, x182 y609 w120 h40 gReadMe, ReadMe
  391. Gui, Add, Button, x332 y609 w120 h40 gDonate, Donate
  392.  
  393. Gui, Add, Text, x380 y1 w110 h18 vguicontroled, Created by Gurud.
  394.  
  395. Gui, Add, GroupBox, x0 y590 w472 h74 ,
  396. Gui, Add, GroupBox, x1 y591 w470 h72 ,
  397. Gui, Add, GroupBox, x2 y592 w468 h70 ,
  398. Gui, Add, GroupBox, x3 y593 w466 h68 ,
  399. Gui, Add, GroupBox, x4 y594 w464 h66 ,
  400.  
  401. Gui, Add, GroupBox, x0 y21 w472 h575 ,
  402. Gui, Add, GroupBox, x1 y22 w470 h574 ,
  403. Gui, Add, GroupBox, x2 y23 w468 h573 ,
  404. Gui, Add, GroupBox, x3 y24 w466 h572 ,
  405. Gui, Add, GroupBox, x4 y25 w464 h571 ,
  406.  
  407. Menu, Tray, Add, Configuration Window, showgui
  408.  
  409. If (minLifePercentToQuit=0)
  410. {
  411.    GuiControl, , minLifePercentToQuitUpdate, N/A
  412.    GuiControl, , minLifePercentToQuitUpdatePercent,
  413. }
  414. If (minESPercentToQuit=0)
  415. {
  416.    GuiControl, , minESPercentToQuitUpdate, N/A
  417.    GuiControl, , minESPercentToQuitUpdatePercent,
  418. }
  419. If (maxLifePercentPerHitToQuit=0 || maxLifePercentPerHitToQuit=100)
  420. {
  421.    GuiControl, , maxLifePercentPerHitToQuitUpdate, N/A
  422.    GuiControl, , maxLifePercentPerHitToQuitUpdatePercent,
  423. }
  424. If (maxESPercentPerHitToQuit=0)
  425. {
  426.    GuiControl, , maxESPercentPerHitToQuitUpdate, N/A
  427.    GuiControl, , maxESPercentPerHitToQuitUpdatePercent,
  428. }
  429. If (minLifePercentToJade=0)
  430. {
  431.    GuiControl, , minLifePercentToJadeUpdate, N/A
  432.    GuiControl, , minLifePercentToJadeUpdatePercent,
  433. }
  434. If (minESPercentToJade=0)
  435. {
  436.    GuiControl, , minESPercentToJadeUpdate, N/A
  437.    GuiControl, , minESPercentToJadeUpdatePercent,
  438. }
  439. If (minLifePercentToElementalResist=0)
  440. {
  441.    GuiControl, , minLifePercentToElementalResistUpdate, N/A
  442.    GuiControl, , minLifePercentToElementalResistUpdatePercent,
  443. }
  444. If (minESPercentToElementalResist=0)
  445. {
  446.    GuiControl, , minESPercentToElementalResistUpdate, N/A
  447.    GuiControl, , minESPercentToElementalResistUpdatePercent,
  448. }
  449. If (minLifePercentToDrink=0)
  450. {
  451.    GuiControl, , minLifePercentToDrinkUpdate, N/A
  452.    GuiControl, , minLifePercentToDrinkUpdatePercent,
  453. }
  454. If (minManaPercentToDrink=0)
  455. {
  456.    GuiControl, , minManaPercentToDrinkUpdate, N/A
  457.    GuiControl, , minManaPercentToDrinkUpdatePercent,
  458. }
  459. If (minManaToDrinkPot=0)
  460. {
  461.    GuiControl, , minManaToDrinkPotUpdate, N/A
  462. }
  463. If (InstantFlaskDelay=0)
  464. {
  465.    GuiControl, , InstantFlaskDelayUpdate, N/A
  466.    GuiControl, , InstantFlaskDelayUpdatePercent,
  467. }
  468. If (minLifePercentToSpam=0)
  469. {
  470.    GuiControl, , minLifePercentToSpamUpdate, N/A
  471.    GuiControl, , minLifePercentToSpamUpdatePercent,
  472. }
  473. If (TradeSpam=0)
  474. {
  475.    GuiControl, , TradeSpamUpdate, N/A
  476.    GuiControl, , TradeSpamUpdatePercent,
  477. }
  478. If (ResyncSpam=0)
  479. {
  480.    GuiControl, , ResyncSpamUpdate, N/A
  481.    GuiControl, , ResyncSpamUpdatePercent,
  482. }
  483. If (RemainingSpam=0)
  484. {
  485.    GuiControl, , RemainingSpamUpdate, N/A
  486.    GuiControl, , RemainingSpamUpdatePercent,
  487. }
  488.  
  489. Gui, Submit
  490.  
  491. StringTrimRight, Name, A_ScriptName, 4
  492.  
  493. Gui, Show, x760 y198 h665 w474, %Name%
  494.  
  495. ;---------------------START DYNAMIC HOTKEYS---------------------
  496.  
  497. ;"Wild Mode allows hotkeys to trigger when other modIfiers are also held.`nFor example, If you bound Ctrl+C to an action...`nWild Mode ON: Ctrl+Alt+C, Ctrl+ShIft+C etc would still trigger the action`nWild Mode OFF: Ctrl+Alt+C etc would not trigger the action."
  498.  
  499. ; Build list of "End Keys" for Input command
  500. EXTRA_KEY_LIST := "{Escape}"  ; DO NOT REMOVE! - Used to quit binding
  501. ; Standard non-printables
  502. EXTRA_KEY_LIST .= "{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}"
  503. EXTRA_KEY_LIST .= "{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BackSpace}{Pause}"
  504. ; Numpad - Numlock ON
  505. EXTRA_KEY_LIST .= "{Numpad0}{Numpad1}{Numpad2}{Numpad3}{Numpad4}{Numpad5}{Numpad6}{Numpad7}{Numpad8}{Numpad9}{NumpadDot}{NumpadMult}{NumpadAdd}{NumpadSub}"
  506. ; Numpad - Numlock OFF
  507. EXTRA_KEY_LIST .= "{NumpadIns}{NumpadEnd}{NumpadDown}{NumpadPgDn}{NumpadLeft}{NumpadClear}{NumpadRight}{NumpadHome}{NumpadUp}{NumpadPgUp}{NumpadDel}"
  508. ; Numpad - Common
  509. EXTRA_KEY_LIST .= "{NumpadMult}{NumpadAdd}{NumpadSub}{NumpadDiv}{NumpadEnter}"
  510. ; Stuff we may or may not want to trap
  511. ;EXTRA_KEY_LIST .= "{Numlock}"
  512. EXTRA_KEY_LIST .= "{Capslock}"
  513. ;EXTRA_KEY_LIST .= "{PrintScreen}"
  514. ; Browser keys
  515. EXTRA_KEY_LIST .= "{Browser_Back}{Browser_Forward}{Browser_Refresh}{Browser_Stop}{Browser_Search}{Browser_Favorites}{Browser_Home}"
  516. ; Media keys
  517. EXTRA_KEY_LIST .= "{Volume_Mute}{Volume_Down}{Volume_Up}{Media_Next}{Media_Prev}{Media_Stop}{Media_Play_Pause}"
  518. ; App Keys
  519. EXTRA_KEY_LIST .= "{Launch_Mail}{Launch_Media}{Launch_App1}{Launch_App2}"
  520.  
  521. ; BindMode vars
  522. HKModIfierState := {}   ; The state of the modIfiers at the end of the last detection sequence
  523. HKControlType := 0      ; The kind of control that the last hotkey was. 0 = regular key, 1 = solitary modIfier, 2 = mouse, 3 = joystick
  524. HKSecondaryInput := ""  ; Set to button pressed If the last detected bind was a Mouse button, Joystick button or Solitary ModIfier
  525. HKLastHotkey := 0       ; Time that Escape was pressed to exit key binding. Used to determine If Escape is held (Clear binding)
  526.  
  527. DefaultHKObject := {hk: "", type: "", wild: ""}
  528.  
  529. ; Misc vars
  530. ININame := "Config.ini"
  531. HotkeyList := []
  532. NumHotkeys := 9
  533.  
  534. ; Create the GUI
  535. Gui 2:Add, Text,, This allows you to change Hotkeys.`n Click the "ReadMe" button to know what the hotkeys do.
  536. Gui, 2:Add, Text, x357 y25 w30 center, Wild`nMode
  537.  
  538. ypos := 50
  539.  
  540. ;Gui, 2:Add, Text, x5 y40 w300 center,Hotkey
  541. ;Gui, 2:Add, Text, x300 y40 center,~ *
  542.  
  543. Loop % NumHotkeys
  544. {
  545.    Gui, 2:Add, Edit, Disabled vHotkeyName%A_Index% w260 x5 y%ypos%, None
  546.    Gui, 2:Add, Button, gBind vBind%A_Index% yp-1 xp+270, Set Hotkey
  547.    Gui, 2:Add, Checkbox, vWild%A_Index% gOptionChanged xp+90 yp+5
  548.    ;Gui, 2:Add, Checkbox, vBlock%A_Index% gOptionChanged xp+30 yp
  549.    ypos += 25
  550. }
  551.  
  552.  
  553. ; Set GUI State
  554. LoadSettings()
  555.  
  556. ; Enable defined hotkeys
  557. EnableHotkeys()
  558.  
  559. Menu, Tray, Add, Configure Hotkeys, showgui2                                                      ;Check the box If Win modIfier is used.
  560. Gui, 2:Submit, Hide
  561.  
  562. Menu Tray, NoStandard
  563.  
  564. Menu Tray, Standard
  565.  
  566. Menu Tray,Check, Configure Hotkeys
  567. Menu Tray,Check, Configuration Window
  568.  
  569. ;---------------------END DYNAMIC HOTKEYS---------------------
  570. ;---------------------DEBUG WINDOW----------------------------
  571.  
  572. Gui, 4:Add, GroupBox, x5 y0 w300 h300 , Player Stats
  573. ypos := 25
  574. Gui, 4:Add, Text, x15 y%ypos% w155, Max HP
  575. Gui, 4:Add, Edit, Disabled vMaxHPvar  x140 y%ypos% w150, Not In Game or Broken
  576. ypos += 25
  577. Gui, 4:Add, Text, x15 y%ypos% w155, Current HP
  578. Gui, 4:Add, Edit, Disabled vCurrHPvar  x140 y%ypos% w150, Not In Game or Broken
  579. ypos += 25
  580. Gui, 4:Add, Text, x15 y%ypos% w155, Reserved HP Flat
  581. Gui, 4:Add, Edit, Disabled vReservedHPFlatvar  x140 y%ypos% w150, Not In Game or Broken
  582. ypos += 25
  583. Gui, 4:Add, Text, x15 y%ypos% w155, Reserved HP Percent
  584. Gui, 4:Add, Edit, Disabled vReservedHPPercentvar  x140 y%ypos% w150, Not In Game or Broken
  585. ypos += 25
  586. Gui, 4:Add, Text, x15 y%ypos% w155, Max Mana
  587. Gui, 4:Add, Edit, Disabled vMaxManavar  x140 y%ypos% w150, Not In Game or Broken
  588. ypos += 25
  589. Gui, 4:Add, Text, x15 y%ypos% w155, Current Mana
  590. Gui, 4:Add, Edit, Disabled vCurrManavar  x140 y%ypos% w150, Not In Game or Broken
  591. ypos += 25
  592. Gui, 4:Add, Text, x15 y%ypos% w155, Reserved Mana Flat
  593. Gui, 4:Add, Edit, Disabled vReservedManaFlatvar  x140 y%ypos% w150, Not In Game or Broken
  594. ypos += 25
  595. Gui, 4:Add, Text, x15 y%ypos% w155, Reserved Mana Percent
  596. Gui, 4:Add, Edit, Disabled vReservedManaPercentvar  x140 y%ypos% w150, Not In Game or Broken
  597. ypos += 25
  598. Gui, 4:Add, Text, x15 y%ypos% w155, Max Energy Shield
  599. Gui, 4:Add, Edit, Disabled vMaxEShieldvar  x140 y%ypos% w150, Not In Game or Broken
  600. ypos += 25
  601. Gui, 4:Add, Text, x15 y%ypos% w155, Current Energy Shield
  602. Gui, 4:Add, Edit, Disabled vCurrEShieldvar  x140 y%ypos% w150, Not In Game or Broken
  603. ypos += 25
  604. Gui, 4:Add, Text, x15 y%ypos% w155, Player Action ID
  605. Gui, 4:Add, Edit, Disabled vPlayerActionIDvar  x140 y%ypos% w150, Not In Game or Broken
  606. ypos += 35
  607.  
  608. Gui, 4:Add, GroupBox, x5 y%ypos% w300 h340 , Checks
  609. ypos += 25
  610. Gui, 4:Add, Text, x15 y%ypos% w155, Chat Status
  611. Gui, 4:Add, Edit, Disabled vChatStatusvar  x140 y%ypos% w150, Not In Game or Broken
  612. ypos += 25
  613. Gui, 4:Add, Text, x15 y%ypos% w155, Mouse On Enemy
  614. Gui, 4:Add, Edit, Disabled vMouseOnEnemyStatusvar  x140 y%ypos% w150, Not In Game or Broken
  615. ypos += 25
  616. Gui, 4:Add, Text, x15 y%ypos% w155, Panel Waypoint
  617. Gui, 4:Add, Edit, Disabled vPanelWaypointvar  x140 y%ypos% w150, Not In Game or Broken
  618. ypos += 25
  619. Gui, 4:Add, Text, x15 y%ypos% w155, Panel Inventory
  620. Gui, 4:Add, Edit, Disabled vPanelInventoryvar  x140 y%ypos% w150, Not In Game or Broken
  621. ypos += 25
  622. Gui, 4:Add, Text, x15 y%ypos% w155, Panel Skill Tree
  623. Gui, 4:Add, Edit, Disabled vPanelSkillTreevar  x140 y%ypos% w150, Not In Game or Broken
  624. ypos += 25
  625. Gui, 4:Add, Text, x15 y%ypos% w155, Panel Social
  626. Gui, 4:Add, Edit, Disabled vPanelSocialvar  x140 y%ypos% w150, Not In Game or Broken
  627. ypos += 25
  628. Gui, 4:Add, Text, x15 y%ypos% w155, Panel Instance Manager
  629. Gui, 4:Add, Edit, Disabled vPanelInstanceManagervar  x140 y%ypos% w150, Not In Game or Broken
  630. ypos += 25
  631. Gui, 4:Add, Text, x15 y%ypos% w155, In City
  632. Gui, 4:Add, Edit, Disabled vInCityvar  x140 y%ypos% w150, Not In Game or Broken
  633. ypos += 25
  634. Gui, 4:Add, Text, x15 y%ypos% w155, Enemy Name
  635. Gui, 4:Add, Edit, Disabled vEnemyNamevar  x140 y%ypos% w150, Not In Game or Broken
  636. ypos += 25
  637. Gui, 4:Add, Text, x15 y%ypos% w155, Enemy Name 2
  638. Gui, 4:Add, Edit, Disabled vEnemyName2var  x140 y%ypos% w150, Not In Game or Broken
  639. ypos += 25
  640. Gui, 4:Add, Text, x15 y%ypos% w155, Map Name
  641. Gui, 4:Add, Edit, Disabled vMapNamevar  x140 y%ypos% w150, Not In Game or Broken
  642.  
  643. Gui, 4:Add, GroupBox, x305 y0 w300 h650 , Flasks Data
  644. ypos := 25
  645. Loop, 5
  646. {
  647.    Gui, 4:Add, Text, x315 y%ypos% w155, Flask %A_Index% Type
  648.    Gui, 4:Add, Edit, Disabled vFlask%A_Index%Typevar  x440 y%ypos% w150, Not In Game or Broken
  649.    ypos += 25
  650.    Gui, 4:Add, Text, x315 y%ypos% w155, Flask %A_Index% Charges Current
  651.    Gui, 4:Add, Edit, Disabled vFlask%A_Index%ChargesCurrentvar  x440 y%ypos% w150, Not In Game or Broken
  652.    ypos += 25
  653.    Gui, 4:Add, Text, x315 y%ypos% w155, Flask %A_Index% Charges Per Use
  654.    Gui, 4:Add, Edit, Disabled vFlask%A_Index%ChargesPerUsevar  x440 y%ypos% w150, Not In Game or Broken
  655.    ypos += 25
  656.    Gui, 4:Add, Text, x315 y%ypos% w155, Flask %A_Index% Mod 1
  657.    Gui, 4:Add, Edit, Disabled vFlask%A_Index%Mod1var  x440 y%ypos% w150, Not In Game or Broken
  658.    ypos += 25
  659.    Gui, 4:Add, Text, x315 y%ypos% w155, Flask %A_Index% Mod 2
  660.    Gui, 4:Add, Edit, Disabled vFlask%A_Index%Mod2var  x440 y%ypos% w150, Not In Game or Broken
  661.    ypos += 25
  662. }
  663.  
  664. Gui, 4:Add, GroupBox, x605 y0 w300 h650 , Buff Data
  665. ypos := 25
  666. Gui, 4:Add, Text, x615 y%ypos% w155, Buff Amount
  667. Gui, 4:Add, Edit, Disabled vBuffAmountvar  x740 y%ypos% w150, Not In Game or Broken
  668. ypos += 25
  669. Loop, 8
  670. {
  671.    Gui, 4:Add, Text, x615 y%ypos% w155, Buff %A_Index% Name
  672.    Gui, 4:Add, Edit, Disabled vBuff%A_Index%Namevar  x740 y%ypos% w150, Not In Game or Broken
  673.    ypos += 25
  674.    Gui, 4:Add, Text, x615 y%ypos% w155, Buff %A_Index% Charges
  675.    Gui, 4:Add, Edit, Disabled vBuff%A_Index%Chargesvar  x740 y%ypos% w150, Not In Game or Broken
  676.    ypos += 25
  677.    Gui, 4:Add, Text, x615 y%ypos% w155, Buff %A_Index% Timer
  678.    Gui, 4:Add, Edit, Disabled vBuff%A_Index%Timervar  x740 y%ypos% w150, Not In Game or Broken
  679.    ypos += 25
  680. }
  681.  
  682. ;---------------------DEBUG WINDOW----------------------------
  683. ;-------GUI-----------------GUI-----------------GUI-----------------GUI-----------------GUI----------
  684.  
  685. ;-------START VARIABLES-----------------START VARIABLES-----------------START VARIABLES--------------
  686.  
  687. SetBatchLines, -1
  688. DetectHiddenWindows, On
  689.  
  690. If not A_IsAdmin
  691. {
  692.    TrayTip, Admin Required, Seems that you are not running this program as Admin`, it might not work properlly., 5
  693. }
  694.  
  695. cliname=Path of Exile
  696.  
  697. cliexesteam=PathOfExileSteam.exe
  698.  
  699. cliexe=PathOfExile.exe
  700. AutoFlaskWatchdogPeriod:=20 ;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.
  701. lagCompensation:=50
  702. ; Font size for the tooltip, leave empty for default(part of DPSCalc)
  703. FontSize := 12
  704. ; Create font for later use(part of DPSCalc)
  705. FixedFont := CreateFont()
  706.  
  707. ResyncTimer:= A_TickCount
  708. RemainingTimer:= A_TickCount
  709. ChatStatusTimer:= A_TickCount+99999999999
  710. TradeTimer:= 0
  711. TradeChannel:= 0
  712. tradechat:= 0
  713. TradeStep:= 3
  714. TradeSpamTimer:= 3
  715. ShIftDownOn:=0
  716. ChatCheckTimer:= 1
  717. 10secsTimer:=A_TickCount-10000
  718. 20secsTimer:=A_TickCount-20000
  719. PanickedTimer:=40
  720. LastHP:=0
  721. LastES:=0
  722. FlaskOnFrozen:=1
  723. FlaskOnShocked:=1
  724. FlaskOnIgnited:=1
  725.  
  726. If (ClientServerMode = 1)
  727. {
  728.    ConfigPath = %A_MyDocuments%
  729.    ConfigPath .= "\My" . A_Space . "Games\Path" . A_Space . "of" . A_Space . "Exile\production_Config.ini"
  730.    Taiwan:=False
  731.    Steam:=False
  732.    Singapore:=False
  733.    GlobalS:=True
  734. }
  735. If (ClientServerMode = 2)
  736. {
  737.    ConfigPath = %A_MyDocuments%
  738.    ConfigPath .= "\My" . A_Space . "Games\Path" . A_Space . "of" . A_Space . "Exile\production_Config.ini"
  739.    Taiwan:=False
  740.    Steam:=True
  741.    Singapore:=False
  742.    GlobalS:=False
  743. }
  744. If (ClientServerMode = 3)
  745. {
  746.    ConfigPath = %A_MyDocuments%
  747.    ConfigPath .= "\My" . A_Space . "Games\Path" . A_Space . "of" . A_Space . "Exile\garena_sg_production_Config.ini"
  748.    Taiwan:=False
  749.    Steam:=False
  750.    Singapore:=True
  751.    GlobalS:=False
  752. }
  753. If (ClientServerMode = 4)
  754. {
  755.    ConfigPath = %A_MyDocuments%
  756.    ConfigPath .= "\My" . A_Space . "Games\Path" . A_Space . "of" . A_Space . "Exile\garena_tw_production_Config.ini"
  757.    Taiwan:=True
  758.    Steam:=False
  759.    Singapore:=False
  760.    GlobalS:=False
  761. }
  762.  
  763. autoQuitPauseBeforeClick:=100
  764. 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)
  765.  
  766. PlayerConfig:={}
  767.  
  768. PlayerConfig["Default"]:={RemCorruptedBloodCharges:RemoveCorruptedBloodCharges,RemAilmentsTimer:RemoveAilmentsTimer,QuickSilverTimer:QuickSilverMovementTimer*100, minLifeRatioToInstant: minLifePercentToSpam/100, IflaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopElementalResist: minLifePercentToElementalResist/100,minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100,maxLifeRatioPerHitToQuit: maxLifePercentPerHitToQuit/100,maxEShieldRatioPerHitToQuit: maxESPercentPerHitToQuit/100,minEShieldRatioToQuit: minESPercentToQuit/100, minEShieldRatioToPopElementalResist: minESPercentToElementalResist/100, minEShieldRatioToPopJade: minESPercentToJade/100}
  769.  
  770. PlayerConfig["Default"].FlaskConfig:=[]
  771.  
  772. WindowQueuedFlaskEffects:=[] ;keyed by "%hwnd%%CurrPid%", hpQueueEndtime, manaQueueEndtime
  773.  
  774. basePtrAoBArray:=[0xCE, 0x50, 0xC7, 0x45, 0xF0]
  775. basePtrAobOffset:=+0x10
  776.  
  777. WindowBasicsCache:=[] ; keyed by "%hwnd%%CurrPid%", entries are objects with properties processHandle, moduleBase, moduleSize, baseFramePtr
  778.  
  779. #Include AutoHotkeyMemoryLib.ahk
  780.  
  781. OnExit, ExitSub
  782.  
  783. Loop
  784. {
  785.    Main()
  786. }
  787.  
  788. ;-------START VARIABLES-----------------START VARIABLES-----------------START VARIABLES--------------
  789.  
  790. ;-------MAIN FUNCTIONS-----------------MAIN FUNCTIONS-----------------MAIN FUNCTIONS-----------------
  791.  
  792. GetWindowBasics(hwnd, byref mB="", byref pH="", byref mS="")
  793. {
  794.    
  795.    global WindowBasicsCache
  796.    global cliexe
  797.    
  798.    WinGet, CurrPid, PID, ahk_id %hwnd%
  799.    
  800.    k="%hwnd%%CurrPid%"
  801.    
  802.    mB:=WindowBasicsCache[k].mBase
  803.    mS:=WindowBasicsCache[k].mSize
  804.    
  805.    If mB=
  806.    {
  807.       WindowBasicsCache[k]:=Object()
  808.       GetModuleInfo(cliexe, CurrPid, mB, mS)
  809.       If (mB="" || mS="")
  810.       {
  811.          MsgBox, Failed to obtain moduleBase or moduleSize for PID %CurrPid%, script will now terminate
  812.          ExitApp
  813.       }      
  814.       WindowBasicsCache[k].mBase:=mB
  815.       WindowBasicsCache[k].mSize:=mS
  816.    }
  817.  
  818.    pH:=WindowBasicsCache[k].ProcessHandle
  819.    If pH=
  820.    {
  821.       pH:=GetProcessHandle(CurrPid)
  822.       If (pH="" || pH=-1)
  823.       {
  824.          MsgBox, Invalid process handle obtained for PID %CurrPid%, script will now terminate
  825.          ExitApp
  826.       }      
  827.       WindowBasicsCache[k].ProcessHandle:=pH
  828.    }
  829. }
  830.  
  831. ScanBaseMgrPtr(mBase,pH,moduleSize)
  832. {
  833.    global basePtrAoBArray
  834.    global basePtrAobOffset
  835.    global baseMgrPtr
  836.    aobResult:=AobScan(pH,mBase,moduleSize,basePtrAoBArray)
  837.  
  838.    If aobResult
  839.    {
  840.       SetFormat, IntegerFast, hex
  841.       baseMgrPtr:=ReadMemUInt(pH,mBase+aobResult+basePtrAobOffset)-mBase
  842.       If (trayNotIfications)
  843.      TrayTip, New Base Pointer Found, baseMgrPtr = %baseMgrPtr%
  844.      IniWrite, %baseMgrPtr% , Config.ini, Config, baseMgrPtr
  845.      GuiControl, , basePtrText, %baseMgrPtr%
  846.      SetFormat, IntegerFast, dec
  847.  
  848.    }
  849.    Else
  850.    {
  851.       MsgBox, baseMgrPtr not found with AoBScan, script will now terminate
  852.       ExitApp
  853.    }  
  854. }
  855.  
  856. GetFrameBase(hwnd)
  857. {
  858.    global baseMgrPtr
  859.    global WindowBasicsCache
  860.    global cliname
  861.    global 10secsTimer
  862.  
  863.    WinGet, CurrPid, PID, ahk_id %hwnd%
  864.    k="%hwnd%%CurrPid%"
  865.  
  866.    fB:=WindowBasicsCache[k].fBase
  867.  
  868.    If fB=
  869.    {
  870.         If (A_TickCount>=10secsTimer+10000)
  871.         {
  872.             IniRead, MD5Hash , Config.ini, Config, MD5Hash, 0
  873.             WinGet FullEXEPath, ProcessPath, %cliname%
  874.             NewMD5Hash:=FileMD5(FullEXEPath)
  875.  
  876.             If (NewMD5Hash!=MD5Hash)
  877.             {
  878.                 IniWrite, 0 , Config.ini, Config, baseMgrPtr
  879.                 baseMgrPtr:= 0
  880.                 IniWrite, %NewMD5Hash% , Config.ini, Config, MD5Hash
  881.             }
  882.             10secsTimer:=A_TickCount
  883.         }
  884.  
  885.         GetWindowBasics(hwnd, mBase, pH, mSize)
  886.  
  887.  
  888.       If baseMgrPtr= 0
  889.       {
  890.          ScanBaseMgrPtr(mBase, pH, mSize)
  891.       }
  892.  
  893.       fB:=GetMultilevelPointer(pH,[mBase+baseMgrPtr,4,0xFC,0x1c])
  894.       WindowBasicsCache[k].fBase:=fB
  895.    }
  896.    return fB
  897. }
  898.  
  899. GetUiBase(hwnd)
  900. {
  901.    global baseMgrPtr
  902.    global cliname
  903.    global 10secsTimer
  904.    global Steam
  905.    global Offset3
  906.    global Offset4
  907.  
  908.  
  909.  
  910.     If (A_TickCount>=10secsTimer+10000)
  911.     {
  912.         IniRead, MD5Hash , Config.ini, Config, MD5Hash, 0
  913.         WinGet FullEXEPath, ProcessPath, %cliname%
  914.         NewMD5Hash:=FileMD5(FullEXEPath)
  915.  
  916.         If (NewMD5Hash!=MD5Hash)
  917.         {
  918.             IniWrite, 0 , Config.ini, Config, baseMgrPtr
  919.             baseMgrPtr:= 0
  920.             IniWrite, %NewMD5Hash% , Config.ini, Config, MD5Hash
  921.         }
  922.         10secsTimer:=A_TickCount
  923.     }
  924.  
  925.  
  926.     GetWindowBasics(hwnd, mBase, pH, mSize)
  927.      
  928.    If baseMgrPtr= 0
  929.    {
  930.       ScanBaseMgrPtr(mBase, pH, mSize)
  931.    }
  932.      
  933.    FrameBase:=GetFrameBase(hwnd)
  934.    If (FrameBase="" || FrameBase=0)
  935.       return
  936.    uiBase:=GetMultilevelPointer(pH,[FrameBase+Offset3,Offset4,0x8f8])
  937.    return uiBase
  938. }
  939.  
  940. ReadClientResolution(hwnd, ByRef w, ByRef h)
  941. {
  942.    global Steam
  943.    global Offset6
  944.    global Offset7
  945.  
  946.    GetWindowBasics(hwnd,mBase,pH)
  947.    If (mBase!=0 && pH && pH!=-1)
  948.    {
  949.       FrameBase:=GetFrameBase(hwnd)
  950.       w:=ReadMemUInt(pH,FrameBase+Offset6)
  951.       h:=ReadMemUInt(pH,FrameBase+Offset7)
  952.       return true
  953.    }  
  954. }
  955.  
  956.  
  957.  
  958. ReadPlayerStats(hwnd, byRef PlayerStats)
  959. {
  960.    global baseMgrPtr
  961.    global Steam
  962.    global Taiwan
  963.    global Singapore
  964.    global GlobalS
  965.  
  966.  
  967.    If (Steam)
  968.    {
  969.       global Offset1:=0x154
  970.       global Offset2:=0x4c4
  971.       global Offset3:=0x158
  972.       global Offset4:=0x220
  973.       global Offset5:=0x2E80
  974.       global Offset6:=0x15a8
  975.       global Offset7:=0x15ac
  976.       global Offset8:=0xa24
  977.       global Offset9:=0x9cc
  978.       global Offset10:=0x12C
  979.       global Offset11:=0x198
  980.    }
  981.    Else If (Taiwan)
  982.    {
  983.       global Offset1:=0x138
  984.       global Offset2:=0x5A0
  985.       global Offset3:=0x13c
  986.       global Offset4:=0x220
  987.       global Offset5:=0x2E80
  988.       global Offset6:=0x15B8
  989.       global Offset7:=0x15BC
  990.       global Offset8:=0x100
  991.       global Offset9:=0xE4
  992.       global Offset10:=0x12C
  993.       global Offset11:=0x198
  994.    }
  995.    Else If (GlobalS)
  996.    {
  997.       global Offset1:=0x138
  998.       global Offset2:=0x144
  999.       global Offset3:=0x13c
  1000.       global Offset4:=0x220
  1001.       global Offset5:=0x3934
  1002.       global Offset6:=0x158c
  1003.       global Offset7:=0x1590
  1004.       global Offset8:=0xa04
  1005.       global Offset9:=0x9ac
  1006.       global Offset10:=0xa38
  1007.       global Offset11:=0xaa0
  1008.    }
  1009.    Else If (Singapore)
  1010.    {
  1011.       global Offset1:=0x138
  1012.       global Offset2:=0x5A0
  1013.       global Offset3:=0x13c
  1014.       global Offset4:=0x220
  1015.       global Offset5:=0x2E80
  1016.       global Offset6:=0x15B8
  1017.       global Offset7:=0x15BC
  1018.       global Offset8:=0x100
  1019.       global Offset9:=0xE4
  1020.       global Offset10:=0x12C
  1021.       global Offset11:=0x198
  1022.    }
  1023.    
  1024.    GetWindowBasics(hwnd, mBase, pH)
  1025.    fBase:=GetFrameBase(hwnd)
  1026.    BaseMgr:=ReadMemUInt(pH,mBase+baseMgrPtr)
  1027.    PlayerBase:=GetMultilevelPointer(pH,[fBase+Offset1,Offset2])
  1028.    ;Config:=GetMultilevelPointer(pH,[BaseMgr+0x180,0x108,0x8c])
  1029.    ;PlayerStats.ConfigPath:=ReadMemStr(ph,Config+0xa4,255,"UTF-16")
  1030.    PlayerMain:=ReadMemUInt(pH,PlayerBase+4)
  1031.    PlayerStatsOffset:=ReadMemUInt(pH,PlayerMain+0xC)
  1032.    PlayerStats.MaxHP:=ReadMemUInt(pH,PlayerStatsOffset+0x2c)
  1033.    PlayerStats.CurrHP:=ReadMemUInt(pH,PlayerStatsOffset+0x30)  
  1034.    PlayerStats.ReservedHPFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x38)
  1035.    PlayerStats.ReservedHPPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x3c)
  1036.    PlayerStats.MaxMana:=ReadMemUInt(pH,PlayerStatsOffset+0x50)
  1037.    PlayerStats.ReservedManaFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x5c)
  1038.    PlayerStats.ReservedManaPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x60)
  1039.    PlayerStats.CurrMana:=ReadMemUInt(pH,PlayerStatsOffset+0x54)
  1040.    PlayerStats.MaxEShield:=ReadMemUInt(pH,PlayerStatsOffset+0x74)
  1041.    PlayerStats.CurrEShield:=ReadMemUInt(pH,PlayerStatsOffset+0x78)
  1042.    PlayerActionIDOffset:=ReadMemUInt(pH,PlayerMain+0x1C)
  1043.    PlayerStats.PlayerActionID:=ReadMemUInt(pH,PlayerActionIDOffset+0x70)
  1044.    /*
  1045.    SetFormat, IntegerFast, hex
  1046.    PlayerActionID += 0
  1047.    PlayerActionID .= ""
  1048.    StringRight, PlayerActionID2, PlayerActionID, 2
  1049.    SetFormat, IntegerFast, d
  1050.    PlayerStats.PlayerActionID:=PlayerActionID2
  1051.    */
  1052.  
  1053.    BuffListStart:=ReadMemUInt(pH,PlayerStatsOffset+0x94)
  1054.    BuffListEnd:=ReadMemUInt(pH,PlayerStatsOffset+0x98)
  1055.    BuffAmount:=((BuffListEnd-BuffListStart)/4)
  1056.    PlayerStats.BuffAmount:=((BuffListEnd-BuffListStart)/4)
  1057.    Loop, %BuffAmount%
  1058.    {
  1059.       BuffBasePtr:=GetMultilevelPointer(ph,[BuffListStart+((A_Index-1)*4),4])
  1060.       BuffNamePtr:=GetMultilevelPointer(ph,[BuffBasePtr+4,0])
  1061.       BuffNameStr:=ReadMemStr(ph,BuffNamePtr,70,"UTF-16")
  1062.       PlayerStats.BuffName[A_Index]:=BuffNameStr
  1063.       BuffCharges:=ReadMemUInt(pH,BuffBasePtr+0x20)
  1064.       PlayerStats.BuffCharges[A_Index]:=BuffCharges
  1065.       BuffTimer:=ReadMemFloat(pH,BuffBasePtr+0xC)
  1066.       PlayerStats.BuffTimer[A_Index]:=BuffTimer
  1067.    }
  1068.  
  1069.  
  1070.    CheckBase:=GetMultilevelPointer(pH,[fBase+Offset3,Offset4])
  1071.  
  1072.    ChatStatusOffset:=GetMultilevelPointer(pH,[CheckBase+Offset9,0x708,0x0])
  1073.    PlayerStats.ChatStatus:=ReadMemUInt(pH,ChatStatusOffset+0x754)
  1074.  
  1075.    PanelInventoryOffset:=ReadMemUInt(pH,CheckBase+Offset8)
  1076.    PlayerStats.PanelInventory:=ReadMemUInt(pH,PanelInventoryOffset+0x754)
  1077.    PanelSocialOffset:=ReadMemUInt(pH,CheckBase+Offset8+0x14)
  1078.    PlayerStats.PanelSocial:=ReadMemUInt(pH,PanelSocialOffset+0x754)
  1079.    PanelSkillTreeOffset:=ReadMemUInt(pH,CheckBase+Offset8+0x18)
  1080.    PlayerStats.PanelSkillTree:=ReadMemUInt(pH,PanelSkillTreeOffset+0x754)
  1081.    PanelWaypointOffset:=ReadMemUInt(pH,CheckBase+Offset8+0x30)
  1082.    PlayerStats.PanelWaypoint:=ReadMemUInt(pH,PanelWaypointOffset+0x754)
  1083.    PanelInstanceManagerOffset:=ReadMemUInt(pH,CheckBase+Offset8+0xB8)  ;added by immor
  1084.    PlayerStats.PanelInstanceManager:=ReadMemUInt(pH,PanelInstanceManagerOffset+0x754) ;added by immor
  1085.    InCityOffset:=GetMultilevelPointer(pH,[CheckBase+Offset10,0x704,0x958])
  1086.    PlayerStats.InCity:=ReadMemUInt(pH,InCityOffset+0x754)
  1087.    MouseOnEnemyOffset:=GetMultilevelPointer(pH,[CheckBase+Offset11,0x8c4,0x7f4])
  1088.    PlayerStats.MouseOnEnemyStatus:=ReadMemUInt(pH,MouseOnEnemyOffset+0x38)
  1089.    EnemyNamePtr:=GetMultilevelPointer(ph,[CheckBase+Offset11,0x8c4,0xb30])
  1090.    EnemyName:=ReadMemStr(ph,EnemyNamePtr,70,"UTF-16")
  1091.    PlayerStats.EnemyName:=EnemyName
  1092.    EnemyNamePtr2:=GetMultilevelPointer(ph,[CheckBase+Offset11,0x8c4,0xac8])
  1093.    EnemyName2:=ReadMemStr(ph,EnemyNamePtr2+0x32,70,"UTF-16")
  1094.    PlayerStats.EnemyName2:=EnemyName2
  1095.  
  1096.    MapNameOffset:=GetMultilevelPointer(pH,[fBase+Offset1,0x8,0x4])
  1097.    MapName:=ReadMemStr(ph,MapNameOffset,100,"UTF-16")
  1098.    PlayerStats.MapName:=MapName
  1099. }
  1100.  
  1101. ReadFlasksData(hwnd, byRef FlasksData)
  1102. {
  1103.    GetWindowBasics(hwnd, mBase, pH)
  1104.    
  1105.    UiBase:=GetUiBase(hwnd)
  1106.    
  1107.    If (!UiBase) ;not InGame
  1108.       return
  1109.    
  1110.    FlaskInvBase:=GetMultilevelPointer(pH,[UiBase+0x8b4,0x950,0x20])
  1111.  
  1112.    Loop, 5
  1113.    {
  1114.       currFlaskPtr:=ReadMemUInt(pH,FlaskInvBase+(A_Index-1)*4)
  1115.  
  1116.       If (currFlaskPtr!=0) ; there's a flask in said slot
  1117.       {
  1118.          FlasksData[A_Index]:={}
  1119.  
  1120.          If A_Index = 1
  1121.          {
  1122.             IniRead, Slot1Disabled, Config.ini, DisableSlot, DisableSlot1, 0
  1123.             If Slot1Disabled = 1
  1124.             continue
  1125.          }
  1126.          Else If A_Index = 2
  1127.          {
  1128.             IniRead, Slot2Disabled, Config.ini, DisableSlot, DisableSlot2, 0
  1129.             If Slot2Disabled = 1
  1130.             continue
  1131.          }
  1132.          Else If A_Index = 3
  1133.          {
  1134.             IniRead, Slot3Disabled, Config.ini, DisableSlot, DisableSlot3, 0
  1135.             If Slot3Disabled = 1
  1136.             continue
  1137.          }
  1138.          Else If A_Index = 4
  1139.          {
  1140.             IniRead, Slot4Disabled, Config.ini, DisableSlot, DisableSlot4, 0
  1141.             If Slot4Disabled = 1
  1142.             continue
  1143.          }
  1144.          Else If A_Index = 5
  1145.          {
  1146.             IniRead, Slot5Disabled, Config.ini, DisableSlot, DisableSlot5, 0
  1147.             If Slot5Disabled = 1
  1148.             continue
  1149.          }
  1150.  
  1151.  
  1152.          FlaskChargesPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0xC])
  1153.          FlasksData[A_Index].ChargesCurrent:=ReadMemUInt(pH,FlaskChargesPtr+0xC)
  1154.          FlasksData[A_Index].ChargesPerUse:=ReadMemUInt(pH,ReadMemUInt(pH,FlaskChargesPtr+8)+0xC)
  1155.  
  1156.          FlaskMod1Ptr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0x10,0x68,0x10,0x38])
  1157.          FlaskMod1Str:=ReadMemStr(ph,FlaskMod1Ptr,70,"UTF-16")
  1158.          FlasksData[A_Index].mod1:=FlaskMod1Str
  1159.  
  1160.          FlaskMod2Ptr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0x10,0x68,0x24,0x38])
  1161.          FlaskMod2Str:=ReadMemStr(ph,FlaskMod2Ptr,70,"UTF-16")
  1162.          FlasksData[A_Index].mod2:=FlaskMod2Str
  1163.  
  1164.          If (FlasksData[A_Index].ChargesCurrent < FlasksData[A_Index].ChargesPerUse) ; not enough charges in this flask to use it, don't bother
  1165.             continue
  1166.  
  1167.          FlaskMetadataPtr:=GetMultilevelPointer(ph,[currFlaskPtr,0,0x14])
  1168.          FlaskMetadataStr:=ReadMemStr(ph,FlaskMetadataPtr,75,"UTF-16")
  1169.          FlaskTypeStr:=SubStr(FlaskMetadataStr,23)
  1170.          FlasksData[A_Index].type:=FlaskTypeStr
  1171.          
  1172.          ;Msgbox, FlaskTypeADK: %FlaskTypeStr%
  1173.  
  1174.          FlaskLocalstatsPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x18,0x14,0xC])
  1175.          
  1176.          If InStr(FlaskTypeStr, "FlaskLife")
  1177.          {
  1178.             FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
  1179.             If ( InStr(FlasksData[A_Index].mod1,"Bubbling") || InStr(FlasksData[A_Index].mod2,"Bubbling") )
  1180.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  1181.             Else If ( InStr(FlasksData[A_Index].mod1,"起泡的*") || InStr(FlasksData[A_Index].mod2,"起泡的*") )
  1182.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  1183.             Else If ( InStr(FlasksData[A_Index].mod1,"Catalysed") || InStr(FlasksData[A_Index].mod2,"Catalysed") )
  1184.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1185.             Else If ( InStr(FlasksData[A_Index].mod1,"催化的*") || InStr(FlasksData[A_Index].mod2,"催化的*") )
  1186.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1187.             Else If ( InStr(FlasksData[A_Index].mod1,"Saturated") || InStr(FlasksData[A_Index].mod2,"Saturated") )
  1188.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  1189.             Else If ( InStr(FlasksData[A_Index].mod1,"飽和的*") || InStr(FlasksData[A_Index].mod2,"飽和的*") )
  1190.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  1191.             Else
  1192.                 FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
  1193.          }
  1194.  
  1195.          If InStr(FlaskTypeStr, "FlaskMana")
  1196.          {
  1197.             FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
  1198.             If ( InStr(FlasksData[A_Index].mod1,"Bubbling") || InStr(FlasksData[A_Index].mod2,"Bubbling") )
  1199.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  1200.             Else If ( InStr(FlasksData[A_Index].mod1,"起泡的*") || InStr(FlasksData[A_Index].mod2,"起泡的*") )
  1201.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  1202.             Else If ( InStr(FlasksData[A_Index].mod1,"Catalysed") || InStr(FlasksData[A_Index].mod2,"Catalysed") )
  1203.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1204.             Else If ( InStr(FlasksData[A_Index].mod1,"催化的*") || InStr(FlasksData[A_Index].mod2,"催化的*") )
  1205.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1206.             Else If ( InStr(FlasksData[A_Index].mod1,"Saturated") || InStr(FlasksData[A_Index].mod2,"Saturated") )
  1207.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  1208.             Else If ( InStr(FlasksData[A_Index].mod1,"飽和的*") || InStr(FlasksData[A_Index].mod2,"飽和的*") )
  1209.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  1210.             Else
  1211.                 FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
  1212.          }
  1213.          
  1214.          If InStr(FlaskTypeStr, "FlaskHybrid")
  1215.          {
  1216.             FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
  1217.             FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
  1218.             If ( InStr(FlasksData[A_Index].mod1,"Bubbling") || InStr(FlasksData[A_Index].mod2,"Bubbling") )
  1219.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  1220.             Else If ( InStr(FlasksData[A_Index].mod1,"起泡的*") || InStr(FlasksData[A_Index].mod2,"起泡的*") )
  1221.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/2.35)
  1222.             Else If ( InStr(FlasksData[A_Index].mod1,"Catalysed") || InStr(FlasksData[A_Index].mod2,"Catalysed") )
  1223.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1224.             Else If ( InStr(FlasksData[A_Index].mod1,"催化的*") || InStr(FlasksData[A_Index].mod2,"催化的*") )
  1225.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1226.             Else If ( InStr(FlasksData[A_Index].mod1,"Saturated") || InStr(FlasksData[A_Index].mod2,"Saturated") )
  1227.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  1228.             Else If ( InStr(FlasksData[A_Index].mod1,"飽和的*") || InStr(FlasksData[A_Index].mod2,"飽和的*") )
  1229.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/0.67)
  1230.             Else
  1231.                 FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
  1232.          }
  1233.  
  1234.          If InStr(FlaskTypeStr, "FlaskUtility")
  1235.          {
  1236.             If ( InStr(FlasksData[A_Index].mod1,"Alchemist") || InStr(FlasksData[A_Index].mod2,"Alchemist") )
  1237.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1238.             Else If ( InStr(FlasksData[A_Index].mod1,"鍊金的*") || InStr(FlasksData[A_Index].mod1,"鍊金的*") )
  1239.                 FlasksData[A_Index].EffectDuration:=(ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)/1.5)
  1240.             Else
  1241.                 FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
  1242.          }
  1243.       }
  1244.    }
  1245. }
  1246.  
  1247. IsInGame(hwnd)
  1248. {
  1249.     global Steam
  1250.    global Offset3
  1251.  
  1252.    If (hwnd=0 || hwnd="")
  1253.       return false
  1254.    GetWindowBasics(hwnd,mBase,pH)
  1255.    If (mBase="" || mBase=0 || pH="" || pH=-1)
  1256.       return false
  1257.    fBase:=GetFrameBase(hwnd)
  1258.    If (fBase="" || fBase=0)
  1259.       return false
  1260.    localConnection:=ReadMemUInt(pH,fBase+Offset3)
  1261.    If (localConnection=0 || localConnection="")
  1262.       return false
  1263.    Else
  1264.       return true
  1265. }
  1266.  
  1267. SetGameStateMenu(hwnd)
  1268. {
  1269.    global Steam
  1270.    global Offset3
  1271.    global Offset5
  1272.  
  1273.    If (hwnd=0 || hwnd="")
  1274.       return false
  1275.    GetWindowBasics(hwnd,mBase,pH)
  1276.    If (mBase="" || mBase=0 || pH="" || pH=-1)
  1277.       return false
  1278.    fBase:=GetFrameBase(hwnd)
  1279.    If (fBase="" || fBase=0)
  1280.       return false
  1281.    localConnection:=ReadMemUInt(pH,fBase+Offset3)
  1282.    If (localConnection!="" && localConnection!=0)
  1283.    {
  1284.       WriteMemUInt(pH,localConnection+Offset5,1)
  1285.    }
  1286. }
  1287.  
  1288. ReadHeroPos(hwnd,ByRef x, ByRef y)
  1289. {
  1290.    global Steam
  1291.    global Offset1
  1292.    global Offset2
  1293.  
  1294.    GetWindowBasics(hwnd,mBase,pH)
  1295.    If (mBase!=0 && pH && pH!=-1)
  1296.    {
  1297.       FrameBase:=GetFrameBase(hwnd)
  1298.  
  1299.       PlayerPosBase:=GetMultilevelPointer(pH,[FrameBase+Offset1,Offset2,0x24])
  1300.  
  1301.       x:=ReadMemFloat(pH,PlayerPosBase+0x2c)
  1302.       y:=ReadMemFloat(pH,PlayerPosBase+0x30)
  1303.  
  1304.       return true
  1305.    }  
  1306. }
  1307.  
  1308. ScreenToClient(hwnd, ByRef x, ByRef y)
  1309. {
  1310.     VarSetCapacity(pt, 8)
  1311.     NumPut(x, pt, 0)
  1312.     NumPut(y, pt, 4)
  1313.     DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
  1314.     x := NumGet(pt, 0, "int")
  1315.     y := NumGet(pt, 4, "int")
  1316.    VarSetCapacity(pt, 0)
  1317. }
  1318.  
  1319. GetClientCoords(byRef mx, byRef my)
  1320. {
  1321.    hwnd:=WinActive("A")  
  1322.    CoordMode, Mouse, Screen
  1323.    MouseGetPos, mx, my
  1324.    ScreenToClient(hwnd,mx,my) ;  x 580   y 435
  1325. }
  1326.  
  1327. QuitToLoginScreen(hwnd)
  1328. {  
  1329.    If (!IsInGame(hwnd))
  1330.    {
  1331.       return
  1332.    }
  1333.    SetGameStateMenu(hwnd)
  1334. }
  1335.  
  1336. GetMaxChargesFlaskOfType(ByRef FlasksData,TypeStr)
  1337. {
  1338.    currMaxCharges:=0
  1339.    Loop, 5
  1340.       If (InStr(FlasksData[A_Index].type,TypeStr))
  1341.       {
  1342.          If ((FlasksData[A_Index].ChargesCurrent>currMaxCharges) && (FlasksData[A_Index].ChargesCurrent>=FlasksData[A_Index].ChargesPerUse))
  1343.          {
  1344.             currMaxI:=A_Index
  1345.             currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1346.          }
  1347.       }
  1348.    return currMaxI
  1349. }
  1350.  
  1351. GetMaxChargesFlaskOfMod(ByRef FlasksData,ModStr)
  1352. {
  1353.    currMaxCharges:=0
  1354.    Loop, 5
  1355.       If ((InStr(FlasksData[A_Index].mod1,ModStr)) || (InStr(FlasksData[A_Index].mod2,ModStr)))
  1356.       {
  1357.          If ((FlasksData[A_Index].ChargesCurrent>currMaxCharges) && (FlasksData[A_Index].ChargesCurrent>=FlasksData[A_Index].ChargesPerUse))
  1358.          {
  1359.             currMaxI:=A_Index
  1360.             currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1361.          }
  1362.       }
  1363.    return currMaxI
  1364. }
  1365.  
  1366. GetMaxChargesFlaskQuickSilver(ByRef FlasksData,TypeStr)
  1367. {
  1368.    currMaxCharges:=0
  1369.    Loop, 5
  1370.       If (InStr(FlasksData[A_Index].type,TypeStr))
  1371.       {
  1372.          If FlasksData[A_Index].ChargesCurrent>=40
  1373.          {
  1374.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1375.             {
  1376.                currMaxI:=A_Index
  1377.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1378.             }
  1379.          }
  1380.       }
  1381.    return currMaxI
  1382. }
  1383.  
  1384. GetMaxChargesFlaskQuickSilver2(ByRef FlasksData,TypeStr)
  1385. {
  1386.    currMaxCharges:=0
  1387.    Loop, 5
  1388.       If (InStr(FlasksData[A_Index].type,TypeStr))
  1389.       {
  1390.          If FlasksData[A_Index].ChargesCurrent>=20
  1391.          {
  1392.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1393.             {
  1394.                currMaxI:=A_Index
  1395.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1396.             }
  1397.          }
  1398.       }
  1399.    return currMaxI
  1400. }
  1401.  
  1402. GetMaxChargesOfInstantFlask(ByRef FlasksData,TypeStr)
  1403. {
  1404.    global PanickedTimer
  1405.    currMaxCharges:=0
  1406.    Loop, 5
  1407.       If (InStr(FlasksData[A_Index].type,TypeStr))
  1408.       {
  1409.          If (InStr(FlasksData[A_Index].mod1,"Seething"))
  1410.          {
  1411.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1412.             {
  1413.                currMaxI:=A_Index
  1414.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1415.             }
  1416.          }
  1417.          Else If (InStr(FlasksData[A_Index].mod2,"Seething"))
  1418.          {
  1419.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1420.             {
  1421.                currMaxI:=A_Index
  1422.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1423.             }
  1424.          }
  1425.          Else If (InStr(FlasksData[A_Index].mod1,"沸騰的"))
  1426.          {
  1427.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1428.             {
  1429.                currMaxI:=A_Index
  1430.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1431.             }
  1432.          }
  1433.          Else If (InStr(FlasksData[A_Index].mod2,"沸騰的"))
  1434.          {
  1435.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1436.             {
  1437.                currMaxI:=A_Index
  1438.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1439.             }
  1440.          }
  1441.          Else If (InStr(FlasksData[A_Index].mod1,"Bubbling"))
  1442.          {
  1443.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1444.             {
  1445.                currMaxI:=A_Index
  1446.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1447.             }
  1448.          }
  1449.          Else If (InStr(FlasksData[A_Index].mod2,"Bubbling"))
  1450.          {
  1451.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1452.             {
  1453.                currMaxI:=A_Index
  1454.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1455.             }
  1456.          }
  1457.          Else If (InStr(FlasksData[A_Index].mod1," 起泡的"))
  1458.          {
  1459.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1460.             {
  1461.                currMaxI:=A_Index
  1462.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1463.             }
  1464.          }
  1465.          Else If (InStr(FlasksData[A_Index].mod2," 起泡的"))
  1466.          {
  1467.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1468.             {
  1469.                currMaxI:=A_Index
  1470.                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1471.             }
  1472.          }
  1473.          Else If ((InStr(FlasksData[A_Index].mod1,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  1474.          {
  1475.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1476.             {
  1477.                If (PanickedTimer>35)
  1478.                {
  1479.                   currMaxI:=A_Index
  1480.                   currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1481.                   PanickedTimer:= 0
  1482.                }
  1483.             }
  1484.          }
  1485.          Else If ((InStr(FlasksData[A_Index].mod2,"Panicked")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  1486.          {
  1487.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1488.             {
  1489.                If (PanickedTimer>35)
  1490.                {
  1491.                   currMaxI:=A_Index
  1492.                   currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1493.                   PanickedTimer:= 0
  1494.                }
  1495.             }
  1496.          }
  1497.          Else If ((InStr(FlasksData[A_Index].mod1,"恐慌的")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  1498.          {
  1499.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1500.             {
  1501.                If (PanickedTimer>35)
  1502.                {
  1503.                   currMaxI:=A_Index
  1504.                   currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1505.                   PanickedTimer:= 0
  1506.                }
  1507.             }
  1508.          }
  1509.          Else If ((InStr(FlasksData[A_Index].mod2,"恐慌的")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  1510.          {
  1511.             If FlasksData[A_Index].ChargesCurrent>currMaxCharges
  1512.             {
  1513.                If (PanickedTimer>35)
  1514.                {
  1515.                   currMaxI:=A_Index
  1516.                   currMaxCharges:=FlasksData[A_Index].ChargesCurrent
  1517.                   PanickedTimer:= 0
  1518.                }
  1519.             }
  1520.          }
  1521.       }
  1522.    return currMaxI
  1523. }
  1524.  
  1525. FileMD5( sFile="", cSz=4 )
  1526. {  ; by SKAN www.autohotkey.com/community/viewtopic.php?t=64211
  1527.     cSz := (cSz<0||cSz>8) ? 2**22 : 2**(18+cSz), VarSetCapacity( Buffer,cSz,0 ) ; 18-Jun-2009
  1528.     hFil := DllCall( "CreateFile", Str,sFile,UInt,0x80000000, Int,3,Int,0,Int,3,Int,0,Int,0 )
  1529.     IfLess,hFil,1, Return,hFil
  1530.     hMod := DllCall( "LoadLibrary", Str,"advapi32.dll" )
  1531.     DllCall( "GetFileSizeEx", UInt,hFil, UInt,&Buffer ),    fSz := NumGet( Buffer,0,"Int64" )
  1532.     VarSetCapacity( MD5_CTX,104,0 ),    DllCall( "advapi32\MD5Init", UInt,&MD5_CTX )
  1533.     Loop % ( fSz//cSz + !!Mod( fSz,cSz ) )
  1534.     DllCall( "ReadFile", UInt,hFil, UInt,&Buffer, UInt,cSz, UIntP,bytesRead, UInt,0 )
  1535.     , DllCall( "advapi32\MD5Update", UInt,&MD5_CTX, UInt,&Buffer, UInt,bytesRead )
  1536.     DllCall( "advapi32\MD5Final", UInt,&MD5_CTX )
  1537.     DllCall( "CloseHandle", UInt,hFil )
  1538.     Loop % StrLen( Hex:="123456789ABCDEF0" )
  1539.     N := NumGet( MD5_CTX,87+A_Index,"Char"), MD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
  1540.     Return MD5, DllCall( "FreeLibrary", UInt,hMod )
  1541. }
  1542.  
  1543.  
  1544. Main()
  1545. {
  1546.     global AutoFlaskWatchdogPeriod
  1547.     global lagCompensation
  1548.     global PlayerConfig
  1549.     global WindowQueuedFlaskEffects
  1550.     global cliname
  1551.     global cliexe
  1552.     global cliexesteam
  1553.     global trayNotIfications
  1554.     global autoQuitMode
  1555.     global desync
  1556.     global remaining
  1557.    global hideout
  1558.     global tradechat
  1559.     global borderless
  1560.     global ResyncTimer
  1561.     global ResyncSpam
  1562.    global RemainingTimer
  1563.    global RemainingSpam
  1564.     global tradechat
  1565.     global TradeSpam
  1566.     global TradeSpamTimer
  1567.     global TradeTimer
  1568.     global TradeChannel
  1569.     global TradeStep
  1570.     global PanickedTimer
  1571.     global QuickSilverCheck
  1572.     global QuickSilverCheck2
  1573.     global AttackInPlaceCheck
  1574.     global AttackInPlaceKeyUp
  1575.     global ChatStatusTimer
  1576.     global ChatCheckTimer
  1577.     global Steam
  1578.     global MovementTimer
  1579.     global 20secsTimer
  1580.     global FLaskHotkey1
  1581.     global FLaskHotkey2
  1582.     global FLaskHotkey3
  1583.     global FLaskHotkey4
  1584.     global FLaskHotkey5
  1585.     global LastHP
  1586.     global LastES
  1587.     global LastMaxHP
  1588.     global LastMaxES
  1589.     global AttackInPlaceKey
  1590.     global FlaskOnFrozenCheck
  1591.     global FlaskOnShockedCheck
  1592.     global FlaskOnIgnitedCheck
  1593.     global QuicksilverBuff
  1594.    global FlaskOnCurseCheck
  1595.    global FlaskOnCorruptedBloodCheck
  1596.    global HoldCtrlCheck
  1597.    global CtrlkeyDown
  1598.    global AttackInPlaceKeyDown
  1599.    global Taiwan
  1600.    global Singapore
  1601.    global ClientServerMode
  1602.    global ConfigPath
  1603.  
  1604.     WinGet, WinID, List, %cliname%
  1605.  
  1606.     Loop, %WinID%
  1607.     {
  1608.      
  1609.         WinGet, ProcModuleName, ProcessName,  % "ahk_id" WinID%A_Index%
  1610.  
  1611.         If (ProcModuleName!="PathOfExile.exe") And (ProcModuleName!="PathOfExileSteam.exe") ; 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
  1612.         {
  1613.             continue
  1614.         }
  1615.        
  1616.         If (ProcModuleName="PathOfExileSteam.exe")
  1617.         {
  1618.             Steam:=True
  1619.             cliexe:="PathOfExileSteam.exe"
  1620.         }
  1621.  
  1622.         Else If (ProcModuleName="PathOfExile.exe")
  1623.         {
  1624.             Steam:=False
  1625.             cliexe=PathOfExile.exe
  1626.         }
  1627.  
  1628.         If (WinID%A_Index%=WinActive("A"))
  1629.         ThisID:=WinActive("A")
  1630.  
  1631.       ;--------------Get keys Start---------------
  1632.  
  1633.       If (A_TickCount>=20secsTimer+20000)
  1634.       {
  1635.          ;Loop, 5
  1636.          ;{
  1637.             FileRead, ProductionConfig, %ConfigPath%
  1638.             ;FileReadLine, ProductionConfig, %ConfigPath%,
  1639.  
  1640.             Loop, read, %ConfigPath%
  1641.             {
  1642.                 Loop, parse, A_LoopReadLine, %A_Tab%
  1643.                 {
  1644.                      testfield = %A_LoopField%
  1645.                      testfield .= ""
  1646.  
  1647.                      IfInString, testfield, attack_in_place
  1648.                      {
  1649.                         StringGetPos, StringPos, testfield, =
  1650.                         vk := SubStr(testfield, StringPos+2)
  1651.                         SetFormat, IntegerFast, hex
  1652.                         vk += 0
  1653.                         vk .= ""
  1654.                         SetFormat, IntegerFast, d
  1655.                         AttackInPlaceKey=vk%vk%
  1656.                         continue
  1657.                      }
  1658.                      IfInString, testfield, use_flask_in_slot1
  1659.                      {
  1660.                         StringGetPos, StringPos, testfield, =
  1661.                         vk := SubStr(testfield, StringPos+2)
  1662.                         SetFormat, IntegerFast, hex
  1663.                         vk += 0
  1664.                         vk .= ""
  1665.                         SetFormat, IntegerFast, d
  1666.                         FlaskHotkey1={vk%vk%
  1667.                         continue
  1668.                      }
  1669.                      IfInString, testfield, use_flask_in_slot2
  1670.                      {
  1671.                         StringGetPos, StringPos, testfield, =
  1672.                         vk := SubStr(testfield, StringPos+2)
  1673.                         SetFormat, IntegerFast, hex
  1674.                         vk += 0
  1675.                         vk .= ""
  1676.                         SetFormat, IntegerFast, d
  1677.                         FlaskHotkey2={vk%vk%
  1678.                         continue
  1679.                      }
  1680.                      IfInString, testfield, use_flask_in_slot3
  1681.                      {
  1682.                         StringGetPos, StringPos, testfield, =
  1683.                         vk := SubStr(testfield, StringPos+2)
  1684.                         SetFormat, IntegerFast, hex
  1685.                         vk += 0
  1686.                         vk .= ""
  1687.                         SetFormat, IntegerFast, d
  1688.                         FlaskHotkey3={vk%vk%
  1689.                         continue
  1690.                      }
  1691.                      IfInString, testfield, use_flask_in_slot4
  1692.                      {
  1693.                         StringGetPos, StringPos, testfield, =
  1694.                         vk := SubStr(testfield, StringPos+2)
  1695.                         SetFormat, IntegerFast, hex
  1696.                         vk += 0
  1697.                         vk .= ""
  1698.                         SetFormat, IntegerFast, d
  1699.                         FlaskHotkey4={vk%vk%
  1700.                         continue
  1701.                      }
  1702.                      IfInString, testfield, use_flask_in_slot5
  1703.                      {
  1704.                         StringGetPos, StringPos, testfield, =
  1705.                         vk := SubStr(testfield, StringPos+2)
  1706.                         SetFormat, IntegerFast, hex
  1707.                         vk += 0
  1708.                         vk .= ""
  1709.                         SetFormat, IntegerFast, d
  1710.                         FlaskHotkey5={vk%vk%
  1711.                         continue
  1712.                      }
  1713.                 }
  1714.             }
  1715.             ;FlaskHotkey%A_Index%={vk%vk%
  1716.          ;}
  1717.          
  1718.          20secsTimer:=A_TickCount
  1719.       }
  1720.  
  1721.       ;--------------Get keys End-----------------
  1722.  
  1723.       PlayerStats:={}
  1724.       ReadPlayerStats(WinID%A_Index%, PlayerStats)
  1725.  
  1726.       CurrentConfig:=PlayerConfig["Default"]
  1727.  
  1728.       If (PlayerStats.MaxHP<1 || PlayerStats.CurrHP=0) ;dead, don't bother
  1729.       {
  1730.          continue
  1731.       }
  1732.  
  1733.       If (!IsInGame(WinID%A_Index%))
  1734.       {
  1735.          LastHP:=0
  1736.          LastES:=0
  1737.          LastMaxHP:=0
  1738.          LastMaxES:=0
  1739.          continue
  1740.       }
  1741.      
  1742.         If PlayerStats.MaxEShield>0
  1743.         {
  1744.             currEShieldRatio:=PlayerStats.CurrEShield/PlayerStats.MaxEShield
  1745.             LastEShieldRatio:=LastES/PlayerStats.MaxEShield
  1746.             If (LastMaxES!=PlayerStats.MaxEShield)
  1747.             {
  1748.                 LastEShieldRatio:=0
  1749.             }
  1750.         }
  1751.         Else
  1752.         {
  1753.             currEShieldRatio:= 1
  1754.         }
  1755.  
  1756.         If (PlayerStats.MaxHP>1)
  1757.         {
  1758.             currLifeRatio:=PlayerStats.CurrHP/(PlayerStats.MaxHP-PlayerStats.ReservedHPFlat-PlayerStats.MaxHP*PlayerStats.ReservedHPPercent/100)
  1759.             LastLifeRatio:=LastHP/(PlayerStats.MaxHP-PlayerStats.ReservedHPFlat-PlayerStats.MaxHP*PlayerStats.ReservedHPPercent/100)   
  1760.             If (LastMaxHP!=PlayerStats.MaxHP)
  1761.             {
  1762.                 LastLifeRatio:=0
  1763.             }
  1764.         }
  1765.         Else
  1766.         {
  1767.             currLifeRatio:=1
  1768.          LastLifeRatio:=0
  1769.         }
  1770.      
  1771.         If (PlayerStats.MaxMana>0)
  1772.         {
  1773.             currManaRatio:=PlayerStats.CurrMana/(PlayerStats.MaxMana-PlayerStats.ReservedManaFlat-PlayerStats.MaxMana*PlayerStats.ReservedManaPercent/100)
  1774.         }
  1775.      
  1776.         If (currLifeRatio<CurrentConfig.minLifeRatioToQuit || currEShieldRatio<CurrentConfig.minEShieldRatioToQuit || (currLifeRatio<LastLifeRatio And ((LastLifeRatio-currLifeRatio)>CurrentConfig.maxLifeRatioPerHitToQuit) And (CurrentConfig.maxLifeRatioPerHitToQuit<1 And CurrentConfig.maxLifeRatioPerHitToQuit>0)) || (CurrentConfig.maxEShieldRatioPerHitToQuit>0 And currEShieldRatio<LastEShieldRatio And ((LastEShieldRatio-currEShieldRatio)>CurrentConfig.maxEShieldRatioPerHitToQuit)))
  1777.         {
  1778.             If (autoQuitMode=0)
  1779.             {
  1780.                 QuitToLoginScreen(WinID%A_Index%)
  1781.                 continue
  1782.             }
  1783.             Else If (autoQuitMode=1)
  1784.             {
  1785.                 run, cports.exe /close * * * * PathofExile.exe
  1786.                 continue
  1787.             }
  1788.             Else If (autoQuitMode=3)
  1789.             {
  1790.             WinActivate Path of Exile ahk_class POEWindowClass
  1791.                 IfWinActive Path of Exile ahk_class POEWindowClass
  1792.             {
  1793.                SendInput {ALT Down}
  1794.                SendInput {F4}
  1795.                SendInput {ALT Up}
  1796.             }
  1797.                 continue
  1798.             }
  1799.             Else If (autoQuitMode=4)
  1800.             {
  1801.  
  1802.             }
  1803.         }
  1804.  
  1805.         If (PlayerStats.CurrHP>0)
  1806.         {
  1807.             LastHP:=PlayerStats.CurrHP
  1808.             LastES:=PlayerStats.CurrEShield
  1809.             LastMaxHP:=PlayerStats.MaxHP
  1810.             LastMaxES:=PlayerStats.MaxEShield
  1811.         }
  1812.         Else
  1813.         {
  1814.             LastHP:=0
  1815.             LastES:=0
  1816.             LastMaxHP:=0
  1817.             LastMaxES:=0
  1818.         }
  1819.  
  1820.  
  1821.         FlasksData:=[]
  1822.         ReadFlasksData(WinID%A_Index%,FlasksData)
  1823.  
  1824.         WinGet, CurrPID, PID,  % "ahk_id" WinID%A_Index%
  1825.         hwnd:=WinID%A_Index%
  1826.         k="%hwnd%%CurrPid%"
  1827.        
  1828.        
  1829.  
  1830.         If (!WindowQueuedFlaskEffects.HasKey(k))
  1831.         {
  1832.             WindowQueuedFlaskEffects[k]:={}
  1833.         }
  1834.  
  1835.         If (currLifeRatio>=0.90)
  1836.         {
  1837.             WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount
  1838.          WindowQueuedFlaskEffects[k].InstantQueueEndtime:=A_TickCount
  1839.         }
  1840.  
  1841.         If (currManaRatio>=0.90)
  1842.         {
  1843.             WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount
  1844.         }
  1845.  
  1846.         If (PlayerStats.BuffAmount>100)
  1847.         {
  1848.             BuffAmount:=0
  1849.         }
  1850.         Else
  1851.         {
  1852.             BuffAmount:=PlayerStats.BuffAmount
  1853.         }
  1854.  
  1855.         QuicksilverBuff:=0
  1856.  
  1857.         RemAilmentsTimer:=Round(CurrentConfig.RemAilmentsTimer/10,1)
  1858.  
  1859.       LeavingArea:=0
  1860.       GracePeriod:=0
  1861.  
  1862.       TrayTip, , %Offset1%
  1863.  
  1864.       loop, %BuffAmount%
  1865.         {
  1866.             BuffTimer:=PlayerStats.BuffTimer[A_Index]
  1867.  
  1868.             If InStr(playerstats.BuffName[A_Index], "aura")
  1869.             {
  1870.                 continue
  1871.             }
  1872.  
  1873.             Else If InStr(playerstats.BuffName[A_Index], "flask_utility_sprint")
  1874.             {
  1875.                 QuicksilverBuff:=1
  1876.                 If (BuffTimer<0.25)
  1877.                 {
  1878.                     QuicksilverBuff:=0
  1879.                     BuffTimer:=0
  1880.                 }
  1881.                 continue
  1882.             }
  1883.  
  1884.  
  1885.             Else If (InStr(playerstats.BuffName[A_Index], "frozen") || InStr(playerstats.BuffName[A_Index], "冰凍"))
  1886.             {
  1887.                 If ((FlaskOnFrozenCheck) && (BuffTimer>=RemAilmentsTimer))
  1888.                 {
  1889.                     If ((!WindowQueuedFlaskEffects[k].HasKey("FrozenQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].FrozenQueueEndtime-lagCompensation)))
  1890.                     {
  1891.                   If Taiwan
  1892.                   {
  1893.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"熱火之")
  1894.                   }
  1895.                   else
  1896.                   {
  1897.                            flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"of Heat")
  1898.                   }
  1899.  
  1900.                         If (flaskNum!="")
  1901.                         {  
  1902.                             WindowQueuedFlaskEffects[k].FrozenQueueEndtime:=A_TickCount+300
  1903.                            
  1904.                             If (trayNotIfications)
  1905.                             {
  1906.                                 TrayTip, PoE AutoFlask Using "of Heat" flask %flaskNum%, %A_Space% , 2
  1907.                             }
  1908.                             hKey:=FlaskHotkey%flaskNum%
  1909.                             IfWinActive Path of Exile ahk_class POEWindowClass
  1910.                      {
  1911.                         Sendinput, %hkey% Down}
  1912.                         Sendinput, %hkey% Up}
  1913.                      }
  1914.                      Else
  1915.                      {
  1916.                         ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  1917.                      }
  1918.                         }
  1919.                     }
  1920.                 }
  1921.                 continue
  1922.             }
  1923.  
  1924.             Else If (InStr(playerstats.BuffName[A_Index], "shocked") || InStr(playerstats.BuffName[A_Index], "感電"))
  1925.             {
  1926.                 If ((FlaskOnShockedCheck) && (BuffTimer>=RemAilmentsTimer))
  1927.                 {
  1928.                     If ((!WindowQueuedFlaskEffects[k].HasKey("ShockedQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].ShockedQueueEndtime-lagCompensation)))
  1929.                     {
  1930.                   If Taiwan
  1931.                   {
  1932.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"接地之")
  1933.                   }
  1934.                   else
  1935.                   {
  1936.                            flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"of Grounding")
  1937.                         }
  1938.  
  1939.                   If (flaskNum!="")
  1940.                         {  
  1941.                             WindowQueuedFlaskEffects[k].ShockedQueueEndtime:=A_TickCount+300
  1942.                            
  1943.                             If (trayNotIfications)
  1944.                             {
  1945.                                 TrayTip, PoE AutoFlask Using "of Grounding" flask %flaskNum%, %A_Space% , 2
  1946.                             }
  1947.                             hKey:=FlaskHotkey%flaskNum%
  1948.                             IfWinActive Path of Exile ahk_class POEWindowClass
  1949.                      {
  1950.                         Sendinput, %hkey% Down}
  1951.                         Sendinput, %hkey% Up}
  1952.                      }
  1953.                      Else
  1954.                      {
  1955.                         ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  1956.                      }
  1957.                         }
  1958.                     }
  1959.                 }
  1960.                 continue
  1961.             }
  1962.  
  1963.             Else If (InStr(playerstats.BuffName[A_Index], "ignited") || InStr(playerstats.BuffName[A_Index], "燃燒"))
  1964.             {
  1965.                 If ((FlaskOnIgnitedCheck) && (BuffTimer>=RemAilmentsTimer))
  1966.                 {
  1967.                     If ((!WindowQueuedFlaskEffects[k].HasKey("IgnitedQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].IgnitedQueueEndtime-lagCompensation)))
  1968.                     {
  1969.                   If Taiwan
  1970.                   {
  1971.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"澆熄之")
  1972.                   }
  1973.                   else
  1974.                   {
  1975.                            flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"of Dousing")
  1976.                   }
  1977.  
  1978.                         If (flaskNum!="")
  1979.                         {  
  1980.                             WindowQueuedFlaskEffects[k].IgnitedQueueEndtime:=A_TickCount+300
  1981.                            
  1982.                             If (trayNotIfications)
  1983.                             {
  1984.                                 TrayTip, PoE AutoFlask Using "of Dousing" flask %flaskNum%, %A_Space% , 2
  1985.                             }
  1986.                             hKey:=FlaskHotkey%flaskNum%
  1987.                             IfWinActive Path of Exile ahk_class POEWindowClass
  1988.                      {
  1989.                         Sendinput, %hkey% Down}
  1990.                         Sendinput, %hkey% Up}
  1991.                      }
  1992.                      Else
  1993.                      {
  1994.                         ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  1995.                      }
  1996.                         }
  1997.                     }
  1998.                 }
  1999.                 continue
  2000.             }
  2001.  
  2002.          Else If (((InStr(playerstats.BuffName[A_Index], "curse")) || InStr(playerstats.BuffName[A_Index], "冰凍")) And !(InStr(playerstats.BuffName[A_Index], "flask")) And !(PlayerStats.BuffTimer[A_Index]="1.#INF00"))
  2003.          {
  2004.             If (FlaskOnCurseCheck)
  2005.             {
  2006.                If ((!WindowQueuedFlaskEffects[k].HasKey("CurseQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].CurseQueueEndtime-lagCompensation)))
  2007.                {
  2008.                   If Taiwan
  2009.                   {
  2010.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"守護之")
  2011.                   }
  2012.                   else
  2013.                   {
  2014.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"of Warding")
  2015.                   }
  2016.  
  2017.                   If (flaskNum!="")
  2018.                   {  
  2019.                      WindowQueuedFlaskEffects[k].CurseQueueEndtime:=A_TickCount+300
  2020.                      
  2021.                      If (trayNotIfications)
  2022.                      {
  2023.                         TrayTip, PoE AutoFlask Using "of Warding" flask %flaskNum%, %A_Space% , 2
  2024.                      }
  2025.                      hKey:=FlaskHotkey%flaskNum%
  2026.                      IfWinActive Path of Exile ahk_class POEWindowClass
  2027.                      {
  2028.                         Sendinput, %hkey% Down}
  2029.                         Sendinput, %hkey% Up}
  2030.                      }
  2031.                      Else
  2032.                      {
  2033.                         ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2034.                      }
  2035.                   }
  2036.                }
  2037.             }
  2038.             continue
  2039.          }
  2040.  
  2041.          Else If (InStr(playerstats.BuffName[A_Index], "corrupted_blood") || InStr(playerstats.BuffName[A_Index], "腐化之血"))
  2042.          {
  2043.             global RemoveCorruptedBloodCharges
  2044.             BuffCharges:=PlayerStats.BuffCharges[A_Index]
  2045.             If ((FlaskOnCorruptedBloodCheck) && (BuffCharges>=RemoveCorruptedBloodCharges))
  2046.             {
  2047.                If ((!WindowQueuedFlaskEffects[k].HasKey("CorruptedBloodQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].CorruptedBloodQueueEndtime-lagCompensation)))
  2048.                {
  2049.                   If Taiwan
  2050.                   {
  2051.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"止血之")
  2052.                   }
  2053.                   else
  2054.                   {
  2055.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"of Staunching")
  2056.                   }
  2057.  
  2058.                   If (flaskNum!="")
  2059.                   {  
  2060.                      WindowQueuedFlaskEffects[k].CorruptedBloodQueueEndtime:=A_TickCount+300
  2061.                      
  2062.                      If (trayNotIfications)
  2063.                      {
  2064.                         TrayTip, PoE AutoFlask Using "of Staunching" flask %flaskNum%, %A_Space% , 2
  2065.                      }
  2066.                      hKey:=FlaskHotkey%flaskNum%
  2067.                      IfWinActive Path of Exile ahk_class POEWindowClass
  2068.                      {
  2069.                         Sendinput, %hkey% Down}
  2070.                         Sendinput, %hkey% Up}
  2071.                      }
  2072.                      Else
  2073.                      {
  2074.                         ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2075.                      }
  2076.                   }
  2077.                }
  2078.             }
  2079.             continue
  2080.          }
  2081.  
  2082.          Else If InStr(playerstats.BuffName[A_Index], "puncture")
  2083.          {
  2084.             If ((FlaskOnCorruptedBloodCheck))
  2085.             {
  2086.                If ((!WindowQueuedFlaskEffects[k].HasKey("CorruptedBloodQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].CorruptedBloodQueueEndtime-lagCompensation)))
  2087.                {
  2088.                   If Taiwan
  2089.                   {
  2090.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"止血之")
  2091.                   }
  2092.                   else
  2093.                   {
  2094.                      flaskNum:=GetMaxChargesFlaskOfMod(FlasksData,"of Staunching")
  2095.                   }
  2096.  
  2097.                   If (flaskNum!="")
  2098.                   {  
  2099.                      WindowQueuedFlaskEffects[k].CorruptedBloodQueueEndtime:=A_TickCount+300
  2100.                      
  2101.                      If (trayNotIfications)
  2102.                      {
  2103.                         TrayTip, PoE AutoFlask Using "of Staunching" flask %flaskNum%, %A_Space% , 2
  2104.                      }
  2105.                      hKey:=FlaskHotkey%flaskNum%
  2106.                      IfWinActive Path of Exile ahk_class POEWindowClass
  2107.                      {
  2108.                         Sendinput, %hkey% Down}
  2109.                         Sendinput, %hkey% Up}
  2110.                      }
  2111.                      Else
  2112.                      {
  2113.                         ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2114.                      }
  2115.                   }
  2116.                }
  2117.             }
  2118.             continue
  2119.          }
  2120.          /* Lag dependent?
  2121.          Else If InStr(playerstats.BuffName[A_Index], "flask_effect_Life")
  2122.          {
  2123.             If (BuffTimer)
  2124.             {
  2125.                WindowQueuedFlaskEffects[k].hpQueueEndtime:=(A_TickCount+(BuffTimer*100))
  2126.             }
  2127.             continue
  2128.          }
  2129.  
  2130.          Else If InStr(playerstats.BuffName[A_Index], "flask_effect_mana")
  2131.          {
  2132.             If (BuffTimer)
  2133.             {
  2134.                WindowQueuedFlaskEffects[k].ManaQueueEndtime:=(A_TickCount+(BuffTimer*100))
  2135.             }
  2136.             continue
  2137.          }
  2138.          */
  2139.  
  2140.          Else If InStr(playerstats.BuffName[A_Index], "leaving_area_protection")
  2141.          {
  2142.             LeavingArea:=1
  2143.             continue
  2144.          }
  2145.          Else If InStr(playerstats.BuffName[A_Index], "grace_period")
  2146.          {
  2147.             GracePeriod:=1
  2148.             continue
  2149.          }
  2150.          
  2151.  
  2152.             /* ;Others
  2153.             Else If InStr(playerstats.BuffName[A_Index], "chilled")
  2154.             {
  2155.                 TrayTip, test , THIS BUFF IS CHILLED!!! buff%A_Index%
  2156.                 continue
  2157.             }
  2158.  
  2159.             Else If InStr(playerstats.BuffName[A_Index], "puncture")
  2160.             {
  2161.                 TrayTip, test, THIS BUFF IS PUNCTURE!!! buff%A_Index%
  2162.                 continue
  2163.             }
  2164.  
  2165.             Else If InStr(playerstats.BuffName[A_Index], "endurance_charge")
  2166.             {
  2167.                 BuffCharges:=PlayerStats.BuffCharges[A_Index]
  2168.                 TrayTip, test, Endurance Charge has %BuffCharges% charges  ;charges test
  2169.                 continue
  2170.             }
  2171.             */
  2172.         }
  2173.  
  2174.       If (!GracePeriod && !LeavingArea)
  2175.       {
  2176.          If (currLifeRatio<CurrentConfig.minLifeRatioToInstant)
  2177.          {
  2178.             If ((!WindowQueuedFlaskEffects[k].HasKey("InstantQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].InstantQueueEndtime)))
  2179.             {
  2180.                tflaskNum2:=GetMaxChargesOfInstantFlask(FlasksData,"FlaskLife")
  2181.                If (tflaskNum2!="")
  2182.                {
  2183.                   flaskNum:=tflaskNum2
  2184.                }
  2185.                If (flaskNum!="")
  2186.                {  
  2187.                   IfDelay:= (CurrentConfig.IflaskDelay*10)
  2188.                   WindowQueuedFlaskEffects[k].InstantQueueEndtime:=A_TickCount+IfDelay
  2189.                   If (trayNotIfications)
  2190.                   {
  2191.                      TrayTip, PoE AutoFlask Using HP Flask %flaskNum%, %A_Space% , 2
  2192.                   }
  2193.                   hKey:=FlaskHotkey%flaskNum%
  2194.                   IfWinActive Path of Exile ahk_class POEWindowClass
  2195.                   {
  2196.                      Sendinput, %hkey% Down}
  2197.                      Sendinput, %hkey% Up}
  2198.                   }
  2199.                   Else
  2200.                   {
  2201.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2202.                   }
  2203.                   break
  2204.                }
  2205.             }
  2206.          }
  2207.  
  2208.         If (currLifeRatio<CurrentConfig.minLifeRatioToDrink)
  2209.         {
  2210.             If ((!WindowQueuedFlaskEffects[k].HasKey("hpQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].hpQueueEndtime-lagCompensation)))
  2211.             {
  2212.                 tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskLife")
  2213.                 tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
  2214.                 If ((tflaskNum1!=) && (tflaskNum2!=))
  2215.                 {
  2216.                     flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
  2217.                 }
  2218.                 Else
  2219.                 {
  2220.                     If (tflaskNum1!="")
  2221.                     {
  2222.                         flaskNum:=tflaskNum1
  2223.                     }
  2224.                     If (tflaskNum2!="")
  2225.                     {
  2226.                         flaskNum:=tflaskNum2
  2227.                     }
  2228.                 }
  2229.                 If (flaskNum!="")
  2230.                 {  
  2231.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2232.                     If (InStr(FlasksData[flaskNum].mod1,"Seething"))
  2233.                     {
  2234.                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2235.                     }
  2236.                     Else If (InStr(FlasksData[flaskNum].mod2,"Seething"))
  2237.                     {
  2238.                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2239.                     }
  2240.                   Else If (InStr(FlasksData[flaskNum].mod1,"沸騰的"))
  2241.                   {
  2242.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2243.                   }
  2244.                   Else If (InStr(FlasksData[flaskNum].mod2,"沸騰的"))
  2245.                   {
  2246.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2247.                   }
  2248.                     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
  2249.                     {
  2250.                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2251.                     }
  2252.                     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
  2253.                     {
  2254.                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2255.                     }
  2256.                   Else If ((InStr(FlasksData[flaskNum].mod1,"恐慌的")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  2257.                   {
  2258.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2259.                   }
  2260.                   Else If ((InStr(FlasksData[flaskNum].mod2,"恐慌的")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  2261.                   {
  2262.                      WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+500
  2263.                   }
  2264.                     Else
  2265.                     {
  2266.                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+EffectDuration*100
  2267.                     }
  2268.                     If (trayNotIfications)
  2269.                     {
  2270.                         TrayTip, PoE AutoFlask Using HP flask %flaskNum%, %A_Space% , 2
  2271.                     }
  2272.                     hKey:=FlaskHotkey%flaskNum%
  2273.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2274.                   {
  2275.                      Sendinput, %hkey% Down}
  2276.                      Sendinput, %hkey% Up}
  2277.                   }
  2278.                   Else
  2279.                   {
  2280.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2281.                   }
  2282.                     Break
  2283.                 }
  2284.             }
  2285.         }
  2286.  
  2287.         If (currLifeRatio<CurrentConfig.minLifeRatioToPopJade || currEShieldRatio<CurrentConfig.minEShieldRatioToPopJade)
  2288.         {
  2289.             If ((!WindowQueuedFlaskEffects[k].HasKey("jadeQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].jadeQueueEndtime-lagCompensation)))
  2290.             {
  2291.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility9") ; Jade Flask
  2292.                 If (flaskNum!="")
  2293.                 {
  2294.                    EffectDuration:=FlasksData[flaskNum].EffectDuration
  2295.                    WindowQueuedFlaskEffects[k].jadeQueueEndtime:=A_TickCount+EffectDuration*100
  2296.                    If (trayNotIfications)
  2297.                    {
  2298.                       TrayTip, PoE AutoFlask Using Jade Flask %flaskNum%, %A_Space% , 2
  2299.                    }
  2300.                    hKey:=FlaskHotkey%flaskNum%
  2301.                    IfWinActive Path of Exile ahk_class POEWindowClass
  2302.                   {
  2303.                      Sendinput, %hkey% Down}
  2304.                      Sendinput, %hkey% Up}
  2305.                   }
  2306.                   Else
  2307.                   {
  2308.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2309.                   }
  2310.                    break
  2311.                 }
  2312.             }
  2313.            
  2314.             If ((!WindowQueuedFlaskEffects[k].HasKey("GraniteQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].GraniteQueueEndtime-lagCompensation)))
  2315.             {
  2316.                flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility10") ; Basalt Flask
  2317.                If (flaskNum = "")
  2318.                {
  2319.                   flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility5") ; Granite Flask
  2320.                }    
  2321.                If (flaskNum!="")
  2322.                {
  2323.                   EffectDuration:=FlasksData[flaskNum].EffectDuration
  2324.                   WindowQueuedFlaskEffects[k].GraniteQueueEndtime:=A_TickCount+EffectDuration*100
  2325.                   If (trayNotIfications)
  2326.                   {
  2327.                      TrayTip, PoE AutoFlask Using Granite/Basalt Flask %flaskNum%, %A_Space% , 2
  2328.                   }
  2329.                   hKey:=FlaskHotkey%flaskNum%
  2330.                   IfWinActive Path of Exile ahk_class POEWindowClass
  2331.                   {
  2332.                      Sendinput, %hkey% Down}
  2333.                      Sendinput, %hkey% Up}
  2334.                   }
  2335.                   Else
  2336.                   {
  2337.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2338.                   }
  2339.                   break
  2340.                }
  2341.             }
  2342.          }
  2343.  
  2344.         If (currLifeRatio<CurrentConfig.minLifeRatioToPopElementalResist || currEShieldRatio<CurrentConfig.minEShieldRatioToPopElementalResist)
  2345.         {
  2346.             If ((!WindowQueuedFlaskEffects[k].HasKey("RubyQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].RubyQueueEndtime-lagCompensation)))
  2347.             {
  2348.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility2") ; Ruby flask
  2349.                 If (flaskNum!="")
  2350.                 {
  2351.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2352.                     WindowQueuedFlaskEffects[k].RubyQueueEndtime:=A_TickCount+EffectDuration*100
  2353.                     If (trayNotIfications)
  2354.                     {
  2355.                         TrayTip, PoE AutoFlask Using Ruby Flask %flaskNum%, %A_Space% , 2
  2356.                     }
  2357.                     hKey:=FlaskHotkey%flaskNum%
  2358.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2359.                   {
  2360.                      Sendinput, %hkey% Down}
  2361.                      Sendinput, %hkey% Up}
  2362.                   }
  2363.                   Else
  2364.                   {
  2365.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2366.                   }
  2367.                     break
  2368.                 }
  2369.             }
  2370.  
  2371.             If ((!WindowQueuedFlaskEffects[k].HasKey("TopazQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].TopazQueueEndtime-lagCompensation)))
  2372.             {
  2373.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility4") ; Topaz flask
  2374.                 If (flaskNum!="")
  2375.                 {
  2376.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2377.                     WindowQueuedFlaskEffects[k].TopazQueueEndtime:=A_TickCount+EffectDuration*100
  2378.                     If (trayNotIfications)
  2379.                     {
  2380.                         TrayTip, PoE AutoFlask Using Topaz Flask %flaskNum%, %A_Space% , 2
  2381.                     }
  2382.                     hKey:=FlaskHotkey%flaskNum%
  2383.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2384.                   {
  2385.                      Sendinput, %hkey% Down}
  2386.                      Sendinput, %hkey% Up}
  2387.                   }
  2388.                   Else
  2389.                   {
  2390.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2391.                   }
  2392.                     break
  2393.                 }
  2394.             }
  2395.  
  2396.             If ((!WindowQueuedFlaskEffects[k].HasKey("SapphireQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].SapphireQueueEndtime-lagCompensation)))
  2397.             {
  2398.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility3") ; Sapphire flask
  2399.                 If (flaskNum!="")
  2400.                 {
  2401.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2402.                     WindowQueuedFlaskEffects[k].SapphireQueueEndtime:=A_TickCount+EffectDuration*100
  2403.                     If (trayNotIfications)
  2404.                     {
  2405.                         TrayTip, PoE AutoFlask Using Sapphire flask %flaskNum%, %A_Space% , 2
  2406.                     }
  2407.                     hKey:=FlaskHotkey%flaskNum%
  2408.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2409.                   {
  2410.                      Sendinput, %hkey% Down}
  2411.                      Sendinput, %hkey% Up}
  2412.                   }
  2413.                   Else
  2414.                   {
  2415.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2416.                   }
  2417.                     break
  2418.                 }
  2419.             }
  2420.  
  2421.             If ((!WindowQueuedFlaskEffects[k].HasKey("AmethystQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].AmethystQueueEndtime-lagCompensation)))
  2422.             {
  2423.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility7") ; Amethyst flask
  2424.                 If (flaskNum!="")
  2425.                 {
  2426.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2427.                     WindowQueuedFlaskEffects[k].AmethystQueueEndtime:=A_TickCount+EffectDuration*100
  2428.                     If (trayNotIfications)
  2429.                     {
  2430.                         TrayTip, PoE AutoFlask Using Amethyst Flask %flaskNum%, %A_Space% , 2
  2431.                     }
  2432.                     hKey:=FlaskHotkey%flaskNum%
  2433.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2434.                   {
  2435.                      Sendinput, %hkey% Down}
  2436.                      Sendinput, %hkey% Up}
  2437.                   }
  2438.                   Else
  2439.                   {
  2440.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2441.                   }
  2442.                     break
  2443.                 }
  2444.             }
  2445.            
  2446.             If ((!WindowQueuedFlaskEffects[k].HasKey("BismuthQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].BismuthQueueEndtime-lagCompensation)))
  2447.             {
  2448.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility15") ; Bismuth flask
  2449.                 If (flaskNum!="")
  2450.                 {
  2451.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2452.                     WindowQueuedFlaskEffects[k].BismuthQueueEndtime:=A_TickCount+EffectDuration*100
  2453.                     If (trayNotIfications)
  2454.                     {
  2455.                         TrayTip, PoE AutoFlask Using Bismuth Flask %flaskNum%, %A_Space% , 2
  2456.                     }
  2457.                     hKey:=FlaskHotkey%flaskNum%
  2458.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2459.                   {
  2460.                      Sendinput, %hkey% Down}
  2461.                      Sendinput, %hkey% Up}
  2462.                   }
  2463.                   Else
  2464.                   {
  2465.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2466.                   }
  2467.                     break
  2468.                 }
  2469.             }
  2470.            
  2471.             If ((!WindowQueuedFlaskEffects[k].HasKey("SulphurQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].SulphurQueueEndtime-lagCompensation)))
  2472.             {
  2473.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility13") ; Sulphur flask
  2474.                 If (flaskNum!="")
  2475.                 {
  2476.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2477.                     WindowQueuedFlaskEffects[k].SulphurQueueEndtime:=A_TickCount+EffectDuration*100
  2478.                     If (trayNotIfications)
  2479.                     {
  2480.                         TrayTip, PoE AutoFlask Using Sulphur Flask %flaskNum%, %A_Space% , 2
  2481.                     }
  2482.                     hKey:=FlaskHotkey%flaskNum%
  2483.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2484.                   {
  2485.                      Sendinput, %hkey% Down}
  2486.                      Sendinput, %hkey% Up}
  2487.                   }
  2488.                   Else
  2489.                   {
  2490.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2491.                   }
  2492.                     break
  2493.                 }
  2494.             }
  2495.            
  2496.             If ((!WindowQueuedFlaskEffects[k].HasKey("SilverQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].SilverQueueEndtime-lagCompensation)))
  2497.             {
  2498.                 flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility14") ; Silver flask
  2499.                 If (flaskNum!="")
  2500.                 {
  2501.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2502.                     WindowQueuedFlaskEffects[k].SilverQueueEndtime:=A_TickCount+EffectDuration*100
  2503.                     If (trayNotIfications)
  2504.                     {
  2505.                         TrayTip, PoE AutoFlask Using Silver Flask %flaskNum%, %A_Space% , 2
  2506.                     }
  2507.                     hKey:=FlaskHotkey%flaskNum%
  2508.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2509.                   {
  2510.                      Sendinput, %hkey% Down}
  2511.                      Sendinput, %hkey% Up}
  2512.                   }
  2513.                   Else
  2514.                   {
  2515.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2516.                   }
  2517.                     break
  2518.                 }
  2519.             }
  2520.            
  2521.            
  2522.         }
  2523.  
  2524.         If (PlayerStats.MaxMana>0 && (currManaRatio<CurrentConfig.minManaRatioToDrink || PlayerStats.CurrMana<CurrentConfig.minManaToDrink))
  2525.         {      
  2526.             If ((!WindowQueuedFlaskEffects[k].HasKey("ManaQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].ManaQueueEndtime-lagCompensation)))
  2527.             {
  2528.                 tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskMana")
  2529.                 tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
  2530.                  
  2531.                 If ((tflaskNum1!=) && (tflaskNum2!=))
  2532.                 {
  2533.                     flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
  2534.                 }
  2535.                 Else
  2536.                 {
  2537.                     If (tflaskNum1!="")
  2538.                     {
  2539.                         flaskNum:=tflaskNum1
  2540.                     }
  2541.                     If (tflaskNum2!="")
  2542.                     {
  2543.                         flaskNum:=tflaskNum2
  2544.                     }
  2545.                 }
  2546.  
  2547.                 If (flaskNum!="")
  2548.                 {
  2549.                     EffectDuration:=FlasksData[flaskNum].EffectDuration
  2550.                     If (InStr(FlasksData[flaskNum].mod1,"Seething"))
  2551.                     {
  2552.                         WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2553.                     }
  2554.                     Else If (InStr(FlasksData[flaskNum].mod2,"Seething"))
  2555.                     {
  2556.                         WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2557.                     }
  2558.                   Else If (InStr(FlasksData[flaskNum].mod1,"沸騰的"))
  2559.                   {
  2560.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2561.                   }
  2562.                   Else If (InStr(FlasksData[flaskNum].mod2,"沸騰的"))
  2563.                   {
  2564.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2565.                   }
  2566.                     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
  2567.                     {
  2568.                         WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2569.                     }
  2570.                     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
  2571.                     {
  2572.                         WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2573.                     }
  2574.                   Else If ((InStr(FlasksData[flaskNum].mod1,"恐慌的")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  2575.                   {
  2576.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2577.                   }
  2578.                   Else If ((InStr(FlasksData[flaskNum].mod2,"恐慌的")) And ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low Life" can be caused by auras hp reservation from blood magic
  2579.                   {
  2580.                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+500
  2581.                   }
  2582.                     Else
  2583.                     {
  2584.                         WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+EffectDuration*100
  2585.                     }
  2586.                     If (trayNotIfications)
  2587.                     {
  2588.                         TrayTip, PoE AutoFlask Using Mana Flask %flaskNum%, %A_Space% , 2
  2589.                     }
  2590.                     hKey:=FlaskHotkey%flaskNum%
  2591.                     IfWinActive Path of Exile ahk_class POEWindowClass
  2592.                   {
  2593.                      Sendinput, %hkey% Down}
  2594.                      Sendinput, %hkey% Up}
  2595.                   }
  2596.                   Else
  2597.                   {
  2598.                      ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2599.                   }
  2600.                     Break
  2601.                 }
  2602.             }
  2603.         }
  2604.       }
  2605.  
  2606.         If (PlayerStats.PlayerActionID!="" && PlayerStats.PlayerActionID!=128 && PlayerStats.PlayerActionID!=90)
  2607.         {
  2608.             MovementTimer:= A_TickCount
  2609.         }
  2610.         ;TODO MovementTimer%A_Index%
  2611.  
  2612.         If(QuickSilverCheck && QuicksilverBuff=0)
  2613.         {
  2614.             If (PlayerStats.InCity!="" && PlayerStats.InCity=65537)
  2615.             {
  2616.                 If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2617.                 {
  2618.                     If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2619.                     {
  2620.                         If (PlayerStats.PlayerActionID!="" && (PlayerStats.PlayerActionID=128 || PlayerStats.PlayerActionID=90))
  2621.                         {
  2622.                             If (A_TickCount>=MovementTimer+CurrentConfig.QuickSilverTimer)
  2623.                             {
  2624.                                 If ((!WindowQueuedFlaskEffects[k].HasKey("QuickQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].QuickQueueEndtime-lagCompensation)))
  2625.                                 {
  2626.                                     flaskNum:=GetMaxChargesFlaskQuickSilver(FlasksData,"FlaskUtility6") ; QuickSilver flask
  2627.                                     If (flaskNum!="")
  2628.                                     {
  2629.                                         EffectDuration:=FlasksData[flaskNum].EffectDuration
  2630.                                         WindowQueuedFlaskEffects[k].QuickQueueEndtime:=A_TickCount+EffectDuration*100
  2631.                                         If (trayNotIfications)
  2632.                                         {
  2633.                                             TrayTip, PoE AutoFlask Using QuickSilver Flask %flaskNum%, %A_Space% , 2
  2634.                                         }
  2635.                                         hKey:=FlaskHotkey%flaskNum%
  2636.                                         IfWinActive Path of Exile ahk_class POEWindowClass
  2637.                               {
  2638.                                  Sendinput, %hkey% Down}
  2639.                                  Sendinput, %hkey% Up}
  2640.                               }
  2641.                               Else
  2642.                               {
  2643.                                  ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2644.                               }
  2645.                                         break
  2646.                                     }
  2647.                                 }
  2648.                             }
  2649.                         }
  2650.                     }
  2651.                 }
  2652.             }
  2653.         }
  2654.  
  2655.         If(QuickSilverCheck2 && QuicksilverBuff=0)
  2656.         {
  2657.             If (PlayerStats.InCity!="" && PlayerStats.InCity=65537)
  2658.             {
  2659.                 If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2660.                 {
  2661.                     If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2662.                     {
  2663.                         If (PlayerStats.PlayerActionID!="" && (PlayerStats.PlayerActionID=128 || PlayerStats.PlayerActionID=90))
  2664.                         {
  2665.                             If (A_TickCount>=MovementTimer+CurrentConfig.QuickSilverTimer)
  2666.                             {
  2667.                                 If ((!WindowQueuedFlaskEffects[k].HasKey("QuickQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].QuickQueueEndtime-lagCompensation)))
  2668.                                 {
  2669.                                     flaskNum:=GetMaxChargesFlaskQuickSilver2(FlasksData,"FlaskUtility6") ; QuickSilver flask
  2670.                                     If (flaskNum!="")
  2671.                                     {
  2672.                                         EffectDuration:=FlasksData[flaskNum].EffectDuration
  2673.                                         WindowQueuedFlaskEffects[k].QuickQueueEndtime:=A_TickCount+EffectDuration*100
  2674.                                         If (trayNotIfications)
  2675.                                         {
  2676.                                             TrayTip, PoE AutoFlask Using QuickSilver flask %flaskNum%, %A_Space% , 2
  2677.                                         }
  2678.                                         hKey:=FlaskHotkey%flaskNum%
  2679.                                         IfWinActive Path of Exile ahk_class POEWindowClass
  2680.                               {
  2681.                                  Sendinput, %hkey% Down}
  2682.                                  Sendinput, %hkey% Up}
  2683.                               }
  2684.                               Else
  2685.                               {
  2686.                                  ControlSend,,%hkey% Down %hkey% Up}, % "ahk_id" hwnd
  2687.                               }
  2688.                                         break
  2689.                                     }
  2690.                                 }
  2691.                             }
  2692.                         }
  2693.                     }
  2694.                 }
  2695.             }
  2696.         }
  2697.      
  2698.         If(AttackInPlaceCheck)
  2699.         {
  2700.             If (IsInGame(hwnd))
  2701.             {
  2702.                 If (PlayerStats.InCity!="" && PlayerStats.InCity=65537)
  2703.                 {
  2704.                     If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2705.                     {
  2706.                         If (PlayerStats.MouseOnEnemyStatus!="" && PlayerStats.MouseOnEnemyStatus=7)
  2707.                         {
  2708.                             If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2709.                             {
  2710.                                 If (PlayerStats.EnemyName!="")
  2711.                                 {
  2712.                                     If (PlayerStats.EnemyName2!="Oak}" && PlayerStats.EnemyName2!="Alira}" && PlayerStats.EnemyName2!="Kraityn}")
  2713.                                     {
  2714.                                         If (InStr(PlayerStats.EnemyName2,"Shrine") || InStr(PlayerStats.EnemyName2,"(Level)"))
  2715.                                         {
  2716.                                             AttackInPlaceKeyUp:=1
  2717.                                         }
  2718.                                         Else
  2719.                                         {
  2720.                                             IfWinActive Path of Exile ahk_class POEWindowClass
  2721.                                             {
  2722.                                     GetKeyState, stateSH, %AttackInPlaceKey%
  2723.                                     If stateSH = U
  2724.                                     {
  2725.                                                 Sendinput, {%AttackInPlaceKey% DOWN}
  2726.                                                 AttackInPlaceKeyUp:=0
  2727.                                        AttackInPlaceKeyDown:=1
  2728.                                     }
  2729.                                             }
  2730.                                             Else
  2731.                                             {
  2732.                                                 AttackInPlaceKeyUp:=1
  2733.                                             }
  2734.                                         }
  2735.                                     }
  2736.                                     Else
  2737.                                     {
  2738.                                         AttackInPlaceKeyUp:=1
  2739.                                     }
  2740.                                 }
  2741.                                 Else
  2742.                                 {
  2743.                                     AttackInPlaceKeyUp:=1
  2744.                                 }
  2745.                             }
  2746.                             Else
  2747.                             {
  2748.                                 AttackInPlaceKeyUp:=1
  2749.                             }
  2750.                         }
  2751.                         Else
  2752.                         {
  2753.                             AttackInPlaceKeyUp:=1
  2754.                         }
  2755.                     }
  2756.                     Else
  2757.                     {
  2758.                         AttackInPlaceKeyUp:=1
  2759.                     }
  2760.                 }
  2761.                 Else
  2762.                 {
  2763.                     AttackInPlaceKeyUp:=1
  2764.                 }
  2765.             }
  2766.             Else
  2767.             {
  2768.                 AttackInPlaceKeyUp:=1
  2769.             }
  2770.             If (AttackInPlaceKeyUp=1 && AttackInPlaceKeyDown=1)
  2771.          {
  2772.             GetKeyState, stateSH, %AttackInPlaceKey%
  2773.             If stateSH = D
  2774.             {
  2775.                Sendinput, {%AttackInPlaceKey% UP}
  2776.             }
  2777.             AttackInPlaceKeyUp:=0
  2778.          }
  2779.         }
  2780.  
  2781.       If(HoldCtrlCheck)
  2782.       {
  2783.          If (IsInGame(hwnd))
  2784.          {
  2785.             If (PlayerStats.PanelWaypoint=65537 && PlayerStats.PanelInstanceManager=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2786.             {
  2787.                If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2788.                {
  2789.                   If (LeavingArea=0)
  2790.                   {
  2791.                      IfWinActive Path of Exile ahk_class POEWindowClass
  2792.                      {
  2793.                         GetKeyState, stateRCtrl, RCtrl
  2794.                         If stateRCtrl = U
  2795.                         {
  2796.                            Sendinput, {RCtrl Down}
  2797.                            CtrlKeyUp:=0
  2798.                            CtrlkeyDown:=1
  2799.                            If (trayNotIfications)
  2800.                            {
  2801.                               TrayTip, , CTRL key: DOWN, 1
  2802.                            }
  2803.                         }
  2804.                      }
  2805.                      Else
  2806.                      {
  2807.                         CtrlKeyUp:=1
  2808.                      }
  2809.                   }
  2810.                   Else
  2811.                   {
  2812.                      CtrlKeyUp:=1
  2813.                   }
  2814.                }
  2815.                Else
  2816.                {
  2817.                   CtrlKeyUp:=1
  2818.                }
  2819.             }
  2820.             Else
  2821.             {
  2822.                CtrlKeyUp:=1
  2823.             }
  2824.          }
  2825.          Else
  2826.          {
  2827.             CtrlKeyUp:=1
  2828.          }
  2829.          If (CtrlKeyUp=1 && CtrlkeyDown=1)
  2830.          {
  2831.             GetKeyState, stateRCtrl, RCtrl
  2832.             If stateRCtrl = D
  2833.             {
  2834.                Sendinput, {RCtrl Up}
  2835.                If (trayNotIfications)
  2836.                {
  2837.                   TrayTip,, CTRL key: UP, 1
  2838.                }
  2839.                CtrlkeyDown=0
  2840.                CtrlKeyUp:=0
  2841.             }
  2842.          }
  2843.       }
  2844.  
  2845.  
  2846.      
  2847.    ;If (PlayerStats.PlayerActionID!="" && PlayerStats.PlayerActionID=2176)  ;2048 not
  2848.    ;If ((autoQuit=1) && (ThisID!="") && (ThisID!=WinActive("A")))
  2849.    ;WinActivate, % "ahk_id" ThisID
  2850.      
  2851.       ++PanickedTimer  ;TODO better way
  2852.  
  2853.  
  2854.       If desync = 1
  2855.       {
  2856.          If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2857.          {
  2858.             If (IsInGame(hwnd))
  2859.             {
  2860.                If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2861.                   {
  2862.                   IfWinActive Path of Exile ahk_class POEWindowClass
  2863.                   {
  2864.                      SendInput {NumpadEnter}/oos{NumpadEnter}
  2865.                   }
  2866.                   Else
  2867.                   {
  2868.                      ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  2869.                      SetKeyDelay, 40, 20
  2870.                      ControlSend,,`/oos, % "ahk_id" hwnd
  2871.                      SetKeyDelay, 0, 0
  2872.                      ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  2873.                   }
  2874.                }
  2875.             }
  2876.          }
  2877.          desync := 0
  2878.       }
  2879.  
  2880.       If remaining = 1
  2881.       {
  2882.          If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2883.          {
  2884.             If (IsInGame(hwnd))
  2885.             {
  2886.                If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2887.                {
  2888.                   IfWinActive Path of Exile ahk_class POEWindowClass
  2889.                   {
  2890.                      SendInput {NumpadEnter}/remaining{NumpadEnter}
  2891.                   }
  2892.                   Else
  2893.                   {
  2894.                      ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  2895.                      SetKeyDelay, 40, 20
  2896.                      ControlSend,,`/remaining, % "ahk_id" hwnd
  2897.                      SetKeyDelay, 0, 0
  2898.                      ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  2899.                   }
  2900.                }
  2901.             }
  2902.             remaining := 0
  2903.             break
  2904.          }
  2905.       }
  2906.  
  2907.       If hideout = 1
  2908.       {
  2909.          If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2910.          {
  2911.             If (IsInGame(hwnd))
  2912.             {
  2913.                If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2914.                {
  2915.                   IfWinActive Path of Exile ahk_class POEWindowClass
  2916.                   {
  2917.                      SendInput {NumpadEnter}/hideout{NumpadEnter}
  2918.                   }
  2919.                   Else
  2920.                   {
  2921.                      ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  2922.                      SetKeyDelay, 40, 20
  2923.                      ControlSend,,`/hideout, % "ahk_id" hwnd
  2924.                      SetKeyDelay, 0, 0
  2925.                      ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  2926.                   }
  2927.                }
  2928.             }
  2929.             hideout := 0
  2930.             break
  2931.          }
  2932.       }
  2933.  
  2934.       If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2935.       {
  2936.          ChatCheckTimer:= 1
  2937.       }
  2938.  
  2939.       If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65537)
  2940.       {
  2941.          If (A_TickCount>=(ChatStatusTimer+50))
  2942.          {
  2943.             If (IsInGame(hwnd))
  2944.             {
  2945.                IfWinActive Path of Exile ahk_class POEWindowClass
  2946.                {
  2947.                   ResyncTimer:= 0
  2948.                   TradeSpam:= 0
  2949.                   GuiControl, , TradeSpam, 0
  2950.                   GuiControl, , TradeSpamUpdate, 0
  2951.                   IniWrite, 0 , Config.ini, Config, TradeSpam
  2952.                   TradeChannel:= 1
  2953.                   tradechat:= 0
  2954.                   TradeTimer:= 0
  2955.                   TradeStep:= 3
  2956.                   TradeSpamTimer:= 3
  2957.                }
  2958.             }
  2959.          }
  2960.          Else
  2961.          {
  2962.             If ChatCheckTimer = 1
  2963.             {
  2964.                ChatStatusTimer:= A_TickCount
  2965.                ChatCheckTimer:= 0
  2966.             }
  2967.          }
  2968.       }
  2969.  
  2970.       If TradeSpam>0
  2971.       {
  2972.          If (A_TickCount>=(TradeSpamTimer+TradeSpam*60000))
  2973.          {
  2974.             tradechat:= 1
  2975.             TradeSpamTimer:= A_TickCount
  2976.          }
  2977.          Else If TradeSpamTimer = 3
  2978.          {
  2979.             tradechat:= 1
  2980.             TradeSpamTimer:= A_TickCount
  2981.          }
  2982.       }
  2983.  
  2984.       If tradechat = 1
  2985.       {
  2986.          SendMode, Input
  2987.          If (A_TickCount>=TradeTimer+1000+(TradeSpam*2000))
  2988.          {
  2989.             If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  2990.             {
  2991.                If (IsInGame(hwnd))
  2992.                {
  2993.                   If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  2994.                   {
  2995.                      IfWinActive Path of Exile ahk_class POEWindowClass
  2996.                      {
  2997.                         SendMode Input
  2998.                         GetKeyState, stateSH, SHIfT
  2999.                         If stateSH = D
  3000.                         {
  3001.                            Sendinput {SHIfT up}
  3002.                         }
  3003.                         If (TradeStep = 1)
  3004.                         {
  3005.                            Send {NumpadEnter}
  3006.                            Send /trade %TradeChannel%
  3007.                            Send {NumpadEnter}
  3008.                            TradeStep:= 2
  3009.                            TradeTimer:= A_TickCount
  3010.                         }
  3011.                         Else If (TradeStep = 2)
  3012.                         {
  3013.                            Send {NumpadEnter}{Up 2}{NumpadEnter}
  3014.                            TradeStep:= 3
  3015.                            TradeTimer:= A_TickCount
  3016.                         }
  3017.                         Else If (TradeStep = 3)
  3018.                         {
  3019.                            If (TradeChannel<10)
  3020.                            {
  3021.                               TradeChannel++
  3022.                               TradeStep:= 1
  3023.                               TradeTimer:= A_TickCount
  3024.                            }
  3025.                            Else
  3026.                            {
  3027.                               TradeChannel:= 1
  3028.                               tradechat:= 0
  3029.                               TradeTimer:= 0
  3030.                               TradeStep:= 1
  3031.                            }
  3032.                         }
  3033.                      }
  3034.                      Else
  3035.                      {
  3036.                         SendMode Input
  3037.                         GetKeyState, stateSH, SHIfT
  3038.                         If stateSH = D
  3039.                         {
  3040.                            Sendinput {SHIfT up}
  3041.                         }
  3042.                         If (TradeStep = 1)
  3043.                         {
  3044.                            SetKeyDelay, 60, 20
  3045.                            ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  3046.                            ControlSendRaw,,`/trade %TradeChannel%, % "ahk_id" hwnd
  3047.                            ControlSend,,{NumpadEnter}, % "ahk_id" hwnd
  3048.                            SetKeyDelay, 0, 0
  3049.                            TradeStep:= 2
  3050.                            TradeTimer:= A_TickCount
  3051.                         }
  3052.                         Else If (TradeStep = 2)
  3053.                         {
  3054.                            SetKeyDelay, 20, 20
  3055.                            ControlSend,,{NumpadEnter}{Up 2}{NumpadEnter}, % "ahk_id" hwnd
  3056.                            SetKeyDelay, 0, 0
  3057.                            TradeStep:= 3
  3058.                            TradeTimer:= A_TickCount
  3059.                         }
  3060.                         Else If (TradeStep = 3)
  3061.                         {
  3062.                            If (TradeChannel<10)
  3063.                            {
  3064.                               TradeChannel++
  3065.                               TradeStep:= 1
  3066.                               TradeTimer:= A_TickCount
  3067.                            }
  3068.                            Else
  3069.                            {
  3070.                               TradeChannel:= 1
  3071.                               tradechat:= 0
  3072.                               TradeTimer:= 0
  3073.                               TradeStep:= 1
  3074.                            }
  3075.                         }
  3076.                      }
  3077.                   }
  3078.                }
  3079.                ChatStatusTimer:= A_TickCount+99999999999
  3080.                ChatCheckTimer:= 1
  3081.             }
  3082.          }
  3083.       }
  3084.       Else
  3085.       {
  3086.          If (A_TickCount>=(ResyncTimer+ResyncSpam*1000) And (ResyncSpam>0))
  3087.          {
  3088.             If (PlayerStats.InCity!="" && PlayerStats.InCity=65537)
  3089.             {
  3090.                If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  3091.                {
  3092.                   If (IsInGame(hwnd))
  3093.                   {
  3094.                      If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  3095.                      {
  3096.                         IfWinActive Path of Exile ahk_class POEWindowClass
  3097.                         {
  3098.                            GetKeyState, stateSH, SHIfT
  3099.                            If stateSH = D
  3100.                            {
  3101.                               Sendinput {SHIfT up}
  3102.                            }
  3103.                            Sendinput {NumpadEnter}/oos{NumpadEnter}
  3104.                         }
  3105.                      }
  3106.                   }
  3107.                }
  3108.             }
  3109.             ResyncTimer:= A_TickCount
  3110.          }
  3111.  
  3112.          If (A_TickCount>=(RemainingTimer+RemainingSpam*1000) And (RemainingSpam>0))
  3113.          {
  3114.             If (PlayerStats.InCity!="" && PlayerStats.InCity=65537)
  3115.             {
  3116.                If (PlayerStats.ChatStatus!="" && PlayerStats.ChatStatus=65536)
  3117.                {
  3118.                   If (IsInGame(hwnd))
  3119.                   {
  3120.                      If (PlayerStats.PanelWaypoint=65536 && PlayerStats.PanelInventory=65536 && PlayerStats.PanelSkillTree=65536 && PlayerStats.PanelSocial=65536)
  3121.                      {
  3122.                         IfWinActive Path of Exile ahk_class POEWindowClass
  3123.                         {
  3124.                            GetKeyState, stateSH, SHIfT
  3125.                            If stateSH = D
  3126.                            {
  3127.                               Sendinput {SHIfT up}
  3128.                            }
  3129.                            Sendinput {NumpadEnter}/remaining{NumpadEnter}
  3130.                         }
  3131.                      }
  3132.                   }
  3133.                }
  3134.             }
  3135.             RemainingTimer:= A_TickCount
  3136.          }
  3137.       }
  3138.  
  3139.       ;--------------Debug Window Update------------------
  3140.  
  3141.       IfWinExist, Debug Window
  3142.       {
  3143.          MaxHPvalue:=PlayerStats.MaxHP
  3144.          GuiControl,4: , MaxHPvar , %MaxHPvalue%
  3145.          CurrHPvalue:=PlayerStats.CurrHP
  3146.          GuiControl,4: , CurrHPvar , %CurrHPvalue%
  3147.          ReservedHPFlatvalue:=PlayerStats.ReservedHPFlat
  3148.          GuiControl,4: , ReservedHPFlatvar , %ReservedHPFlatvalue%
  3149.          ReservedHPPercentvalue:=PlayerStats.ReservedHPPercent
  3150.          GuiControl,4: , ReservedHPPercentvar , %ReservedHPPercentvalue%
  3151.          MaxManavalue:=PlayerStats.MaxMana
  3152.          GuiControl,4: , MaxManavar , %MaxManavalue%
  3153.          CurrManavalue:=PlayerStats.CurrMana
  3154.          GuiControl,4: , CurrManavar , %CurrManavalue%
  3155.          ReservedManaFlatvalue:=PlayerStats.ReservedManaFlat
  3156.          GuiControl,4: , ReservedManaFlatvar , %ReservedManaFlatvalue%
  3157.          ReservedManaPercentvalue:=PlayerStats.ReservedManaPercent
  3158.          GuiControl,4: , ReservedManaPercentvar , %ReservedManaPercentvalue%
  3159.          MaxEShieldvalue:=PlayerStats.MaxEShield
  3160.          GuiControl,4: , MaxEShieldvar , %MaxEShieldvalue%
  3161.          CurrEShieldvalue:=PlayerStats.CurrEShield
  3162.          GuiControl,4: , CurrEShieldvar , %CurrEShieldvalue%
  3163.          PlayerActionIDvalue:=PlayerStats.PlayerActionID
  3164.          If (PlayerActionIDvalue=128 || PlayerActionIDvalue=90)
  3165.          {
  3166.             GuiControl,4: , PlayerActionIDvar , %PlayerActionIDvalue% (Moving)
  3167.          }
  3168.          Else If (PlayerActionIDvalue=2 || PlayerActionIDvalue=10 || PlayerActionIDvalue=12)
  3169.          {
  3170.             GuiControl,4: , PlayerActionIDvar , %PlayerActionIDvalue% (Attacking)
  3171.          }
  3172.          Else If (PlayerActionIDvalue=0)
  3173.          {
  3174.             GuiControl,4: , PlayerActionIDvar , %PlayerActionIDvalue% (Nothing)
  3175.          }
  3176.          Else If (PlayerActionIDvalue=64)
  3177.          {
  3178.             GuiControl,4: , PlayerActionIDvar , %PlayerActionIDvalue% (Dead)
  3179.          }
  3180.          Else
  3181.          {
  3182.             GuiControl,4: , PlayerActionIDvar , %PlayerActionIDvalue% (Unknown)
  3183.          }
  3184.          ChatStatusvalue:=PlayerStats.ChatStatus
  3185.          If (ChatStatusvalue=65537)
  3186.          {
  3187.             GuiControl,4: , ChatStatusvar , Opened
  3188.          }
  3189.          Else If (ChatStatusvalue=65536)
  3190.          {
  3191.             GuiControl,4: , ChatStatusvar , Closed
  3192.          }
  3193.          MouseOnEnemyStatusvalue:=PlayerStats.MouseOnEnemyStatus
  3194.          If (MouseOnEnemyStatusvalue=7)
  3195.          {
  3196.             GuiControl,4: , MouseOnEnemyStatusvar , Yes
  3197.          }
  3198.          Else If (MouseOnEnemyStatusvalue=6)
  3199.          {
  3200.             GuiControl,4: , MouseOnEnemyStatusvar , No
  3201.          }
  3202.          PanelWaypointvalue:=PlayerStats.PanelWaypoint
  3203.          If (PanelWaypointvalue=65537)
  3204.          {
  3205.             GuiControl,4: , PanelWaypointvar , Opened
  3206.          }
  3207.          Else If (PanelWaypointvalue=65536)
  3208.          {
  3209.             GuiControl,4: , PanelWaypointvar , Closed
  3210.          }
  3211.          PanelInventoryvalue:=PlayerStats.PanelInventory
  3212.          If (PanelInventoryvalue=65537)
  3213.          {
  3214.             GuiControl,4: , PanelInventoryvar , Opened
  3215.          }
  3216.          Else If (PanelInventoryvalue=65536)
  3217.          {
  3218.             GuiControl,4: , PanelInventoryvar , Closed
  3219.          }
  3220.          PanelSkillTreevalue:=PlayerStats.PanelSkillTree
  3221.          If (PanelSkillTreevalue=65537)
  3222.          {
  3223.             GuiControl,4: , PanelSkillTreevar , Opened
  3224.          }
  3225.          Else If (PanelSkillTreevalue=65536)
  3226.          {
  3227.             GuiControl,4: , PanelSkillTreevar , Closed
  3228.          }
  3229.          PanelSocialvalue:=PlayerStats.PanelSocial
  3230.          If (PanelSocialvalue=65537)
  3231.          {
  3232.             GuiControl,4: , PanelSocialvar , Opened
  3233.          }
  3234.          Else If (PanelSkillTreevalue=65536)
  3235.          {
  3236.             GuiControl,4: , PanelSocialvar , Closed
  3237.          }
  3238.          InCityvalue:=PlayerStats.InCity
  3239.          If (InCityvalue=65537)
  3240.          {
  3241.             GuiControl,4: , InCityvar , No
  3242.          }
  3243.          Else If (InCityvalue=65536)
  3244.          {
  3245.             GuiControl,4: , InCityvar , Yes
  3246.          }
  3247.          PanelInstanceManagervalue:=PlayerStats.PanelInstanceManager
  3248.          If (PanelInstanceManagervalue=65537)
  3249.          {
  3250.             GuiControl,4: , PanelInstanceManagervar , Opened
  3251.          }
  3252.          Else If (PanelInstanceManagervalue=65536)
  3253.          {
  3254.             GuiControl,4: , PanelInstanceManagervar , Closed
  3255.          }
  3256.          
  3257.          EnemyNamevalue:=PlayerStats.EnemyName
  3258.          GuiControl,4: , EnemyNamevar , %EnemyNamevalue%
  3259.          EnemyName2value:=PlayerStats.EnemyName2
  3260.          GuiControl,4: , EnemyName2var , %EnemyName2value%
  3261.          MapNamevalue:=PlayerStats.MapName
  3262.          GuiControl,4: , MapNamevar , %MapNamevalue%
  3263.  
  3264.          Loop, 5
  3265.          {
  3266.             Flask%A_Index%Typevalue:=FlasksData[A_Index].type
  3267.             value:=Flask%A_Index%Typevalue
  3268.             GuiControl,4: , Flask%A_Index%Typevar , %value%
  3269.  
  3270.             Flask%A_Index%ChargesCurrentvalue:=FlasksData[A_Index].ChargesCurrent
  3271.             value:=Flask%A_Index%ChargesCurrentvalue
  3272.             GuiControl,4: , Flask%A_Index%ChargesCurrentvar , %value%
  3273.  
  3274.             Flask%A_Index%ChargesPerUsevalue:=FlasksData[A_Index].ChargesPerUse
  3275.             value:=Flask%A_Index%ChargesPerUsevalue
  3276.             GuiControl,4: , Flask%A_Index%ChargesPerUsevar , %value%
  3277.  
  3278.             Flask%A_Index%mod1value:=FlasksData[A_Index].mod1
  3279.             value:=Flask%A_Index%mod1value
  3280.             GuiControl,4: , Flask%A_Index%mod1var , %value%
  3281.  
  3282.             Flask%A_Index%mod2value:=FlasksData[A_Index].mod2
  3283.             value:=Flask%A_Index%mod2value
  3284.             GuiControl,4: , Flask%A_Index%mod2var , %value%
  3285.          }
  3286.  
  3287.          BuffAmountvalue:=round(PlayerStats.BuffAmount)
  3288.          GuiControl,4: , BuffAmountvar , %BuffAmountvalue%
  3289.  
  3290.          Loop, 8
  3291.          {
  3292.  
  3293.             BuffName%A_Index%value:=PlayerStats.BuffName[A_Index]
  3294.             value:=BuffName%A_Index%value
  3295.             GuiControl,4: , Buff%A_Index%Namevar , %value%
  3296.  
  3297.             BuffCharges%A_Index%value:=PlayerStats.BuffCharges[A_Index]
  3298.             value:=BuffCharges%A_Index%value
  3299.             GuiControl,4: , Buff%A_Index%Chargesvar , %value%
  3300.  
  3301.             BuffTimer%A_Index%value:=PlayerStats.BuffTimer[A_Index]
  3302.             value:=BuffTimer%A_Index%value
  3303.             If (value="1.#INF00")
  3304.             {
  3305.                GuiControl,4: , Buff%A_Index%Timervar , Infinite
  3306.             }
  3307.             Else
  3308.             {
  3309.                GuiControl,4: , Buff%A_Index%Timervar , %value%
  3310.             }
  3311.          }
  3312.       }
  3313.       ;--------------Debug Window Update------------------
  3314.       Sleep, %AutoFlaskWatchdogPeriod%
  3315.    }
  3316.    Sleep, 1
  3317. }
  3318.  
  3319. ;-------MAIN FUNCTIONS-----------------MAIN FUNCTIONS-----------------MAIN FUNCTIONS-----------------
  3320.  
  3321. ;-------TEST FUNCTIONS-----------------TEST FUNCTIONS-----------------TEST FUNCTIONS-----------------
  3322.  
  3323.  
  3324. UsePortal()
  3325. {
  3326.    IfWinActive Path of Exile ahk_class POEWindowClass
  3327.    {
  3328.       BlockInput On
  3329.       SendMode Input
  3330.       hwnd:=WinActive("A")
  3331.       GetKeyState, stateR, RButton
  3332.       If stateR = D
  3333.       {
  3334.          Send {RButton up}
  3335.       }
  3336.       GetKeyState, stateL, LButton
  3337.       If stateL = D
  3338.       {
  3339.          Send {LButton up}
  3340.       }
  3341.       GetKeyState, stateM, MButton
  3342.       If stateM = D
  3343.       {
  3344.          Send {MButton up}
  3345.       }
  3346.       GetKeyState, stateQ, Q
  3347.       If stateQ = D
  3348.       {
  3349.          Send {Q up}
  3350.       }
  3351.       GetKeyState, stateW, W
  3352.       If stateW = D
  3353.       {
  3354.          Send {W up}
  3355.       }
  3356.       GetKeyState, stateE, E
  3357.       If stateE = D
  3358.       {
  3359.          Send {E up}
  3360.       }
  3361.       GetKeyState, stateR, R
  3362.       If stateR = D
  3363.       {
  3364.          Send {R up}
  3365.       }
  3366.       GetKeyState, stateT, T
  3367.       If stateT = D
  3368.       {
  3369.          Send {T up}
  3370.       }
  3371.       GetKeyState, stateI, I
  3372.       If stateI = D
  3373.       {
  3374.          Send {I up}
  3375.       }
  3376.       GetKeyState, stateSP, SPACE
  3377.       If stateSP = D
  3378.       {
  3379.          Send {SPACE up}
  3380.       }
  3381.       GetKeyState, stateSH, SHIfT
  3382.       If stateSH = D
  3383.       {
  3384.          Send {SHIfT up}
  3385.       }
  3386.       ReadClientResolution(hwnd,w,h)
  3387.       Send {SPACE}
  3388.       Send {NumpadEnter}
  3389.       Send {Raw} /oos
  3390.       Send {NumpadEnter}
  3391.       Send {i}
  3392.       ErrorLevel = 1
  3393.       Sleep, 50
  3394.       ScrollX:= (w/2)
  3395.       ScrollY:= (h/2)
  3396.       PixElsearch, ScrollX, ScrollY, ScrollX, ScrollY, w, h, 0xFFFFFF, 1, fast  ;2b1d35  312238
  3397.       If ErrorLevel = 0
  3398.       {
  3399.          MouseMove, (ScrollX), (ScrollY),0
  3400.          If PortalInvCheck() = true
  3401.          {
  3402.  
  3403.          }
  3404.          Else If PortalInvCheck() = false
  3405.          {
  3406.             ScrollX:= (w/2)
  3407.             Loop
  3408.             {
  3409.                ErrorLevel = 1
  3410.                PixElsearch, ScrollX2, ScrollY2, ScrollX, ScrollY, (ScrollX+50), (ScrollY+10), 0xFFFFFF, 1, fast ;0xFBFBFB, 4, fast  ;2b1d35  312238
  3411.                If ErrorLevel = 0
  3412.                {
  3413.                   MouseMove, (ScrollX2), (ScrollY2),0
  3414.                   If PortalInvCheck() = true
  3415.                      Break
  3416.                   Else If PortalInvCheck() = false
  3417.                   {
  3418.                      Send {SPACE}
  3419.                      MouseMove, (w/2), (h/2), 0                      
  3420.                      BlockInput Off
  3421.                      Return
  3422.                   }
  3423.                }
  3424.                Else
  3425.                {
  3426.                   ScrollX:= (ScrollX+50)
  3427.                   Continue
  3428.                }
  3429.             }
  3430.          }
  3431.       }
  3432.       Send {RButton}
  3433.       Send {SPACE}
  3434.       Sleep, 50
  3435.       MouseMove, (w/2), (h/2),0
  3436.       Sleep, 50
  3437.       Send {LButton}
  3438.       sleep, 250
  3439.       Loop
  3440.       {
  3441.          ErrorLevel = 1
  3442.          PixElsearch, PixX, PixY, (w/4), (h/10), ((w/4)*3), h, 0xddbb30, 34, fast  ;0xdcc8c8 text color
  3443.          If ErrorLevel = 0
  3444.          {
  3445.             MouseMove, (PixX), (PixY),0
  3446.             Sleep, 20
  3447.             Send {LButton}
  3448.             Loop ;only search for portals when not moving
  3449.             {  
  3450.                ReadHeroPos(hwnd,PosX1,PosY1)
  3451.                sleep, 30
  3452.                ReadHeroPos(hwnd,PosX2,PosY2)
  3453.                If PosX1 = %PosX2%
  3454.                {
  3455.                   If PosY1 = %PosY2%
  3456.                   {
  3457.                      break
  3458.                   }
  3459.            
  3460.                }
  3461.                Else
  3462.                sleep, 30
  3463.             }
  3464.          }
  3465.          Else
  3466.          {
  3467.             Break
  3468.          }
  3469.       }
  3470.       Sleep, 50
  3471.       MouseMove, (w/2), (h/2),0
  3472.       Sleep, 50
  3473.       Send {LButton}
  3474.       Sleep, 50
  3475.       BlockInput Off
  3476.    }
  3477.    Else
  3478.    return
  3479. }
  3480.  
  3481. ; Poe Default Style 0x14CF0000
  3482.  
  3483. Toggle_Window(window)
  3484. {
  3485.    global ClientX, ClientY, ClientW, ClientH
  3486.    IfWinActive Path of Exile ahk_class POEWindowClass
  3487.    {
  3488.       WinGet, S, Style, % "ahk_id " window   ; Get the style of the window
  3489.       If (S & +0x840000)      ; If not borderless
  3490.       {
  3491.          WinGetPos, ClientX, ClientY, ClientW, ClientH
  3492.          hwnd:=WinActive("A")
  3493.          ReadClientResolution(hwnd,w,h)
  3494.          
  3495.          WinSet, Style, -0x840000, % "ahk_id " window   ; Remove borders
  3496.          WinSet, Style, -0x400000, % "ahk_id " window
  3497.  
  3498.          WinMove, % "ahk_id " window,, %ClientX%, %ClientY%, %w%, %h%
  3499.          Confine := !Confine
  3500.          ClipCursor(Confine, (ClientX), (ClientY), (ClientX+w),(ClientY+h))
  3501.          return
  3502.       }
  3503.       If (S & -0x840000)      ; If borderless
  3504.       {
  3505.          WinSet, Style, +0x840000, % "ahk_id " window   ; Reapply borders
  3506.          WinSet, Style, +0x400000, % "ahk_id " window
  3507.          WinMove, % "ahk_id " window,, %ClientX%, %ClientY%, %ClientW%, %ClientW%
  3508.          Confine := !Confine
  3509.          ClipCursor(Confine, 0, 0, A_ScreenWidth, A_ScreenHeight)
  3510.          return
  3511.       }
  3512.    }
  3513. }
  3514.  
  3515. ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 )
  3516. {
  3517.    VarSetCapacity(R,16,0),  NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12)
  3518.    Return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
  3519. }
  3520.  
  3521. ; Parse clipboard content for item level and dps
  3522. Webgrab()
  3523. {
  3524.    global Rarity
  3525.    IfWinActive Path of Exile ahk_class POEWindowClass
  3526.    {
  3527.       SendMode Input
  3528.       clipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived.
  3529.       ErrorLevel = 0
  3530.       Send ^c
  3531.       ClipWait, 0.05  ; Wait for the clipboard to contain text.
  3532.       If ErrorLevel = 1
  3533.       {
  3534.          return
  3535.       }
  3536.       NameIsDone := False
  3537.       ItemName :=
  3538.  
  3539.       Loop, Parse, Clipboard, `n, `r
  3540.       {
  3541.          ; Clipboard must have "Rarity:" in the first line
  3542.          If A_Index = 1
  3543.          {
  3544.             IfNotInString, A_LoopField, Rarity:
  3545.            {
  3546.                Exit
  3547.             }
  3548.             IfInString, A_LoopField, Rarity: Magic
  3549.             {
  3550.                Rarity:= 2
  3551.             }
  3552.             IfInString, A_LoopField, Rarity: Rare
  3553.             {
  3554.                Rarity:= 3
  3555.             }
  3556.             Else
  3557.             {
  3558.                Continue
  3559.             }
  3560.  
  3561.          }
  3562.      
  3563.          ; Get name
  3564.          If Not NameIsDone
  3565.          {
  3566.             If A_LoopField = --------
  3567.             {
  3568.                NameIsDone := True
  3569.             }
  3570.             Else
  3571.             {
  3572.                ItemName%A_Index% = %A_LoopField%
  3573.             }
  3574.             Continue
  3575.          }
  3576.  
  3577.          If (Rarity = 2)
  3578.          {
  3579.             IfInString, ItemName2, Flask
  3580.             {
  3581.                ItemName2 = Flask
  3582.                Run http://pathofexile.gamepedia.com/%ItemName2%
  3583.                Rarity:= 0
  3584.                return
  3585.             }
  3586.             Run http://www.poemods.com
  3587.             Rarity:= 0
  3588.             return
  3589.          }
  3590.  
  3591.  
  3592.          If (Rarity = 3)
  3593.          {
  3594.             Run http://www.poemods.com
  3595.             Rarity:= 0
  3596.             return
  3597.          }
  3598.          Else
  3599.          {
  3600.             StringReplace, ItemName2_, ItemName2, %A_SPACE%, _, All
  3601.             Run http://pathofexile.gamepedia.com/%ItemName2_%
  3602.             Rarity:= 0
  3603.             return
  3604.          }
  3605.       }
  3606.    }
  3607.    return
  3608. }
  3609.  
  3610.  
  3611. PortalInvCheck()
  3612. {
  3613. IfWinActive Path of Exile ahk_class POEWindowClass
  3614. {
  3615.          SendMode Input
  3616.          clipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived.
  3617.          ErrorLevel = 0
  3618.          Send ^c
  3619.          ClipWait, 0.05  ; Wait for the clipboard to contain text.
  3620.          If ErrorLevel = 1
  3621.          {
  3622.             return false
  3623.          }
  3624.  
  3625.         ItemLevel := ""
  3626.         Name := ""
  3627.         Type := ""
  3628.         Quality := 0
  3629.         AttackSpeed := 0
  3630.         PhysicalDamageLow := 0
  3631.         PhysicalDamageHigh := 0
  3632.         IncreasedPhysicalDamage := 0
  3633.         FireDamageLow := 0
  3634.         FireDamageHigh := 0
  3635.         ColdDamageLow := 0
  3636.         ColdDamageHigh := 0
  3637.         LightningDamageLow := 0
  3638.         LightningDamageHigh := 0
  3639.         ChaosDamageLow := 0
  3640.         ChaosDamageHigh := 0
  3641.         Armour := 0
  3642.         EvasionRating := 0
  3643.         EnergyShield := 0
  3644.          
  3645.  
  3646.         Loop, parse, Clipboard, `n, `r          ; Goes through a loop with the lines of text found in the clipboard
  3647.         {
  3648.                 If (A_Index = 1)
  3649.                 {
  3650.                         IfNotInString, A_Loopfield, Rarity:            ; Starts a check whether it has "Rarity:" in the first line, otherwise exit
  3651.                         {
  3652.                                 Exit
  3653.                         }
  3654.                 }
  3655.                 Else If (A_Index = 2)
  3656.                 {
  3657.                         Name := A_Loopfield
  3658.                 }
  3659.                 Else If (A_Index = 3)
  3660.                 {
  3661.                         Type := A_Loopfield
  3662.                 }
  3663.                 Else If (!ItemLevel && RegExMatch(A_Loopfield, "Itemlevel: (\d*)", SubPat))
  3664.                 {
  3665.                         ItemLevel := SubPat1
  3666.                 }
  3667.                 Else If (!Quality && RegExMatch(A_Loopfield, "Quality: \+(\d*)\%", SubPat))
  3668.                 {
  3669.                         Quality := SubPat1/100
  3670.                 }
  3671.                
  3672.                 Else If (!AttackSpeed && RegExMatch(A_Loopfield, "Attacks per Second: (\d\.\d*)", SubPat))
  3673.                 {
  3674.                         AttackSpeed     := SubPat1
  3675.                 }
  3676.                 Else If (!PhysicalDamageLow && RegExMatch(A_Loopfield, "Physical Damage: (\d*)-(\d*)", SubPat))
  3677.                 {
  3678.                         PhysicalDamageLow := SubPat1
  3679.                         PhysicalDamageHigh := SubPat2
  3680.                 }
  3681.                 Else If (!IncreasedPhysicalDamage && RegExMatch(A_Loopfield, "(\d*)\% increased Physical Damage", SubPat))
  3682.                 {
  3683.                         IncreasedPhysicalDamage := SubPat1/100
  3684.                 }
  3685.                
  3686.                 Else If (!FireDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Fire Damage", SubPat))
  3687.                 {
  3688.                         FireDamageLow := SubPat1
  3689.                         FireDamageHigh := SubPat2
  3690.                 }
  3691.                 Else If (!ColdDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Cold Damage", SubPat))
  3692.                 {
  3693.                         ColdDamageLow := SubPat1
  3694.                         ColdDamageHigh := SubPat2
  3695.                 }
  3696.                 Else If (!LightningDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Lightning Damage", SubPat))
  3697.                 {
  3698.                         LightningDamageLow := SubPat1
  3699.                         LightningDamageHigh := SubPat2
  3700.                 }
  3701.                 Else If (!ChaosDamageLow && RegExMatch(A_Loopfield, "Adds (\d*)-(\d*) Chaos Damage", SubPat))
  3702.                 {
  3703.                         ChaosDamageLow := SubPat1
  3704.                         ChaosDamageHigh := SubPat2
  3705.                 }      
  3706.                
  3707.                 Else If (!Armour && RegExMatch(A_Loopfield, "Armour: (\d*)", SubPat))
  3708.                 {
  3709.                         Armour:= SubPat1
  3710.                 }
  3711.                 Else If (!EvasionRating && RegExMatch(A_Loopfield, "Evasion Rating: (\d*)", SubPat))
  3712.                 {
  3713.                         EvasionRating:= SubPat1
  3714.                 }
  3715.                 Else If (!EnergyShield && RegExMatch(A_Loopfield, "Energy Shield: (\d*)", SubPat))
  3716.                 {
  3717.                         EnergyShield:= SubPat1
  3718.                 }      
  3719.          }
  3720.    
  3721.       If (!ItemLevel) ; If we didn't get the itemlevel...
  3722.       {
  3723.          Portal := "Portal Scroll"
  3724.          If Portal = %name%
  3725.          return true
  3726.          Else
  3727.          return false
  3728.       }
  3729.    }
  3730. return false
  3731. }
  3732.  
  3733. ;-------TEST FUNCTIONS-----------------TEST FUNCTIONS-----------------TEST FUNCTIONS-----------------
  3734.  
  3735. ;-------GUI UPDATE FUNCTIONS--------------GUI UPDATE FUNCTIONS--------------GUI UPDATE FUNCTIONS-----
  3736.  
  3737. GuiUpdate:
  3738.   Gui, Submit, NoHide
  3739.  
  3740.    GuiControl, , QuickSilverMovementTimerUpdate, % Round(QuickSilverMovementTimer/10,1)
  3741.    GuiControl, , RemoveAilmentsTimerUpdate, % Round(RemoveAilmentsTimer/10,1)
  3742.    GuiControl, , RemoveCorruptedBloodChargesUpdate, %RemoveCorruptedBloodCharges%
  3743.  
  3744.    If (minLifePercentToQuit=0)
  3745.    {
  3746.       GuiControl, , minLifePercentToQuitUpdate, N/A
  3747.       GuiControl, , minLifePercentToQuitUpdatePercent,
  3748.    }
  3749.    Else
  3750.    {
  3751.       GuiControl, , minLifePercentToQuitUpdate, %minLifePercentToQuit%
  3752.       GuiControl, , minLifePercentToQuitUpdatePercent, `%
  3753.    }
  3754.    If (minESPercentToQuit=0)
  3755.    {
  3756.       GuiControl, , minESPercentToQuitUpdate, N/A
  3757.       GuiControl, , minESPercentToQuitUpdatePercent,
  3758.    }
  3759.    Else
  3760.    {
  3761.       GuiControl, , minESPercentToQuitUpdate, %minESPercentToQuit%
  3762.       GuiControl, , minESPercentToQuitUpdatePercent, `%
  3763.    }
  3764.    If (maxLifePercentPerHitToQuit=0 || maxLifePercentPerHitToQuit=100)
  3765.    {
  3766.       GuiControl, , maxLifePercentPerHitToQuitUpdate, N/A
  3767.       GuiControl, , maxLifePercentPerHitToQuitUpdatePercent,
  3768.    }
  3769.    Else
  3770.    {
  3771.       GuiControl, , maxLifePercentPerHitToQuitUpdate, %maxLifePercentPerHitToQuit%
  3772.       GuiControl, , maxLifePercentPerHitToQuitUpdatePercent, `%
  3773.    }
  3774.    If (maxESPercentPerHitToQuit=0)
  3775.    {
  3776.       GuiControl, , maxESPercentPerHitToQuitUpdate, N/A
  3777.       GuiControl, , maxESPercentPerHitToQuitUpdatePercent,
  3778.    }
  3779.    Else
  3780.    {
  3781.       GuiControl, , maxESPercentPerHitToQuitUpdate, %maxESPercentPerHitToQuit%
  3782.       GuiControl, , maxESPercentPerHitToQuitUpdatePercent, `%
  3783.    }
  3784.    If (minLifePercentToJade=0)
  3785.    {
  3786.       GuiControl, , minLifePercentToJadeUpdate, N/A
  3787.       GuiControl, , minLifePercentToJadeUpdatePercent,
  3788.    }
  3789.    Else
  3790.    {
  3791.       GuiControl, , minLifePercentToJadeUpdate, %minLifePercentToJade%
  3792.       GuiControl, , minLifePercentToJadeUpdatePercent, `%
  3793.    }
  3794.    If (minESPercentToJade=0)
  3795.    {
  3796.       GuiControl, , minESPercentToJadeUpdate, N/A
  3797.       GuiControl, , minESPercentToJadeUpdatePercent,
  3798.    }
  3799.    Else
  3800.    {
  3801.       GuiControl, , minESPercentToJadeUpdate, %minESPercentToJade%
  3802.       GuiControl, , minESPercentToJadeUpdatePercent, `%
  3803.    }
  3804.    If (minLifePercentToElementalResist=0)
  3805.    {
  3806.       GuiControl, , minLifePercentToElementalResistUpdate, N/A
  3807.       GuiControl, , minLifePercentToElementalResistUpdatePercent,
  3808.    }
  3809.    Else
  3810.    {
  3811.       GuiControl, , minLifePercentToElementalResistUpdate, %minLifePercentToElementalResist%
  3812.       GuiControl, , minLifePercentToElementalResistUpdatePercent, `%
  3813.    }
  3814.    If (minESPercentToElementalResist=0)
  3815.    {
  3816.       GuiControl, , minESPercentToElementalResistUpdate, N/A
  3817.       GuiControl, , minESPercentToElementalResistUpdatePercent,
  3818.    }
  3819.    Else
  3820.    {
  3821.       GuiControl, , minESPercentToElementalResistUpdate, %minESPercentToElementalResist%
  3822.       GuiControl, , minESPercentToElementalResistUpdatePercent, `%
  3823.    }
  3824.    If (minLifePercentToDrink=0)
  3825.    {
  3826.       GuiControl, , minLifePercentToDrinkUpdate, N/A
  3827.       GuiControl, , minLifePercentToDrinkUpdatePercent,
  3828.    }
  3829.    Else
  3830.    {
  3831.       GuiControl, , minLifePercentToDrinkUpdate, %minLifePercentToDrink%
  3832.       GuiControl, , minLifePercentToDrinkUpdatePercent, `%
  3833.    }
  3834.    If (minManaPercentToDrink=0)
  3835.    {
  3836.       GuiControl, , minManaPercentToDrinkUpdate, N/A
  3837.       GuiControl, , minManaPercentToDrinkUpdatePercent,
  3838.    }
  3839.    Else
  3840.    {
  3841.       GuiControl, , minManaPercentToDrinkUpdate, %minManaPercentToDrink%
  3842.       GuiControl, , minManaPercentToDrinkUpdatePercent, `%
  3843.    }
  3844.    If (minManaToDrinkPot=0)
  3845.    {
  3846.       GuiControl, , minManaToDrinkPotUpdate, N/A
  3847.    }
  3848.    Else
  3849.    {
  3850.       GuiControl, , minManaToDrinkPotUpdate, %minManaToDrinkPot%
  3851.    }
  3852.    If (InstantFlaskDelay=0)
  3853.    {
  3854.       GuiControl, , InstantFlaskDelayUpdate, N/A
  3855.       GuiControl, , InstantFlaskDelayUpdatePercent,
  3856.    }
  3857.    Else
  3858.    {
  3859.       GuiControl, , InstantFlaskDelayUpdate,  % Round(InstantFlaskDelay/100,2)
  3860.       GuiControl, , InstantFlaskDelayUpdatePercent, s
  3861.  
  3862.    }
  3863.    If (minLifePercentToSpam=0)
  3864.    {
  3865.       GuiControl, , minLifePercentToSpamUpdate, N/A
  3866.       GuiControl, , minLifePercentToSpamUpdatePercent,
  3867.    }
  3868.    Else
  3869.    {
  3870.       GuiControl, , minLifePercentToSpamUpdate, %minLifePercentToSpam%
  3871.       GuiControl, , minLifePercentToSpamUpdatePercent, `%
  3872.    }
  3873.    If (TradeSpam=0)
  3874.    {
  3875.       GuiControl, , TradeSpamUpdate, N/A
  3876.       GuiControl, , TradeSpamUpdatePercent,
  3877.    }
  3878.    Else
  3879.    {
  3880.       GuiControl, , TradeSpamUpdate, %TradeSpam%
  3881.       GuiControl, , TradeSpamUpdatePercent, m
  3882.    }
  3883.    If (ResyncSpam=0)
  3884.    {
  3885.       GuiControl, , ResyncSpamUpdate, N/A
  3886.       GuiControl, , ResyncSpamUpdatePercent,
  3887.    }
  3888.    Else
  3889.    {
  3890.       GuiControl, , ResyncSpamUpdate, %ResyncSpam%
  3891.       GuiControl, , ResyncSpamUpdatePercent, s
  3892.    }
  3893.    If (RemainingSpam=0)
  3894.    {
  3895.       GuiControl, , RemainingSpamUpdate, N/A
  3896.       GuiControl, , RemainingSpamUpdatePercent,
  3897.    }
  3898.    Else
  3899.    {
  3900.       GuiControl, , RemainingSpamUpdate, %RemainingSpam%
  3901.       GuiControl, , RemainingSpamUpdatePercent, s
  3902.    }
  3903.  
  3904.    Loop, 5
  3905.    {
  3906.         If ConfigChoice = %A_Index%
  3907.         {
  3908.             IniWrite, %minLifePercentToQuit% , Config.ini, Config%A_Index%, minLifePercentToQuit
  3909.             IniWrite, %minESPercentToQuit% , Config.ini, Config%A_Index%, minESPercentToQuit
  3910.             IniWrite, %maxLifePercentPerHitToQuit% , Config.ini, Config%A_Index%, maxLifePercentPerHitToQuit
  3911.             IniWrite, %maxESPercentPerHitToQuit% , Config.ini, Config%A_Index%, maxESPercentPerHitToQuit
  3912.             IniWrite, %minLifePercentToJade% , Config.ini, Config%A_Index%, minLifePercentToJade
  3913.             IniWrite, %minESPercentToJade% , Config.ini, Config%A_Index%, minESPercentToJade
  3914.             IniWrite, %minLifePercentToElementalResist% , Config.ini, Config%A_Index%, minLifePercentToElementalResist
  3915.             IniWrite, %minESPercentToElementalResist% , Config.ini, Config%A_Index%, minESPercentToElementalResist
  3916.             IniWrite, %minLifePercentToDrink% , Config.ini, Config%A_Index%, minLifePercentToDrink
  3917.             IniWrite, %minManaPercentToDrink% , Config.ini, Config%A_Index%, minManaPercentToDrink
  3918.             IniWrite, %minManaToDrinkPot% , Config.ini, Config%A_Index%, minManaToDrinkPot
  3919.             IniWrite, %minLifePercentToSpam% , Config.ini, Config%A_Index%, minLifePercentToSpam
  3920.             IniWrite, %InstantFlaskDelay% , Config.ini, Config%A_Index%, InstantFlaskDelay
  3921.             IniWrite, %QuickSilverMovementTimer% , Config.ini, Config%A_Index%, QuickSilverMovementTimer
  3922.             IniWrite, %RemoveAilmentsTimer% , Config.ini, Config%A_Index%, RemoveAilmentsTimer
  3923.             IniWrite, %ResyncSpam% , Config.ini, Config%A_Index%, ResyncSpam
  3924.          IniWrite, %RemainingSpam% , Config.ini, Config%A_Index%, RemainingSpam
  3925.          IniWrite, %RemoveCorruptedBloodCharges% , Config.ini, Config%A_Index%, RemoveCorruptedBloodCharges
  3926.         }
  3927.    }
  3928.  
  3929.    
  3930.    IniWrite, %InstantFlaskDelay% , Config.ini, Config, InstantFlaskDelay
  3931.    IfDelay:= InstantFlaskDelay
  3932.  
  3933.    PlayerConfig["Default"]:={RemCorruptedBloodCharges:RemoveCorruptedBloodCharges,RemAilmentsTimer:RemoveAilmentsTimer,QuickSilverTimer:QuickSilverMovementTimer*100, minLifeRatioToInstant: minLifePercentToSpam/100, IflaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopElementalResist: minLifePercentToElementalResist/100,minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100,maxLifeRatioPerHitToQuit: maxLifePercentPerHitToQuit/100,maxEShieldRatioPerHitToQuit: maxESPercentPerHitToQuit/100,minEShieldRatioToQuit: minESPercentToQuit/100, minEShieldRatioToPopElementalResist: minESPercentToElementalResist/100, minEShieldRatioToPopJade: minESPercentToJade/100}
  3934.  
  3935.  
  3936. return
  3937.  
  3938. ExitSub:
  3939. If A_ExitReason not in Logoff,Shutdown  ; Avoid spaces around the comma in this line.
  3940. {
  3941.     IniWrite, %TabChoice%, Config.ini, Config, LastTab
  3942. }
  3943. ExitApp
  3944.  
  3945. TabFunc:
  3946. Gui, Submit, NoHide
  3947. return
  3948.  
  3949. Default:
  3950.    Gui, Submit, NoHide
  3951.  
  3952.     Loop, 5
  3953.     {
  3954.        If ConfigChoice = %A_Index%
  3955.        {
  3956.           IniDelete, Config.ini, Config%A_Index%
  3957.        }
  3958.     }
  3959.    
  3960.    Reload
  3961.    Sleep, 2000
  3962.    MsgBox,0,, An error ocurred, reloading script.
  3963. ExitApp
  3964.  
  3965. DefaultHotkeys:
  3966.   Gui, Submit, NoHide
  3967.  
  3968.    IniDelete, Config.ini, Hotkeys
  3969.  
  3970.  
  3971.    Reload
  3972.    Sleep, 2000
  3973.    MsgBox,0,, An error ocurred, reloading script.
  3974. ExitApp
  3975.  
  3976.  
  3977. AutoQuitList:
  3978.   Gui, Submit, NoHide
  3979.    If AutoQuitChoice = 1
  3980.    autoQuitMode:=1
  3981.    If AutoQuitChoice = 2
  3982.    autoQuitMode:=0
  3983.    If AutoQuitChoice = 3
  3984.    autoQuitMode:=3
  3985.    If AutoQuitChoice = 4
  3986.    autoQuitMode:=4
  3987.    
  3988.    IniWrite, %AutoQuitChoice% , Config.ini, Config, AutoQuitMethod
  3989. return
  3990.  
  3991. ClientServerList:
  3992.   Gui, Submit, NoHide
  3993.    If ClientServerChoice = 1
  3994.    ClientServerMode:=1
  3995.    If ClientServerChoice = 2
  3996.    ClientServerMode:=2
  3997.    If ClientServerChoice = 3
  3998.    ClientServerMode:=3
  3999.    If ClientServerChoice = 4
  4000.    ClientServerMode:=4
  4001.    
  4002.    IniWrite, %ClientServerChoice% , Config.ini, Config, ClientServer
  4003. reload
  4004.  
  4005. ConfigList:
  4006.   Gui, Submit, NoHide
  4007.  
  4008.  
  4009.    Loop, 5
  4010.    {
  4011.         If ConfigChoice = %A_Index%
  4012.         {
  4013.             IniRead, minLifePercentToQuit , Config.ini, Config%A_Index%, minLifePercentToQuit, 35
  4014.             IniRead, minESPercentToQuit , Config.ini, Config%A_Index%, minESPercentToQuit, 0
  4015.             IniRead, maxLifePercentPerHitToQuit , Config.ini, Config%A_Index%, maxLifePercentPerHitToQuit, 50
  4016.             IniRead, maxESPercentPerHitToQuit , Config.ini, Config%A_Index%, maxESPercentPerHitToQuit, 0
  4017.             IniRead, minLifePercentToJade , Config.ini, Config%A_Index%, minLifePercentToJade, 70
  4018.             IniRead, minLifePercentToJade , Config.ini, Config%A_Index%, minLifePercentToJade, 70
  4019.             IniRead, minESPercentToJade , Config.ini, Config%A_Index%, minESPercentToJade, 0
  4020.             IniRead, minLifePercentToElementalResist , Config.ini, Config%A_Index%, minLifePercentToElementalResist, 70
  4021.             IniRead, minESPercentToElementalResist , Config.ini, Config%A_Index%, minESPercentToElementalResist, 0
  4022.             IniRead, minLifePercentToDrink , Config.ini, Config%A_Index%, minLifePercentToDrink, 55
  4023.             IniRead, minManaPercentToDrink , Config.ini, Config%A_Index%, minManaPercentToDrink, 25
  4024.             IniRead, minManaToDrinkPot , Config.ini, Config%A_Index%, minManaToDrinkPot, 15
  4025.             IniRead, minLifePercentToSpam, Config.ini, Config%A_Index%, minLifePercentToSpam, 35
  4026.             IniRead, ResyncSpam, Config.ini, Config%A_Index%, ResyncSpam, 0
  4027.          IniRead, RemainingSpam, Config.ini, Config%A_Index%, RemainingSpam, 0
  4028.             IniRead, InstantFlaskDelay, Config.ini, Config%A_Index%, InstantFlaskDelay, 0
  4029.             IniRead, QuickSilverMovementTimer , Config.ini, Config%A_Index%, QuickSilverMovementTimer, 15
  4030.          IniRead, RemoveAilmentsTimer , Config.ini, Config%A_Index%, RemoveAilmentsTimer, 10
  4031.          IniRead, RemoveCorruptedBloodCharges, Config.ini, Config%A_Index%, RemoveCorruptedBloodCharges, 10
  4032.             IniWrite, %A_Index%, Config.ini, Config, ConfigNumber
  4033.         }
  4034.     }
  4035.  
  4036.  
  4037.    GuiControl, , minLifePercentToQuit, %minLifePercentToQuit%
  4038.    GuiControl, , maxLifePercentPerHitToQuit, %maxLifePercentPerHitToQuit%
  4039.    GuiControl, , maxESPercentPerHitToQuit, %maxESPercentPerHitToQuit%
  4040.    GuiControl, , minESPercentToQuit, %minESPercentToQuit%
  4041.    GuiControl, , minLifePercentToJade, %minLifePercentToJade%
  4042.    GuiControl, , minESPercentToJade, %minESPercentToJade%
  4043.    GuiControl, , minLifePercentToElementalResist, %minLifePercentToElementalResist%
  4044.    GuiControl, , minESPercentToElementalResist, %minESPercentToElementalResist%
  4045.    GuiControl, , minLifePercentToDrink, %minLifePercentToDrink%
  4046.    GuiControl, , minManaPercentToDrink, %minManaPercentToDrink%
  4047.    GuiControl, , minManaToDrinkPot, %minManaToDrinkPot%
  4048.    GuiControl, , minLifePercentToSpam, %minLifePercentToSpam%
  4049.    GuiControl, , ResyncSpam, %ResyncSpam%
  4050.    GuiControl, , RemainingSpam, %RemainingSpam%
  4051.    GuiControl, , InstantFlaskDelay, %InstantFlaskDelay%
  4052.    GuiControl, , QuickSilverMovementTimer, %QuickSilverMovementTimer%
  4053.    GuiControl, , RemoveAilmentsTimer, %RemoveAilmentsTimer%
  4054.    GuiControl, , RemoveCorruptedBloodCharges, %RemoveCorruptedBloodCharges%
  4055.  
  4056.  
  4057.    GuiControl, , QuickSilverMovementTimerUpdate, % Round(QuickSilverMovementTimer/10,1)
  4058.    GuiControl, , RemoveAilmentsTimerUpdate, % Round(RemoveAilmentsTimer/10,1)
  4059.    GuiControl, , RemoveCorruptedBloodChargesUpdate, %RemoveCorruptedBloodCharges%
  4060.  
  4061.    If (minLifePercentToQuit=0)
  4062.    {
  4063.       GuiControl, , minLifePercentToQuitUpdate, N/A
  4064.       GuiControl, , minLifePercentToQuitUpdatePercent,
  4065.    }
  4066.    Else
  4067.    {
  4068.       GuiControl, , minLifePercentToQuitUpdate, %minLifePercentToQuit%
  4069.       GuiControl, , minLifePercentToQuitUpdatePercent, `%
  4070.    }
  4071.    If (minESPercentToQuit=0)
  4072.    {
  4073.       GuiControl, , minESPercentToQuitUpdate, N/A
  4074.       GuiControl, , minESPercentToQuitUpdatePercent,
  4075.    }
  4076.    Else
  4077.    {
  4078.       GuiControl, , minESPercentToQuitUpdate, %minESPercentToQuit%
  4079.       GuiControl, , minESPercentToQuitUpdatePercent, `%
  4080.    }
  4081.    If (maxLifePercentPerHitToQuit=0 || maxLifePercentPerHitToQuit=100)
  4082.    {
  4083.       GuiControl, , maxLifePercentPerHitToQuitUpdate, N/A
  4084.       GuiControl, , maxLifePercentPerHitToQuitUpdatePercent,
  4085.    }
  4086.    Else
  4087.    {
  4088.       GuiControl, , maxLifePercentPerHitToQuitUpdate, %maxLifePercentPerHitToQuit%
  4089.       GuiControl, , maxLifePercentPerHitToQuitUpdatePercent, `%
  4090.    }
  4091.    If (maxESPercentPerHitToQuit=0)
  4092.    {
  4093.       GuiControl, , maxESPercentPerHitToQuitUpdate, N/A
  4094.       GuiControl, , maxESPercentPerHitToQuitUpdatePercent,
  4095.    }
  4096.    Else
  4097.    {
  4098.       GuiControl, , maxESPercentPerHitToQuitUpdate, %maxESPercentPerHitToQuit%
  4099.       GuiControl, , maxESPercentPerHitToQuitUpdatePercent, `%
  4100.    }
  4101.    If (minLifePercentToJade=0)
  4102.    {
  4103.       GuiControl, , minLifePercentToJadeUpdate, N/A
  4104.       GuiControl, , minLifePercentToJadeUpdatePercent,
  4105.    }
  4106.    Else
  4107.    {
  4108.       GuiControl, , minLifePercentToJadeUpdate, %minLifePercentToJade%
  4109.       GuiControl, , minLifePercentToJadeUpdatePercent, `%
  4110.    }
  4111.    If (minESPercentToJade=0)
  4112.    {
  4113.       GuiControl, , minESPercentToJadeUpdate, N/A
  4114.       GuiControl, , minESPercentToJadeUpdatePercent,
  4115.    }
  4116.    Else
  4117.    {
  4118.       GuiControl, , minESPercentToJadeUpdate, %minESPercentToJade%
  4119.       GuiControl, , minESPercentToJadeUpdatePercent, `%
  4120.    }
  4121.    If (minLifePercentToElementalResist=0)
  4122.    {
  4123.       GuiControl, , minLifePercentToElementalResistUpdate, N/A
  4124.       GuiControl, , minLifePercentToElementalResistUpdatePercent,
  4125.    }
  4126.    Else
  4127.    {
  4128.       GuiControl, , minLifePercentToElementalResistUpdate, %minLifePercentToElementalResist%
  4129.       GuiControl, , minLifePercentToElementalResistUpdatePercent, `%
  4130.    }
  4131.    If (minESPercentToElementalResist=0)
  4132.    {
  4133.       GuiControl, , minESPercentToElementalResistUpdate, N/A
  4134.       GuiControl, , minESPercentToElementalResistUpdatePercent,
  4135.    }
  4136.    Else
  4137.    {
  4138.       GuiControl, , minESPercentToElementalResistUpdate, %minESPercentToElementalResist%
  4139.       GuiControl, , minESPercentToElementalResistUpdatePercent, `%
  4140.    }
  4141.    If (minLifePercentToDrink=0)
  4142.    {
  4143.       GuiControl, , minLifePercentToDrinkUpdate, N/A
  4144.       GuiControl, , minLifePercentToDrinkUpdatePercent,
  4145.    }
  4146.    Else
  4147.    {
  4148.       GuiControl, , minLifePercentToDrinkUpdate, %minLifePercentToDrink%
  4149.       GuiControl, , minLifePercentToDrinkUpdatePercent, `%
  4150.    }
  4151.    If (minManaPercentToDrink=0)
  4152.    {
  4153.       GuiControl, , minManaPercentToDrinkUpdate, N/A
  4154.       GuiControl, , minManaPercentToDrinkUpdatePercent,
  4155.    }
  4156.    Else
  4157.    {
  4158.       GuiControl, , minManaPercentToDrinkUpdate, %minManaPercentToDrink%
  4159.       GuiControl, , minManaPercentToDrinkUpdatePercent, `%
  4160.    }
  4161.    If (minManaToDrinkPot=0)
  4162.    {
  4163.       GuiControl, , minManaToDrinkPotUpdate, N/A
  4164.    }
  4165.    Else
  4166.    {
  4167.       GuiControl, , minManaToDrinkPotUpdate, %minManaToDrinkPot%
  4168.    }
  4169.    If (InstantFlaskDelay=0)
  4170.    {
  4171.       GuiControl, , InstantFlaskDelayUpdate, N/A
  4172.       GuiControl, , InstantFlaskDelayUpdatePercent,
  4173.    }
  4174.    Else
  4175.    {
  4176.       GuiControl, , InstantFlaskDelayUpdate,  % Round(InstantFlaskDelay/100,2)
  4177.       GuiControl, , InstantFlaskDelayUpdatePercent, s
  4178.  
  4179.    }
  4180.    If (minLifePercentToSpam=0)
  4181.    {
  4182.       GuiControl, , minLifePercentToSpamUpdate, N/A
  4183.       GuiControl, , minLifePercentToSpamUpdatePercent,
  4184.    }
  4185.    Else
  4186.    {
  4187.       GuiControl, , minLifePercentToSpamUpdate, %minLifePercentToSpam%
  4188.       GuiControl, , minLifePercentToSpamUpdatePercent, `%
  4189.    }
  4190.    If (TradeSpam=0)
  4191.    {
  4192.       GuiControl, , TradeSpamUpdate, N/A
  4193.       GuiControl, , TradeSpamUpdatePercent,
  4194.    }
  4195.    Else
  4196.    {
  4197.       GuiControl, , TradeSpamUpdate, %TradeSpam%
  4198.       GuiControl, , TradeSpamUpdatePercent, m
  4199.    }
  4200.    If (ResyncSpam=0)
  4201.    {
  4202.       GuiControl, , ResyncSpamUpdate, N/A
  4203.       GuiControl, , ResyncSpamUpdatePercent,
  4204.    }
  4205.    Else
  4206.    {
  4207.       GuiControl, , ResyncSpamUpdate, %ResyncSpam%
  4208.       GuiControl, , ResyncSpamUpdatePercent, s
  4209.    }
  4210.    If (RemainingSpam=0)
  4211.    {
  4212.       GuiControl, , RemainingSpamUpdate, N/A
  4213.       GuiControl, , RemainingSpamUpdatePercent,
  4214.    }
  4215.    Else
  4216.    {
  4217.       GuiControl, , RemainingSpamUpdate, %RemainingSpam%
  4218.       GuiControl, , RemainingSpamUpdatePercent, s
  4219.    }
  4220.  
  4221.    PlayerConfig["Default"]:={RemCorruptedBloodCharges:RemoveCorruptedBloodCharges,RemAilmentsTimer:RemoveAilmentsTimer,QuickSilverTimer:QuickSilverMovementTimer*100, minLifeRatioToInstant: minLifePercentToSpam/100, IflaskDelay: InstantFlaskDelay,minLifeRatioToDrink: minLifePercentToDrink/100, minManaRatioToDrink: minManaPercentToDrink/100, minManaToDrink: minManaToDrinkPot, minLifeRatioToPopElementalResist: minLifePercentToElementalResist/100,minLifeRatioToPopJade: minLifePercentToJade/100, minLifeRatioToQuit: minLifePercentToQuit/100,maxLifeRatioPerHitToQuit: maxLifePercentPerHitToQuit/100,maxEShieldRatioPerHitToQuit: maxESPercentPerHitToQuit/100,minEShieldRatioToQuit: minESPercentToQuit/100, minEShieldRatioToPopElementalResist: minESPercentToElementalResist/100, minEShieldRatioToPopJade: minESPercentToJade/100}
  4222.    
  4223. return
  4224.  
  4225. TrayNotIficationsCheck:
  4226.   Gui, Submit, NoHide
  4227.    If TrayCheckBox = 0
  4228.    {
  4229.       TrayNotIficationsCheck = 0
  4230.       trayNotIfications:=true
  4231.    }
  4232.    If TrayCheckBox = 1
  4233.    {
  4234.       TrayNotIficationsCheck = 1
  4235.       trayNotIfications:=false
  4236.    }
  4237.    IniWrite, %TrayNotIficationsCheck% , Config.ini, Config, TrayNotIficationsCheck
  4238. return  
  4239.  
  4240. QuickSilverCheck:
  4241.   Gui, Submit, NoHide
  4242.    If QuickSilverCheckBox = 0
  4243.    {
  4244.       QuickSilverCheck = 0
  4245.       IniWrite, 0 , Config.ini, Config, QuickSilverCheck
  4246.    }
  4247.    If QuickSilverCheckBox = 1
  4248.    {
  4249.       QuickSilverCheck = 1
  4250.       IniWrite, 1 , Config.ini, Config, QuickSilverCheck
  4251.    }
  4252.    IniWrite, %QuickSilverCheck% , Config.ini, Config, QuickSilverCheck
  4253. return
  4254.  
  4255. QuickSilverCheck2:
  4256.   Gui, Submit, NoHide
  4257.    If QuickSilverCheckBox2 = 0
  4258.    {
  4259.       QuickSilverCheck2 = 0
  4260.       IniWrite, 0 , Config.ini, Config, QuickSilverCheck2
  4261.    }
  4262.    If QuickSilverCheckBox2 = 1
  4263.    {
  4264.       QuickSilverCheck2 = 1
  4265.       IniWrite, 1 , Config.ini, Config, QuickSilverCheck2
  4266.    }
  4267.    IniWrite, %QuickSilverCheck2% , Config.ini, Config, QuickSilverCheck2
  4268. return
  4269.  
  4270. FlaskOnFrozenCheck:
  4271.   Gui, Submit, NoHide
  4272.    If FlaskOnFrozenCheckBox = 0
  4273.    {
  4274.       FlaskOnFrozenCheck = 0
  4275.       IniWrite, 0 , Config.ini, Config, FlaskOnFrozenCheck
  4276.    }
  4277.    If FlaskOnFrozenCheckBox = 1
  4278.    {
  4279.       FlaskOnFrozenCheck = 1
  4280.       IniWrite, 1 , Config.ini, Config, FlaskOnFrozenCheck
  4281.    }
  4282.    IniWrite, %FlaskOnFrozenCheck% , Config.ini, Config, FlaskOnFrozenCheck
  4283. return
  4284.  
  4285. FlaskOnShockedCheck:
  4286.   Gui, Submit, NoHide
  4287.    If FlaskOnShockedCheckBox = 0
  4288.    {
  4289.       FlaskOnShockedCheck = 0
  4290.       IniWrite, 0 , Config.ini, Config, FlaskOnShockedCheck
  4291.    }
  4292.    If FlaskOnShockedCheckBox = 1
  4293.    {
  4294.       FlaskOnShockedCheck = 1
  4295.       IniWrite, 1 , Config.ini, Config, FlaskOnShockedCheck
  4296.    }
  4297.    IniWrite, %FlaskOnShockedCheck% , Config.ini, Config, FlaskOnShockedCheck
  4298. return
  4299.  
  4300. FlaskOnIgnitedCheck:
  4301.   Gui, Submit, NoHide
  4302.    If FlaskOnIgnitedCheckBox = 0
  4303.    {
  4304.       FlaskOnIgnitedCheck = 0
  4305.       IniWrite, 0 , Config.ini, Config, FlaskOnIgnitedCheck
  4306.    }
  4307.    If FlaskOnIgnitedCheckBox = 1
  4308.    {
  4309.       FlaskOnIgnitedCheck = 1
  4310.       IniWrite, 1 , Config.ini, Config, FlaskOnIgnitedCheck
  4311.    }
  4312.    IniWrite, %FlaskOnIgnitedCheck% , Config.ini, Config, FlaskOnIgnitedCheck
  4313. return
  4314.  
  4315. FlaskOnCurseCheck:
  4316.   Gui, Submit, NoHide
  4317.    If FlaskOnCurseCheckBox = 0
  4318.    {
  4319.       FlaskOnCurseCheck = 0
  4320.       IniWrite, 0 , Config.ini, Config, FlaskOnCurseCheck
  4321.    }
  4322.    If FlaskOnCurseCheckBox = 1
  4323.    {
  4324.       FlaskOnCurseCheck = 1
  4325.       IniWrite, 1 , Config.ini, Config, FlaskOnCurseCheck
  4326.    }
  4327.    IniWrite, %FlaskOnCurseCheck% , Config.ini, Config, FlaskOnCurseCheck
  4328. return
  4329.  
  4330. FlaskOnCorruptedBloodCheck:
  4331.   Gui, Submit, NoHide
  4332.    If FlaskOnCorruptedBloodCheckBox = 0
  4333.    {
  4334.       FlaskOnCorruptedBloodCheck = 0
  4335.       IniWrite, 0 , Config.ini, Config, FlaskOnCorruptedBloodCheck
  4336.    }
  4337.    If FlaskOnCorruptedBloodCheckBox = 1
  4338.    {
  4339.       FlaskOnCorruptedBloodCheck = 1
  4340.       IniWrite, 1 , Config.ini, Config, FlaskOnCorruptedBloodCheck
  4341.    }
  4342.    IniWrite, %FlaskOnCorruptedBloodCheck% , Config.ini, Config, FlaskOnCorruptedBloodCheck
  4343. return
  4344.  
  4345. AttackInPlaceCheck:
  4346.   Gui, Submit, NoHide
  4347.    If AttackInPlaceCheckBox = 0
  4348.    {
  4349.       AttackInPlaceCheck = 0
  4350.       IniWrite, 0 , Config.ini, Config, AttackInPlaceCheck
  4351.    }
  4352.    If AttackInPlaceCheckBox = 1
  4353.    {
  4354.       AttackInPlaceCheck = 1
  4355.       IniWrite, 1 , Config.ini, Config, AttackInPlaceCheck
  4356.    }
  4357.    IniWrite, %AttackInPlaceCheck% , Config.ini, Config, AttackInPlaceCheck
  4358. return
  4359.  
  4360. HoldCtrlCheck:
  4361.   Gui, Submit, NoHide
  4362.    If HoldCtrlCheckBox = 0
  4363.    {
  4364.       HoldCtrlCheck = 0
  4365.       IniWrite, 0 , Config.ini, Config, HoldCtrlCheck
  4366.    }
  4367.    If HoldCtrlCheckBox = 1
  4368.    {
  4369.       HoldCtrlCheck = 1
  4370.       IniWrite, 1 , Config.ini, Config, HoldCtrlCheck
  4371.    }
  4372.    IniWrite, %HoldCtrlCheck% , Config.ini, Config, HoldCtrlCheck
  4373. return
  4374.  
  4375.  
  4376. DPSCheck:
  4377.   Gui, Submit, NoHide
  4378.    If DPSCheckBox = 0
  4379.    {
  4380.       IniWrite, 0 , Config.ini, Config, DPSCheck
  4381.    }
  4382.    If DPSCheckBox = 1
  4383.    {
  4384.       IniWrite, 1 , Config.ini, Config, DPSCheck
  4385.    }
  4386. Return
  4387.  
  4388. showgui:
  4389.   Gui, Show, x760 y198 h665 w474
  4390. Return
  4391.  
  4392. showgui2:
  4393.  
  4394.    Gui, 2:Show,,Hotkeys
  4395.  
  4396.    ; Set GUI State
  4397.    LoadSettings()
  4398.  
  4399.    ; Enable defined hotkeys
  4400.    EnableHotkeys()
  4401. Return
  4402.  
  4403. showgui4:
  4404.  
  4405.    Gui, 4:Show,,Debug Window
  4406.  
  4407. Return
  4408.  
  4409. DisableSlot:
  4410.   Gui, Submit, NoHide
  4411.    Loop, 5
  4412.    {
  4413.         If DisableSlot%A_Index% = 0
  4414.         {
  4415.             IniWrite, 0 , Config.ini, DisableSlot, DisableSlot%A_Index%
  4416.         }
  4417.         Else If DisableSlot%A_Index% = 1
  4418.         {
  4419.             IniWrite, 1 , Config.ini, DisableSlot, DisableSlot%A_Index%
  4420.         }
  4421.    }
  4422. return
  4423.  
  4424. ReadMe:
  4425.   MsgBox, ------------------------------HOTKEYS------------------------------`n`n[F1] --- Use Resync Command`n[F2] --- Use Remaining Command`n[F3] --- Over an Item for DPSCalc`n[Ctrl+F3] --- Over an Item for More info on the Internet`n[F4] --- Test Exit to Log In Screen`n[Ctrl+F4] -- Test Use Portal`n[F10] -- Send Last Chat Message to Trade Channels 1-10`n[Alt + W] - Change Window to Bordeless, and locks mouse on window.`n[MIDDLE MOUSE] - Send Hideout command.`n`n------------------------------CREDITS------------------------------`n`n Base Script Created by Wrongusername.`n`n GUI and 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`nThe link has been coppied to the clipboard.
  4426.    clipboard = http://www.ownedcore.com/forums/mmo/path-of-exile/poe-bots-programs/451206-poe-autoflask-autoscript-improvements-updates.html
  4427. return
  4428.  
  4429. Donate:
  4430.   Run "https://donate.doctorswithoutborders.org/onetime.cfm"
  4431. return
  4432.  
  4433. GuiClose:
  4434.    Gui, Submit
  4435.    If (trayNotIfications)
  4436.    {
  4437.       TrayTip, Script is Still Running in the Background, %A_Space% , 2
  4438.    }
  4439. return
  4440.  
  4441.  
  4442.  
  4443. ;-------GUI UPDATE FUNCTIONS--------------GUI UPDATE FUNCTIONS--------------GUI UPDATE FUNCTIONS-----
  4444.  
  4445. ;-------HOTKEYS-----------------HOTKEYS-----------------HOTKEYS-----------------HOTKEYS--------------
  4446. ; Test that bound hotkeys work
  4447. ;These labels may contain any commands for their respective hotkeys to perform.
  4448. DoHotkey1:
  4449.   desync:=1
  4450. return
  4451.  
  4452. DoHotkey2:
  4453.   remaining:=1
  4454. return
  4455.  
  4456. DoHotkey3:
  4457.   DPSCalc()
  4458. return
  4459.  
  4460. DoHotkey4:
  4461.   Webgrab()
  4462. return
  4463.  
  4464. DoHotkey5:
  4465.  
  4466.             If (autoQuitMode=0)
  4467.             {
  4468.                  QuitToLoginScreen(WinActive("A"))
  4469.             }
  4470.             Else If (autoQuitMode=1)
  4471.             {
  4472.                 run, cports.exe /close * * * * PathofExile.exe
  4473.             }
  4474.             Else If (autoQuitMode=3)
  4475.             {
  4476.             WinActivate Path of Exile ahk_class POEWindowClass
  4477.                 IfWinActive Path of Exile ahk_class POEWindowClass
  4478.             {
  4479.                SendInput {ALT Down}
  4480.                SendInput {F4}
  4481.                SendInput {ALT Up}
  4482.             }
  4483.             }
  4484.             Else If (autoQuitMode=4)
  4485.             {
  4486.                run, cports.exe /close * * * * PathofExile.exe
  4487.             }
  4488. return
  4489.  
  4490. DoHotkey6:
  4491.   UsePortal()
  4492. return
  4493.  
  4494. DoHotkey7:
  4495.   tradechat:=1
  4496. return
  4497.  
  4498. DoHotkey8:
  4499.   WinGet, window, ID, A   ; Use the ID of the active window.
  4500.    Toggle_Window(window)
  4501. return
  4502.  
  4503. DoHotkey9:
  4504.   hideout:=1
  4505. return
  4506.  
  4507. ;-------HOTKEYS-----------------HOTKEYS-----------------HOTKEYS-----------------HOTKEYS--------------
  4508.  
  4509. ; Something changed - rebuild
  4510. OptionChanged:
  4511.   OptionChanged()
  4512.    return
  4513.  
  4514. OptionChanged()
  4515. {
  4516.    global HotkeyList
  4517.  
  4518.    Gui, 2:Submit, NoHide
  4519.    ; Disable Hotkeys
  4520.    DisableHotkeys()
  4521.  
  4522.    Loop % HotkeyList.MaxIndex(){
  4523.       ;HotkeyList[A_Index].block := Block%A_Index%
  4524.       HotkeyList[A_Index].wild := Wild%A_Index%
  4525.    }
  4526.  
  4527.    EnableHotkeys()
  4528.  
  4529.    SaveSettings()
  4530. }
  4531.  
  4532. ; Detects a pressed key combination
  4533. Bind:
  4534.   Gui, 2:Submit, NoHide
  4535.    Bind(substr(A_GuiControl,5))
  4536.    return
  4537.  
  4538. Bind(ctrlnum)
  4539. {
  4540.    global HKModIfierState
  4541.    global BindMode
  4542.    global EXTRA_KEY_LIST
  4543.    global HKControlType
  4544.    global HKSecondaryInput
  4545.    global HKLastHotkey
  4546.  
  4547.    global HotkeyList
  4548.  
  4549.    ; init vars
  4550.    HKControlType := 0
  4551.    HKModIfierState := {ctrl: 0, alt: 0, shIft: 0, win: 0}
  4552.  
  4553.    ; Disable existing hotkeys
  4554.    DisableHotkeys()
  4555.  
  4556.    ; Enable Joystick detection hotkeys
  4557.    JoystickDetection(1)
  4558.  
  4559.    ; Start Bind Mode - this starts detection for mouse buttons and modIfier keys
  4560.    BindMode := 1
  4561.  
  4562.    ; Show the prompt
  4563.    prompt := "Please press the desired key combination.`n`n"
  4564.    prompt .= "Supports most keyboard keys and all mouse buttons. Also Ctrl, Alt, ShIft, Win as modIfiers or individual keys.`n"
  4565.    prompt .= "Joystick buttons are also supported, but currently not with modIfiers.`n"
  4566.    prompt .= "`nHit Escape to cancel."
  4567.    prompt .= "`nHold Escape to clear a binding."
  4568.    Gui, 3:Add, text, center, %prompt%
  4569.    Gui, 3:-Border +AlwaysOnTop
  4570.    Gui, 3:Show
  4571.  
  4572.    outhk := ""
  4573.  
  4574.    Input, detectedkey, L1 M, %EXTRA_KEY_LIST%
  4575.  
  4576.    If (substr(ErrorLevel,1,7) == "EndKey:"){
  4577.       ; A "Special" (Non-printable) key was pressed
  4578.       tmp := substr(ErrorLevel,8)
  4579.       detectedkey := tmp
  4580.       If (tmp == "Escape"){
  4581.          ; Detection ended by Escape
  4582.          If (HKControlType > 0){
  4583.             ; The Escape key was sent because a special button was used
  4584.             detectedkey := HKSecondaryInput
  4585.          } Else {
  4586.             detectedkey := ""
  4587.             ; Start listening to key up event for Escape, to see If it was held
  4588.             HKLastHotkey := ctrlnum
  4589.             hotkey, Escape up, EscapeReleased, ON
  4590.             SetTimer, DeleteHotkey, 1000
  4591.          }
  4592.       }
  4593.    }
  4594.  
  4595.    ; Stop listening to mouse, keyboard etc
  4596.    BindMode := 0
  4597.    JoystickDetection(0)
  4598.  
  4599.    ; Hide prompt
  4600.    Gui, 3:Submit
  4601.  
  4602.  
  4603.    ; Process results
  4604.  
  4605.    modct := CurrentModIfierCount()
  4606.  
  4607.    If (detectedkey && modct && HKControlType == 3){
  4608.       msgbox ,,Error, ModIfiers (Ctrl, Alt, ShIft, Win) are currently not supported with Joystick buttons.
  4609.       detectedkey := ""
  4610.    }
  4611.  
  4612.    If (detectedkey)
  4613.    {
  4614.       ; Update the hotkey object
  4615.       outhk := BuildHotkeyString(detectedkey,HKControlType)
  4616.       tmp := {hk: outhk, type: HKControlType, status: 0}
  4617.  
  4618.       clash := 0
  4619.       Loop % HotkeyList.MaxIndex(){
  4620.          If (A_Index == ctrlnum)
  4621.          {
  4622.             continue
  4623.          }
  4624.          If (StripPrefix(HotkeyList[A_Index].hk) == StripPrefix(tmp.hk))
  4625.          {
  4626.             clash := 1
  4627.          }
  4628.       }
  4629.       If (clash)
  4630.       {
  4631.          msgbox You cannot bind the same hotkey to two dIfferent actions. Aborting...
  4632.       }
  4633.       Else
  4634.       {
  4635.          HotkeyList[ctrlnum] := tmp
  4636.       }
  4637.  
  4638.       ; Rebuild rest of hotkey object, save settings etc
  4639.       OptionChanged()
  4640.       ; Write settings to INI file
  4641.       ;SaveSettings()
  4642.  
  4643.       ; Update the GUI control
  4644.       UpdateHotkeyControls()
  4645.  
  4646.       ; Enable the hotkeys
  4647.       ;EnableHotkeys()
  4648.    }
  4649.    Else
  4650.    {
  4651.       ; Escape was pressed - resotre original hotkey, If any
  4652.       EnableHotkeys()
  4653.    }
  4654.    return
  4655. }
  4656.  
  4657. DeleteHotkey:
  4658.   SetTimer, DeleteHotkey, Off
  4659.    DeleteHotKey(HKLastHotkey)
  4660. return
  4661.  
  4662. DeleteHotkey(hk)
  4663. {
  4664.    global HotkeyList
  4665.    global DefaultHKObject
  4666.  
  4667.    soundbeep
  4668.    DisableHotkeys()
  4669.    HotkeyList[hk] := DefaultHKObject
  4670.  
  4671.    OptionChanged()
  4672.  
  4673.    UpdateHotkeyControls()
  4674.    return
  4675. }
  4676.  
  4677. EscapeReleased:
  4678.   hotkey, Escape up, EscapeReleased, OFF
  4679.    SetTimer, DeleteHotkey, Off
  4680. return
  4681.  
  4682. ; Enables User-Defined Hotkeys
  4683. EnableHotkeys()
  4684. {
  4685.    global HotkeyList
  4686.    Loop % HotkeyList.MaxIndex()
  4687.    {
  4688.       status := HotkeyList[A_Index].status
  4689.       hk := HotkeyList[A_Index].hk
  4690.       If (hk != "" && status == 0){
  4691.          prefix := BuildPrefix(HotkeyList[A_Index])
  4692.          ;Msgbox % "ADDING: " prefix "," hk
  4693.          hotkey, %prefix%%hk%, DoHotkey%A_Index%, ON
  4694.          HotkeyList[A_Index].status := 1
  4695.       }
  4696.    }
  4697. }
  4698.  
  4699. ; Disables User-Defined Hotkeys
  4700. DisableHotkeys()
  4701. {
  4702.    global HotkeyList
  4703.  
  4704.    Loop % HotkeyList.MaxIndex(){
  4705.       status := HotkeyList[A_Index].status
  4706.       hk := HotkeyList[A_Index].hk
  4707.       If (hk != "" && status == 1){
  4708.          prefix := BuildPrefix(HotkeyList[A_Index])
  4709.          ;Msgbox % "REMOVING: " prefix "," hk
  4710.          hotkey, %prefix%%hk%, DoHotkey%A_Index%, OFF
  4711.          ;hotkey, %hk%, DoHotkey%A_Index%, OFF
  4712.          HotkeyList[A_Index].status := 0
  4713.       }
  4714.    }
  4715. }
  4716.  
  4717. ; Builds the prefix for a given hotkey object
  4718. BuildPrefix(hk)
  4719. {
  4720.    prefix := "~"
  4721.    ;If (!hk.block){
  4722.    ;  prefix .= "~"
  4723.    ;}
  4724.    If (hk.wild){
  4725.       prefix .= "*"
  4726.    }
  4727.    return prefix
  4728. }
  4729.  
  4730. ; Removes ~ * etc prefixes (But NOT modIfiers!) from a hotkey object for comparison
  4731. StripPrefix(hk)
  4732. {
  4733.    Loop {
  4734.       chr := substr(hk,1,1)
  4735.       If (chr == "~" || chr == "*" || chr == "$"){
  4736.          hk := substr(hk,2)
  4737.       } Else {
  4738.          break
  4739.       }
  4740.    }
  4741.    return hk
  4742. }
  4743.  
  4744. ; Write settings to the INI
  4745. SaveSettings()
  4746. {
  4747.    global ININame
  4748.    global NumHotkeys
  4749.    global HotkeyList
  4750.  
  4751.    Loop % HotkeyList.MaxIndex(){
  4752.       hk := HotkeyList[A_Index].hk
  4753.       type := HotkeyList[A_Index].type
  4754.       ;block := HotkeyList[A_Index].block
  4755.       wild := HotkeyList[A_Index].wild
  4756.  
  4757.       ;If (hk != ""){
  4758.          iniwrite, %hk%, %ININame%, Hotkeys, hk_%A_Index%_hk
  4759.          iniwrite, %type%, %ININame%, Hotkeys, hk_%A_Index%_type
  4760.          ;iniwrite, %block%, %ININame%, Hotkeys, hk_%A_Index%_block
  4761.          iniwrite, %wild%, %ININame%, Hotkeys, hk_%A_Index%_wild
  4762.       ;}
  4763.    }
  4764.    return
  4765. }
  4766.  
  4767.  
  4768. ; Read settings from the INI
  4769. LoadSettings()
  4770. {
  4771.    global ININame
  4772.    global NumHotkeys
  4773.    global HotkeyList
  4774.    global DefaultHKObject
  4775.  
  4776.    Loop % NumHotkeys
  4777.    {
  4778.       ; Init array so all items exist
  4779.       HotkeyList[A_Index] := DefaultHKObject
  4780.  
  4781.       IniRead, type, %ININame% , Hotkeys, hk_%A_Index%_type,
  4782.      
  4783.       If A_index=1
  4784.       {
  4785.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,F1
  4786.       }
  4787.       If A_index=2
  4788.       {
  4789.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,F2
  4790.       }
  4791.       If A_index=3
  4792.       {
  4793.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,F3
  4794.       }
  4795.       If A_index=4
  4796.       {
  4797.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,^F3
  4798.       }
  4799.       If A_index=5
  4800.       {
  4801.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,F4
  4802.       }
  4803.       If A_index=6
  4804.       {
  4805.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,^F4
  4806.       }
  4807.       If A_index=7
  4808.       {
  4809.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,F10
  4810.       }
  4811.       If A_index=8
  4812.       {
  4813.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,!W
  4814.       }
  4815.       If A_index=9
  4816.       {
  4817.          IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,mbutton
  4818.       }
  4819.      
  4820.       ;IniRead, val, %ININame% , Hotkeys, hk_%A_Index%_hk,
  4821.      
  4822.       If (val != "ERROR")
  4823.       {
  4824.          If A_index=9
  4825.          {
  4826.             IniRead, type, %ININame% , Hotkeys, hk_%A_Index%_type,2
  4827.          }
  4828.          Else
  4829.          {
  4830.             IniRead, type, %ININame% , Hotkeys, hk_%A_Index%_type, 0
  4831.          }
  4832.          ;IniRead, block, %ININame% , Hotkeys, hk_%A_Index%_block, 0
  4833.          IniRead, wild, %ININame% , Hotkeys, hk_%A_Index%_wild, 0
  4834.  
  4835.          HotkeyList[A_Index] := {hk: val, type: type, wild: wild, status: 0}
  4836.       }
  4837.    }
  4838.    UpdateHotkeyControls()
  4839.    Gui, 2:Submit, NoHide
  4840. }
  4841.  
  4842. ; Update the GUI controls with the hotkey names
  4843. UpdateHotkeyControls()
  4844. {
  4845.    global HotkeyList
  4846.  
  4847.    Loop % HotkeyList.MaxIndex()
  4848.    {
  4849.       If (HotkeyList[A_Index].hk != "")
  4850.       {
  4851.          tmp := BuildHotkeyName(HotkeyList[A_Index].hk,HotkeyList[A_Index].type)
  4852.          GuiControl, 2:, HotkeyName%A_Index%, %tmp%
  4853.       }
  4854.       Else
  4855.       {
  4856.          GuiControl, 2:, HotkeyName%A_Index%, None
  4857.       }
  4858.       ;tmp := HotkeyList[A_Index].block
  4859.       ;GuiControl,, Block%A_Index%, %tmp%
  4860.  
  4861.       tmp := HotkeyList[A_Index].wild
  4862.       GuiControl, 2:, Wild%A_Index%, %tmp%
  4863.    }
  4864.    Gui, 2:Submit, NoHide
  4865. }
  4866.  
  4867. ; Builds an AHK String (eg "^c" for CTRL + C) from the last detected hotkey
  4868. BuildHotkeyString(str, type := 0)
  4869. {
  4870.    global HKModIfierState
  4871.  
  4872.    outhk := ""
  4873.    modct := CurrentModIfierCount()
  4874.  
  4875.    If (type == 1){
  4876.       ; Solitary modIfier key used (eg Left / Right Alt)
  4877.       outhk := str
  4878.    } Else {
  4879.       If (modct){
  4880.          ; ModIfiers used in combination with something Else - List modIfiers in a specIfic order
  4881.          modIfiers := ["CTRL","ALT","SHIfT","WIN"]
  4882.  
  4883.          Loop, 4 {
  4884.             key := modIfiers[A_Index]
  4885.             value := HKModIfierState[modIfiers[A_Index]]
  4886.             If (value){
  4887.                If (key == "CTRL"){
  4888.                   outhk .= "^"
  4889.                } Else If (key == "ALT"){
  4890.                   outhk .= "!"
  4891.                } Else If (key == "SHIfT"){
  4892.                   outhk .= "+"
  4893.                } Else If (key == "WIN"){
  4894.                   outhk .= "#"
  4895.                }
  4896.             }
  4897.          }
  4898.       }
  4899.       ; ModIfiers etc processed, complete the string
  4900.       outhk .= str
  4901.    }
  4902.  
  4903.    return outhk
  4904. }
  4905.  
  4906. ; Builds a Human-Readable form of a Hotkey string (eg "^C" -> "CTRL + C")
  4907. BuildHotkeyName(hk,ctrltype)
  4908. {
  4909.    outstr := ""
  4910.    modctr := 0
  4911.    stringupper, hk, hk
  4912.  
  4913.    Loop % strlen(hk) {
  4914.       chr := substr(hk,1,1)
  4915.       mod := 0
  4916.  
  4917.       If (chr == "^"){
  4918.          ; Ctrl
  4919.          mod := "CTRL"
  4920.          modctr++
  4921.       } Else If (chr == "!"){
  4922.          ; Alt
  4923.          mod := "ALT"
  4924.          modctr++
  4925.       } Else If (chr == "+"){
  4926.          ; ShIft
  4927.          mod := "SHIfT"
  4928.          modctr++
  4929.       } Else If (chr == "#"){
  4930.          ; Win
  4931.          mod := "WIN"
  4932.          modctr++
  4933.       } Else {
  4934.          break
  4935.       }
  4936.       If (mod){
  4937.          If (modctr > 1){
  4938.             outstr .= " + "
  4939.          }
  4940.          outstr .= mod
  4941.          ; shIft character out
  4942.          hk := substr(hk,2)
  4943.       }
  4944.    }
  4945.    If (modctr){
  4946.       outstr .= " + "
  4947.    }
  4948.  
  4949.    If (ctrltype == 1){
  4950.       ; Solitary ModIfiers
  4951.       pfx := substr(hk,1,1)
  4952.       If (pfx == "L"){
  4953.          outstr .= "LEFT "
  4954.       } Else {
  4955.          outstr .= "RIGHT "
  4956.       }
  4957.       outstr .= substr(hk,2)
  4958.    } Else If (ctrltype == 2){
  4959.       ; Mouse Buttons
  4960.       If (hk == "LBUTTON") {
  4961.          outstr .= "LEFT MOUSE"
  4962.       } Else If (hk == "RBUTTON") {
  4963.          outstr .= "RIGHT MOUSE"
  4964.       } Else If (hk == "MBUTTON") {
  4965.          outstr .= "MIDDLE MOUSE"
  4966.       } Else If (hk == "XBUTTON1") {
  4967.          outstr .= "MOUSE THUMB 1"
  4968.       } Else If (hk == "XBUTTON2") {
  4969.          outstr .= "MOUSE THUMB 2"
  4970.       } Else If (hk == "WHEELUP") {
  4971.          outstr .= "MOUSE WHEEL U"
  4972.       } Else If (hk == "WHEELDOWN") {
  4973.          outstr .= "MOUSE WHEEL D"
  4974.       } Else If (hk == "WHEELLEFT") {
  4975.          outstr .= "MOUSE WHEEL L"
  4976.       } Else If (hk == "WHEELRIGHT") {
  4977.          outstr .= "MOUSE WHEEL R"
  4978.       }
  4979.    } Else If (ctrltype == 3){
  4980.       ; Joystick Buttons
  4981.       pos := instr(hk,"JOY")
  4982.       id := substr(hk,1,pos-1)
  4983.       button := substr(hk,5)
  4984.       outstr .= "JOYSTICK " id " BTN " button
  4985.    } Else {
  4986.       ; Keyboard Keys
  4987.       tmp := instr(hk,"NUMPAD")
  4988.       If (tmp){
  4989.          outstr .= "NUMPAD " substr(hk,7)
  4990.       } Else {
  4991.          ; Replace underscores with spaces (In case of key name like MEDIA_PLAY_PAUSE)
  4992.          StringReplace, hk, hk, _ , %A_SPACE%, All
  4993.          outstr .= hk
  4994.       }
  4995.    }
  4996.  
  4997.  
  4998.    return outstr
  4999. }
  5000.  
  5001. ; Detects ModIfiers and Mouse Buttons in BindMode
  5002. #If BindMode
  5003.    ; Detect key down of modIfier keys
  5004.    *lctrl::
  5005.    *rctrl::
  5006.    *lalt::
  5007.    *ralt::
  5008.    *lshIft::
  5009.    *rshIft::
  5010.    *lwin::
  5011.    *rwin::
  5012.       mod := substr(A_ThisHotkey,2)
  5013.       SetModIfier(mod,1)
  5014.       return
  5015.  
  5016.    ; Detect key up of modIfier keys
  5017.    *lctrl up::
  5018.    *rctrl up::
  5019.    *lalt up::
  5020.    *ralt up::
  5021.    *lshIft up::
  5022.    *rshIft up::
  5023.    *lwin up::
  5024.    *rwin up::
  5025.       ; Strip * from beginning, " up" from end etc
  5026.       mod := substr(substr(A_ThisHotkey,2),1,strlen(A_ThisHotkey) -4)
  5027.       If (CurrentModIfierCount() == 1){
  5028.          ; If CurrentModIfierCount is 1 when an up is received, then that is a Solitary ModIfier
  5029.          ; It cannot be a modIfier + normal key, as this code would have quit on keydown of normal key
  5030.  
  5031.          HKControlType := 1
  5032.          HKSecondaryInput := mod
  5033.  
  5034.          ; Send Escape - This will cause the Input command to quit with an EndKey of Escape
  5035.          ; But we stored the modIfier key, so we will know it was not really escape
  5036.          Send {Escape}
  5037.       }
  5038.       SetModIfier(mod,0)
  5039.       return
  5040.  
  5041.    ; Detect Mouse buttons
  5042.    lbutton::
  5043.    rbutton::
  5044.    mbutton::
  5045.    xbutton1::
  5046.    xbutton2::
  5047.    wheelup::
  5048.    wheeldown::
  5049.    wheelleft::
  5050.    wheelright::
  5051.       HKControlType := 2
  5052.       HKSecondaryInput := A_ThisHotkey
  5053.       Send {Escape}
  5054.       return
  5055. #If
  5056.  
  5057. ; Adds / removes hotkeys to detect Joystick Buttons in BindMode
  5058. JoystickDetection(mode := 1)
  5059. {
  5060.    If (mode){
  5061.       mode := "ON"
  5062.    } Else {
  5063.       mode := "OFF"
  5064.    }
  5065.    Loop , 16 {
  5066.       stickid := A_Index
  5067.       Loop, 32 {
  5068.          buttonid := A_Index
  5069.          hotkey, %stickid%Joy%buttonid%, JoystickPressed, %mode%
  5070.       }
  5071.    }
  5072. }
  5073.  
  5074. ; A Joystick button was pressed while in Binding mode
  5075. JoystickPressed:
  5076.   HKControlType := 3
  5077.    HKSecondaryInput := A_ThisHotkey
  5078.    Send {Escape}
  5079.    return
  5080.  
  5081. ; Sets the state of the HKModIfierState object to reflect the state of the modIfier keys
  5082. SetModIfier(hk,state)
  5083. {
  5084.    global HKModIfierState
  5085.  
  5086.    If (hk == "lctrl" || hk == "rctrl"){
  5087.       HKModIfierState.ctrl := state
  5088.    } Else If (hk == "lalt" || hk == "ralt"){
  5089.       HKModIfierState.alt := state
  5090.    } Else If (hk == "lshIft" || hk == "rshIft"){
  5091.       HKModIfierState.shIft := state
  5092.    } Else If (hk == "lwin" || hk == "rwin"){
  5093.       HKModIfierState.win := state
  5094.    }
  5095.    return
  5096. }
  5097.  
  5098. ; Counts how many modIfier keys are currently held
  5099. CurrentModIfierCount()
  5100. {
  5101.    global HKModIfierState
  5102.  
  5103.    return HKModIfierState.ctrl + HKModIfierState.alt + HKModIfierState.shIft  + HKModIfierState.win
  5104. }
  5105.  
  5106. ; Takes the start of the file name (before .ini or .exe and replaces it with .ini)
  5107. BuildIniName()
  5108. {
  5109.    tmp := A_Scriptname
  5110.    Stringsplit, tmp, tmp,.
  5111.    ini_name := ""
  5112.    last := ""
  5113.    Loop, % tmp0
  5114.    {
  5115.       ; build the string up to the last period (.)
  5116.       If (last != ""){
  5117.          If (ini_name != ""){
  5118.             ini_name := ini_name "."
  5119.          }
  5120.          ini_name := ini_name last
  5121.       }
  5122.       last := tmp%A_Index%
  5123.    }
  5124.    ;this.ini_name := ini_name ".ini"
  5125.    return ini_name ".ini"
  5126. }
  5127.  
  5128. ;-------NOT MY FUNCTIONS--------------NOT MY FUNCTIONS--------------NOT MY FUNCTIONS-----------------
  5129.  
  5130. ; DPS Calculator Script
  5131. ; This script can be found here:
  5132. ; https://www.pathofexile.com/forum/view-thread/594346
  5133. ; If you have any questions or comments please post them there as well. If you think you can help
  5134. ; improve this project. I am looking for contributors. So Pm me If you think you can help.
  5135. ;
  5136. ;
  5137. ; If you have a issue please post what version you are using.
  5138. ; Reason being is that something that might be a issue might already be fixed.
  5139. ; Version: 1.2d
  5140.  
  5141. ;DPSCalc Credits:
  5142. ;Nipper4369, creator of DPSCalc
  5143. ;mcpower for the base iLVL display of the script 5months ago before Immo.
  5144. ;Immo for the base iLVL display of the script.(Which was taken from mcpower.)
  5145. ;olop4444 for helping Nipper4369 figure out the calculations for Q20 items.
  5146. ;Aeons for a rewrite and fancy tooltips.
  5147. ;kongyuyu for base item level display.
  5148. ;Fayted for testing the script.
  5149.  
  5150. ; Creates a font for later use
  5151. CreateFont()
  5152. {
  5153.    global FontSize
  5154.    Options :=
  5155.    If (!(FontSize = ""))
  5156.    {
  5157.       Options = s%FontSize%
  5158.    }
  5159.    Gui Font, %Options%, Courier New
  5160.    Gui Font, %Options%, Consolas
  5161.    Gui Add, Text, HwndHidden,
  5162.    SendMessage, 0x31,,,, ahk_id %Hidden%
  5163.    return ErrorLevel
  5164. }
  5165.  
  5166. ; Sets the font for a created ahk tooltip
  5167. SetFont(Font)
  5168. {
  5169.    SendMessage, 0x30, Font, 1,, ahk_class tooltips_class32 ahk_exe autohotkey.exe
  5170. }
  5171.  
  5172. ; Parse elemental damage
  5173. ParseDamage(String, DmgType, ByRef DmgLo, ByRef DmgHi)
  5174. {
  5175.    IfInString, String, %DmgType% Damage
  5176.    {
  5177.       IfInString, String, Converted to or IfInString, String, taken as
  5178.        Return
  5179.       IfNotInString, String, increased
  5180.       {
  5181.          StringSplit, Arr, String, %A_Space%
  5182.          StringSplit, Arr, Arr2, -
  5183.          DmgLo := Arr1
  5184.          DmgHi := Arr2
  5185.       }
  5186.    }
  5187. }
  5188.  
  5189. ; Parse clipboard content for item level and dps
  5190. DPSCalc()
  5191. {
  5192.    Global DPS
  5193.    If DPS
  5194.    return
  5195.    IfWinActive Path of Exile ahk_class POEWindowClass
  5196.    {
  5197.       SendMode Input
  5198.       clipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived.
  5199.       ErrorLevel = 0
  5200.       Send ^c
  5201.       ClipWait, 0.05  ; Wait for the clipboard to contain text.
  5202.       If ErrorLevel = 1
  5203.       {
  5204.          return
  5205.       }
  5206.       NameIsDone := False
  5207.       ItemName :=
  5208.       ItemLevel := -1
  5209.       IsWeapon := False
  5210.       PhysLo := 0
  5211.       PhysHi := 0
  5212.       Quality := 0
  5213.       AttackSpeed := 0
  5214.       PhysMult := 0
  5215.       ChaoLo := 0
  5216.       ChaoHi := 0
  5217.       ColdLo := 0
  5218.       ColdHi := 0
  5219.       FireLo := 0
  5220.       FireHi := 0
  5221.       LighLo := 0
  5222.       LighHi := 0
  5223.  
  5224.       Loop, Parse, Clipboard, `n, `r
  5225.       {
  5226.          ; Clipboard must have "Rarity:" in the first line
  5227.          If A_Index = 1
  5228.          {
  5229.             IfNotInString, A_LoopField, Rarity:
  5230.            {
  5231.                Exit
  5232.             }
  5233.             Else
  5234.             {
  5235.                Continue
  5236.             }
  5237.          }
  5238.    
  5239.          ; Get name
  5240.          If Not NameIsDone
  5241.          {
  5242.             If A_LoopField = --------
  5243.             {
  5244.                NameIsDone := True
  5245.             }
  5246.             Else
  5247.             {
  5248.                ItemName := ItemName . A_LoopField . "`n" ; Add a line of name
  5249.             }
  5250.             Continue
  5251.          }
  5252.    
  5253.          ; Get item level
  5254.          IfInString, A_LoopField, Item level:
  5255.         {
  5256.             StringSplit, ItemLevelArray, A_LoopField, %A_Space%
  5257.             ItemLevel := ItemLevelArray3
  5258.             Continue
  5259.          }
  5260.    
  5261.          ; Get quality
  5262.          IfInString, A_LoopField, Quality:
  5263.         {
  5264.             StringSplit, Arr, A_LoopField, %A_Space%, +`%
  5265.             Quality := Arr2
  5266.             Continue
  5267.          }
  5268.    
  5269.          ; Get total physical damage
  5270.          IfInString, A_LoopField, Physical Damage:
  5271.         {
  5272.             IsWeapon = True
  5273.             StringSplit, Arr, A_LoopField, %A_Space%
  5274.             StringSplit, Arr, Arr3, -
  5275.             PhysLo := Arr1
  5276.             PhysHi := Arr2
  5277.             Continue
  5278.          }
  5279.          ;Fix for Elemental damage only weapons. Like the Oro's SacrIfice
  5280.          IfInString, A_LoopField, Elemental Damage:
  5281.         {
  5282.             IsWeapon = True
  5283.             Continue
  5284.          }
  5285.    
  5286.          ; These only make sense for weapons
  5287.          If IsWeapon
  5288.          {
  5289.             ; Get attack speed
  5290.             IfInString, A_LoopField, Attacks per Second:
  5291.            {
  5292.                StringSplit, Arr, A_LoopField, %A_Space%
  5293.                AttackSpeed := Arr4
  5294.                Continue
  5295.             }
  5296.    
  5297.             ; Get percentage physical damage increase
  5298.             IfInString, A_LoopField, increased Physical Damage
  5299.             {
  5300.                StringSplit, Arr, A_LoopField, %A_Space%, `%
  5301.                PhysMult := Arr1
  5302.                Continue
  5303.             }
  5304.          
  5305.          ;Lines to skip fix for converted type damage. Like the Voltaxic RIft
  5306.          IfInString, A_LoopField, Converted to
  5307.           Goto, SkipDamageParse
  5308.          IfInString, A_LoopField, can Shock
  5309.           Goto, SkipDamageParse
  5310.          
  5311.             ; Parse elemental damage
  5312.             ParseDamage(A_LoopField, "Chaos", ChaoLo, ChaoHi)
  5313.             ParseDamage(A_LoopField, "Cold", ColdLo, ColdHi)
  5314.             ParseDamage(A_LoopField, "Fire", FireLo, FireHi)
  5315.             ParseDamage(A_LoopField, "Lightning", LighLo, LighHi)
  5316.            
  5317.            SkipDamageParse:
  5318.         }
  5319.       }
  5320.       If ItemLevel = -1 ; Something without an itemlevel
  5321.       {  
  5322.          Exit
  5323.       }
  5324.       ; Get position of mouse cursor
  5325.       global X
  5326.       global Y
  5327.       MouseGetPos, X, Y
  5328.    
  5329.       ; All items should show name and item level
  5330.       ; Pad to 3 places
  5331.       ItemLevel := "   " + ItemLevel
  5332.       StringRight, ItemLevel, ItemLevel, 3
  5333.       TT = %ItemName%Item lvl: %ItemLevel%
  5334.    
  5335.       ; DPS calculations
  5336.       If IsWeapon {
  5337.          SetFormat, FloatFast, 5.1
  5338.    
  5339.          PhysDps := ((PhysLo + PhysHi) / 2) * AttackSpeed
  5340.          EleDps := ((ChaoLo + ChaoHi + ColdLo + ColdHi + FireLo + FireHi + LighLo + LighHi) / 2) * AttackSpeed
  5341.          TotalDps := PhysDps + EleDps
  5342.    
  5343.          TT = %TT%`nPhys DPS: %PhysDps%`nElem DPS: %EleDps%`nTotal DPS: %TotalDps%
  5344.    
  5345.          ; Only show Q20 values If item is not Q20
  5346.          If Quality < 20
  5347.          {
  5348.             TotalPhysMult := (PhysMult + Quality + 100) / 100
  5349.             BasePhysDps := PhysDps / TotalPhysMult
  5350.             Q20Dps := BasePhysDps * ((PhysMult + 120) / 100) + EleDps
  5351.    
  5352.             TT = %TT%`nQ20 DPS:  %Q20Dps%
  5353.          }
  5354.       }
  5355.    
  5356.            ; Replaces Clipboard with tooltip data
  5357.            StringReplace, clipboard, TT, `n, %A_SPACE% , All
  5358.  
  5359.       ; Show tooltip, with fixed width font
  5360.       ToolTip, %TT%, X + 35, Y + 35
  5361.       ;global FixedFont
  5362.       ;SetFont(FixedFont)
  5363.       ; Set up count variable and start timer for tooltip timeout
  5364.       global ToolTipTimeout := 0
  5365.       SetTimer, ToolTipTimer, 100
  5366.    }
  5367. }
  5368.  
  5369. ; Tick every 100 ms
  5370. ; Remove tooltip If mouse is moved or 5 seconds pass
  5371. ToolTipTimer:
  5372. ToolTipTimeout += 1
  5373. MouseGetPos, CurrX, CurrY
  5374. MouseMoved := (CurrX - X)**2 + (CurrY - Y)**2 > 40**2
  5375. If (MouseMoved or ToolTipTimeout >= 50)
  5376. {
  5377.    SetTimer, ToolTipTimer, Off
  5378.    ToolTip
  5379. }
  5380. return
  5381.  
  5382. ;-------NOT MY FUNCTIONS--------------NOT MY FUNCTIONS--------------NOT MY FUNCTIONS-----------------
  5383.  
  5384. ;-------END--------------END--------------END--------------END--------------END----------------------
Advertisement