SHARE
TWEET

Untitled

kapko Jul 15th, 2019 199 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. #Warn All, Off    ; #Warn eables warnings to assist with detecting common errors, while "all, off" makes them all disabled
  3. #HotkeyInterval 1000  ; This is  the default value (milliseconds).
  4. #MaxHotkeysPerInterval 200
  5. #MaxThreadsPerHotkey 1
  6. #SingleInstance
  7. #WinActivateForce ; need to test it
  8. ; #NoTrayIcon
  9. DetectHiddenWindows, Off
  10. SendMode Input
  11. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  12. SetBatchLines, -1
  13. SetWinDelay, -1
  14. SetControlDelay, -1
  15. CoordMode, Mouse, Screen
  16. #Include Gdip_all_2.ahk
  17.  
  18. If !pToken := Gdip_Startup()                        
  19. {
  20.    MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
  21.    ExitApp
  22. }
  23.  
  24. global version := "0.9.6.1 - beta"
  25. IniWrite, %version%, Data/basic_settings.ini, authentication data, version
  26.  
  27.  
  28. GOTO_STARTBOT := 0
  29. GOTO_INIT := 0
  30.  
  31. ; created by Mate @tibiapf.com
  32.  
  33. ; official website: www.wrlbot.tk
  34. ; project thread: https://tibiapf.com/showthread.php?71-all-versions-Warlock-Bot
  35. ; see also: https://tibiapf.com/showthread.php?35-all-versions-Hunter-Bot
  36. ; github site: https://github.com/Brazyliszek/Warlock-bot
  37.  
  38. ;################## todos ##################
  39. ;dodac funkcje ifwinexist(1 or 2){ settimers off, guicontrol runemaking1 or 2 itp off, check gui itd)
  40. ;info, ze win nie jest aktywne, a dziala screen checker powinno miec wysoki priorytet
  41. ;dodac timer if mainbot win active := gui redraw
  42. ;zoptymalizowac fishing
  43. ; optymalizacja dll i sleepĆ³w
  44. ; zmienic hide_client_1 na hide client 1
  45. ; zoptymalizowac scp, niepotrzebnie non stop zbiera to samo hwnd, niepotrzebnie caly czas robi bitmapy. Mozna po prostu dodac jakas zmienna iterujaca++ przy kazdej zmianie bmp lub hwnd  do controla i on by tylko to zczytywal i w razie w robil jakis gosub get bmp/hwnd
  46.  
  47. ; add character moved as alarm type
  48.  
  49.  
  50.  
  51. ; MAIN RULES USING THIS SCRIPT AND FEW TIPS:
  52. ; 1) Bot depends on time instead of mana amount to create runes
  53. ; 2) Your main backpack must be different than backpacks in which will you store blank and conjured runes (if you're using hand-mode)
  54. ; 3) Your hand slot must be empty, otherwise object you had in hand may be moved to backpack and you can lose it in case of death (if you're using hand-mode)
  55. ; 4) You must take screenshot of a free slot using our tool to take ingame images (if you're using hand-mode)
  56. ; 5) ImageSearch searches for images from topleft to bottomright side of desired area. Keep that in mind.
  57. ; 6) If constantly bot returns "couldn't find free slot on inventory" try to take another image, dont really need to be fully in center.
  58.  
  59.  
  60.  
  61. ; latest ver. changelog
  62. ;   0.9.6.1
  63. ;       repaired window managment (flash, fishing, main gui)
  64. ;       repaired 'screen change' alarm after hiding minimized client window
  65. ;       removed serious bug causing mouse movment block
  66. ;
  67. ;   0.9.6
  68. ;       removed support for x32 systems
  69. ;       added tooltips on each control
  70. ;       added possibility to hide/show game window
  71. ;       improved tray menu items
  72. ;       implemented screen checker platform (scp_wrlbot.exe), that is providing pseudo-multitasking
  73. ;       added separated timers for all bot functions for both clients
  74. ;       improved pause function
  75. ;       added flash client as alarm type
  76. ;       added image search by hwnd
  77. ;       added mouse control by ext. DLL
  78. ;       added fishing feature
  79. ;       added default buttons for inital windows
  80. ;
  81. ;
  82. ;   0.9.5.1 & 2
  83. ;       fixed anty_logout() on medivia
  84. ;       added auto 'sendmode = event' if medivia
  85. ;
  86. ;   0.9.5
  87. ;       reorganized file managment
  88. ;       added online bot version confirmation
  89. ;       added way more efficient double alarm effect
  90. ;       repaired bug if window title has changed after initialization
  91. ;       changed spell cast method to send hotkey input instead of string
  92. ;       added configuration of such things as: food/anty idle time, anty log direction, distance to walk in case of alarm, hotkey to eat food, if you want notification to be shown or not
  93. ;       added auto-shutdown on specific hour
  94. ;       added alarm if gm on battle, if lack of soul points
  95. ;       repaired bug with screen check false alarm while minimizing or maximizing game window
  96. ;
  97. ;   0.9.4
  98. ;       repaired bug with spellcaster if no blank
  99. ;       minor changes to runemake() algorithm
  100. ;       added ver 32 and 64 bit
  101. ;
  102. ;   0.9.3
  103. ;       repaired bug with crash if last used client directory has changed
  104. ;       now you can change in ini files values of randomization (1-15~), food and antylog time (ms), to show or not notifications (bool), and blank rune spell (string)
  105. ;       changed action order in case of alarm execution (now is: logout>walk>sound>shutdown)
  106. ;       repaired bug with shutdown/walk alarm type, now you can do both in the same time (in specified oreder)
  107. ;       repaired bug with food/anty log delay (it should eat once every 150sec not every each cicle)
  108. ;       minor changes to pause(), still not tested
  109. ;
  110. ;   0.9.2
  111. ;       solved problems with not loading previously saved settings
  112. ;       removed tests hotkeys f1 and f2 from public bot version
  113. ;       changed auth gui to make password and account name unchangable
  114. ;  
  115. ;   0.9.1  
  116. ;       added inital msgbox, informing about version and where to report bugs
  117.  
  118.  ; ######################################################### VARIABLES ##############################################################################
  119. global refresh_time := 200      ; screen checker frequency
  120. global MainBotWindow
  121. global fishing_time := 1500
  122. global fishing1_stack := []
  123. global fishing1_spot := []
  124. global fishing2_stack := []
  125. global fishing2_spot := []
  126. global transparent_tibia1 := 0
  127. global transparent_tibia2 := 0
  128. global WalkMethod_IfFood
  129. global WalkMethod_IfBlank
  130. global WalkMethod_IfPlayer
  131. global WalkMethod_IfSoul
  132. global client_screen_checker
  133. global img_filename
  134. global sc_temp_img_dir1 = "Data\Images\select_area1.png"
  135. global sc_temp_img_dir2 = "Data\Images\select_area2.png"
  136. global execution_allowed := 1
  137. global rune_spellkey1
  138. global spelltime1
  139. global rune_spellkey2
  140. global spelltime2
  141. global blank_spellname
  142. global hand_slot_pos_x
  143. global hand_slot_pos_y
  144. global house_pos_x      ; to dele soon
  145. global house_pos_y           ; to dele soon
  146. global house_pos_x1
  147. global house_pos_y1
  148. global house_pos_x2
  149. global house_pos_y2
  150. global title_tibia1
  151. global title_tibia2
  152. global pid_tibia1
  153. global pid_tibia2
  154. global Bot_protection = 0
  155. global current_time1 := 0       ; prev. was a_tickcount, not sure if will work
  156. global deviation1 := 0
  157. global planned_time1
  158. global current_time2 := 0       ; prev. was a_tickcount, not sure if will work
  159. global deviation2 := 0
  160. global planned_time2
  161. global randomization := 5          ; level of randomness in functions
  162. global steps_to_walk          ; how many sqm bot has to go incase of alarm
  163. global show_notifications     ; if you want notification to be displayed set 1, else 0
  164. global food_time         ; bot doesnt eat each cicle but rather checks if last eating wasn't earlier than current time - food_time (ms)
  165. global anty_log_time      ; same as above, but relate of anty_log function
  166. global eat_using_hotkey
  167. global eat_hotkey
  168. global check_x1
  169. global check_y1
  170. global check_x2
  171. global check_y2
  172. global hwnd1
  173. global hwnd2
  174. global area_start_x1
  175. global area_start_y1
  176. global area_start_x2
  177. global area_start_y2
  178. global bmparea_check1
  179. global bmparea_check2
  180. global rm1 := 0
  181. global al1 := 0
  182. global fe1 := 0
  183. global fi1 := 0
  184. global a1 := 0
  185. global paused := 0
  186. global rm2 := 0
  187. global al2 := 0
  188. global fe2 := 0
  189. global fi2 := 0
  190. global a2 := 0
  191. coord_var = 0
  192. tab_window_size_x = 465
  193. tab_window_size_y = 260
  194. pic_window_size_x = % tab_window_size_x+40
  195. pic_window_size_y = % tab_window_size_y+40
  196. global BOTnameTR := "Warlock"
  197. global BOTName := "Warlock Bot"
  198. global Fishing_gui1_title := "Fishing setup - client 1"
  199. global Fishing_gui2_title := "Fishing setup - client 2"
  200. If WinExist("WarlockBot"){
  201.     MsgBox, 16, Error, There is other Warlock bot already running. Application will close now.                   ; prevent from running bot multiple times. may interact in unexpected way, prevention move
  202.     ExitApp
  203. }
  204.  
  205. checkfiles:
  206. IncludeImages := "area_check1.bmp|area_check2.bmp|background.png|backpack1.bmp|backpack2.bmp|blank_rune.bmp|conjured_rune1.bmp|conjured_rune2.bmp|food1.bmp|food2.bmp|free_slot.bmp|picbp.bmp|select_area1.png|select_area2.png|tabledone.png|table_main_f.png|icon.ico|msinfo32.ico|warlockbot_startwin.png|pp_donate.bmp|soul0.bmp|soul1.bmp|soul2.bmp|soul3.bmp|soul4.bmp|soul5.bmp|fishing_rod_bp.bmp|fishing_rod.bmp|fish.bmp"
  207. Loop, Parse, IncludeImages, |
  208. {
  209.    If (!FileExist("Data\Images\" A_LoopField))
  210.    {
  211.    MsgBox, 262193, Something is wrong..., There is lack in files. Couldn't find some images. Do you want to restore them?
  212.    IfMsgBox Ok
  213.       goto Installfiles
  214.    else
  215.       ExitApp
  216.    }
  217. }
  218. IncludeFiles := "alarm_food.mp3|alarm_screen.mp3|alarm_blank.mp3|alarm_soul.mp3"
  219. Loop, Parse, IncludeFiles, |
  220. {
  221.    If (!FileExist("Data\Sounds\" A_LoopField))
  222.    {
  223.    MsgBox, 262193, Something is wrong..., There is lack in files. Couldn't find some sounds. Do you want to restore them?
  224.    IfMsgBox Ok
  225.       goto Installfiles
  226.    else
  227.       ExitApp
  228.    }
  229. }
  230.  
  231. IncludeFiles := "basic_settings.ini|mousehook64.dll|scp_wrlbot.exe"
  232. Loop, Parse, IncludeFiles, |
  233. {
  234.    If (!FileExist("Data\" A_LoopField))
  235.    {
  236.    MsgBox, 262193, Something is wrong..., There is lack in files. Couldn't find some files. Do you want to restore them?
  237.    IfMsgBox Ok
  238.       goto Installfiles
  239.    else
  240.       ExitApp
  241.    }
  242. }
  243.  
  244. if GOTO_STARTBOT
  245.    goto, start_bot       ; <<----------------------------------------------------------------------------------- temprarly, for tests purpose
  246. if GOTO_INIT
  247.    goto, start_initialization
  248.  
  249.  
  250.  
  251. MsgBox, 262208, Important, Hi! `nPlease keep in mind this is version %version%`, which means it still has some bugs and not all function may work properly. Please report all bugs, false alerts, crashes on forum tibiapf.com with every important details in valid thread or directly on official webiste wrlbot.tk. `n`nThanks for using my software`, hope you like it. `nMate/Brazyliszek
  252. ; ######################################################### AUTHENTICATION #########################################################################
  253.  
  254. pass_authentication:
  255. Gui, New, +Caption
  256. IniRead, last_used_login, Data/basic_settings.ini, authentication data, last_used_login
  257. IniRead, last_used_pass, Data/basic_settings.ini, authentication data, last_used_pass
  258. IniRead, version, Data/basic_settings.ini, authentication data, version
  259. last_used_login := "demo"
  260. last_used_pass := "demo"
  261. Gui, Add,edit,x5 y26 w80 h17 vuser, %last_used_login%
  262. Gui, Add,edit,x5 y60 w80 h17 password vpass, %last_used_pass%
  263. Gui, Add,button,x5 y80 h20 w55 gLogin center +BackgroundTrans Default , Login
  264. Gui, Add,button,x65 y80 h20 w20 gHelp_button center, ?
  265. Gui, Add, Pic, x0 y0 0x4000000, %A_WorkingDir%\Data\Images\warlockbot_startwin.png
  266. Gui, font, bold s8
  267. Gui, Add, Text, x95 y130 w300 vauth_text_box cWhite +BackgroundTrans, Enter your license account data.
  268. Gui, Show, w287 h149,Authentication
  269. GuiControl, Disable, pass
  270. GuiControl, Disable, user
  271. start_value := 1
  272. return
  273.  
  274. Help_button:
  275. MsgBox, 0, Help, Version: %version%`nStandard password for beta version is demo/demo. If any other problems occured contact me using data below.`n`nSupport: via privmassage on forum tibiapf.com @Mate`nThrough contact page on official site: http://wrlbot.tk/contact`n`n`ngithub site: https://github.com/Brazyliszek/Warlock-bot`nproject thread: https://tibiapf.com/showthread.php?71-all-versions-Warlock-Bot`nsee also: https://tibiapf.com/showthread.php?35-all-versions-Hunter-Bot
  276. return
  277.  
  278. Login:
  279. if start_value = 2
  280.    goto check_version
  281. Gui, Font, c00ABFF
  282. Guicontrol, move, auth_text_box, x200 y130
  283. GuiControl, font, auth_text_box
  284. GuiControl, text, auth_text_box, connecting...
  285. If (start_value = 1){
  286.    start_value := 0
  287.    user_name := "demo"
  288.    user_pass := "demo"
  289.    sleep 500
  290.    GuiControlGet, user,, user
  291.    GuiControlGet, pass,, pass
  292.    IniWrite, %user%, Data/basic_settings.ini, authentication data, last_used_login
  293.    IniWrite, %pass%, Data/basic_settings.ini, authentication data, last_used_pass
  294.    If (user != user_name) or (pass != user_pass){
  295.       Guicontrol, move, auth_text_box, x100 y130
  296.       Gui, Font, cRed
  297.       GuiControl, font, auth_text_box
  298.       GuiControl, text, auth_text_box, Wrong login name or password.
  299.       start_value := 1
  300.       return
  301.       }
  302.    else{
  303.       Guicontrol, move, auth_text_box, x170 y130
  304.       Gui, Font, c00FF11
  305.       GuiControl, font, auth_text_box
  306.       GuiControl, text, auth_text_box, Account confirmed!
  307.       sleep, 1000
  308.       goto, check_version
  309.       }
  310.    }
  311. else{
  312.    sleep 1000
  313.    Guicontrol, move, auth_text_box, x95 y130
  314.    Gui, Font, cRed
  315.    GuiControl, font, auth_text_box
  316.    GuiControl, text, auth_text_box, Check your internet connection.
  317.    start_value := 1
  318.    return
  319. }
  320. start_value := 1
  321. return
  322.  
  323. check_version:
  324. start_value := 2
  325. Gui, Font, c00ABFF
  326. Guicontrol, move, auth_text_box, x170 y130
  327. GuiControl, font, auth_text_box
  328. GuiControl, text, auth_text_box, Version checking...
  329. sleep 800
  330. If (ConnectedToInternet() and start_value = 2){
  331.    ComObjError(false)
  332.    whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
  333.    whr.Open("GET", "http://wrlbot.000webhostapp.com/version.txt", true)
  334.    whr.Send()
  335.    whr.WaitForResponse()
  336.    version_current := whr.ResponseText
  337.    if ((StrLen(version_current) < 5) or (StrLen(version_current) > 15) or (version_current == "")){
  338.       Guicontrol, move, auth_text_box, x15 y130
  339.       Gui, Font, cRed
  340.       GuiControl, font, auth_text_box
  341.       GuiControl, text, auth_text_box, There was problem with obtaining version info.
  342.       sleep, 2500
  343.       Gui, Destroy
  344.       start_value := 2
  345.       goto, start_initialization
  346.       return
  347.     }  
  348.    IniRead, version, Data/basic_settings.ini, authentication data, version
  349.    If (version != version_current){
  350.       Guicontrol, move, auth_text_box, x50 y130 w300
  351.       Gui, Font, cRed
  352.       GuiControl, font, auth_text_box
  353.       GuiControl, text, auth_text_box, Warlock bot outdated. Please update it.
  354.       sleep, 500
  355.       Msgbox,,Warlock bot,You are using old version. There is a newer one available to download. Update your bot if you want to have bugs repaired and new features built in it.
  356.       sleep, 1000
  357.       Gui, Destroy
  358.       start_value := 2
  359.       goto, start_initialization
  360.       return
  361.       }
  362.    else{
  363.       Guicontrol, move, auth_text_box, x150 y130
  364.       Gui, Font, c00FF11
  365.       GuiControl, font, auth_text_box
  366.       GuiControl, text, auth_text_box, Bot version confirmed!
  367.       sleep, 1500
  368.       Gui, Destroy
  369.       start_value := 2
  370.       goto, start_initialization
  371.       return
  372.       }
  373.    }
  374. else{
  375.    Guicontrol, move, auth_text_box, x98 y130
  376.    Gui, Font, cRed
  377.    GuiControl, font, auth_text_box
  378.    GuiControl, text, auth_text_box, Check your internet connection.
  379.    Gui, Destroy
  380.    goto, start_initialization
  381.    start_value := 2
  382.    return
  383. }
  384. start_value := 2
  385. return
  386.  
  387.  
  388.  
  389. ; ######################################################### INITIALIZATION  AND GUI ################################################################
  390. start_initialization:
  391. sleep, 500            ; auth gui destroy somehow minimized initial window if it was open too fast
  392. Gui, New, +Caption
  393. IniRead, last_used_client_dir, Data/basic_settings.ini, initialization data, last_used_client_dir
  394. IniRead, last_used_mc_count, Data/basic_settings.ini, initialization data, last_used_mc_count
  395. IniRead, Bot_protection, Data/basic_settings.ini, initialization data, Bot_protection
  396. Gui, Add, Text, x5 y15 +BackgroundTrans, Client location:
  397. Gui, Add, Text, x5 y40 +BackgroundTrans, How many mc?
  398. Gui, Add, edit, x85 y15 w140 h17 vedit_client_dir +ReadOnly, %last_used_client_dir%
  399. Gui, Add, DropDownList, x85 y35 w30 Choose%last_used_mc_count% vmc_count, 1|2
  400. Gui, Add, button, x233 y15 h18 gselect_file,Browse
  401. Gui, Add, button, x187 y128 h20 w50 gCheck_initial_settings Default ,Start
  402. Gui, Add, button, x237 y128 h20 w50 gHelp_initial_button, Help
  403. Gui, Add, Text, x5 y65 +BackgroundTrans, On some servers with good bot protecion functions like`nmove() or use() might not work properly. If you experienced`nsuch issues click on this checkbox to enable mouse`nsimulation on lower level.
  404. Gui, Add, Checkbox, x5 y128 gBot_protection vBot_protection checked%Bot_protection%,SendMode = Event
  405. Gui, Show, w287 h149, Initial setup
  406. return
  407.  
  408. select_file:
  409. FileSelectFile, client_dir, 3, , Select tibia client, executable files  (*.exe)
  410. if client_dir =          
  411.     return
  412. else
  413.     GuiControl,,edit_client_dir,%client_dir%
  414. return
  415.  
  416. Help_initial_button:
  417. MsgBox, 0, Help, First you have to do is to enter valid game client location. Is neccesery for bot to obtain its unique process id.`nSecondly you got to choose on how many clients will you operate. You can use Warlock Bot on up to two clients.`nAnd the last thing - select SendMode Event - only if bot returns errors like "There was problem with function use()" or for example bot has problems with eating food or moving items in inventory. It means that server owners made their client bot unfriendly. It will slow the bot a little bit and make mouse movements visible.
  418. return
  419.  
  420. Check_initial_settings:
  421. GuiControlGet, edit_client_dir,,edit_client_dir
  422. GuiControlGet, mc_count,,mc_count
  423. GuiControlGet, Bot_protection,,Bot_protection
  424. IniWrite, %edit_client_dir%, Data/basic_settings.ini, initialization data, last_used_client_dir
  425. IniWrite, %mc_count%, Data/basic_settings.ini, initialization data, last_used_mc_count
  426. IniWrite, %Bot_protection%, Data/basic_settings.ini, initialization data, Bot_protection
  427. IfNotInString, edit_client_dir, exe
  428.    {  
  429.    TrayTip, %BOTName%, You should enter valid tibia clients file path (*.exe).
  430.    SetTimer, RemoveTrayTip, 3500
  431.    return
  432. }
  433. IfInString, edit_client_dir, medivia
  434.    {  
  435.    GuiControlGet, Bot_protection,,Bot_protection
  436.    if (Bot_protection = 0 and temp_var_bp != 1){
  437.       MsgBox, 64, Highly edited otclient detected!, It is recommended to have 'SendMode = Event' enabled.
  438.       GuiControl,,Bot_protection,1
  439.       temp_var_bp := 1
  440.       return
  441.    }
  442. }
  443. IfNotExist, %edit_client_dir%
  444.    {
  445.    TrayTip, %BOTName%, Couldn't find client in given directory.
  446.    SetTimer, RemoveTrayTip, 3500
  447.    return
  448. }
  449. If (mc_count = "" ){
  450.    TrayTip, %BOTName%, You should enter tibia multiclient count to run.
  451.    SetTimer, RemoveTrayTip, 3500      
  452.    return
  453. }  
  454. else{      
  455.    Gui, Destroy
  456.    goto, run_clients
  457.    sleep, 500
  458. }
  459. return
  460.  
  461.  
  462. run_clients:
  463.   SplitPath, edit_client_dir, client_name, client_only_dir        
  464.    run, %client_name%, %client_only_dir%, min, pid_tibia1           ; Use ahk_pid to identify a window belonging to a specific process. The process identifier (PID) is typically retrieved by WinGet, Run or Process.
  465.    title_tibia1 := "Game client 1 - identyfied by " pid_tibia1
  466.    WinActivate, ahk_pid %pid_tibia1%
  467.    WinWait, ahk_pid %pid_tibia1%
  468.    WinSetTitle, ahk_pid %pid_tibia1%,, %title_tibia1%
  469.    sleep, 500
  470.    WinGet, hwnd1, ID, %title_tibia1%
  471.    Dwm_SetWindowAttributeTransistionDisable(hwnd1, 1)                            ; to disable windows animation while minimizing/maximizing
  472.    ;    WinMinimize, %title_tibia1%
  473.    sleep, 500
  474.    if (mc_count = 2){
  475.       run, %client_name%, %client_only_dir%, min, pid_tibia2
  476.       title_tibia2 := "Game client 2 - identyfied by " pid_tibia2
  477.       WinActivate, ahk_pid %pid_tibia2%
  478.       WinWait, ahk_pid %pid_tibia2%
  479.       WinSetTitle, ahk_pid %pid_tibia2%,, %title_tibia2%
  480.       sleep, 50
  481.       WinGet, hwnd2, ID, %title_tibia2%
  482.       Dwm_SetWindowAttributeTransistionDisable(hwnd2, 1)                
  483.       ; WinMinimize, %title_tibia2%
  484.       sleep, 500
  485.    }
  486.    sleep 500
  487.    if (mc_count = 1 and WinExist(title_tibia1)) or (mc_count = 2 and WinExist(title_tibia1) and WinExist(title_tibia2)){
  488.       goto, start_bot
  489.    }
  490.    else{
  491.       msgbox,,Error 1098,Tibia clients couldn't be open. The most common reason is that the client doesn't have built in mc. Bot will close now.
  492.       ExitApp
  493. }
  494. return
  495.  
  496. start_bot:
  497. ;Gui, New
  498. Gui, +HwndMainBotWindow
  499. Gui, Add, Tab3, vTab2 x32 y55 w280 h216, Client 1|Client 2
  500.  
  501. Gui, Tab, 1
  502. Gui, Add, GroupBox, x42 y85 w138 h70, Runemaker
  503. Gui, Add, Text, x50 y106 w70 h20 , Hotkey to use:
  504. Gui, Add, Hotkey, x128 y102 w40 h20 Center vRune_spellkey1, %rune_spellkey1%
  505. Gui, Add, Text, x50 y127 w70 h20 , Conjuring time:
  506. Gui, Add, Edit, x128 y124 w40 h20 Limit4 Number r1 gCheck_spelltime1 vSpelltime1, %spelltime1%
  507.  
  508. Gui, Add, GroupBox, x42 y160 w138 h48, Fishing
  509. Gui, Add, Button, x52 y178 w120 h20 gFishing_setup1 vFishing_setup1, setup for client 1
  510.  
  511. Gui, Add, GroupBox, x190 y85 w110 h123, Screen checker
  512. Gui, Add, Picture, x203 y105 gArea_screen_checker1 vImage_screen_checker1, %sc_temp_img_dir1%
  513. Gui, Add, CheckBox, x204 y184 w80 h20 gEnabled_screen_checker1 vEnabled_screen_checker1, enabled
  514.  
  515. Gui, Add, GroupBox, x42 y213 w257 h47 , Throw conjured runes?
  516. Gui, Add, Button, x52 y232 w50 h20 ggetpos_house_1 vgetpos_house_1, get pos
  517. Gui, Add, Edit, x110 y232 w40 h20 +Disabled +center vhouse_pos_x1, %house_pos_x1%
  518. Gui, Add, Edit, x151 y232 w40 h20 +Disabled +center vhouse_pos_y1, %house_pos_y1%
  519. Gui, Add, CheckBox, x200 y232 w90 h20 vdeposit_runes_1, throw runes
  520. Rune_spellkey1_TT := "Set key you want to be pressed while runemake"
  521. Spelltime1_TT := "How much time it take to conjure one rune"
  522. Fishing_setup1_TT := "Configure your fishing setup"
  523. Image_screen_checker1_TT := "Click the box to set part of screen to be checked for change,`nfor example: battle list, hp bar, minimap, vip list"
  524. Enabled_screen_checker1_TT := "Enable screen checker function for game client 1"
  525. getpos_house_1_TT := "Obtain position on screen where to throw conjured runes - house, ground etc."
  526. house_pos_x1_TT := "Obtain position on screen where to throw conjured runes - house, ground etc."
  527. house_pos_y1_TT := "Obtain position on screen where to throw conjured runes - house, ground etc."
  528. deposit_runes_1_TT := "Throw conjured runes on this exact position"
  529.  
  530.  
  531.  
  532. Gui, Tab, 2
  533. Gui, Add, GroupBox, x42 y85 w138 h70, Runemaker
  534. Gui, Add, Text, x50 y106 w70 h20 , Hotkey to use:
  535. Gui, Add, Hotkey, x128 y102 w40 h20 Center vRune_spellkey2, %rune_spellkey2%
  536. Gui, Add, Text, x50 y127 w70 h20 , Conjuring time:
  537. Gui, Add, Edit, x128 y124 w40 h20 Limit4 Number r1 gCheck_spelltime2 vSpelltime2, %spelltime2%
  538.  
  539. Gui, Add, GroupBox, x42 y160 w138 h48 +Disabled, Fishing
  540. Gui, Add, Button, x52 y178 w120 h20 vFishing_setup2 gFishing_setup2 vFishing_setup2, setup for client 2
  541.  
  542. Gui, Add, GroupBox, x190 y85 w110 h123, Screen checker
  543. Gui, Add, Picture, x203 y105 gArea_screen_checker2 vImage_screen_checker2, %sc_temp_img_dir2%
  544. Gui, Add, CheckBox, x204 y184 w80 h20 gEnabled_screen_checker2 vEnabled_screen_checker2 , enabled
  545.  
  546. Gui, Add, GroupBox, x42 y213 w257 h47 , Throw conjured runes?
  547. Gui, Add, Button, x52 y232 w50 h20 vgetpos_house_2 ggetpos_house_2 vgetpos_house_2, get pos
  548. Gui, Add, Edit, x110 y232 w40 h20 +Disabled +center vhouse_pos_x2, %house_pos_x2%
  549. Gui, Add, Edit, x151 y232 w40 h20 +Disabled +center vhouse_pos_y2, %house_pos_y2%
  550. Gui, Add, CheckBox, x200 y232 w90 h20 vdeposit_runes_2, throw runes
  551.  
  552. Rune_spellkey2_TT := "Set key you want to be pressed while runemake"
  553. Spelltime2_TT := "How much time it take to conjure one rune"
  554. Fishing_setup2_TT := "Configure your fishing setup"
  555. Image_screen_checker2_TT := "Click the box to set part of screen to be checked for change,`nfor example: battle list, hp bar, minimap, vip list"
  556. Enabled_screen_checker2_TT := "Enable screen checker function for game client 2"
  557. getpos_house_2_TT := "Obtain position on screen where to throw conjured runes - house, ground etc."
  558. house_pos_x2_TT := "Obtain position on screen where to throw conjured runes - house, ground etc."
  559. house_pos_y2_TT := "Obtain position on screen where to throw conjured runes - house, ground etc."
  560. deposit_runes_2_TT := "Throw conjured runes on this exact position"
  561.  
  562.  
  563.  
  564. Gui, Add, Tab2, +Theme vTab1 gTab1 x20 y20 w%tab_window_size_x% h%tab_window_size_y%,Main|Alarms|Settings|Advanced
  565. ; Gui, Add, Text, x130 y55 w190 h20 ; to white gray bar right to tab control
  566. Gui, Color, White
  567. Gui, Tab, 1
  568. Gui, Add, Pic, x322 y65, Data/Images/table_main_f.png
  569. Gui, Add, GroupBox, x322 y50 w150 h165, Main functions
  570.  
  571. Gui, Font, bold cGray
  572. Gui, Add, Text, x352 y71, client:
  573. Gui, Add, Text, x410 y71, 1
  574. Gui, Add, Text, x449 y71, 2
  575. Gui, Font
  576. Gui, Add, Text, x333 y94 w58 -Right , runemaking
  577. Gui, Add, Text, x333 y119 w58 -Right , anty logout
  578. Gui, Add, Text, x333 y144 w58 -Right ,  food eater
  579. Gui, Add, Text, x333 y169 w58 -Right ,  fishing
  580. Gui, Add, Text, x333 y194 w58 -Right ,  alarms
  581.  
  582. Gui, Add, CheckBox, x407 y91 w20 h20 vEnabled_runemaking1 gEnabled_runemaking1
  583. Gui, Add, CheckBox, x407 y116 w20 h20 vEnabled_anty_logout1 gEnabled_anty_logout1
  584. Gui, Add, CheckBox, x407 y141 w20 h20 vEnabled_food_eater1 gEnabled_food_eater1
  585. Gui, Add, CheckBox, x407 y165 w20 h20 gFishing_enabled1 vFishing_enabled1,
  586. Gui, Add, CheckBox, x407 y191 w20 h20 vAlarms_enabled1
  587.  
  588. Gui, Add, CheckBox, x446 y91 w20 h20 vEnabled_runemaking2 gEnabled_runemaking2
  589. Gui, Add, CheckBox, x446 y116 w20 h20 vEnabled_anty_logout2 gEnabled_anty_logout2
  590. Gui, Add, CheckBox, x446 y141 w20 h20 vEnabled_food_eater2 gEnabled_food_eater2
  591. Gui, Add, CheckBox, x446 y165 w20 h20 gFishing_enabled2 vFishing_enabled2,
  592. Gui, Add, CheckBox, x446 y191 w20 h20 vAlarms_enabled2
  593.  
  594. Gui, Add, GroupBox, x322 y219 w150 h49, Show/hide
  595. Gui, Add, Button, x335 y238 w60 h20 vToggle_hide1 gToggle_hide1, client 1
  596. Gui, Add, Button, x400 y238 w60 h20 vToggle_hide2 gToggle_hide2, client 2
  597.  
  598. Enabled_runemaking1_TT := "Make sure you configured all the neccesary shit`n - hand slot position, spell time, took proper images etc"
  599. Enabled_anty_logout1_TT := "It will change your character direction as specified in advanced settings"
  600. Enabled_food_eater1_TT := "It will eat food you took image of in settings`n or set hotkey in advanced settings for tibia 7.8 and newer"
  601. Fishing_enabled1_TT := "Enable the fisher, wish you succesful fishing"
  602. Alarms_enabled1_TT := "Alarms need to be enabled in order to be alarmed"
  603. Toggle_hide1_TT := "Use this button to minimize or activate your game client"
  604.  
  605. Enabled_runemaking2_TT := "Make sure you configured all the neccesary shit`n - hand slot position, spell time, took proper images etc"
  606. Enabled_anty_logout2_TT := "It will change your character direction as specified in advanced settings"
  607. Enabled_food_eater2_TT := "It will eat food you took image of in settings`n or set hotkey in advanced settings for tibia 7.8 and newer"
  608. Fishing_enabled2_TT := "Enable the fisher, wish you succesful fishing"
  609. Alarms_enabled2_TT := "Alarms need to be enabled in order to be alarmed"
  610. Toggle_hide2_TT := "Use this button to minimize or activate your game client"
  611.  
  612.  
  613. Gui, Tab, 2
  614. Gui, Add, Pic, x33 y57, Data/Images/tabledone.png
  615. Gui, Add, GroupBox, x32 y50 w439 h217 , Alarms setup
  616. Gui, Add, Text, x38 y106 w80 h20 +Right vifnofood +0x0100, if no food
  617. Gui, Add, Text, x38 y139 w80 h20 +Right vifnoblank +0x0100, if no blank runes
  618. Gui, Add, Text, x38 y174 w80 h20 +Right vifscreen +0x0100, if screen change
  619. Gui, Add, Text, x38 y207 w80 h20 +Right vifnosoul +0x0100, if no soul                 ; 8<<<
  620. Gui, Add, Text, x38 y240 w80 h20 +Right vifmoved +0x0100, if char moved                ; 8<<<
  621.  
  622. Gui, Add, Text, x129 y62 w40 h30 +Center valarmPause +0x0100, pause`nbot
  623. Gui, Add, Text, x176 y69 w40 h20 +Center valarmLogout +0x0100, logout
  624. Gui, Add, Text, x223 y62 w40 h30 +Center valamrSound +0x0100, play sound
  625. Gui, Add, Text, x268 y62 w46 h30 +Center valarmShutdown +0x0100, shut pc`ndown
  626. Gui, Add, Text, x324 y69 w40 h20 +Center valarmWalk +0x0100, walk
  627. Gui, Add, Text, x380 y62 w40 h30 +Center valarmSpell +0x0100, cast`nspell
  628. Gui, Add, Text, x427 y62 w40 h30 +Center valarmFlash +0x0100, flash`nclient
  629.  
  630. ifnofood_TT := "Alarm executed when bot couldn't find food"
  631. ifnoblank_TT := "Alarm executed when bot couldn't find blank rune`nwhile using hand-mode setting"
  632. ifscreen_TT := "Decide how the bot should act`nwhen part of screen has changed"
  633. ifnosoul_TT := "Bot will check each runemake cicle if`nyou still have soul points"
  634. ifmoved_TT := "Function currently disabled.`nWill be released in upcoming updates."
  635.  
  636. alarmPause_TT := "It will result in pause all bot functions`nas rune making, food eating and anty-`nlogout for the specified client"
  637. alarmLogout_TT := "Instant character logout (you can set 'double alarm effect'`nin settings in order to all characters to logout)"
  638. alamrSound_TT := "Short sound alarm repeated loudly few times"
  639. alarmShutdown_TT := "Force your PC to shut down"
  640. alarmWalk_TT := "It will make you character walk few sqms in desired direction.`nAmount of steps configurable in advanced settings.`nYou can also set 'double alarm effect' in order to make both`n   of your characters move simultaneously"
  641. alarmSpell_TT := "Good function to use if you are out of blank runes or souls. Configurable in settings. "
  642. alarmFlash_TT := "It will instantly activate the client"
  643.  
  644. Gui, Add, CheckBox, x141 y103 w20 h20 vPauseRunemaking_IfFood gPauseRunemaking_IfFood,
  645. Gui, Add, CheckBox, x189 y103 w20 h20 vLogout_IfFood gLogout_IfFood,
  646. Gui, Add, CheckBox, x236 y103 w20 h20 vPlaySound_IfFood gPlaySound_IfFood,
  647. Gui, Add, CheckBox, x285 y103 w20 h20 vShutDown_IfFood gShutDown_IfFood,
  648. Gui, Add, CheckBox, x394 y103 w20 h20 vCastSpell_IfFood,
  649. Gui, Add, CheckBox, x440 y103 w20 h20 vFlash_IfFood,
  650. GuiControl, Disable, CastSpell_IfFood
  651.  
  652. Gui, Add, CheckBox, x141 y136 w20 h20 vPauseRunemaking_IfBlank gPauseRunemaking_IfBlank,
  653. Gui, Add, CheckBox, x189 y136 w20 h20 vLogout_IfBlank gLogout_IfBlank,
  654. Gui, Add, CheckBox, x236 y136 w20 h20 vPlaySound_IfBlank gPlaySound_IfBlank,
  655. Gui, Add, CheckBox, x285 y136 w20 h20 vShutDown_IfBlank gShutDown_IfBlank,
  656. Gui, Add, CheckBox, x394 y136 w20 h20 vCastSpell_IfBlank gCastSpell_IfBlank,
  657. Gui, Add, CheckBox, x440 y136 w20 h20 vFlash_IfBlank,
  658.  
  659. Gui, Add, CheckBox, x141 y170 w20 h20 vPauseRunemaking_IfPlayer gPauseRunemaking_IfPlayer,
  660. Gui, Add, CheckBox, x189 y170 w20 h20 vLogout_IfPlayer gLogout_IfPlayer,
  661. Gui, Add, CheckBox, x236 y170 w20 h20 vPlaySound_IfPlayer gPlaySound_IfPlayer,
  662. Gui, Add, CheckBox, x285 y170 w20 h20 vShutDown_IfPlayer gShutDown_IfPlayer,
  663. Gui, Add, CheckBox, x394 y170 w20 h20 vCastSpell_IfPlayer,
  664. Gui, Add, CheckBox, x440 y170 w20 h20 vFlash_IfPlayer,
  665. GuiControl, Disable, CastSpell_IfPlayer
  666.  
  667. Gui, Add, CheckBox, x141 y203 w20 h20 vPauseRunemaking_IfSoul gPauseRunemaking_IfSoul,
  668. Gui, Add, CheckBox, x189 y203 w20 h20 vLogout_IfSoul gLogout_IfSoul,
  669. Gui, Add, CheckBox, x236 y203 w20 h20 vPlaySound_IfSoul gPlaySound_IfSoul,
  670. Gui, Add, CheckBox, x285 y203 w20 h20 vShutDown_IfSoul gShutDown_IfSoul,
  671. Gui, Add, CheckBox, x394 y203 w20 h20 vCastSpell_IfSoul gCastSpell_IfSoul,
  672. Gui, Add, CheckBox, x440 y203 w20 h20 vFlash_IfSoul,
  673.  
  674. Gui, Add, CheckBox, x141 y238 w20 h20 +Disabled vPauseRunemaking_IfCharMoved ;gPauseRunemaking_IfCharMoved,
  675. Gui, Add, CheckBox, x189 y238 w20 h20 +Disabled vLogout_IfCharMoved ;gLogout_IfCharMoved,
  676. Gui, Add, CheckBox, x236 y238 w20 h20 +Disabled vPlaySound_IfCharMoved ;gPlaySound_IfCharMoved,
  677. Gui, Add, CheckBox, x285 y238 w20 h20 +Disabled vShutDown_IfCharMoved ;gShutDown_IfCharMoved,
  678. Gui, Add, CheckBox, x394 y238 w20 h20 +Disabled vCastSpell_IfCharMoved ;gCastSpell_IfCharMoved,
  679. Gui, Add, CheckBox, x440 y238 w20 h20 +Disabled vFlash_IfCharMoved,
  680.  
  681.  
  682.  
  683. Gui, Add, DropDownList, x320 y103 w50 h20 r5 vWalkMethod_IfFood gWalkMethod_IfFood Choose%WalkMethod_IfFood% , off|north|east|south|west                 ; -14<<<<<<<
  684. Gui, Add, DropDownList, x320 y136 w50 h20 r5 vWalkMethod_IfBlank gWalkMethod_IfBlank Choose%WalkMethod_IfBlank% , off|north|east|south|west
  685. Gui, Add, DropDownList, x320 y170 w50 h20 r5 vWalkMethod_IfPlayer gWalkMethod_IfPlayer Choose%WalkMethod_IfPlayer% , off|north|east|south|west
  686. Gui, Add, DropDownList, x320 y203 w50 h20 r5 vWalkMethod_IfSoul Choose%WalkMethod_IfSoul% Choose%WalkMethod_IfSoul% , off|north|east|south|west
  687. Gui, Add, DropDownList, x320 y238 w50 h20 r5 +Disabled  vWalkMethod_IfCharMoved Choose1 , off|north|east|south|west
  688.  
  689.  
  690. Gui, Tab, 3
  691. Gui, Add, GroupBox, x32 y50 w199 h215 , Store your images
  692. Gui, Add, Pic, x43 y77, Data/Images/picbp.bmp
  693. Gui, Add, Pic, x56 y98 gTake_image_conjured_rune1 vconjured_rune1, Data/Images/conjured_rune1.bmp
  694. Gui, Add, Pic, x167 y98 gTake_image_conjured_rune2 vconjured_rune2, Data/Images/conjured_rune2.bmp
  695. Gui, Add, Pic, x56 y135 gTake_image_backpack1 vbackpack1, Data/Images/backpack1.bmp
  696. Gui, Add, Pic, x167 y135 gTake_image_backpack2 vbackpack2, Data/Images/backpack2.bmp
  697. Gui, Add, Pic, x139 y181 gTake_image_food1 vfood1, Data/Images/food1.bmp
  698. Gui, Add, Pic, x176 y181 gTake_image_food2 vfood2, Data/Images/food2.bmp
  699. Gui, Add, Pic, x93 y209 gTake_image_blank_rune vblank_rune, Data/Images/blank_rune.bmp
  700. Gui, Add, Pic, x164 y206 gTake_image_free_slot vfree_slot, Data/Images/free_slot.bmp
  701.  
  702. conjured_rune1_TT := "Take picture of rune you will conjure on client 1"
  703. conjured_rune2_TT := "Take picture of rune you will conjure on client 2"
  704. backpack1_TT := "Take picture of new backpack on client 1`n(necessary if you are using 'open new backpack')"
  705. backpack2_TT := "Take picture of new backpack on client 2`n(necessary if you are using 'open new backpack')"
  706. food1_TT := "Take piture of food"
  707. food2_TT := "Take piture of food"
  708. blank_rune_TT := "Take piture of blank rune`n(necessary if you are using 'hand mode')"
  709. free_slot_TT := "Take piture of free slot`n(necessary if you are using 'hand mode')"
  710.  
  711.  
  712. Gui, Add, GroupBox, x240 y50 w232 h110 , Runemaker configuration
  713. Gui, Add, Edit, x251 y68 w34 h20 +Disabled +center vhand_slot_pos_x, %hand_slot_pos_x%
  714. Gui, Add, Edit, x289 y68 w34 h20 +Disabled +center vhand_slot_pos_y , %hand_slot_pos_y%
  715. Gui, Add, Button, x332 y68 h20 vGetpos_hand_slot gGetpos_hand_slot, get hand slot position
  716. Gui, Add, CheckBox, x254 y94 w130 h20 vHand_mode, move blanks to hand
  717. Gui, Add, CheckBox, x254 y114 w130 h20 vOpenNewBackpack, open new backpacks
  718. Gui, Add, CheckBox, x254 y134 w130 h20 vCreate_blank, create blank runes
  719.  
  720. Gui, Add, GroupBox, x240 y170 w232 h95, Alarms configuration
  721.  
  722. Gui, Add, Edit, x251 y188 w60 h20 center vSpell_to_cast_name, %Spell_to_cast_name%
  723. Gui, Add, Text, x320 y191 w140 h20 , spell to cast in case of alarm
  724. Gui, Add, Text, x251 y211 w60 h20 , say this spell
  725. Gui, Add, Edit, x314 y208 w20 h20 center number limit2 vSpell_to_cast_count gCheck_spell_to_cast_count, %Check_spell_to_cast_count%
  726. Gui, Add, Text, x340 y211 w130 h20, times each runemake cicle.
  727. Gui, Add, Checkbox, x254 y236 h20 vDouble_alarm_screen_checker,  Double alarm effect
  728.  
  729. hand_slot_pos_x_TT := "Obtained hand slot position"
  730. hand_slot_pos_y_TT := "Obtained hand slot position"
  731. Getpos_hand_slot_TT := "Click and move your mouse to center of left or right hand slot"
  732. Hand_mode_TT := "Use it if you need move blank rune to hand in order to create rune.`n(hand slot position, image of blank rune and free slot MUST be configured!)"
  733. OpenNewBackpack_TT := "Make sure you have took picture for new backpack"
  734. Create_blank_TT := "If its possible to cast 'adori blank' on your OT"
  735.  
  736. Spell_to_cast_name_TT := "Type here the incantation of spell you want to cast,`nunder certain alarm condition"
  737. Spell_to_cast_count_TT := "The count of times spell should be casted each runemake cycle"
  738. Double_alarm_screen_checker_TT := "It will enable you to execute alarm simultaneously on both clients.`nWorks only for 'walk', 'logout' and 'pause' "
  739.  
  740.  
  741.  
  742. Gui, Tab, 4
  743. Gui, Add, GroupBox, x32 y49 w210 h219 , Advanced settings
  744. Gui Add, Text, x46 y69 w107 h23 +0x200, blank rune spell name:
  745. Gui Add, Text, x46 y93 w130 h23 +0x200, use hotkey to eat food?
  746. Gui Add, Text, x46 y117 w97 h23 +0x200, eat food once every
  747. Gui Add, Text, x46 y141 w110 h23 +0x200, antylogout dance every
  748. Gui Add, Text, x46 y165 w102 h23 +0x200, antylogout directions
  749. Gui Add, Text, x46 y189 w92 h23 +0x200, show notifications
  750. Gui Add, Text, x46 y213 w156 h23 +0x200, steps to walk in case of alarm
  751. Gui Add, Text, x46 y237 w136 h23 +0x200, shut down your pc at:
  752.  
  753.  
  754. Gui Add, Edit, x158 y69 w68 h21 Center vBlank_spellname gCheck_blank_spellname, %blank_spellname%
  755. Gui Add, Hotkey, x162 y93 w40 h21 Center vEat_hotkey, %eat_hotkey%
  756. Gui Add, CheckBox, x210 y93 w22 h23 Center veat_using_hotkey geat_using_hotkey,
  757. Gui Add, Edit, x144 y117 w35 h21 Center vFood_time gCheck_food_time, %food_time%
  758. Gui Add, Text, x185 y117 w25 h23 +0x200, sec
  759. Gui Add, Edit, x159 y141 w35 h21 Center vAnty_log_time gCheck_anty_log_time, %anty_log_time%
  760. Gui Add, Text, x198 y141 w25 h23 +0x200, sec
  761. Gui Add, DropDownList, x150 y165 w36 Center vAnty_log_dir1 gCheck_dir1, n|e|s|w
  762. Gui Add, DropDownList, x190 y165 w36 Center vAnty_log_dir2 gCheck_dir2, n|e|s|w
  763. Gui Add, DropDownList, x137 y189 w90 Center vShow_notifications, always|only important|never
  764. Gui Add, DropDownList, x193 y213 w34 Center vSteps_to_walk, 1|2|3|4|5|6|7|8
  765. Gui, Add, DateTime, x152 y237 w55 vAuto_shutdown_time Choose 1, HH:mm
  766. Gui Add, CheckBox, x214 y237 w23 vAuto_shutdown_enabled gAuto_shutdown_enabled h23,
  767.  
  768. Blank_spellname_TT := "Usually 'adori blank'..."
  769. Eat_hotkey_TT := "If you are playing on tibia 7.8 and newer`nit might suit you to set food on hotkey"
  770. eat_using_hotkey_TT := "If you are playing on tibia 7.8 and newer`nit might suit you to set food on hotkey"
  771. Food_time_TT := "Decide how ofter character should eat food"
  772. Anty_log_time_TT := "Decide how often character should do anty-logout"
  773. Anty_log_dir1_TT := "Choose character direction of anty-logout"
  774. Anty_log_dir2_TT := "Choose character direction of anty-logout"
  775. Show_notifications_TT := "It is recommended to set 'only-importnant' notifications"
  776. Steps_to_walk_TT := "Decide how many sqm character should move in case of emergency"
  777. Auto_shutdown_time_TT := "Determine if you want bot to force shutdown your pc at specific time"
  778. Auto_shutdown_enabled_TT := "Enable auto-shutdown your pc"
  779.  
  780.  
  781. Gui, Add, GroupBox, x253 y49 w217 h219 , Credits and contacts
  782. Gui Add, Text, x261 y71 w200 h53, Official project forum - you can report your bugs or share your opinion about the bot here:
  783. Gui Add, Link, x290 y97 w150 h23 vTibiaPf, <a href="https://tibiapf.com/showthread.php?71-all-versions-Warlock-Bot">tibiapf.com - warlockbot</a>
  784. Gui Add, Text, x261 y117 w140 h23 +0x200, Warlock bot's official website:
  785. Gui Add, Link, x321 y137 w80 h23 vWrlbottk, <a href="http://wrlbot.tk">www.wrlbot.tk</a>
  786. Gui Add, Text, x261 y160 w198 h63,If you like it you can support me with a few bucks through PayPal donation. I would be really grateful!
  787. Gui, Add, Pic, x313 y205 vPayPal gPayPal, Data/Images/pp_donate.bmp
  788. Gui Add, Text, x261 y240 w198 h23, Software created by Brazyliszek/Mate
  789.  
  790. TibiaPf_TT := "Open link"
  791. Wrlbottk_TT := "Open link"
  792. PayPal_TT := "Open link"
  793.  
  794. Gui,Tab
  795.  
  796. Gui,Add, Pic, x0 y0 w%pic_window_size_x% h%pic_window_size_y% 0x4000000, %A_WorkingDir%\Data\Images\background.png
  797. Gui,Show, w%pic_window_size_x% h%pic_window_size_y%, %BOTName%
  798.  
  799. IniRead, randomization, Data/basic_settings.ini, conf values, randomization
  800. IniRead, rune_spellkey1, Data/basic_settings.ini, bot variables, rune_spellkey1
  801. IniRead, rune_spellkey2, Data/basic_settings.ini, bot variables, rune_spellkey2
  802. IniRead, Spelltime1, Data/basic_settings.ini, bot variables, Spelltime1
  803. IniRead, Spelltime2, Data/basic_settings.ini, bot variables, Spelltime2
  804.  
  805. IniRead, deposit_runes_1, Data/basic_settings.ini, bot variables, deposit_runes_1
  806. IniRead, house_pos_x1, Data/basic_settings.ini, bot variables, house_pos_x1
  807. IniRead, house_pos_y1, Data/basic_settings.ini, bot variables, house_pos_y1
  808. IniRead, deposit_runes_2, Data/basic_settings.ini, bot variables, deposit_runes_2
  809. IniRead, house_pos_x2, Data/basic_settings.ini, bot variables, house_pos_x2
  810. IniRead, house_pos_y2, Data/basic_settings.ini, bot variables, house_pos_y2
  811.  
  812. IniRead, PauseRunemaking_IfCharMoved, Data/basic_settings.ini, bot variables, PauseRunemaking_IfCharMoved
  813. IniRead, PauseRunemaking_IfFood, Data/basic_settings.ini, bot variables, PauseRunemaking_IfFood
  814. IniRead, PauseRunemaking_IfBlank, Data/basic_settings.ini, bot variables, PauseRunemaking_IfBlank
  815. IniRead, PauseRunemaking_IfPlayer, Data/basic_settings.ini, bot variables, PauseRunemaking_IfPlayer
  816. IniRead, PauseRunemaking_IfSoul, Data/basic_settings.ini, bot variables, PauseRunemaking_IfSoul
  817.  
  818. IniRead, Logout_IfCharMoved, Data/basic_settings.ini, bot variables, Logout_IfCharMoved
  819. IniRead, Logout_IfFood, Data/basic_settings.ini, bot variables,  Logout_IfFood
  820. IniRead, Logout_IfBlank, Data/basic_settings.ini, bot variables, Logout_IfBlank
  821. IniRead, Logout_IfPlayer, Data/basic_settings.ini, bot variables, Logout_IfPlayer
  822. IniRead, Logout_IfSoul, Data/basic_settings.ini, bot variables, Logout_IfSoul
  823.  
  824. IniRead, PlaySound_IfCharMoved, Data/basic_settings.ini, bot variables,  PlaySound_IfCharMoved
  825. IniRead, PlaySound_IfFood, Data/basic_settings.ini, bot variables,  PlaySound_IfFood
  826. IniRead, PlaySound_IfBlank, Data/basic_settings.ini, bot variables,  PlaySound_IfBlank
  827. IniRead, PlaySound_IfPlayer, Data/basic_settings.ini, bot variables, PlaySound_IfPlayer
  828. IniRead, PlaySound_IfSoul, Data/basic_settings.ini, bot variables,  PlaySound_IfSoul
  829.  
  830. IniRead, ShutDown_IfCharMoved, Data/basic_settings.ini, bot variables, ShutDown_IfCharMoved
  831. IniRead, ShutDown_IfFood, Data/basic_settings.ini, bot variables, ShutDown_IfFood
  832. IniRead, ShutDown_IfBlank, Data/basic_settings.ini, bot variables, ShutDown_IfBlank
  833. IniRead, ShutDown_IfPlayer, Data/basic_settings.ini, bot variables, ShutDown_IfPlayer
  834. IniRead, ShutDown_IfSoul, Data/basic_settings.ini, bot variables, ShutDown_IfSoul
  835.  
  836. IniRead, WalkMethod_IfFood, Data/basic_settings.ini, bot variables, WalkMethod_IfFood
  837. IniRead, WalkMethod_IfBlank, Data/basic_settings.ini, bot variables, WalkMethod_IfBlank
  838. IniRead, WalkMethod_IfPlayer, Data/basic_settings.ini, bot variables, WalkMethod_IfPlayer
  839. IniRead, WalkMethod_IfSoul, Data/basic_settings.ini, bot variables, WalkMethod_IfSoul
  840. IniRead, WalkMethod_IfCharMoved, Data/basic_settings.ini, bot variables, WalkMethod_IfCharMoved
  841.  
  842. IniRead, CastSpell_IfBlank, Data/basic_settings.ini, bot variables, CastSpell_IfBlank
  843. IniRead, CastSpell_IfSoul, Data/basic_settings.ini, bot variables, CastSpell_IfSoul
  844.  
  845. IniRead, Flash_IfCharMoved, Data/basic_settings.ini, bot variables, Flash_IfCharMoved
  846. IniRead, Flash_IfFood, Data/basic_settings.ini, bot variables, Flash_IfFood
  847. IniRead, Flash_IfBlank, Data/basic_settings.ini, bot variables, Flash_IfBlank
  848. IniRead, Flash_IfPlayer, Data/basic_settings.ini, bot variables, Flash_IfPlayer
  849. IniRead, Flash_IfSoul, Data/basic_settings.ini, bot variables, Flash_IfSoul
  850.  
  851. IniRead, OpenNewBackpack, Data/basic_settings.ini, bot variables, OpenNewBackpack
  852. IniRead, Create_blank, Data/basic_settings.ini, bot variables, Create_blank
  853. IniRead, Hand_mode, Data/basic_settings.ini, bot variables, Hand_mode
  854. IniRead, hand_slot_pos_x, Data/basic_settings.ini, bot variables, hand_slot_pos_x
  855. IniRead, hand_slot_pos_y, Data/basic_settings.ini, bot variables, hand_slot_pos_y
  856.  
  857. IniRead, Spell_to_cast_name, Data/basic_settings.ini, bot variables, Spell_to_cast_name
  858. IniRead, Spell_to_cast_count, Data/basic_settings.ini, bot variables, Spell_to_cast_count
  859. IniRead, Double_alarm_screen_checker, Data/basic_settings.ini, bot variables, Double_alarm_screen_checker
  860.  
  861. IniRead, Blank_spellname, Data/basic_settings.ini, bot variables, Blank_spellname
  862. IniRead, Eat_hotkey, Data/basic_settings.ini, bot variables, Eat_hotkey
  863. IniRead, eat_using_hotkey, Data/basic_settings.ini, bot variables, eat_using_hotkey
  864. IniRead, Food_time, Data/basic_settings.ini, bot variables, Food_time
  865. IniRead, Anty_log_time, Data/basic_settings.ini, bot variables, Anty_log_time
  866. IniRead, Anty_log_dir1, Data/basic_settings.ini, bot variables, Anty_log_dir1
  867. IniRead, Anty_log_dir2, Data/basic_settings.ini, bot variables, Anty_log_dir2
  868. IniRead, Show_notifications, Data/basic_settings.ini, bot variables, Show_notifications
  869. IniRead, Steps_to_walk, Data/basic_settings.ini, bot variables, Steps_to_walk
  870. IniRead, Auto_shutdown_time, Data/basic_settings.ini, bot variables, Auto_shutdown_time
  871.  
  872. GuiControl,, rune_spellkey1, %rune_spellkey1%
  873. GuiControl,, rune_spellkey2, %rune_spellkey2%
  874. GuiControl,, Spelltime1, %Spelltime1%
  875. GuiControl,, Spelltime2, %Spelltime2%
  876.  
  877. GuiControl,, deposit_runes_1, %deposit_runes_1%
  878. GuiControl,, house_pos_x1, %house_pos_x1%
  879. GuiControl,, house_pos_y1, %house_pos_y1%
  880. GuiControl,, deposit_runes_2, %deposit_runes_2%
  881. GuiControl,, house_pos_x2, %house_pos_x2%
  882. GuiControl,, house_pos_y2, %house_pos_y2%
  883.  
  884. GuiControl,, PauseRunemaking_IfCharMoved, %PauseRunemaking_IfCharMoved%
  885. GuiControl,, PauseRunemaking_IfFood, %PauseRunemaking_IfFood%
  886. GuiControl,, PauseRunemaking_IfBlank, %PauseRunemaking_IfBlank%
  887. GuiControl,, PauseRunemaking_IfPlayer, %PauseRunemaking_IfPlayer%
  888. GuiControl,, PauseRunemaking_IfSoul, %PauseRunemaking_IfSoul%
  889.  
  890. GuiControl,, Logout_IfCharMoved, %Logout_IfCharMoved%
  891. GuiControl,, Logout_IfFood, %Logout_IfFood%
  892. GuiControl,, Logout_IfBlank, %Logout_IfBlank%
  893. GuiControl,, Logout_IfPlayer, %Logout_IfPlayer%
  894. GuiControl,, Logout_IfSoul, %Logout_IfSoul%
  895.  
  896. GuiControl,, PlaySound_IfCharMoved, %PlaySound_IfCharMoved%
  897. GuiControl,, PlaySound_IfFood, %PlaySound_IfFood%
  898. GuiControl,, PlaySound_IfBlank, %PlaySound_IfBlank%
  899. GuiControl,, PlaySound_IfPlayer, %PlaySound_IfPlayer%
  900. GuiControl,, PlaySound_IfSoul, %PlaySound_IfSoul%
  901.  
  902. GuiControl,, ShutDown_IfCharMoved, %ShutDown_IfCharMoved%
  903. GuiControl,, ShutDown_IfFood, %ShutDown_IfFood%
  904. GuiControl,, ShutDown_IfBlank, %ShutDown_IfBlank%
  905. GuiControl,, ShutDown_IfPlayer, %ShutDown_IfPlayer%
  906. GuiControl,, ShutDown_IfSoul, %ShutDown_IfSoul%
  907.  
  908. GuiControl,Choose, WalkMethod_IfFood, %WalkMethod_IfFood%
  909. GuiControl,Choose, WalkMethod_IfBlank, %WalkMethod_IfBlank%
  910. GuiControl,Choose, WalkMethod_IfPlayer, %WalkMethod_IfPlayer%
  911. GuiControl,Choose, WalkMethod_IfSoul, %WalkMethod_IfSoul%
  912. GuiControl,Choose, WalkMethod_IfCharMoved, %WalkMethod_IfCharMoved%
  913.  
  914. GuiControl,, CastSpell_IfBlank, %CastSpell_IfBlank%
  915. GuiControl,, CastSpell_IfSoul, %CastSpell_IfSoul%
  916.  
  917. GuiControl,, Flash_IfCharMoved, %Flash_IfCharMoved%
  918. GuiControl,, Flash_IfFood, %Flash_IfFood%
  919. GuiControl,, Flash_IfBlank, %Flash_IfBlank%
  920. GuiControl,, Flash_IfPlayer, %Flash_IfPlayer%
  921. GuiControl,, Flash_IfSoul, %Flash_IfSoul%
  922.  
  923. GuiControl,, OpenNewBackpack, %OpenNewBackpack%
  924. GuiControl,, Create_blank, %Create_blank%
  925. GuiControl,, Hand_mode, %Hand_mode%
  926. GuiControl,, hand_slot_pos_x, %hand_slot_pos_x%
  927. GuiControl,, hand_slot_pos_y, %hand_slot_pos_y%
  928.  
  929. GuiControl,, Spell_to_cast_name, %Spell_to_cast_name%
  930. GuiControl,, Spell_to_cast_count, %Spell_to_cast_count%
  931. GuiControl,, Double_alarm_screen_checker, %Double_alarm_screen_checker%
  932.  
  933. GuiControl,, Blank_spellname, %Blank_spellname%
  934. GuiControl,, Eat_hotkey, %Eat_hotkey%
  935. GuiControl,, eat_using_hotkey, %eat_using_hotkey%
  936. GuiControl,, Food_time, %Food_time%
  937. GuiControl,, Anty_log_time, %Anty_log_time%
  938. GuiControl,Choose, Anty_log_dir1, %Anty_log_dir1%
  939. GuiControl,Choose, Anty_log_dir2, %Anty_log_dir2%
  940. GuiControl,Choose, Show_notifications, %Show_notifications%
  941. GuiControl,Choose, Steps_to_walk, %Steps_to_walk%
  942. GuiControl,, Auto_shutdown_time, %Auto_shutdown_time%
  943.  
  944.  
  945.  
  946. if (mc_count = 1){                                       ; disabling few functions in case if only one client was turned on
  947.    GuiControl, Disable, rune_spellkey2
  948.    GuiControl, Disable, Spelltime2
  949.    GuiControl, Disable, Image_screen_checker2,
  950.    GuiControl, Disable, Enabled_screen_checker2
  951.    GuiControl, Disable, Fishing_setup2,
  952.    GuiControl, Disable, getpos_house_2,
  953.    GuiControl, Disable, deposit_runes_2
  954.    GuiControl, Disable, Enabled_runemaking2
  955.    GuiControl, Disable, Enabled_anty_logout2
  956.    GuiControl, Disable, Enabled_food_eater2
  957.    GuiControl, Disable, Fishing_enabled2
  958.    GuiControl, Disable, Alarms_enabled2
  959.    GuiControl, Disable, Double_alarm_screen_checker
  960.    GuiControl, Disable, Toggle_hide2
  961.    GuiControl,, Double_alarm_screen_checker, 0
  962.    GuiControl,, NotNeeded_pid2, 0000
  963. }
  964.  
  965. ;sleep, 100
  966. gosub, CP_GUI
  967. gosub, MENU_CREATE
  968.  
  969. Gui, Fishing_gui1: New
  970. Gui, Fishing_gui1: +hwndFishing_gui1 +AlwaysOnTop +Caption +ToolWindow
  971. Gui, Fishing_gui1: Add, Button, x6 y10 w68 h35 gFishing_getSpots1 vFishing_button_text1 , get fishing spots
  972. Gui, Fishing_gui1: Add, Button, x77 y10 w68 h35 gFishing_reset1, reset
  973. Gui, Fishing_gui1: Add, CheckBox, x12 y50 w140 h20 vFishing_noFood_enabled1, fish only if no food
  974. Gui, Fishing_gui1: Add, CheckBox, x12 y70 w120 h30 vFishing_noSlot_enabled1, fish only if found empty slot in bp
  975. Gui, Fishing_gui1: Add, Pic, x8 y104, Data/Images/fishing_rod_bp.bmp
  976. Gui, Fishing_gui1: Add, Pic, x95 y125 gTake_image_fishing_rod1 vfishing_rod1, Data/Images/fishing_rod.bmp
  977. Gui, Fishing_gui1: Add, Pic, x104 y172 gTake_image_fish1 vfish1, Data/Images/fish.bmp
  978. Gui, Fishing_gui1: Add, Button, x28 y217 w90 h20 gFishing_done1 default , done
  979.  
  980. Gui, Fishing_selectTopLeft1: New
  981. Gui, Fishing_selectTopLeft1: +hwndFishing_selectTopLeft1
  982. Gui, Fishing_selectTopLeft1: -SysMenu +ToolWindow -Caption +Border +AlwaysOnTop +OwnerFishing_gui1
  983. Gui, Fishing_selectTopLeft1: Font,norm bold s10
  984. Gui, Fishing_selectTopLeft1: Add,Text,,Select top left corner of game window
  985. Gui, Fishing_selectTopLeft1: Font
  986. Gui, Fishing_selectTopLeft1: Add,Text,, Move your mouse to TOP LEFT corner of game window`nand click left mouse button. Or click escape to cancel.
  987.  
  988. Gui, Fishing_selectBottomRight1: New
  989. Gui, Fishing_selectBottomRight1: +hwndFishing_selectBottomRight1
  990. Gui, Fishing_selectBottomRight1: -SysMenu +ToolWindow -Caption +Border +AlwaysOnTop +OwnerFishing_gui1
  991. Gui, Fishing_selectBottomRight1: Font,norm bold s10
  992. Gui, Fishing_selectBottomRight1: Add,Text,,Select bottom right corner of game window
  993. Gui, Fishing_selectBottomRight1: Font
  994. Gui, Fishing_selectBottomRight1: Add,Text,, Move your mouse to BOTTOM RIGHT corner of game window`nand click left mouse button. Or click escape to cancel.
  995.  
  996.  
  997. Gui, Fishing_gui2: New
  998. Gui, Fishing_gui2: +hwndFishing_gui2 +AlwaysOnTop +Caption +ToolWindow
  999. Gui, Fishing_gui2: Add, Button, x6 y10 w68 h35 gFishing_getSpots2 vFishing_button_text2 , get fishing spots
  1000. Gui, Fishing_gui2: Add, Button, x77 y10 w68 h35 gFishing_reset2, reset
  1001. Gui, Fishing_gui2: Add, CheckBox, x12 y50 w140 h20 vFishing_noFood_enabled2, fish only if no food
  1002. Gui, Fishing_gui2: Add, CheckBox, x12 y70 w120 h30 vFishing_noSlot_enabled2, fish only if found empty slot in bp
  1003. Gui, Fishing_gui2: Add, Pic, x8 y104, Data/Images/fishing_rod_bp.bmp
  1004. Gui, Fishing_gui2: Add, Pic, x95 y125 gTake_image_fishing_rod2 vfishing_rod2, Data/Images/fishing_rod.bmp
  1005. Gui, Fishing_gui2: Add, Pic, x104 y172 gTake_image_fish2 vfish2, Data/Images/fish.bmp
  1006. Gui, Fishing_gui2: Add, Button, x28 y217 w90 h20 gFishing_done2 default , done
  1007.  
  1008. Gui, Fishing_selectTopLeft2: New
  1009. Gui, Fishing_selectTopLeft2: +hwndFishing_selectTopLeft2
  1010. Gui, Fishing_selectTopLeft2: -SysMenu +ToolWindow -Caption +Border +AlwaysOnTop +OwnerFishing_gui2
  1011. Gui, Fishing_selectTopLeft2: Font,norm bold s10
  1012. Gui, Fishing_selectTopLeft2: Add,Text,,Select top left corner of game window
  1013. Gui, Fishing_selectTopLeft2: Font
  1014. Gui, Fishing_selectTopLeft2: Add,Text,, Move your mouse to TOP LEFT corner of game window`nand click left mouse button. Or click escape to cancel.
  1015.  
  1016. Gui, Fishing_selectBottomRight2: New
  1017. Gui, Fishing_selectBottomRight2: +hwndFishing_selectBottomRight2
  1018. Gui, Fishing_selectBottomRight2: -SysMenu +ToolWindow -Caption +Border +AlwaysOnTop +OwnerFishing_gui2
  1019. Gui, Fishing_selectBottomRight2: Font,norm bold s10
  1020. Gui, Fishing_selectBottomRight2: Add,Text,,Select bottom right corner of game window
  1021. Gui, Fishing_selectBottomRight2: Font
  1022. Gui, Fishing_selectBottomRight2: Add,Text,, Move your mouse to BOTTOM RIGHT corner of game window`nand click left mouse button. Or click escape to cancel.
  1023.  
  1024.  
  1025. Gui, Screenshoot_window: New
  1026. Gui, Screenshoot_window: -SysMenu +ToolWindow -Caption +Border +AlwaysOnTop
  1027. Gui, Screenshoot_window: Font,norm bold s10
  1028. Gui, Screenshoot_window: Add,Text, vText_to_display,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1029. Gui, Screenshoot_window: Font
  1030. Gui, Screenshoot_window: Add,Text,, Move your mouse to center of item you want to save`nand click left mouse button. Or click escape to cancel.
  1031.  
  1032.  
  1033. Gui, screen_box: New
  1034. Gui screen_box: +alwaysontop -Caption +Border +ToolWindow +LastFound
  1035. Gui, screen_box: Color, ADEBDA
  1036. WinSet, Transparent, 50 ; Else Add transparency
  1037.  
  1038.  
  1039.  
  1040. OnMessage(0x200, "WM_MOUSEMOVE")
  1041. #Persistent               ; to overwrite settings only if main window has been shown
  1042. OnExit("save")
  1043. return
  1044.  
  1045. ; ######################################################### MAIN #########################################################################
  1046. Enabled_runemaking1:
  1047.   GuiControlGet, Enabled_runemaking1,, Enabled_runemaking1
  1048.    GuiControlGet, Enabled_runemaking2,, Enabled_runemaking2
  1049.    GuiControlGet, Spelltime1,, Spelltime1
  1050.    GuiControlGet, rune_spellkey1,, rune_spellkey1
  1051.    IfWinNotExist, ahk_pid %pid_tibia1%
  1052.       {
  1053.       if (pid_tibia1 != ""){
  1054.          title_tibia1 := "Game client 1 - identyfied by " pid_tibia1
  1055.          WinActivate, ahk_pid %pid_tibia1%
  1056.          WinWait, ahk_pid %pid_tibia1%
  1057.          WinSetTitle, %title_tibia1%
  1058.          sleep, 50
  1059.       }
  1060.       IfWinNotExist, ahk_pid %pid_tibia1%
  1061.       {
  1062.          notification(2, title_tibia1, "Window " . title_tibia1 . " doesn't exist.")
  1063.          GuiControl,, Enabled_runemaking1, 0
  1064.          Check_gui()
  1065.          return
  1066.       }
  1067.    }
  1068.    if (Spelltime1 = ""){
  1069.       notification(1, title_tibia1, "Please enter valid spell time.")
  1070.       GuiControl,, Enabled_runemaking1, 0
  1071.       Check_gui()
  1072.       return
  1073.    }
  1074.    if (rune_spellkey1 = ""){
  1075.       notification(1, title_tibia1, "Please enter valid spell key.")
  1076.       GuiControl,, Enabled_runemaking1, 0
  1077.       Check_gui()
  1078.       return
  1079.    }
  1080.    GuiControlGet, hand_mode,, hand_mode
  1081.     if ((Hand_mode = 1) and ((hand_slot_pos_x = "") or (hand_slot_pos_y = ""))){
  1082.       notification(1, title_tibia1, "Please get your hand slot position in settings.")
  1083.       GuiControl,, Enabled_runemaking1, 0
  1084.       Check_gui()
  1085.       return
  1086.    }
  1087.    if (Enabled_runemaking1 = 1){
  1088.       global planned_time1 := % A_TickCount + 5000
  1089.       SetTimer, check_runes, 1000
  1090.    }
  1091.    check_gui()
  1092. return
  1093.    
  1094.    
  1095. Enabled_runemaking2:
  1096.   GuiControlGet, Enabled_runemaking1,, Enabled_runemaking1
  1097.    GuiControlGet, Enabled_runemaking2,, Enabled_runemaking2
  1098.    GuiControlGet, Spelltime2,, Spelltime2
  1099.    GuiControlGet, rune_spellkey2,, rune_spellkey2
  1100.    IfWinNotExist, ahk_pid %pid_tibia2%
  1101.       {
  1102.       if (pid_tibia2 != ""){
  1103.          title_tibia2 := "Game client 2 - identyfied by " pid_tibia2
  1104.          WinActivate, ahk_pid %pid_tibia2%
  1105.          WinWait, ahk_pid %pid_tibia2%
  1106.          WinSetTitle, %title_tibia2%
  1107.          sleep, 50
  1108.       }
  1109.       IfWinNotExist, ahk_pid %pid_tibia2%
  1110.          {
  1111.          notification(2, title_tibia2, "Window " . title_tibia2 . " doesn't exist.")
  1112.          GuiControl,, Enabled_runemaking2, 0
  1113.          Check_gui()
  1114.          return
  1115.       }
  1116.    }
  1117.    if (Spelltime2 = ""){
  1118.       notification(1, title_tibia2, "Please enter valid spell time.")
  1119.       GuiControl,, Enabled_runemaking2, 0
  1120.       Check_gui()
  1121.       return
  1122.    }
  1123.    if (rune_spellkey2 = ""){
  1124.       notification(1, title_tibia2, "Please enter valid spell key.")
  1125.       GuiControl,, Enabled_runemaking2, 0      
  1126.       Check_gui()
  1127.       return
  1128.    }
  1129.    GuiControlGet, hand_mode,, hand_mode
  1130.    if ((Hand_mode = 1) and ((hand_slot_pos_x = "") or (hand_slot_pos_y = ""))){
  1131.       notification(1, title_tibia1, "Please get your hand slot position in settings.")
  1132.       GuiControl,, Enabled_runemaking1, 0
  1133.       Check_gui()
  1134.       return
  1135.    }
  1136.    if (Enabled_runemaking2 = 1){
  1137.       global planned_time2 := % A_TickCount + 10000
  1138.       SetTimer, check_runes, 1000
  1139.    }
  1140.    check_gui()
  1141. return
  1142.  
  1143.  
  1144. check_runes:
  1145.   GuiControlGet, Enabled_runemaking1,, Enabled_runemaking1
  1146.    GuiControlGet, Enabled_runemaking2,, Enabled_runemaking2
  1147.    if (execution_allowed = 1) and ((A_TickCount - planned_time1) > 0) and (Enabled_runemaking1 = 1)
  1148.       goto Rune_execution1
  1149.    if (execution_allowed = 1) and ((A_TickCount - planned_time2) > 0) and (Enabled_runemaking2 = 1)
  1150.       goto Rune_execution2
  1151. return
  1152.  
  1153.  
  1154. Rune_execution1:
  1155.   Critical
  1156.    global execution_allowed := 0
  1157.    BlockInput, off
  1158.    IfWinNotExist, ahk_pid %pid_tibia1%
  1159.       {
  1160.       notification(2, title_tibia1, "Window " . title_tibia1 . " doesn't exist.")
  1161.       GuiControl,, Enabled_runemaking1, 0
  1162.       Check_gui()
  1163.      
  1164.       global execution_allowed := 1
  1165.       return
  1166.    }
  1167.    GuiControlGet, Spelltime1,, Spelltime1
  1168.    global current_time1 := A_TickCount
  1169.    global deviation1 := % current_time1 - planned_time1
  1170.    global planned_time1 := % current_time1 + Spelltime1*1000 - deviation1
  1171.    runemake(title_tibia1, 1)
  1172.    sleep_random(10,100)
  1173.    check_soul(title_tibia1)
  1174.    global execution_allowed := 1
  1175. return
  1176.  
  1177. Rune_execution2:
  1178.   Critical
  1179.    global execution_allowed := 0
  1180.    BlockInput, off
  1181.    IfWinNotExist, ahk_pid %pid_tibia2%
  1182.       {
  1183.       notification(2, title_tibia2, "Window " . title_tibia2 . " doesn't exist.")
  1184.       GuiControl,, Enabled_runemaking2, 0
  1185.       Check_gui()
  1186.       global execution_allowed := 1
  1187.       return
  1188.    }
  1189.    GuiControlGet, Spelltime2,, Spelltime2
  1190.    global current_time2 := A_TickCount
  1191.    global deviation2 := % current_time2 - planned_time2
  1192.    global planned_time2 := % current_time2 + Spelltime2*1000 - deviation2
  1193.    runemake(title_tibia2, 2)
  1194.    sleep_random(10,100)
  1195.    check_soul(title_tibia2)
  1196.    global execution_allowed := 1
  1197. return
  1198.  
  1199. Enabled_food_eater1:
  1200.   GuiControlGet, Enabled_food_eater1,, Enabled_food_eater1
  1201.    GuiControlGet, Enabled_food_eater2,, Enabled_food_eater2
  1202.    GuiControlGet, food_time,, food_time
  1203.    IfWinNotExist, ahk_pid %pid_tibia1%
  1204.       {
  1205.       if (pid_tibia1 != ""){
  1206.          title_tibia1 := "Game client 1 - identyfied by " pid_tibia1
  1207.          WinActivate, ahk_pid %pid_tibia1%
  1208.          WinWait, ahk_pid %pid_tibia1%
  1209.          WinSetTitle, %title_tibia1%
  1210.          sleep, 50
  1211.       }
  1212.       IfWinNotExist, ahk_pid %pid_tibia1%
  1213.       {
  1214.          notification(2, client_id, "Window " . title_tibia1 . " doesn't exist.")
  1215.          GuiControl,, Enabled_food_eater1, 0
  1216.          check_gui()
  1217.          return
  1218.       }
  1219.    }
  1220.    if (food_time = "") or (food_time < 15) or (food_time > 2000){
  1221.       notification(1, title_tibia1, "Please enter valid food time")
  1222.       GuiControl,, Enabled_food_eater1, 0
  1223.       check_gui()
  1224.       return
  1225.    }
  1226.    if (Enabled_food_eater1 = 1){
  1227.       SetTimer, food_eater1, % food_time*1000
  1228.       GuiControl, Disable%Enabled_food_eater1%, food_time
  1229.    }
  1230.    else if ((Enabled_food_eater1 = 0) and (Enabled_food_eater1 = 0))
  1231.       GuiControl, Disable%Enabled_food_eater1%, food_time
  1232.    check_gui()
  1233. return
  1234.  
  1235. food_eater1:
  1236. IfWinNotExist, ahk_pid %pid_tibia1%
  1237.    return
  1238. GuiControlGet, Enabled_food_eater1,, Enabled_food_eater1
  1239. if (Enabled_food_eater1 = 1){
  1240.    sleep_random(10,3000)
  1241.    eat_food(title_tibia1)
  1242. }
  1243. else
  1244.    SetTimer, food_eater1, off
  1245. return
  1246.  
  1247. Enabled_food_eater2:
  1248.   GuiControlGet, Enabled_food_eater1,, Enabled_food_eater1
  1249.    GuiControlGet, Enabled_food_eater2,, Enabled_food_eater2
  1250.    GuiControlGet, food_time,, food_time
  1251.    IfWinNotExist, ahk_pid %pid_tibia2%
  1252.       {
  1253.       if (pid_tibia2 != ""){
  1254.          title_tibia2 := "Game client 2 - identyfied by " pid_tibia2
  1255.          WinActivate, ahk_pid %pid_tibia2%
  1256.          WinWait, ahk_pid %pid_tibia2%
  1257.          WinSetTitle, %title_tibia2%
  1258.          sleep, 50
  1259.       }
  1260.       IfWinNotExist, ahk_pid %pid_tibia2%
  1261.       {
  1262.          notification(2, client_id, "Window " . title_tibia2 . " doesn't exist.")
  1263.          GuiControl,, Enabled_food_eater2, 0
  1264.          check_gui()
  1265.          return
  1266.       }
  1267.    }
  1268.    if (food_time = "") or (food_time < 15) or (food_time > 2000){
  1269.       notification(1, title_tibia2, "Please enter valid food time")
  1270.       GuiControl,, Enabled_food_eater2, 0
  1271.       check_gui()
  1272.       return
  1273.    }
  1274.    if (Enabled_food_eater2 = 1){
  1275.       SetTimer, food_eater2, % food_time*1000
  1276.       GuiControl, Disable%Enabled_food_eater2%, food_time
  1277.    }
  1278.    else if ((Enabled_food_eater1 = 0) and (Enabled_food_eater1 = 0))
  1279.       GuiControl, Disable%Enabled_food_eater2%, food_time
  1280.    check_gui()
  1281.    
  1282. return
  1283.  
  1284. food_eater2:
  1285. IfWinNotExist, ahk_pid %pid_tibia2%
  1286.    return
  1287. GuiControlGet, Enabled_food_eater2,, Enabled_food_eater2
  1288. if (Enabled_food_eater2 = 1){
  1289.    sleep_random(10,3000)
  1290.    eat_food(title_tibia2)
  1291. }
  1292. else
  1293.    SetTimer, food_eater2, off
  1294. return
  1295.  
  1296. Enabled_anty_logout1:
  1297.   GuiControlGet, Enabled_anty_logout1,, Enabled_anty_logout1
  1298.    GuiControlGet, Enabled_anty_logout2,, Enabled_anty_logout2
  1299.    GuiControlGet, anty_log_time,, anty_log_time
  1300.    IfWinNotExist, ahk_pid %pid_tibia1%
  1301.       {
  1302.       if (pid_tibia1 != ""){
  1303.          title_tibia1 := "Game client 1 - identyfied by " pid_tibia1
  1304.          WinActivate, ahk_pid %pid_tibia1%
  1305.          WinWait, ahk_pid %pid_tibia1%
  1306.          WinSetTitle, %title_tibia1%
  1307.          sleep, 50
  1308.       }
  1309.       IfWinNotExist, ahk_pid %pid_tibia1%
  1310.       {
  1311.          notification(2, client_id, "Window " . title_tibia1 . " doesn't exist.")
  1312.          GuiControl,, Enabled_anty_logout1, 0
  1313.          check_gui()
  1314.          return
  1315.       }
  1316.    }
  1317.    if (anty_log_time = "") or (anty_log_time < 15) or (anty_log_time > 2000){
  1318.       notification(1, title_tibia1, "Please enter valid anty logout time.")
  1319.       GuiControl,, Enabled_anty_logout1, 0
  1320.       check_gui()
  1321.       return
  1322.    }
  1323.    if (Enabled_anty_logout1 = 1){
  1324.       SetTimer, anty_logout_timer1, % anty_log_time*1000
  1325.       GuiControl, Disable%Enabled_anty_logout1%, anty_log_time
  1326.    }
  1327.    else if ((Enabled_anty_logout1 = 0) and (Enabled_anty_logout2 = 0))
  1328.       GuiControl, Disable%Enabled_anty_logout1%, anty_log_time
  1329.    check_gui()
  1330. return
  1331.  
  1332. anty_logout_timer1:
  1333. IfWinNotExist, ahk_pid %pid_tibia1%
  1334.    return
  1335. GuiControlGet, Enabled_anty_logout1,, Enabled_anty_logout1
  1336. if (Enabled_anty_logout1 = 1){
  1337.    sleep_random(10,3000)
  1338.    anty_logout(title_tibia1)
  1339. }
  1340. else
  1341.    SetTimer, anty_logout_timer1, off
  1342. return
  1343.  
  1344. Enabled_anty_logout2:
  1345.   GuiControlGet, Enabled_anty_logout1,, Enabled_anty_logout1
  1346.    GuiControlGet, Enabled_anty_logout2,, Enabled_anty_logout2
  1347.    GuiControlGet, anty_log_time,, anty_log_time
  1348.    IfWinNotExist, ahk_pid %pid_tibia2%
  1349.       {
  1350.       if (pid_tibia2 != ""){
  1351.          title_tibia2 := "Game client 2 - identyfied by " pid_tibia2
  1352.          WinActivate, ahk_pid %pid_tibia2%
  1353.          WinWait, ahk_pid %pid_tibia2%
  1354.          WinSetTitle, %title_tibia2%
  1355.          sleep, 50
  1356.       }
  1357.       IfWinNotExist, ahk_pid %pid_tibia2%
  1358.       {
  1359.          notification(2, client_id, "Window " . title_tibia2 . " doesn't exist.")
  1360.          GuiControl,, Enabled_anty_logout2, 0
  1361.          check_gui()
  1362.          return
  1363.       }
  1364.    }
  1365.    if (anty_log_time = "") or (anty_log_time < 15) or (anty_log_time > 2000){
  1366.       notification(1, title_tibia2, "Please enter valid anty logout time.")
  1367.       GuiControl,, Enabled_anty_logout2, 0
  1368.       check_gui()
  1369.       return
  1370.    }
  1371.    if (Enabled_anty_logout2 = 1){
  1372.       SetTimer, anty_logout_timer2, % anty_log_time*1000
  1373.       GuiControl, Disable%Enabled_anty_logout2%, anty_log_time
  1374.    }
  1375.    else if ((Enabled_anty_logout1 = 0) and (Enabled_anty_logout2 = 0))
  1376.       GuiControl, Disable%Enabled_anty_logout2%, anty_log_time
  1377.    check_gui()
  1378. return
  1379.  
  1380. anty_logout_timer2:
  1381. IfWinNotExist, ahk_pid %pid_tibia2%
  1382.    return
  1383. GuiControlGet, Enabled_anty_logout2,, Enabled_anty_logout2
  1384. if (Enabled_anty_logout2 = 1){
  1385.    sleep_random(10,3000)
  1386.  
  1387.    anty_logout(title_tibia2)
  1388. }
  1389. else
  1390.    SetTimer, anty_logout_timer2, off
  1391. return
  1392.  
  1393.  
  1394.  
  1395. ; ######################################################### FUNCTIONS ##############################################################################
  1396.  
  1397.  
  1398. runemake(client_id, client_number){
  1399.    GuiControlGet, Enabled_runemaking1,, Enabled_runemaking1
  1400.    GuiControlGet, Enabled_runemaking2,, Enabled_runemaking2
  1401.    if (((client_id = title_tibia1) and (Enabled_runemaking1 = 0)) or ((client_id = title_tibia2) and (Enabled_runemaking2 = 0)))
  1402.       return
  1403.    backpack_id := "backpack" . client_number                  ; this declaration is needed for now
  1404.    rune_spellkey_id := "rune_spellkey" . client_number
  1405.    conjured_rune_id := "conjured_rune" . client_number
  1406.    house_deposit_id := "deposit_runes_" . client_number
  1407.    GuiControlGet, openNewBackpack,, openNewBackpack
  1408.    GuiControlGet, hand_mode,, hand_mode
  1409.    GuiControlGet, house_deposit,, %house_deposit_id%
  1410.    GuiControlGet, create_blank,, create_blank
  1411.    GuiControlGet, rune_spellkey,, %rune_spellkey_id%
  1412.    global mc_count
  1413.    if (create_blank = 1){
  1414.       if (find(client_id, "blank_rune", "inventory", 1, 0) = 0){
  1415.          say(client_id, blank_spellname)        
  1416.          sleep_random(1500,2000)
  1417.       }
  1418.    }
  1419.    if (openNewBackpack = 1){
  1420.       blankrune_check:
  1421.      if (find(client_id, "blank_rune", "inventory", 1, 0) = 0){
  1422.          sleep_random(100,250)
  1423.          if (find(client_id, backpack_id, "inventory", 1, 0) = 0)
  1424.             alarm(client_id, "blank_runes")
  1425.          else{
  1426.             use(client_id, backpack_id)
  1427.             sleep_random(500,1000)
  1428.             goto blankrune_check
  1429.          }
  1430.       }
  1431.    }
  1432.    if (hand_mode = 1){
  1433.       move(client_id, "blank_rune", "hand")
  1434.       sleep_random(300,500)
  1435.       if (find(client_id, "blank_rune", "hand_slot", 1, -1) = 0){
  1436.          move(client_id, "blank_rune", "hand")                              ; duplication try of move blank rune to hand
  1437.          sleep_random(300,500)
  1438.          if (find(client_id, "blank_rune", "hand_slot", 1, 0) = 0)
  1439.             notification(0, client_id, "Couldn't find blank rune on hand slot.")
  1440.       }
  1441.    }
  1442.    sleep_random(300,700)
  1443.    cast(client_id, rune_spellkey)
  1444.    sleep_random(500,800)
  1445.    if (house_deposit = 1 and hand_mode = 1){
  1446.       if (find(client_id, conjured_rune_id, "hand_slot", 1, 0) = 1){
  1447.          sleep_random(100,200)
  1448.          move(client_id, "hand", "house")
  1449.          return
  1450.       }
  1451.       else if (find(client_id, conjured_rune_id, "inventory", 1, 0) = 1){
  1452.          sleep_random(100,200)
  1453.          move(client_id, conjured_rune_id, "house")
  1454.          return
  1455.       }
  1456.       else
  1457.          notification(0, client_id, "Couldn't find conjured rune on screen. Can't throw it on desired position.")
  1458.    }
  1459.    else if (house_deposit = 1 and hand_mode = 0){
  1460.       if (find(client_id, conjured_rune_id, "inventory", 1, 0) = 1){
  1461.          sleep_random(300,700)
  1462.          move(client_id, conjured_rune_id, "house")
  1463.          return
  1464.       }
  1465.       else
  1466.          notification(0, client_id, "Couldn't find conjured rune on screen. Can't throw it on desired position.")
  1467.    }
  1468.    else if (house_deposit = 0 and hand_mode = 1){
  1469.       freeslot_check:
  1470.      if (find(client_id, "free_slot", "inventory", 1, 0) = 0){
  1471.          if (openNewBackpack = 1){
  1472.             if (find(client_id, backpack_id, "inventory", 1, 0) = 0){
  1473.                notification(0, client_id, "Couldn't find free slot.")
  1474.             }
  1475.             else{
  1476.                use(client_id, backpack_id)
  1477.                goto freeslot_check
  1478.             }
  1479.          }
  1480.          else{
  1481.             notification(0, client_id, "Couldn't find free slot.")
  1482.             return
  1483.          }
  1484.       }
  1485.       else{
  1486.          sleep_random(300,700)
  1487.          move(client_id, "hand", "free_slot")
  1488.          if (find(client_id, conjured_rune_id, "hand_slot", 1, -1) = 1)
  1489.             move(client_id, "hand", "free_slot")
  1490.          return
  1491.       }
  1492.    }
  1493.    else
  1494.       return
  1495. sleep_random(500,900)
  1496. return
  1497. }
  1498.  
  1499. check_soul(client_id){
  1500.    GuiControlGet, PauseRunemaking_IfSoul,,PauseRunemaking_IfSoul
  1501.    GuiControlGet, Logout_IfSoul,,Logout_IfSoul
  1502.    GuiControlGet, PlaySound_IfSoul,,PlaySound_IfSoul
  1503.    GuiControlGet, ShutDown_IfSoul,,ShutDown_IfSoul
  1504.    GuiControlGet, WalkMethod_IfSoul,,WalkMethod_IfSoul
  1505.    GuiControlGet, CastSpell_IfSoul,,CastSpell_IfSoul
  1506.    GuiControlGet, Flash_IfSoul,,Flash_IfSoul
  1507.    if (PauseRunemaking_IfSoul or Logout_IfSoul or PlaySound_IfSoul or ShutDown_IfSoul or CastSpell_IfSoul or Flash_IfSoul or (WalkMethod_IfSoul != "off")){
  1508.       if ((find(client_id, "soul0", "inventory", 1, 0) = 1) or (find(client_id, "soul1", "inventory", 1, 0) = 1) or (find(client_id, "soul2", "inventory", 1, 0) = 1) or (find(client_id, "soul3", "inventory", 1, 0) = 1) or (find(client_id, "soul4", "inventory", 1, 0) = 1)){
  1509.          alarm(client_id, "soul")
  1510.       }
  1511.    }
  1512. }
  1513. return
  1514.    
  1515.  
  1516. alarm(client_id, type){
  1517.    GuiControlGet, Double_alarm_screen_checker,,Double_alarm_screen_checker
  1518.    GuiControlGet, Steps_to_walk,,Steps_to_walk
  1519.    GuiControlGet, Alarms_enabled1,,Alarms_enabled1
  1520.    GuiControlGet, Alarms_enabled2,,Alarms_enabled2
  1521.    global mc_count
  1522.    ; msgbox, client_id:%client_id%`ntitle_tibia1:%title_tibia1%`n:Alarms_enabled1%Alarms_enabled1%`ntitle_tibia2:%title_tibia2%`nAlarms_enabled2:%Alarms_enabled2%
  1523.    if ((client_id = title_tibia1) and (Alarms_enabled1 = 0)) or ((client_id = title_tibia2) and (Alarms_enabled2 = 0)){
  1524.       return  
  1525.    }
  1526.    IfInString, client_id, Game client 1            
  1527.       client_number := 1
  1528.    else
  1529.       client_number := 2
  1530.     if (type = "player"){
  1531.       GuiControlGet, PauseRunemaking_IfPlayer,,PauseRunemaking_IfPlayer
  1532.       GuiControlGet, Logout_IfPlayer,,Logout_IfPlayer
  1533.       GuiControlGet, PlaySound_IfPlayer,,PlaySound_IfPlayer
  1534.       GuiControlGet, ShutDown_IfPlayer,,ShutDown_IfPlayer
  1535.       GuiControlGet, WalkMethod_IfPlayer,,WalkMethod_IfPlayer
  1536.       GuiControlGet, Flash_IfPlayer,,Flash_IfPlayer
  1537.       notification(0, client_id, "There was a change on screen-check region.")
  1538.       if (Logout_IfPlayer = 1){
  1539.          logout(client_id)
  1540.       }
  1541.       if (WalkMethod_IfPlayer != "off"){
  1542.             walk(client_id, WalkMethod_IfPlayer, steps_to_walk)
  1543.       }
  1544.       if (PlaySound_IfPlayer = 1){
  1545.          sound("Data/Sounds/alarm_screen.mp3")
  1546.       }
  1547.       if (Flash_IfPlayer = 1){
  1548.          if (transparent_tibia%client_number% = 1)
  1549.             gosub, hide_client_%client_number%
  1550.          else
  1551.             WinActivate, %client_id%
  1552.          Winget, temp_hwnd, ID, %client_id%
  1553.          Loop 8{
  1554.             DllCall( "FlashWindow", UInt,temp_hwnd, Int,True )
  1555.             Sleep 250
  1556.          }
  1557.          DllCall( "FlashWindow", UInt,temp_hwnd, Int,False )
  1558.       }
  1559.       if (PauseRunemaking_IfPlayer = 1){
  1560.          if ((Double_alarm_screen_checker = 1) and (mc_count = 2)){
  1561.             GuiControl,, Enabled_runemaking1,0
  1562.             GuiControl,, Enabled_anty_logout1,0
  1563.             GuiControl,, Enabled_food_eater1,0
  1564.             GuiControl,, Fishing_enabled1,0
  1565.             GuiControl,, Enabled_runemaking2,0
  1566.             GuiControl,, Enabled_anty_logout2,0
  1567.             GuiControl,, Enabled_food_eater2,0
  1568.             GuiControl,, Fishing_enabled2,0
  1569.             Check_gui()
  1570.          }
  1571.          else{
  1572.             GuiControl,, Enabled_runemaking%client_number%, 0
  1573.             GuiControl,, Enabled_runemaking%client_number%,0
  1574.             GuiControl,, Enabled_anty_logout%client_number%,0
  1575.             GuiControl,, Enabled_food_eater%client_number%,0
  1576.             GuiControl,, Fishing_enabled%client_number%,0
  1577.             Check_gui()
  1578.          }
  1579.       }
  1580.       if (ShutDown_IfPlayer = 1){
  1581.          shutdown()
  1582.       }
  1583.    }
  1584.    if (type = "food"){
  1585.       GuiControlGet, PauseRunemaking_IfFood,,PauseRunemaking_IfFood
  1586.       GuiControlGet, Logout_IfFood,,Logout_IfFood
  1587.       GuiControlGet, PlaySound_IfFood,,PlaySound_IfFood
  1588.       GuiControlGet, ShutDown_IfFood,,ShutDown_IfFood
  1589.       GuiControlGet, WalkMethod_IfFood,,WalkMethod_IfFood
  1590.       GuiControlGet, Flash_IfFood,,Flash_IfFood
  1591.       notification(0, client_id, "Couldn't find food in inventory.")
  1592.       if (Logout_IfFood = 1){        
  1593.          logout(client_id)
  1594.       }
  1595.       if (WalkMethod_IfFood != "off"){
  1596.             walk(client_id, WalkMethod_IfFood, steps_to_walk)
  1597.       }
  1598.       if (PlaySound_IfFood = 1){
  1599.          sound("Data/Sounds/alarm_food.mp3")
  1600.       }
  1601.       if (PauseRunemaking_IfFood = 1){
  1602.          if ((Double_alarm_screen_checker = 1) and (mc_count = 2)){
  1603.             GuiControl,, Enabled_runemaking1,0
  1604.             GuiControl,, Enabled_anty_logout1,0
  1605.             GuiControl,, Enabled_food_eater1,0
  1606.             GuiControl,, Fishing_enabled1,0
  1607.             GuiControl,, Enabled_runemaking2,0
  1608.             GuiControl,, Enabled_anty_logout2,0
  1609.             GuiControl,, Enabled_food_eater2,0
  1610.             GuiControl,, Fishing_enabled2,0
  1611.             Check_gui()
  1612.          }
  1613.          else{
  1614.             GuiControl,, Enabled_runemaking%client_number%, 0
  1615.             GuiControl,, Enabled_runemaking%client_number%,0
  1616.             GuiControl,, Enabled_anty_logout%client_number%,0
  1617.             GuiControl,, Enabled_food_eater%client_number%,0
  1618.             GuiControl,, Fishing_enabled%client_number%,0
  1619.             Check_gui()
  1620.          }
  1621.       }
  1622.       if (Flash_IfFood = 1){
  1623.          if (transparent_tibia%client_number% = 1)
  1624.             gosub, hide_client_%client_number%
  1625.          else
  1626.             WinActivate, %client_id%
  1627.          Winget, temp_hwnd, ID, %client_id%
  1628.          Loop 8{
  1629.             DllCall( "FlashWindow", UInt,temp_hwnd, Int,True )
  1630.             Sleep 250
  1631.          }
  1632.          DllCall( "FlashWindow", UInt,temp_hwnd, Int,False )
  1633.       }
  1634.       if (ShutDown_IfFood = 1){
  1635.          shutdown()
  1636.       }
  1637.    }
  1638.    if (type = "blank_runes"){
  1639.       GuiControlGet, PauseRunemaking_IfBlank,,PauseRunemaking_IfBlank
  1640.       GuiControlGet, Logout_IfBlank,,Logout_IfBlank
  1641.       GuiControlGet, PlaySound_IfBlank,,PlaySound_IfBlank
  1642.       GuiControlGet, ShutDown_IfBlank,,ShutDown_IfBlank
  1643.       GuiControlGet, WalkMethod_IfBlank,,WalkMethod_IfBlank
  1644.       GuiControlGet, CastSpell_IfBlank,,CastSpell_IfBlank
  1645.       GuiControlGet, Flash_IfBlank,,Flash_IfBlank
  1646.       notification(0, client_id, "Couldn't find blank rune in inventory.")
  1647.       if (Logout_IfBlank = 1){
  1648.          logout(client_id)
  1649.       }
  1650.       if (WalkMethod_IfBlank != "off"){
  1651.             walk(client_id, WalkMethod_IfBlank, steps_to_walk)
  1652.       }
  1653.       if (PlaySound_IfBlank = 1){
  1654.          sound("Data/Sounds/alarm_blank.mp3")
  1655.       }
  1656.       if (ShutDown_IfBlank = 1){
  1657.          shutdown()
  1658.       }
  1659.       if (PauseRunemaking_IfBlank = 1){
  1660.          if ((Double_alarm_screen_checker = 1) and (mc_count = 2)){
  1661.             GuiControl,, Enabled_runemaking1,0
  1662.             GuiControl,, Enabled_anty_logout1,0
  1663.             GuiControl,, Enabled_food_eater1,0
  1664.             GuiControl,, Fishing_enabled1,0
  1665.             GuiControl,, Enabled_runemaking2,0
  1666.             GuiControl,, Enabled_anty_logout2,0
  1667.             GuiControl,, Enabled_food_eater2,0
  1668.             GuiControl,, Fishing_enabled2,0
  1669.             Check_gui()
  1670.          }
  1671.          else{
  1672.             GuiControl,, Enabled_runemaking%client_number%, 0
  1673.             GuiControl,, Enabled_runemaking%client_number%,0
  1674.             GuiControl,, Enabled_anty_logout%client_number%,0
  1675.             GuiControl,, Enabled_food_eater%client_number%,0
  1676.             GuiControl,, Fishing_enabled%client_number%,0
  1677.             Check_gui()
  1678.          }
  1679.       }
  1680.       if (Flash_IfBlank = 1){
  1681.          if (transparent_tibia%client_number% = 1)
  1682.             gosub, hide_client_%client_number%
  1683.          else
  1684.             WinActivate, %client_id%
  1685.          Winget, temp_hwnd, ID, %client_id%
  1686.          Loop 8{
  1687.             DllCall( "FlashWindow", UInt,temp_hwnd, Int,True )
  1688.             Sleep 250
  1689.          }
  1690.          DllCall( "FlashWindow", UInt,temp_hwnd, Int,False )
  1691.       }
  1692.       if (CastSpell_IfBlank = 1){
  1693.          GuiControlGet, Spell_to_cast_name,,Spell_to_cast_name
  1694.          GuiControlGet, Spell_to_cast_count,,Spell_to_cast_count
  1695.          cast(client_id,Spell_to_cast_name)
  1696.          temp_count = 1
  1697.         ; emergency_spellcaster_blank:
  1698.          while (Spell_to_cast_count - temp_count > 0){
  1699.             sleep_random(2000,2200)
  1700.             cast(client_id,Spell_to_cast_name)
  1701.             temp_count = % temp_count + 1
  1702.         ;    goto, emergency_spellcaster_blank
  1703.          }
  1704.       }
  1705.      
  1706.       return 1
  1707.    }
  1708.    if (type = "Soul"){
  1709.       GuiControlGet, PauseRunemaking_IfSoul,,PauseRunemaking_IfSoul
  1710.       GuiControlGet, Logout_IfSoul,,Logout_IfSoul
  1711.       GuiControlGet, PlaySound_IfSoul,,PlaySound_IfSoul
  1712.       GuiControlGet, ShutDown_IfSoul,,ShutDown_IfSoul
  1713.       GuiControlGet, WalkMethod_IfSoul,,WalkMethod_IfSoul
  1714.       GuiControlGet, Flash_IfSoul,,Flash_IfSoul
  1715.       notification(0, client_id, "Bot recognized lack of soul points.")
  1716.       if (Logout_IfSoul = 1){
  1717.          logout(client_id)
  1718.       }
  1719.       if (WalkMethod_IfSoul != "off"){
  1720.             walk(client_id, WalkMethod_IfSoul, steps_to_walk)
  1721.       }
  1722.       if (PlaySound_IfSoul = 1){
  1723.          sound("Data/Sounds/alarm_soul.mp3")
  1724.       }
  1725.       if (ShutDown_IfSoul = 1){
  1726.          shutdown()
  1727.       }
  1728.       if (PauseRunemaking_IfSoul = 1){
  1729.          if ((Double_alarm_screen_checker = 1) and (mc_count = 2)){
  1730.             GuiControl,, Enabled_runemaking1,0
  1731.             GuiControl,, Enabled_anty_logout1,0
  1732.             GuiControl,, Enabled_food_eater1,0
  1733.             GuiControl,, Fishing_enabled1,0
  1734.             GuiControl,, Enabled_runemaking2,0
  1735.             GuiControl,, Enabled_anty_logout2,0
  1736.             GuiControl,, Enabled_food_eater2,0
  1737.             GuiControl,, Fishing_enabled2,0
  1738.             Check_gui()
  1739.          }
  1740.          else{
  1741.             GuiControl,, Enabled_runemaking%client_number%, 0
  1742.             GuiControl,, Enabled_runemaking%client_number%,0
  1743.             GuiControl,, Enabled_anty_logout%client_number%,0
  1744.             GuiControl,, Enabled_food_eater%client_number%,0
  1745.             GuiControl,, Fishing_enabled%client_number%,0
  1746.             Check_gui()
  1747.          }
  1748.       }
  1749.       if (Flash_IfSoul = 1){
  1750.          if (transparent_tibia%client_number% = 1)
  1751.             gosub, hide_client_%client_number%
  1752.          else
  1753.             WinActivate, %client_id%
  1754.          Winget, temp_hwnd, ID, %client_id%
  1755.          Loop 8{
  1756.             DllCall( "FlashWindow", UInt,temp_hwnd, Int,True )
  1757.             Sleep 250
  1758.          }
  1759.          DllCall( "FlashWindow", UInt,temp_hwnd, Int,False )
  1760.       }
  1761.       if (CastSpell_IfSoul = 1){
  1762.          GuiControlGet, Spell_to_cast_name,,Spell_to_cast_name
  1763.          GuiControlGet, Spell_to_cast_count,,Spell_to_cast_count
  1764.          cast(client_id,Spell_to_cast_name)
  1765.          temp_count = 1
  1766.     ;     emergency_spellcaster_soul:
  1767.          while (Spell_to_cast_count - temp_count > 0){
  1768.             sleep_random(2000,2200)
  1769.             cast(client_id,Spell_to_cast_name)
  1770.             temp_count = % temp_count + 1
  1771.        ;     goto, emergency_spellcaster_soul
  1772.          }
  1773.       }
  1774.    }
  1775. }
  1776. return
  1777.  
  1778.  
  1779. cast(client_id, key){                          ;  don't need window to be active
  1780.    ControlSend,,{%key%}, %client_id%
  1781. }
  1782. return
  1783.  
  1784.  
  1785. say(client_id,text){                          ;  don't need window to be active
  1786.    BlockInput, On
  1787.    ControlSend,,{enter}, %client_id%
  1788.    ControlSend,, %text%, %client_id%
  1789.    BlockInput, off
  1790.    sleep_random(70,150)
  1791.    BlockInput, on
  1792.    ControlSend,, {Enter}, %client_id%
  1793.    BlockInput, Off
  1794. }
  1795. return
  1796.  
  1797. eat_food(client_id){
  1798.    GuiControlGet, Enabled_runemaking1,, Enabled_runemaking1
  1799.    GuiControlGet, Enabled_runemaking2,, Enabled_runemaking2
  1800.    GuiControlGet, eat_using_hotkey,, eat_using_hotkey
  1801.    GuiControlGet, eat_hotkey,, eat_hotkey
  1802.    GuiControlGet, food_time,, food_time
  1803. ;   if (((client_id = title_tibia1) and (Enabled_runemaking1 = 0)) or ((client_id = title_tibia2) and (Enabled_runemaking2 = 0)))
  1804.  ;     return
  1805.    if (eat_using_hotkey = 1){
  1806.       cast(client_id, eat_hotkey)
  1807.       sleep_random(500, 800)
  1808.       cast(client_id, eat_hotkey)
  1809.       sleep_random(500, 800)
  1810.       cast(client_id, eat_hotkey)
  1811.       sleep_random(500, 800)
  1812.       return
  1813.    }
  1814.    else{
  1815.       sleep_random(50,100)
  1816.       if (find(client_id, "food1", "inventory", 1, 0) = 1){
  1817.          use(client_id, "food1")
  1818.          sleep_random(200,500)
  1819.          use(client_id, "food1")
  1820.          sleep_random(200,500)
  1821.          use(client_id, "food1")
  1822.          sleep_random(200,500)
  1823.       }
  1824.       else if (find(client_id, "food2", "inventory", 1, 0) = 1){
  1825.          use(client_id, "food2")
  1826.          sleep_random(200,500)
  1827.          use(client_id, "food2")
  1828.          sleep_random(200,500)
  1829.          use(client_id, "food2")
  1830.          sleep_random(200,500)
  1831.       }
  1832.       else if (find(client_id, "fish", "inventory", 1, 0) = 1){
  1833.          use(client_id, "fish")
  1834.          sleep_random(200,500)
  1835.          use(client_id, "fish")
  1836.          sleep_random(200,500)
  1837.          use(client_id, "fish")
  1838.          sleep_random(200,500)
  1839.       }
  1840.       else
  1841.          alarm(client_id, "food")
  1842.    }
  1843. }
  1844. return
  1845.  
  1846.  
  1847.  
  1848. anty_logout(client_id){                       ;  don't need window to be active
  1849.    GuiControlGet, Enabled_anty_logout1,, Enabled_anty_logout1
  1850.    GuiControlGet, Enabled_anty_logout2,, Enabled_anty_logout2
  1851.    GuiControlGet, Anty_log_dir1,, Anty_log_dir1
  1852.    GuiControlGet, Anty_log_dir2,, Anty_log_dir2
  1853.    if (((client_id = title_tibia1) and (Enabled_anty_logout1 = 0)) or ((client_id = title_tibia2) and (Enabled_anty_logout2 = 0)))
  1854.       return
  1855.    GuiControlGet, anty_log,,anty_log
  1856.    if anty_log = 0
  1857.       return
  1858.    if (((Anty_log_dir1 != "") and (Anty_log_dir2 != "")) and (Anty_log_dir1 != Anty_log_dir2)){
  1859.       if Anty_log_dir1 = n
  1860.          direction1 = up
  1861.       if Anty_log_dir1 = e
  1862.          direction1 = right
  1863.       if Anty_log_dir1 = s
  1864.          direction1 = down
  1865.       if Anty_log_dir1 = w
  1866.          direction1 = left
  1867.       if Anty_log_dir2 = n
  1868.          direction2 = up
  1869.       if Anty_log_dir2 = e
  1870.          direction2 = right
  1871.       if Anty_log_dir2 = s
  1872.          direction2 = down
  1873.       if Anty_log_dir2 = w
  1874.          direction2 = left
  1875.    }
  1876.    else{
  1877.       direction1 = up
  1878.       direction2 = down
  1879.    }
  1880.    KeyWait, Up
  1881.    KeyWait, Down
  1882.    KeyWait, Right
  1883.    KeyWait, Left
  1884.    BlockInput, On
  1885.    sleep_random(15,30)
  1886.    ControlSend,, {Ctrl down}, %client_id%
  1887.    sleep_random(45,70)
  1888.    ControlSend,, {%direction1%}, %client_id%
  1889.    sleep_random(15,30)
  1890.    ControlSend,, {Ctrl up}, %client_id%
  1891.    BlockInput, Off
  1892.    sleep_random(500,900)
  1893.    KeyWait, Up
  1894.    KeyWait, Down
  1895.    KeyWait, Right
  1896.    KeyWait, Left
  1897.    BlockInput, On
  1898.    sleep_random(15,30)
  1899.    ControlSend,, {Ctrl down}, %client_id%
  1900.    sleep_random(45,70)
  1901.    ControlSend,, {%direction2%}, %client_id%
  1902.    sleep_random(15,30)
  1903.    ControlSend,, {Ctrl up}, %client_id%
  1904.    BlockInput, Off
  1905.    sleep_random(500,900)
  1906. }
  1907. return
  1908.  
  1909. move(client_id,object,destination){
  1910.    IfWinNotExist, %client_id%
  1911.    {
  1912.       notification(2, client_id, "Window " . client_id . " doesn't exist.")
  1913.       return
  1914.      
  1915.    }
  1916.    global item_pos_x
  1917.    global item_pos_y  
  1918.    Random, random_pos_x, -randomization, randomization
  1919.    Random, random_pos_y, -randomization, randomization
  1920.    sleep 10
  1921.    if (object = "hand"){
  1922.       GuiControlGet, hand_slot_pos_x,, hand_slot_pos_x
  1923.       GuiControlGet, hand_slot_pos_y,, hand_slot_pos_y
  1924.       object_pos_x := hand_slot_pos_x + random_pos_x
  1925.       object_pos_y := hand_slot_pos_y + random_pos_y
  1926.    }
  1927.    else{
  1928.       find(client_id, object, "inventory", 1, 1)
  1929.       object_pos_x := item_pos_x + random_pos_x
  1930.       object_pos_y := item_pos_y + random_pos_y
  1931.    }
  1932.    if (destination = "house"){
  1933.       IfInString, client_id, Game client 1            
  1934.          client_number := 1
  1935.       else
  1936.          client_number := 2
  1937.       GuiControlGet, house_pos_x,, house_pos_x%client_number%
  1938.       GuiControlGet, house_pos_y,, house_pos_y%client_number%
  1939.       destination_pos_x := house_pos_x + random_pos_x
  1940.       destination_pos_y := house_pos_y + random_pos_y
  1941.    }
  1942.    if (destination = "hand"){
  1943.       GuiControlGet, hand_slot_pos_x,, hand_slot_pos_x
  1944.       GuiControlGet, hand_slot_pos_y,, hand_slot_pos_y
  1945.       destination_pos_x := hand_slot_pos_x + random_pos_x
  1946.       destination_pos_y := hand_slot_pos_y + random_pos_y
  1947.    }
  1948.    if (destination = "free_slot"){
  1949.       find(client_id, "free_slot", "inventory", 1, 1)
  1950.       destination_pos_x := item_pos_x + random_pos_x
  1951.       destination_pos_y := item_pos_y + random_pos_y
  1952.    }
  1953.    if ((object_pos_x != "") and (object_pos_y != "") and (destination_pos_x != "") and (destination_pos_y != "")){
  1954.       object_pos_y := object_pos_y - 25
  1955.       destination_pos_y := destination_pos_y - 25
  1956.       KeyWait, LButton
  1957.       KeyWait, RButton
  1958.       ;;BlockInput, MouseMove
  1959.       ;Hotkey, LButton, do_nothing, On
  1960.       BlockInput, on ;Hotkey, RButton, do_nothing, On
  1961.       sleep_random(5, 10)
  1962.       if (Bot_protection = 1)
  1963.          DllCall("Data\mousehook64.dll\dragDrop", "AStr", client_id, "INT", false, "INT", object_pos_x, "INT", object_pos_y, "INT", destination_pos_x, "INT", destination_pos_y)
  1964.       else
  1965.          DllCall("Data\mousehook64.dll\dragDrop", "AStr", client_id, "INT", true, "INT", object_pos_x, "INT", object_pos_y, "INT", destination_pos_x, "INT", destination_pos_y)
  1966.       sleep_random(5, 10)
  1967.       BlockInput, Off
  1968.       ;Hotkey, LButton, do_nothing, Off
  1969.       ;Hotkey, RButton, do_nothing, Off
  1970.       ;;BlockInput, MouseMoveOff
  1971.       Sleep_random(150, 180)
  1972.    }
  1973.    else
  1974.       notification(1, client_id, "There was a problem with position in function move()")
  1975. }
  1976. return
  1977.  
  1978. do_nothing:
  1979. return
  1980.  
  1981.  
  1982. use(client_id, object){
  1983.    IfWinNotExist, %client_id%
  1984.    {
  1985.        notification(2, client_id, "Window " . client_id . " doesn't exist.")
  1986.       return
  1987.    }
  1988.    global item_pos_x
  1989.    global item_pos_y
  1990.    if ((object = "blank_rune") or (object = "conjured_rune1") or (object = "conjured_rune2") or (object = "free_slot") or (object = "food1") or (object = "food2") or (object = "backpack1") or (object = "backpack2")){
  1991.       region = "inventory"
  1992.    }
  1993.    else
  1994.       region = "screen"
  1995.    find(client_id, object, region, 1, 0)
  1996.    if ((item_pos_x != "") and (item_pos_y != "")){
  1997.       KeyWait, LButton
  1998.       KeyWait, RButton
  1999.       ;BlockInput, Mouse
  2000.       ;Hotkey, LButton, do_nothing, On
  2001.       BlockInput, on ;Hotkey, RButton, do_nothing, On
  2002. ;      Sleep_random(40, 60)
  2003.       item_pos_y := item_pos_y - 35
  2004.       DllCall("Data\mousehook64.dll\RightClick", "AStr", client_id, "INT", item_pos_x, "INT", item_pos_y)
  2005.       Sleep_random(15, 30)
  2006.       ;Hotkey, LButton, do_nothing, Off
  2007.       ;Hotkey, RButton, do_nothing, Off
  2008.       BlockInput, Off
  2009.    }
  2010.    else
  2011.       notification(1, client_id, "There was a problem in use " . object . " on position x(empty) y(empty).")
  2012. }
  2013. return
  2014.  
  2015.  
  2016.  
  2017. logout(client_id){
  2018.    GuiControlGet, Double_alarm_screen_checker,,Double_alarm_screen_checker
  2019.    global mc_count
  2020.    if ((Double_alarm_screen_checker == 1) and (mc_count == 2)){
  2021.       BlockInput, On
  2022.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia1%
  2023.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia2%
  2024.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia1%
  2025.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia2%
  2026.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia1%
  2027.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia2%
  2028.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia1%
  2029.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %title_tibia2%
  2030.       BlockInput, Off
  2031.    }
  2032.    else{
  2033.       BlockInput, On
  2034.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %client_id%
  2035.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %client_id%
  2036.       ControlSend,, {Ctrl down}{l}{Ctrl up}, %client_id%
  2037.       BlockInput, Off
  2038.    }
  2039.    ; msgbox, %Double_alarm_screen_checker%, %mc_count%, %title_tibia1%, %title_tibia2%, %client_id%
  2040. }
  2041.  
  2042.  
  2043. return
  2044.  
  2045.  
  2046. sound(file_dir){
  2047.    SoundPlay, %file_dir%
  2048. }
  2049. return
  2050.  
  2051.  
  2052. walk(client_id, walk_dir, steps){
  2053.    local i := 0
  2054.    IniRead, mc_count, Data/basic_settings.ini, initialization data, last_used_mc_count
  2055.    GuiControlGet, Double_alarm_screen_checker,,Double_alarm_screen_checker
  2056.    
  2057.    if walk_dir = North
  2058.       arrow_to_press := "Up"
  2059.    else if walk_dir = East
  2060.       arrow_to_press := "Right"
  2061.    else if walk_dir = West
  2062.       arrow_to_press := "Left"
  2063.    else
  2064.       arrow_to_press := "Down"
  2065.    
  2066.   ; walk_label:                                    
  2067.    while (i < steps){
  2068.       if ((Double_alarm_screen_checker = 1) and (mc_count = 2)){
  2069.          ControlSend,,{%arrow_to_press%}, %title_tibia1%
  2070.          sleep_random(90,100)
  2071.          ControlSend,,{%arrow_to_press%}, %title_tibia2%
  2072.       }
  2073.       else
  2074.          ControlSend,,{%arrow_to_press%}, %client_id%
  2075.       sleep_random(200, 250)
  2076.       i++
  2077.  ;     goto, walk_label
  2078.    }
  2079. }
  2080.  
  2081. return
  2082.  
  2083. shutdown(){
  2084.  ;  pause("on", 1)
  2085.    shutdown, 1 ; Temporarly 1, in final version should be 4+1 = 5   (1 - shutdown, 4 - force)
  2086. }
  2087. return
  2088.  
  2089.  
  2090. sleep_random(min, max){
  2091.    random, delay, %min%, %max%
  2092.    sleep, %delay%
  2093. }
  2094. return
  2095.  
  2096. pause(){
  2097.    global paused
  2098.    if (paused = 0){
  2099.       GuiControlGet, rm1,, Enabled_runemaking1
  2100.       GuiControlGet, al1,, Enabled_anty_logout1
  2101.       GuiControlGet, fe1,, Enabled_food_eater1
  2102.       GuiControlGet, fi1,, Fishing_enabled1
  2103.       GuiControlGet, a1,, Alarms_enabled1
  2104.       GuiControlGet, rm2,, Enabled_runemaking2
  2105.       GuiControlGet, al2,, Enabled_anty_logout2
  2106.       GuiControlGet, fe2,, Enabled_food_eater2
  2107.       GuiControlGet, fi2,, Fishing_enabled2
  2108.       GuiControlGet, a2,, Alarms_enabled2
  2109.       GuiControl,, Enabled_runemaking1,0
  2110.       GuiControl,, Enabled_anty_logout1,0
  2111.       GuiControl,, Enabled_food_eater1,0
  2112.       GuiControl,, Fishing_enabled1,0
  2113.       GuiControl,, Alarms_enabled1,0
  2114.       GuiControl,, Enabled_runemaking2,0
  2115.       GuiControl,, Enabled_anty_logout2,0
  2116.       GuiControl,, Enabled_food_eater2,0
  2117.       GuiControl,, Fishing_enabled2,0
  2118.       GuiControl,, Alarms_enabled2,0
  2119.       GuiControl,Disabled, Enabled_runemaking1
  2120.       GuiControl,Disabled, Enabled_anty_logout1
  2121.       GuiControl,Disabled, Enabled_food_eater1
  2122.       GuiControl,Disabled, Fishing_enabled1
  2123.       GuiControl,Disabled, Alarms_enabled1
  2124.       GuiControl,Disabled, Enabled_runemaking2
  2125.       GuiControl,Disabled, Enabled_anty_logout2
  2126.       GuiControl,Disabled, Enabled_food_eater2
  2127.       GuiControl,Disabled, Fishing_enabled2
  2128.       GuiControl,Disabled, Alarms_enabled2
  2129.       WinSetTitle, ahk_id %MainBotWindow%,,Warlock Bot - paused
  2130.       paused := 1
  2131.    }
  2132.    else{
  2133.       GuiControl,, Enabled_runemaking1,%rm1%
  2134.       GuiControl,, Enabled_anty_logout1,%al1%
  2135.       GuiControl,, Enabled_food_eater1,%fe1%
  2136.       GuiControl,, Fishing_enabled1,%fi1%
  2137.       GuiControl,, Alarms_enabled1,%a1%
  2138.       GuiControl,, Enabled_runemaking2,%rm2%
  2139.       GuiControl,, Enabled_anty_logout2,%al2%
  2140.       GuiControl,, Enabled_food_eater2,%fe2%
  2141.       GuiControl,, Fishing_enabled2,%fi2%
  2142.       GuiControl,, Alarms_enabled2,%a2%
  2143.       GuiControl,Enabled, Enabled_runemaking1
  2144.       GuiControl,Enabled, Enabled_anty_logout1
  2145.       GuiControl,Enabled, Enabled_food_eater1
  2146.       GuiControl,Enabled, Fishing_enabled1
  2147.       GuiControl,Enabled, Alarms_enabled1
  2148.       GuiControl,Enabled, Enabled_runemaking2
  2149.       GuiControl,Enabled, Enabled_anty_logout2
  2150.       GuiControl,Enabled, Enabled_food_eater2
  2151.       GuiControl,Enabled, Fishing_enabled2
  2152.       GuiControl,Enabled, Alarms_enabled2
  2153.       WinSetTitle, ahk_id %MainBotWindow%,,Warlock Bot
  2154.       paused := 0
  2155.    }
  2156.    GuiControlGet, Spelltime1,, Spelltime1
  2157.    GuiControlGet, Spelltime2,, Spelltime2
  2158.    if ((A_TickCount - planned_time1) > Spelltime1*1000){
  2159.       global planned_time1 := % A_TickCount + 1000
  2160.    }
  2161.    if ((A_TickCount - planned_time2) > Spelltime2*1000){
  2162.       global planned_time2 := % A_TickCount + 4000
  2163.    }
  2164. }
  2165. return
  2166.  
  2167.  
  2168. notification(emergency_level, client_id, text){
  2169.    if emergency_level < 0
  2170.       return
  2171.    GuiControlGet, show_notifications,, show_notifications
  2172.    if ((show_notifications = "always") or (show_notifications = "only important" and emergency_level >= 1) or (show_notifications = "never" and emergency_level = 2)){
  2173.       global old_text
  2174.       global notification_isbeing_show
  2175.       if (notification_isbeing_show = 1) and (old_text != text)
  2176.          TrayTip, %client_id%, %old_text%`n%text%
  2177.       else
  2178.          TrayTip, %client_id%, %text%
  2179.       SetTimer, RemoveTrayTip, 4500
  2180.       global notification_isbeing_show := 1
  2181.       global old_text := text
  2182.    }
  2183. }
  2184. return
  2185.  
  2186. RemoveTrayTip:
  2187. SetTimer, RemoveTrayTip, Off
  2188. global notification_isbeing_show := 0
  2189. global old_text := ""
  2190. TrayTip
  2191. return
  2192.  
  2193.  
  2194. find(client_id, object, region, center, notification){
  2195.    IfWinNotExist, %client_id%
  2196.       {
  2197.          notification(2, client_id, "Window " . client_id . " doesn't exist.")
  2198.          return
  2199.       }
  2200.    global image_name := A_WorkingDir . "\Data\Images\" . object . ".bmp"
  2201.    if ( region = "inventory" ){
  2202.       start_x := 0 ; % 3*A_ScreenWidth/4
  2203.       start_y := 0
  2204.       end_x := 0
  2205.       end_y := 0
  2206.    }
  2207.    else if ( region = "hand_slot" ){
  2208.       GuiControlGet, hand_slot_pos_x,, hand_slot_pos_x
  2209.       GuiControlGet, hand_slot_pos_y,, hand_slot_pos_y
  2210.       start_x := % hand_slot_pos_x - 20
  2211.       start_y := % hand_slot_pos_y - 20
  2212.       end_x := % hand_slot_pos_x + 30
  2213.       end_y := % hand_slot_pos_y + 30
  2214.    }
  2215.    else{
  2216.       start_x := 0
  2217.       start_y := 0
  2218.       end_x := 0
  2219.       end_y := 0
  2220.    }
  2221.    CoordMode, Mouse, Screen
  2222.    WinGet, client_HWND, ID, %client_id%
  2223.    bmpArea := Gdip_BitmapFromHWND(client_HWND)
  2224.    bmpObject := Gdip_CreateBitmapFromFile(image_name)
  2225.    RET := Gdip_ImageSearch(bmpArea,bmpObject, OutputList, start_x, start_y, 0, 0) ;, start_x, start_y, end_x, end_y)
  2226.    Gdip_DisposeImage(bmpObject)
  2227.    Gdip_DisposeImage(bmpArea)
  2228.    Sleep, 150
  2229.    if (RET != 1){
  2230.       notification(notification, client_id, "Couldn't find " . object . " on " . region . ". (Ret: " . RET ")")
  2231.       global item_pos_x := ""
  2232.       global item_pos_y := ""
  2233.       ; msgbox,,Test board, RET: %RET%,`n object: %object%,`n region: %region%,`n OutputList: %OutputList%,`n object_pos_x: %object_pos_x%,`n object_pos_y: %object_pos_y%,`n item_pos_x: %item_pos_x%,`n item_pos_y: %item_pos_y%
  2234.       return 0
  2235.    }
  2236.    else{
  2237.       sleep, 100
  2238.       StringGetPos, Comma_pos, OutputList, `,
  2239.       StringLen, OutputLen, OutputList
  2240.       Comma_pos_y := Comma_pos + 1
  2241.       Comma_pos_x := OutputLen - Comma_pos
  2242.       StringTrimRight, object_pos_x, OutputList, Comma_pos_x
  2243.       StringTrimLeft, object_pos_y, OutputList, Comma_pos_y
  2244.       global item_pos_x := object_pos_x
  2245.       global item_pos_y := object_pos_y
  2246.       if ( region = "hand_slot" and ((item_pos_x > end_x) or (item_pos_y > end_y))){
  2247.          notification(notification, client_id, "Couldn't find " . object . " on " . region . ".")
  2248.          global item_pos_x := ""
  2249.          global item_pos_y := ""
  2250.          ; msgbox,,Test board, RET: %RET%,`n object: %object%,`n region: %region%,`n OutputList: %OutputList%,`n object_pos_x: %object_pos_x%,`n object_pos_y: %object_pos_y%,`n item_pos_x: %item_pos_x%,`n item_pos_y: %item_pos_y%
  2251.       return 0
  2252.       }
  2253.       if (center = 1){                                    
  2254.          pBM := Gdip_CreateBitmapFromFile( image_name )                
  2255.          image_width := Gdip_GetImageWidth( pBM )
  2256.          image_height := Gdip_GetImageHeight( pBM )  
  2257.          Gdip_DisposeImage( pBM )                                          
  2258.          global item_pos_x := % Round(object_pos_x + image_width/2)
  2259.          global item_pos_y := % Round(object_pos_y + image_height/2)
  2260.       }
  2261.       ; msgbox,,Test board, RET: %RET%,`n object: %object%,`n region: %region%,`n OutputList: %OutputList%,`n object_pos_x: %object_pos_x%,`n object_pos_y: %object_pos_y%,`n item_pos_x: %item_pos_x%,`n item_pos_y: %item_pos_y%
  2262.       return 1
  2263.    }
  2264. }
  2265. return
  2266.  
  2267.  
  2268.  
  2269. find_instances(client_id, object, notification, return_list := 0){
  2270.    IfWinNotExist, %client_id%
  2271.       {
  2272.          notification(notification, client_id, "Window " . client_id . " doesn't exist.")
  2273.          return
  2274.       }
  2275.    global image_name := A_WorkingDir . "\Data\Images\" . object . ".bmp"
  2276.    CoordMode, Mouse, Screen
  2277.    WinGet, client_HWND, ID, %client_id%
  2278.    bmpArea := Gdip_BitmapFromHWND(client_HWND)
  2279.    bmpObject := Gdip_CreateBitmapFromFile(image_name)
  2280.    RET := Gdip_ImageSearch(bmpArea,bmpObject,OutputList, 0, 0, 0, 0,,,,0)
  2281.    Gdip_DisposeImage(bmpObject)
  2282.    Gdip_DisposeImage(bmpArea)
  2283.    Sleep, 150
  2284.    if (RET > 200 or RET < 0){
  2285.       notification(1, client_id, "Couldn't find count of instances of" . object . " on " . region . ". (Ret: " . RET ")")
  2286.       return 0
  2287.    }
  2288.    if (return_list)
  2289.       return OutputList
  2290.    else
  2291.       return RET
  2292. }
  2293.  
  2294.  
  2295.  
  2296.  
  2297. take_screenshot(filename, width, height){
  2298.    global screenshooter_active
  2299.    if screenshooter_active = 1
  2300.       return
  2301.    screenshooter_active = 1
  2302.    global img_filename := filename
  2303.    global img_width := width
  2304.    global img_height := height
  2305.    Gui, Screenshoot_window: Show, AutoSize xCenter yCenter
  2306.    text := "Take screenshoot of " . img_filename
  2307.    GuiControl,Screenshoot_window:, Text_to_display, %text%
  2308.    CoordMode, Mouse, Screen
  2309.    MouseGetPos, actual_pos_x, actual_pos_y
  2310.    actual_pos_x = % actual_pos_x - img_width/2
  2311.    actual_pos_y = % actual_pos_y - img_height/2
  2312.    Gui, screen_box: Show, w%img_width% h%img_height% x%actual_pos_x% y%actual_pos_y% NoActivate, ScreenBoxID
  2313.    sleep, 20
  2314.    SetTimer, move_box, 50
  2315. ;   Winget, winstatus_MainBotWindow, minmax, ahk_id %MainBotWindow%
  2316. ;   if winstatus_MainBotWindow != -1
  2317.       WinMinimize, ahk_id %MainBotWindow%
  2318.    Hotkey, LButton, take_screen_shot, On
  2319.    Hotkey, Esc, take_screen_shot_off, On
  2320. }
  2321. return
  2322.  
  2323. move_box:
  2324.   MouseGetPos, even_more_actual_pos_x, even_more_actual_pos_y
  2325.    even_more_actual_pos_x = % even_more_actual_pos_x - img_width/2
  2326.    even_more_actual_pos_y = % even_more_actual_pos_y - img_height/2
  2327.    WinMove, ScreenBoxID,, %even_more_actual_pos_x%, %even_more_actual_pos_y%
  2328. return
  2329.  
  2330. take_screen_shot:
  2331.   CoordMode, Mouse, Screen
  2332.    MouseGetPos, ss_x, ss_y
  2333.    ess_x := % ss_x - img_width/2  + 1
  2334.    ess_y := % ss_y - img_height/2  + 1
  2335.    Hotkey, LButton, take_screen_shot, Off
  2336.    SetTimer, move_box, Off
  2337.    Gui, screen_box: Cancel
  2338.    outfile := "Data\Images\" . img_filename . ".bmp"
  2339.    pic_name := "pic_" . img_filename
  2340.    Area := ess_x "|" ess_y "|" img_width "|" img_height
  2341.    pToken := Gdip_Startup()
  2342.    pBitmap := Gdip_BitmapFromScreen(Area)
  2343.    Gdip_SaveBitmapToFile(pBitmap, outfile, 100)
  2344.    Gdip_DisposeImage(pBitmap)
  2345.    ; Gdip_Shutdown(pToken)
  2346.    Gui, Screenshoot_window: Hide
  2347.    notification(0, "Succes!", "Item saved as " . outfile . ".")
  2348.    if (img_filename = "area_check1"){
  2349.       WinActivate, ahk_id %MainBotWindow%
  2350.       global area_start_x1 := round(ess_x)
  2351.       global area_start_y1 := round(ess_y)
  2352.       GuiControl,, Image_screen_checker1, %outfile%
  2353.       global sc_temp_img_dir1 = % outfile
  2354.       bmparea_check1 := Gdip_CreateBitmapFromFile(outfile)
  2355.    }
  2356.    else if (img_filename = "area_check2"){
  2357.       WinActivate, ahk_id %MainBotWindow%
  2358.       global area_start_x2 := round(ess_x)
  2359.       global area_start_y2 := round(ess_y)
  2360.       GuiControl,, Image_screen_checker2, %outfile%
  2361.       global sc_temp_img_dir2 = % outfile
  2362.       bmparea_check2 := Gdip_CreateBitmapFromFile(outfile)
  2363.    }
  2364.    else if (img_filename = "fishing_rod"){
  2365.       GuiControl, Fishing_gui1:, fishing_rod1, %outfile%
  2366.       GuiControl, Fishing_gui2:, fishing_rod2, %outfile%
  2367.    }
  2368.    else if (img_filename = "fish"){
  2369.       GuiControl, Fishing_gui1:, fish1, %outfile%
  2370.       GuiControl, Fishing_gui2:, fish2, %outfile%
  2371.    }
  2372.    else{
  2373.       WinActivate, ahk_id %MainBotWindow%
  2374.       GuiControl,, %img_filename%, %outfile%
  2375.    }
  2376.    global screenshooter_active := 0
  2377. return
  2378.  
  2379. take_screen_shot_off:
  2380.   Hotkey, LButton, take_screen_shot, Off
  2381.    Hotkey, Esc, take_screen_shot_off, Off
  2382.    Gui, Screenshoot_window: Hide
  2383.    Gui, screen_box: Cancel
  2384.    SetTimer, move_box, Off
  2385.    if (img_filename != "fishing_rod") and (img_filename != "fish")
  2386.       WinActivate, ahk_id %MainBotWindow%
  2387.    global screenshooter_active := 0
  2388. return
  2389.  
  2390. Take_image_fishing_rod1:
  2391.   hide_sqmnet_fishing()
  2392.    take_screenshot("fishing_rod", 28, 28)
  2393. return
  2394. Take_image_fishing_rod2:
  2395.   hide_sqmnet_fishing()
  2396.    take_screenshot("fishing_rod", 28, 28)
  2397. return
  2398. Take_image_fish1:
  2399.   hide_sqmnet_fishing()
  2400.    take_screenshot("fish", 10, 10)
  2401. return
  2402. Take_image_fish2:
  2403.   hide_sqmnet_fishing()
  2404.    take_screenshot("fish", 10, 10)
  2405. return
  2406. Take_image_conjured_rune1:
  2407.   take_screenshot("conjured_rune1", 28, 28)
  2408. return
  2409. Take_image_conjured_rune2:
  2410.   take_screenshot("conjured_rune2", 28, 28)
  2411. return
  2412. Take_image_backpack1:
  2413.   take_screenshot("backpack1", 28, 28)
  2414. return
  2415. Take_image_backpack2:
  2416.   take_screenshot("backpack2", 28, 28)
  2417. return
  2418. Take_image_food1:
  2419.   take_screenshot("food1", 10, 10)
  2420. return
  2421. Take_image_food2:
  2422.   take_screenshot("food2", 10, 10)
  2423. return
  2424. Take_image_blank_rune:
  2425.   take_screenshot("blank_rune", 28, 28)
  2426. return
  2427. Take_image_free_slot:
  2428.   take_screenshot("free_slot", 32, 32)         ; 38 prev iously
  2429. return
  2430.  
  2431. getpos_hand_slot:
  2432.   IfWinNotExist, ahk_pid %pid_tibia1%
  2433.       {
  2434.          IfWinNotExist, ahk_pid %pid_tibia2%
  2435.             {
  2436.             notification(1,"Get hand slot position tool", "None of clients does work.")
  2437.             return
  2438.          }
  2439.          else{
  2440.             if (transparent_tibia2 = 1)
  2441.                gosub, hide_client_2
  2442.             WinMinimize, ahk_id %MainBotWindow%
  2443.             WinActivate, ahk_pid %pid_tibia2%
  2444.             WinWait, ahk_pid %pid_tibia2%
  2445.             SetSystemCursor("IDC_CROSS")
  2446.             Hotkey, LButton, mouse_getpos_hand_slot, on
  2447.             return
  2448.          }
  2449.    }
  2450.    if (transparent_tibia1 = 1)
  2451.       gosub, hide_client_1
  2452.    WinMinimize, ahk_id %MainBotWindow%
  2453.    WinActivate, ahk_pid %pid_tibia1%
  2454.    WinWait, ahk_pid %pid_tibia1%
  2455.    SetSystemCursor("IDC_CROSS")
  2456.    Hotkey, LButton, mouse_getpos_hand_slot, on
  2457. return
  2458.  
  2459. mouse_getpos_hand_slot:
  2460.   MouseGetPos, hand_slot_pos_x, hand_slot_pos_y
  2461.    Hotkey, LButton, mouse_getpos_hand_slot, Off
  2462.    WinActivate, ahk_id %MainBotWindow%
  2463.    RestoreCursors()
  2464.    if (hand_slot_pos_x > 1) and (hand_slot_pos_x < A_ScreenWidth) and (hand_slot_pos_y > 50) and (hand_slot_pos_y < A_Screenheight){
  2465.       GuiControl,, hand_slot_pos_x, %hand_slot_pos_x%
  2466.       GuiControl,, hand_slot_pos_y, %hand_slot_pos_y%
  2467.    }
  2468.    else{
  2469.       notification(1,"Get hand slot position tool", "Coordinates are not valid.")
  2470.    }
  2471. return
  2472.  
  2473. getpos_house_1:
  2474.   IfWinNotExist, ahk_pid %pid_tibia1%
  2475.       {
  2476.          notification(1, client_id, "Window " . title_tibia1 . " doesn't exist.")
  2477.          return
  2478.       }
  2479.    if (transparent_tibia1 = 1)
  2480.       gosub, hide_client_1
  2481.    WinMinimize, ahk_id %MainBotWindow%
  2482.    WinActivate, ahk_pid %pid_tibia1%
  2483.    WinWait, ahk_pid %pid_tibia1%
  2484.    SetSystemCursor("IDC_CROSS")
  2485.    Hotkey, LButton, mouse_getpos_house_1, on
  2486. return
  2487.  
  2488. mouse_getpos_house_1:
  2489.   MouseGetPos, house_pos_x1, house_pos_y1
  2490.    Hotkey, LButton, mouse_getpos_house_1, Off
  2491.    GuiControl,, house_pos_x1, %house_pos_x1%
  2492.    GuiControl,, house_pos_y1, %house_pos_y1%
  2493.    WinActivate, ahk_id %MainBotWindow%
  2494.    RestoreCursors()
  2495. return
  2496.  
  2497. getpos_house_2:
  2498.   IfWinNotExist, ahk_pid %pid_tibia2%
  2499.       {
  2500.          notification(1, client_id, "Window " . title_tibia2 . " doesn't exist.")
  2501.          return
  2502.       }
  2503.    if (transparent_tibia2 = 1)
  2504.       gosub, hide_client_2
  2505.    WinMinimize, ahk_id %MainBotWindow%
  2506.    WinActivate, ahk_pid %pid_tibia2%
  2507.    WinWait, ahk_pid %pid_tibia2%
  2508.    SetSystemCursor("IDC_CROSS")
  2509.    Hotkey, LButton, mouse_getpos_house_2, on
  2510. return
  2511.  
  2512. mouse_getpos_house_2:
  2513.   MouseGetPos, house_pos_x2, house_pos_y2
  2514.    Hotkey, LButton, mouse_getpos_house_2, Off
  2515.    GuiControl,, house_pos_x2, %house_pos_x2%
  2516.    GuiControl,, house_pos_y2, %house_pos_y2%
  2517.    WinActivate, ahk_id %MainBotWindow%
  2518.    RestoreCursors()
  2519. return
  2520.  
  2521. RestoreCursors()
  2522. {
  2523.    SPI_SETCURSORS := 0x57
  2524.    DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORS, UInt,0, UInt,0, UInt,0 )
  2525. }
  2526. return
  2527.  
  2528.  
  2529. SetSystemCursor( Cursor = "", cx = 0, cy = 0 )
  2530. {
  2531.    BlankCursor := 0, SystemCursor := 0, FileCursor := 0 ; init
  2532.    
  2533.    SystemCursors = 32512IDC_ARROW,32513IDC_IBEAM,32514IDC_WAIT,32515IDC_CROSS
  2534.    ,32516IDC_UPARROW,32640IDC_SIZE,32641IDC_ICON,32642IDC_SIZENWSE
  2535.    ,32643IDC_SIZENESW,32644IDC_SIZEWE,32645IDC_SIZENS,32646IDC_SIZEALL
  2536.    ,32648IDC_NO,32649IDC_HAND,32650IDC_APPSTARTING,32651IDC_HELP
  2537.    
  2538.    If Cursor = ; empty, so create blank cursor
  2539.    {
  2540.       VarSetCapacity( AndMask, 32*4, 0xFF ), VarSetCapacity( XorMask, 32*4, 0 )
  2541.       BlankCursor = 1 ; flag for later
  2542.    }
  2543.    Else If SubStr( Cursor,1,4 ) = "IDC_" ; load system cursor
  2544.    {
  2545.       Loop, Parse, SystemCursors, `,
  2546.       {
  2547.          CursorName := SubStr( A_Loopfield, 6, 15 ) ; get the cursor name, no trailing space with substr
  2548.          CursorID := SubStr( A_Loopfield, 1, 5 ) ; get the cursor id
  2549.          SystemCursor = 1
  2550.          If ( CursorName = Cursor )
  2551.          {
  2552.             CursorHandle := DllCall( "LoadCursor", Uint,0, Int,CursorID )  
  2553.             Break              
  2554.          }
  2555.       }  
  2556.       If CursorHandle = ; invalid cursor name given
  2557.       {
  2558.          Msgbox,, SetCursor, Error: Invalid cursor name
  2559.          CursorHandle = Error
  2560.       }
  2561.    }  
  2562.    Else If FileExist( Cursor )
  2563.    {
  2564.       SplitPath, Cursor,,, Ext ; auto-detect type
  2565.       If Ext = ico
  2566.          uType := 0x1  
  2567.       Else If Ext in cur,ani
  2568.          uType := 0x2      
  2569.       Else ; invalid file ext
  2570.       {
  2571.          Msgbox,, SetCursor, Error: Invalid file type
  2572.          CursorHandle = Error
  2573.       }      
  2574.       FileCursor = 1
  2575.    }
  2576.    Else
  2577.    {  
  2578.       Msgbox,, SetCursor, Error: Invalid file path or cursor name
  2579.       CursorHandle = Error ; raise for later
  2580.    }
  2581.    If CursorHandle != Error
  2582.    {
  2583.       Loop, Parse, SystemCursors, `,
  2584.       {
  2585.          If BlankCursor = 1
  2586.          {
  2587.             Type = BlankCursor
  2588.             %Type%%A_Index% := DllCall( "CreateCursor"
  2589.             , Uint,0, Int,0, Int,0, Int,32, Int,32, Uint,&AndMask, Uint,&XorMask )
  2590.             CursorHandle := DllCall( "CopyImage", Uint,%Type%%A_Index%, Uint,0x2, Int,0, Int,0, Int,0 )
  2591.             DllCall( "SetSystemCursor", Uint,CursorHandle, Int,SubStr( A_Loopfield, 1, 5 ) )
  2592.          }        
  2593.          Else If SystemCursor = 1
  2594.          {
  2595.             Type = SystemCursor
  2596.             CursorHandle := DllCall( "LoadCursor", Uint,0, Int,CursorID )  
  2597.             %Type%%A_Index% := DllCall( "CopyImage"
  2598.             , Uint,CursorHandle, Uint,0x2, Int,cx, Int,cy, Uint,0 )      
  2599.             CursorHandle := DllCall( "CopyImage", Uint,%Type%%A_Index%, Uint,0x2, Int,0, Int,0, Int,0 )
  2600.             DllCall( "SetSystemCursor", Uint,CursorHandle, Int,SubStr( A_Loopfield, 1, 5 ) )
  2601.          }
  2602.          Else If FileCursor = 1
  2603.          {
  2604.             Type = FileCursor
  2605.             %Type%%A_Index% := DllCall( "LoadImageA"
  2606.             , UInt,0, Str,Cursor, UInt,uType, Int,cx, Int,cy, UInt,0x10 )
  2607.             DllCall( "SetSystemCursor", Uint,%Type%%A_Index%, Int,SubStr( A_Loopfield, 1, 5 ) )        
  2608.          }          
  2609.       }
  2610.    }  
  2611. }
  2612. return
  2613.  
  2614. ConnectedToInternet(flag=0x40) {
  2615.    Return DllCall("Wininet.dll\InternetGetConnectedState", "Str", flag,"Int",0)
  2616. }
  2617.  
  2618.  
  2619. WM_MOUSEMOVE()
  2620. {
  2621.     static CurrControl, PrevControl, _TT  ; _TT is kept blank for use by the ToolTip command below.
  2622.     CurrControl := A_GuiControl
  2623.     If (CurrControl <> PrevControl and not InStr(CurrControl, " "))
  2624.     {
  2625.         ToolTip  ; Turn off any previous tooltip.
  2626.         SetTimer, DisplayToolTip, 500
  2627.         PrevControl := CurrControl
  2628.     }
  2629.     return
  2630.  
  2631.     DisplayToolTip:
  2632.    SetTimer, DisplayToolTip, Off
  2633.     ToolTip % %CurrControl%_TT  ; The leading percent sign tell it to use an expression.
  2634.     SetTimer, RemoveToolTip, 10000
  2635.     return
  2636.  
  2637.     RemoveToolTip:
  2638.    SetTimer, RemoveToolTip, Off
  2639.     ToolTip
  2640.     return
  2641. }
  2642.  
  2643.  
  2644.  
  2645. save(){
  2646.  
  2647.    GuiControlGet, rune_spellkey1,, rune_spellkey1
  2648.    GuiControlGet, rune_spellkey2,, rune_spellkey2
  2649.    GuiControlGet, Spelltime1,, Spelltime1
  2650.    GuiControlGet, Spelltime2,, Spelltime2
  2651.  
  2652.    GuiControlGet, deposit_runes_1,, deposit_runes_1
  2653.    GuiControlGet, house_pos_x1,, house_pos_x1
  2654.    GuiControlGet, house_pos_y1,, house_pos_y1
  2655.    GuiControlGet, deposit_runes_2,, deposit_runes_2
  2656.    GuiControlGet, house_pos_x2,, house_pos_x2
  2657.    GuiControlGet, house_pos_y2,, house_pos_y2
  2658.  
  2659.    GuiControlGet, PauseRunemaking_IfCharMoved,, PauseRunemaking_IfCharMoved
  2660.    GuiControlGet, PauseRunemaking_IfFood,, PauseRunemaking_IfFood
  2661.    GuiControlGet, PauseRunemaking_IfBlank,, PauseRunemaking_IfBlank
  2662.    GuiControlGet, PauseRunemaking_IfPlayer,, PauseRunemaking_IfPlayer
  2663.    GuiControlGet, PauseRunemaking_IfSoul,, PauseRunemaking_IfSoul
  2664.  
  2665.    GuiControlGet, Logout_IfCharMoved,, Logout_IfCharMoved
  2666.    GuiControlGet, Logout_IfFood,,  Logout_IfFood
  2667.    GuiControlGet, Logout_IfBlank,, Logout_IfBlank
  2668.    GuiControlGet, Logout_IfPlayer,, Logout_IfPlayer
  2669.    GuiControlGet, Logout_IfSoul,, Logout_IfSoul
  2670.  
  2671.    GuiControlGet, PlaySound_IfCharMoved,,  PlaySound_IfCharMoved
  2672.    GuiControlGet, PlaySound_IfFood,,  PlaySound_IfFood
  2673.    GuiControlGet, PlaySound_IfBlank,,  PlaySound_IfBlank
  2674.    GuiControlGet, PlaySound_IfPlayer,, PlaySound_IfPlayer
  2675.    GuiControlGet, PlaySound_IfSoul,,  PlaySound_IfSoul
  2676.  
  2677.    GuiControlGet, ShutDown_IfCharMoved,, ShutDown_IfCharMoved
  2678.    GuiControlGet, ShutDown_IfFood,, ShutDown_IfFood
  2679.    GuiControlGet, ShutDown_IfBlank,, ShutDown_IfBlank
  2680.    GuiControlGet, ShutDown_IfPlayer,, ShutDown_IfPlayer
  2681.    GuiControlGet, ShutDown_IfSoul,, ShutDown_IfSoul
  2682.  
  2683.    GuiControlGet, WalkMethod_IfFood,, WalkMethod_IfFood
  2684.    GuiControlGet, WalkMethod_IfBlank,, WalkMethod_IfBlank
  2685.    GuiControlGet, WalkMethod_IfPlayer,, WalkMethod_IfPlayer
  2686.    GuiControlGet, WalkMethod_IfSoul,, WalkMethod_IfSoul
  2687.    GuiControlGet, WalkMethod_IfCharMoved,, WalkMethod_IfCharMoved
  2688.  
  2689.    GuiControlGet, CastSpell_IfBlank,, CastSpell_IfBlank
  2690.    GuiControlGet, CastSpell_IfSoul,, CastSpell_IfSoul
  2691.  
  2692.    GuiControlGet, Flash_IfCharMoved,, Flash_IfCharMoved
  2693.    GuiControlGet, Flash_IfFood,, Flash_IfFood
  2694.    GuiControlGet, Flash_IfBlank,, Flash_IfBlank
  2695.    GuiControlGet, Flash_IfPlayer,, Flash_IfPlayer
  2696.    GuiControlGet, Flash_IfSoul,, Flash_IfSoul
  2697.  
  2698.    GuiControlGet, OpenNewBackpack,, OpenNewBackpack
  2699.    GuiControlGet, Create_blank,, Create_blank
  2700.    GuiControlGet, Hand_mode,, Hand_mode
  2701.    GuiControlGet, hand_slot_pos_x,, hand_slot_pos_x
  2702.    GuiControlGet, hand_slot_pos_y,, hand_slot_pos_y
  2703.  
  2704.    GuiControlGet, Spell_to_cast_name,, Spell_to_cast_name
  2705.    GuiControlGet, Spell_to_cast_count,, Spell_to_cast_count
  2706.    GuiControlGet, Double_alarm_screen_checker,, Double_alarm_screen_checker
  2707.  
  2708.    GuiControlGet, Blank_spellname,, Blank_spellname
  2709.    GuiControlGet, Eat_hotkey,, Eat_hotkey
  2710.    GuiControlGet, eat_using_hotkey,, eat_using_hotkey
  2711.    GuiControlGet, Food_time,, Food_time
  2712.    GuiControlGet, Anty_log_time,, Anty_log_time
  2713.    GuiControlGet, Anty_log_dir1,, Anty_log_dir1
  2714.    GuiControlGet, Anty_log_dir2,, Anty_log_dir2
  2715.    GuiControlGet, Show_notifications,, Show_notifications
  2716.    GuiControlGet, Steps_to_walk,, Steps_to_walk
  2717.    GuiControlGet, Auto_shutdown_time,, Auto_shutdown_time
  2718.    
  2719.    
  2720.    
  2721.    IniWrite, %rune_spellkey1%, Data/basic_settings.ini, bot variables, rune_spellkey1
  2722.    IniWrite, %rune_spellkey2%, Data/basic_settings.ini, bot variables, rune_spellkey2
  2723.    IniWrite, %Spelltime1%, Data/basic_settings.ini, bot variables, Spelltime1
  2724.    IniWrite, %Spelltime2%, Data/basic_settings.ini, bot variables, Spelltime2
  2725.  
  2726.    IniWrite, %deposit_runes_1%, Data/basic_settings.ini, bot variables, deposit_runes_1
  2727.    IniWrite, %house_pos_x1%, Data/basic_settings.ini, bot variables, house_pos_x1
  2728.    IniWrite, %house_pos_y1%, Data/basic_settings.ini, bot variables, house_pos_y1
  2729.    IniWrite, %deposit_runes_2%, Data/basic_settings.ini, bot variables, deposit_runes_2
  2730.    IniWrite, %house_pos_x2%, Data/basic_settings.ini, bot variables, house_pos_x2
  2731.    IniWrite, %house_pos_y2%, Data/basic_settings.ini, bot variables, house_pos_y2
  2732.  
  2733.    IniWrite, %PauseRunemaking_IfCharMoved%, Data/basic_settings.ini, bot variables, PauseRunemaking_IfCharMoved
  2734.    IniWrite, %PauseRunemaking_IfFood%, Data/basic_settings.ini, bot variables, PauseRunemaking_IfFood
  2735.    IniWrite, %PauseRunemaking_IfBlank%, Data/basic_settings.ini, bot variables, PauseRunemaking_IfBlank
  2736.    IniWrite, %PauseRunemaking_IfPlayer%, Data/basic_settings.ini, bot variables, PauseRunemaking_IfPlayer
  2737.    IniWrite, %PauseRunemaking_IfSoul%, Data/basic_settings.ini, bot variables, PauseRunemaking_IfSoul
  2738.  
  2739.    IniWrite, %Logout_IfCharMoved%, Data/basic_settings.ini, bot variables, Logout_IfCharMoved
  2740.    IniWrite, %Logout_IfFood%, Data/basic_settings.ini, bot variables,  Logout_IfFood
  2741.    IniWrite, %Logout_IfBlank%, Data/basic_settings.ini, bot variables, Logout_IfBlank
  2742.    IniWrite, %Logout_IfPlayer%, Data/basic_settings.ini, bot variables, Logout_IfPlayer
  2743.    IniWrite, %Logout_IfSoul%, Data/basic_settings.ini, bot variables, Logout_IfSoul
  2744.  
  2745.    IniWrite, %PlaySound_IfCharMoved%, Data/basic_settings.ini, bot variables,  PlaySound_IfCharMoved
  2746.    IniWrite, %PlaySound_IfFood%, Data/basic_settings.ini, bot variables,  PlaySound_IfFood
  2747.    IniWrite, %PlaySound_IfBlank%, Data/basic_settings.ini, bot variables,  PlaySound_IfBlank
  2748.    IniWrite, %PlaySound_IfPlayer%, Data/basic_settings.ini, bot variables, PlaySound_IfPlayer
  2749.    IniWrite, %PlaySound_IfSoul%, Data/basic_settings.ini, bot variables,  PlaySound_IfSoul
  2750.  
  2751.    IniWrite, %ShutDown_IfCharMoved%, Data/basic_settings.ini, bot variables, ShutDown_IfCharMoved
  2752.    IniWrite, %ShutDown_IfFood%, Data/basic_settings.ini, bot variables, ShutDown_IfFood
  2753.    IniWrite, %ShutDown_IfBlank%, Data/basic_settings.ini, bot variables, ShutDown_IfBlank
  2754.    IniWrite, %ShutDown_IfPlayer%, Data/basic_settings.ini, bot variables, ShutDown_IfPlayer
  2755.    IniWrite, %ShutDown_IfSoul%, Data/basic_settings.ini, bot variables, ShutDown_IfSoul
  2756.  
  2757.    IniWrite, %WalkMethod_IfFood%, Data/basic_settings.ini, bot variables, WalkMethod_IfFood
  2758.    IniWrite, %WalkMethod_IfBlank%, Data/basic_settings.ini, bot variables, WalkMethod_IfBlank
  2759.    IniWrite, %WalkMethod_IfPlayer%, Data/basic_settings.ini, bot variables, WalkMethod_IfPlayer
  2760.    IniWrite, %WalkMethod_IfSoul%, Data/basic_settings.ini, bot variables, WalkMethod_IfSoul
  2761.    IniWrite, %WalkMethod_IfCharMoved%, Data/basic_settings.ini, bot variables, WalkMethod_IfCharMoved
  2762.  
  2763.    IniWrite, %CastSpell_IfBlank%, Data/basic_settings.ini, bot variables, CastSpell_IfBlank
  2764.    IniWrite, %CastSpell_IfSoul%, Data/basic_settings.ini, bot variables, CastSpell_IfSoul
  2765.  
  2766.    IniWrite, %Flash_IfCharMoved%, Data/basic_settings.ini, bot variables, Flash_IfCharMoved
  2767.    IniWrite, %Flash_IfFood%, Data/basic_settings.ini, bot variables, Flash_IfFood
  2768.    IniWrite, %Flash_IfBlank%, Data/basic_settings.ini, bot variables, Flash_IfBlank
  2769.    IniWrite, %Flash_IfPlayer%, Data/basic_settings.ini, bot variables, Flash_IfPlayer
  2770.    IniWrite, %Flash_IfSoul%, Data/basic_settings.ini, bot variables, Flash_IfSoul
  2771.  
  2772.    IniWrite, %OpenNewBackpack%, Data/basic_settings.ini, bot variables, OpenNewBackpack
  2773.    IniWrite, %Create_blank%, Data/basic_settings.ini, bot variables, Create_blank
  2774.    IniWrite, %Hand_mode%, Data/basic_settings.ini, bot variables, Hand_mode
  2775.    IniWrite, %hand_slot_pos_x%, Data/basic_settings.ini, bot variables, hand_slot_pos_x
  2776.    IniWrite, %hand_slot_pos_y%, Data/basic_settings.ini, bot variables, hand_slot_pos_y
  2777.  
  2778.    IniWrite, %Spell_to_cast_name%, Data/basic_settings.ini, bot variables, Spell_to_cast_name
  2779.    IniWrite, %Spell_to_cast_count%, Data/basic_settings.ini, bot variables, Spell_to_cast_count
  2780.    IniWrite, %Double_alarm_screen_checker%, Data/basic_settings.ini, bot variables, Double_alarm_screen_checker
  2781.  
  2782.    IniWrite, %Blank_spellname%, Data/basic_settings.ini, bot variables, Blank_spellname
  2783.    IniWrite, %Eat_hotkey%, Data/basic_settings.ini, bot variables, Eat_hotkey
  2784.    IniWrite, %eat_using_hotkey%, Data/basic_settings.ini, bot variables, eat_using_hotkey
  2785.    IniWrite, %Food_time%, Data/basic_settings.ini, bot variables, Food_time
  2786.    IniWrite, %Anty_log_time%, Data/basic_settings.ini, bot variables, Anty_log_time
  2787.    IniWrite, %Anty_log_dir1%, Data/basic_settings.ini, bot variables, Anty_log_dir1
  2788.    IniWrite, %Anty_log_dir2%, Data/basic_settings.ini, bot variables, Anty_log_dir2
  2789.    IniWrite, %Show_notifications%, Data/basic_settings.ini, bot variables, Show_notifications
  2790.    IniWrite, %Steps_to_walk%, Data/basic_settings.ini, bot variables, Steps_to_walk
  2791.    IniWrite, %Auto_shutdown_time%, Data/basic_settings.ini, bot variables, Auto_shutdown_time
  2792. }
  2793. return
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  ; ######################################################### CHECKING VALUES ############################################################################
  2799.  
  2800. Installfiles:
  2801. DataFolder :=  A_ScriptDir . "\Data"
  2802. IfNotExist, %DataFolder%
  2803.    FileCreateDir, %DataFolder%
  2804. ImgFolder :=  A_ScriptDir . "\Data\Images"
  2805. IfNotExist, %ImgFolder%
  2806.    FileCreateDir, %ImgFolder%
  2807. SoundsFolder :=  A_ScriptDir . "\Data\Sounds"
  2808. IfNotExist, %SoundsFolder%
  2809.    FileCreateDir, %SoundsFolder%
  2810.  
  2811. FileInstall, Data\Images\area_check1.bmp, Data\Images\area_check1.bmp
  2812. FileInstall, Data\Images\area_check2.bmp, Data\Images\area_check2.bmp
  2813. FileInstall, Data\Images\backpack1.bmp, Data\Images\backpack1.bmp
  2814. FileInstall, Data\Images\backpack2.bmp, Data\Images\backpack2.bmp
  2815. FileInstall, Data\Images\blank_rune.bmp, Data\Images\blank_rune.bmp
  2816. FileInstall, Data\Images\conjured_rune1.bmp, Data\Images\conjured_rune1.bmp
  2817. FileInstall, Data\Images\conjured_rune2.bmp, Data\Images\conjured_rune2.bmp
  2818. FileInstall, Data\Images\fishing_rod_bp.bmp, Data\Images\fishing_rod_bp.bmp
  2819. FileInstall, Data\Images\fish.bmp, Data\Images\fish.bmp
  2820. FileInstall, Data\Images\fishing_rod.bmp, Data\Images\fishing_rod.bmp
  2821. FileInstall, Data\Images\food1.bmp, Data\Images\food1.bmp
  2822. FileInstall, Data\Images\food2.bmp, Data\Images\food2.bmp
  2823. FileInstall, Data\Images\free_slot.bmp, Data\Images\free_slot.bmp
  2824. FileInstall, Data\Images\picbp.bmp, Data\Images\picbp.bmp
  2825. FileInstall, Data\Images\select_area1.png, Data\Images\select_area1.png
  2826. FileInstall, Data\Images\select_area2.png, Data\Images\select_area2.png
  2827. FileInstall, Data\Images\tabledone.png, Data\Images\tabledone.png
  2828. FileInstall, Data\Images\table_main_f.png, Data\Images\table_main_f.png
  2829. FileInstall, Data\Images\icon.ico, Data\Images\icon.ico
  2830. FileInstall, Data\Images\msinfo32.ico, Data\Images\msinfo32.ico
  2831. FileInstall, Data\Images\warlockbot_startwin.png, Data\Images\warlockbot_startwin.png
  2832. FileInstall, Data\Images\background.png, Data\Images\background.png
  2833. FileInstall, Data\Images\pp_donate.bmp, Data\Images\pp_donate.bmp
  2834. FileInstall, Data\Images\soul0.bmp, Data\Images\soul0.bmp
  2835. FileInstall, Data\Images\soul1.bmp, Data\Images\soul1.bmp
  2836. FileInstall, Data\Images\soul2.bmp, Data\Images\soul2.bmp
  2837. FileInstall, Data\Images\soul3.bmp, Data\Images\soul3.bmp
  2838. FileInstall, Data\Images\soul4.bmp, Data\Images\soul4.bmp
  2839. FileInstall, Data\Images\soul5.bmp, Data\Images\soul5.bmp
  2840.  
  2841. FileInstall, Data\Sounds\alarm_food.mp3, Data\Sounds\alarm_food.mp3
  2842. FileInstall, Data\Sounds\alarm_screen.mp3, Data\Sounds\alarm_screen.mp3
  2843. FileInstall, Data\Sounds\alarm_blank.mp3, Data\Sounds\alarm_blank.mp3
  2844. FileInstall, Data\Sounds\alarm_soul.mp3, Data\Sounds\alarm_soul.mp3
  2845.  
  2846. FileInstall, Data/basic_settings.ini, Data/basic_settings.ini
  2847. FileInstall, Data/mousehook64.dll, Data/mousehook64.dll
  2848. FileInstall, Data/scp_wrlbot.exe, Data/scp_wrlbot.exe
  2849.  
  2850. goto checkfiles
  2851. return
  2852.  
  2853. Bot_protection:
  2854. GuiControlGet, Bot_protection,, Bot_protection
  2855. if Bot_protection = 1
  2856.    global Bot_protection = 1
  2857. else
  2858.    global Bot_protection = 0
  2859. return
  2860.  
  2861. Check_gui(){                                    ; it grays out gui controls
  2862.    GuiControlGet, Enabled_runemaking1,, Enabled_runemaking1
  2863.    GuiControlGet, Enabled_runemaking2,, Enabled_runemaking2
  2864.    GuiControl, disable%Enabled_runemaking1%, Spelltime1
  2865.    GuiControl, disable%Enabled_runemaking1%, rune_spellkey1
  2866.    GuiControl, disable%Enabled_runemaking2%, Spelltime2
  2867.    GuiControl, disable%Enabled_runemaking2%, rune_spellkey2
  2868.    GuiControlGet, Enabled_anty_logout1,, Enabled_anty_logout1
  2869.    GuiControlGet, Enabled_anty_logout2,, Enabled_anty_logout2
  2870.    if ((Enabled_anty_logout1 = 1) or (Enabled_anty_logout2 = 1))
  2871.       GuiControl, Disabled, Anty_log_time
  2872.    else
  2873.       GuiControl, Enabled, Anty_log_time
  2874.    GuiControlGet, Enabled_food_eater1,, Enabled_food_eater1
  2875.    GuiControlGet, Enabled_food_eater2,, Enabled_food_eater2
  2876.    if ((Enabled_food_eater1 = 1) or (Enabled_food_eater2 = 1))
  2877.       GuiControl, Disabled, Food_time
  2878.    else
  2879.       GuiControl, Enabled, Food_time
  2880.    GuiControlGet, fishing_enabled1,, fishing_enabled1
  2881.    GuiControl, disable%fishing_enabled1%, Fishing_setup1
  2882.    GuiControlGet, fishing_enabled2,, fishing_enabled2
  2883.    GuiControl, disable%fishing_enabled2%, Fishing_setup2
  2884.    if ((Enabled_runemaking1 = 1) or (Enabled_runemaking2 = 1))
  2885.       check_var = 1
  2886.    else{
  2887.       BlockInput, Off
  2888.       check_var = 0
  2889.       SetTimer, check_runes, Off        ; the only one way to set timer off is by check_gui
  2890.    }
  2891. }
  2892. return
  2893.  
  2894. getRandomArrayValue1(arr,arrayChanged:=0){
  2895.     static ind1:=""
  2896.     if (arrayChanged || !ind1){
  2897.         ind1:=[]
  2898.         for k in arr
  2899.             ind1.push(k)
  2900.     }
  2901.     Random,num,1,ind1.length()
  2902.     return arr[ind1[num]]
  2903. }
  2904.  
  2905. getRandomArrayValue2(arr,arrayChanged:=0){
  2906.     static ind2:=""
  2907.     if (arrayChanged || !ind2){
  2908.         ind2:=[]
  2909.         for k in arr
  2910.             ind2.push(k)
  2911.     }
  2912.     Random,num,1,ind2.length()
  2913.     return arr[ind2[num]]
  2914. }
  2915.  
  2916. auto_stack(client_id, object){
  2917.     start_time := A_tickcount
  2918.     count1 := find_instances(client_id, object, 2, 0)
  2919.     stacker_loop1:
  2920.     if (count1 > 1){
  2921.        list = % find_instances(client_id, object, 2, 1)
  2922.        coords := ""
  2923.       coords := Object()
  2924.         for i, obj in strsplit(list, "`n")
  2925.             coords.push({x: strsplit(obj, ",").1, y: strsplit(obj, ",").2})
  2926.         object_pos_x := coords.1.x
  2927.         object_pos_y := coords.1.y
  2928.         destination_pos_x := coords.2.x ; + 14
  2929.         destination_pos_y := coords.2.y ; + 14
  2930.        if ((object_pos_x != "") and (object_pos_y != "") and (destination_pos_x != "") and (destination_pos_y != "")){
  2931.           object_pos_y := object_pos_y - 25
  2932.           destination_pos_y := destination_pos_y - 25
  2933.           KeyWait, LButton
  2934.           KeyWait, RButton
  2935.           ;;BlockInput, MouseMove
  2936.           ;Hotkey, LButton, do_nothing, On
  2937.           BlockInput, on ;Hotkey, RButton, do_nothing, On
  2938.           sleep_random(5, 10)
  2939.           if (Bot_protection = 1)
  2940.              DllCall("Data\mousehook64.dll\dragDrop", "AStr", client_id, "INT", false, "INT", object_pos_x, "INT", object_pos_y, "INT", destination_pos_x, "INT", destination_pos_y)
  2941.           else
  2942.              DllCall("Data\mousehook64.dll\dragDrop", "AStr", client_id, "INT", true, "INT", object_pos_x, "INT", object_pos_y, "INT", destination_pos_x, "INT", destination_pos_y)
  2943.           sleep_random(5, 10)
  2944.           BlockInput, off
  2945.           ;Hotkey, LButton, do_nothing, Off
  2946.           ;Hotkey, RButton, do_nothing, Off
  2947.           ;;BlockInput, MouseMoveOff
  2948.           Sleep_random(150, 180)
  2949.        }
  2950.        count2 := find_instances(client_id, object, 2, 0)
  2951.        if (count2 < count1){
  2952.           count1 := count2
  2953.           goto stacker_loop1
  2954.        }
  2955.        else if ((count2 = count1) and (count2 > 2)){
  2956.         stacker_loop2:
  2957.         list = % find_instances(client_id, object, 2, 1)
  2958.         coords := ""
  2959.          coords := Object()
  2960.         for i, obj in strsplit(list, "`n")
  2961.             coords.push({x: strsplit(obj, ",").1, y: strsplit(obj, ",").2})
  2962.             object_pos_x := coords.1.x
  2963.             object_pos_y := coords.1.y
  2964.             destination_pos_x := coords.3.x
  2965.             destination_pos_y := coords.3.y
  2966.             if ((object_pos_x != "") and (object_pos_y != "") and (destination_pos_x != "") and (destination_pos_y != "")){
  2967.                 object_pos_y := object_pos_y - 25
  2968.                 destination_pos_y := destination_pos_y - 25
  2969.                 KeyWait, LButton
  2970.                 KeyWait, RButton
  2971.                 ;;BlockInput, MouseMove
  2972.                 ;Hotkey, LButton, do_nothing, On
  2973.                 BlockInput, on ;Hotkey, RButton, do_nothing, On
  2974.                 sleep_random(5, 10)
  2975.                 if (Bot_protection = 1)
  2976.                     DllCall("Data\mousehook64.dll\dragDrop", "AStr", client_id, "INT", false, "INT", object_pos_x, "INT", object_pos_y, "INT", destination_pos_x, "INT", destination_pos_y)
  2977.                 else
  2978.                     DllCall("Data\mousehook64.dll\dragDrop", "AStr", client_id, "INT", true, "INT", object_pos_x, "INT", object_pos_y, "INT", destination_pos_x, "INT", destination_pos_y)
  2979.                 sleep_random(5, 10)
  2980.                 BlockInput, off
  2981.                 ;Hotkey, LButton, do_nothing, Off
  2982.                 ;Hotkey, RButton, do_nothing, Off
  2983.                 ;;BlockInput, MouseMoveOff
  2984.                 Sleep_random(150, 180)
  2985.             }
  2986.             count3 := find_instances(client_id, object, 2, 0)
  2987.             if ((count3 < count2) and (count3 > 1)){
  2988.                 count2 := count3
  2989.                 count1 := count3
  2990.                 goto stacker_loop1
  2991.             }
  2992.         }
  2993.     }
  2994. ;   Msgbox, % A_tickcount - start_time
  2995. }
  2996. return
  2997.  
  2998.  
  2999.  
  3000.  
  3001. Dwm_SetWindowAttributeTransistionDisable(hwnd,bool:=1)
  3002. {
  3003.     ;
  3004.     ;   DWMWA_TRANSITIONS_FORCEDISABLED=3
  3005.     ;   Use with DwmSetWindowAttribute. Enables or forcibly disables DWM transitions.
  3006.     ;   The pvAttribute parameter points to a value of TRUE to disable transitions or FALSE to enable transitions.
  3007.     ;  
  3008.     ;   Input:
  3009.     ;       hwnd, handle to the window to for which the transistion is to be disabled/enabled
  3010.     ;       bool, specify true (1) to disable, or false (0) to enable transition.
  3011.     ;
  3012.     dwAttribute:=3
  3013.     cbAttribute:=4
  3014.     VarSetCapacity(pvAttribute,4,0)
  3015.     NumPut(bool,pvAttribute,0,"Int")
  3016.     hr:=DllCall("Dwmapi.dll\DwmSetWindowAttribute", "Uint", hwnd, "Uint", dwAttribute, "Uint", &pvAttribute, "Uint", cbAttribute)
  3017.     return hr ; 0 is ok!
  3018. }
  3019. return
  3020.  
  3021.  
  3022. PayPal:
  3023. Run, http://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=C9FXNFELYMDH8
  3024. return
  3025.  
  3026.  
  3027. Eat_using_hotkey:
  3028.   GuiControlGet, eat_using_hotkey,, eat_using_hotkey
  3029.    if (eat_using_hotkey = 1){
  3030.       GuiControlGet, eat_hotkey_temp,, eat_hotkey
  3031.       if (eat_hotkey_temp = ""){
  3032.          notification(1, BOTName, "You should first enter hotkey on which eating food is setted up on your Tibia client.")
  3033.          GuiControl,,eat_using_hotkey,0
  3034.          return
  3035.       }
  3036.    }
  3037. return
  3038.  
  3039. Check_food_time:
  3040.   sleep, 1300
  3041.    GuiControlGet, food_time,, food_time
  3042.    if (food_time < 15){
  3043.       notification(1, BOTName, "Food time can not be shorter than 15 seconds.")
  3044.       GuiControl,,food_time, %shorter_spelltime%
  3045.    }
  3046.    if (food_time > 2000){
  3047.       notification(1, BOTName, "Food time can not be longer than 2000 seconds.")
  3048.       GuiControl,,food_time, %shorter_spelltime%
  3049.    }
  3050. return
  3051.  
  3052. Check_anty_log_time:
  3053.   sleep, 1300
  3054.    GuiControlGet, anty_log_time,, anty_log_time
  3055.    if (anty_log_time > 2000){
  3056.       notification(1, BOTName, "Anty logout time can not be longer than 2000 seconds.")
  3057.       GuiControl,,anty_log_time, %shorter_spelltime%
  3058.       return
  3059.    }
  3060.    if (anty_log_time < 15){
  3061.       notification(1, BOTName, "Anty logout time can not be shorter than 15 seconds.")
  3062.       GuiControl,,anty_log_time, %shorter_spelltime%
  3063.    }
  3064. return
  3065.  
  3066.  
  3067. Check_dir1:
  3068. GuiControlGet, Anty_log_dir1,, Anty_log_dir1
  3069. GuiControlGet, Anty_log_dir2,, Anty_log_dir2
  3070. if Anty_log_dir2 == ""
  3071.    return
  3072. if (Anty_log_dir1 == Anty_log_dir2){
  3073.    GuiControl, Choose, Anty_log_dir2,0
  3074.    notification(1, BOTName, "You can not set the same direction twice.")
  3075. }
  3076. return
  3077.  
  3078. Check_dir2:
  3079. GuiControlGet, Anty_log_dir1,, Anty_log_dir1
  3080. GuiControlGet, Anty_log_dir2,, Anty_log_dir2
  3081. if Anty_log_dir1 == ""
  3082.    return
  3083. if (Anty_log_dir1 == Anty_log_dir2){
  3084.    GuiControl, Choose, Anty_log_dir1,0
  3085.    notification(1, BOTName, "You can not set the same direction twice.")
  3086. }
  3087. return
  3088.  
  3089. Auto_shutdown_enabled:
  3090. GuiControlGet, Auto_shutdown_enabled,, Auto_shutdown_enabled
  3091. GuiControlGet, Auto_shutdown_time,, Auto_shutdown_time
  3092. if (Auto_shutdown_enabled = 1){
  3093.    global hour_shutdown := SubStr(Auto_shutdown_time, 9,2)
  3094.    global min_shutdown := SubStr(Auto_shutdown_time, 11,2)
  3095.    if ((A_Hour != hour_shutdown) or (A_Min != min_shutdown )){
  3096.       notification(2, BOTName, "Shutdown is planned at " . hour_shutdown . ":" . min_shutdown ".")
  3097.       GuiControl, Disable, Auto_shutdown_time
  3098.       Settimer, Planned_shutdown, 60000
  3099.       return
  3100.    }
  3101.    else{
  3102.       GuiControl,, Auto_shutdown_enabled, 0
  3103.       notification(1, BOTName, "You can not plan to shutdown your pc immediately.")
  3104.       Settimer, Planned_shutdown, Off
  3105.    }
  3106. }
  3107. else
  3108.    GuiControl, Enable, Auto_shutdown_time
  3109.    Settimer, Planned_shutdown, off
  3110.    notification(2, BOTName, "Shutdown deactivated.")
  3111. return
  3112.  
  3113. Planned_shutdown:
  3114. if ((hour_shutdown == "") or (min_shutdown == ""))
  3115.    return
  3116. if (A_Hour >= hour_shutdown) and (A_Min >= min_shutdown)
  3117.    shutdown, 1
  3118. return
  3119.  
  3120. Check_spell_to_cast_count:
  3121. sleep, 1000
  3122.    GuiControlGet, spell_to_cast_count,,spell_to_cast_count
  3123.    if ((spell_to_cast_count < 1) or (spell_to_cast_count > 10)){
  3124.       notification(1, BOTName, "The amount of times choosen spell will be casted can't be lower than 1 and higher than 10.")
  3125.       GuiControl,,spell_to_cast_count,1
  3126.    }
  3127. return
  3128.  
  3129.  
  3130. Check_house_pos_x:
  3131. sleep, 1000
  3132.    GuiControlGet, house_pos_x,,house_pos_x
  3133.    if (house_pos_x < 50){
  3134.       notification(1, BOTName, "X coordinate of sqm to throw can't be lower than 50.")
  3135.       GuiControl,,house_pos_x, 666
  3136.    }
  3137.    if (house_pos_x > A_ScreenWidth){
  3138.       notification(1, BOTName, "X coordinate of sqm to throw can't be higher than screen width.")
  3139.       GuiControl,,house_pos_x, 666
  3140.    }
  3141. return
  3142.  
  3143.  
  3144. Check_house_pos_y:
  3145. sleep, 1000
  3146.    GuiControlGet, house_pos_y,,house_pos_y
  3147.    if (house_pos_y < 1){
  3148.       notification(1, BOTName, "Y coordinate of sqm to throw can't be lower than 1.")
  3149.       GuiControl,,house_pos_y, 666
  3150.    }
  3151.    if (house_pos_y > A_Screenheight){
  3152.       notification(1, BOTName, "Y coordinate of sqm to throw can't be higher than screen height.")
  3153.       GuiControl,,house_pos_y, 666
  3154.    }
  3155. return
  3156.  
  3157.  
  3158. Check_spelltime1:
  3159. sleep, 1000
  3160.    GuiControlGet, spelltime1,,spelltime1
  3161.    if (spelltime1 < 15){
  3162.       notification(1, title_tibia1, "Rune make cycle can't take less then 15 seconds.")
  3163.       GuiControl,,spelltime1, 15
  3164.    }
  3165. return
  3166.  
  3167. Check_spelltime2:
  3168. sleep, 1000
  3169.    GuiControlGet, spelltime2,,spelltime2
  3170.    if (spelltime2 < 15){
  3171.       notification(1, title_tibia2, "Rune make cycle can't take less then 15 seconds.")
  3172.       GuiControl,,spelltime2, 15
  3173.    }
  3174. return
  3175.  
  3176. Check_blank_spellname:
  3177.   sleep, 1000
  3178.    GuiControlGet, blank_spellname,,blank_spellname
  3179.    if (blank_spellname = ""){
  3180.       notification(1, BotName, "'Spell to conjure blank runes' control field can't be left empty.")
  3181.       GuiControl,,blank_spellname, adori blank
  3182.    }
  3183.    GuiControlGet, blank_spellname_temp,,blank_spellname
  3184.    global blank_spellname := blank_spellname_temp
  3185. return
  3186.  
  3187. PauseRunemaking_IfFood:
  3188. GuiControlGet, PauseRunemaking_IfFood,,PauseRunemaking_IfFood
  3189. GuiControlGet, Logout_IfFood,,Logout_IfFood
  3190. GuiControlGet, PlaySound_IfFood,,PlaySound_IfFood
  3191. GuiControlGet, ShutDown_IfFood,,ShutDown_IfFood
  3192. GuiControlGet, WalkMethod_IfFood,,WalkMethod_IfFood
  3193. GuiControlGet, CastSpell_IfFood,,CastSpell_IfFood
  3194. if (Logout_IfFood = 1 or ShutDown_IfFood = 1){
  3195.    GuiControl,,PauseRunemaking_IfFood,1
  3196.    return
  3197. }
  3198. if (PauseRunemaking_IfFood = 0){
  3199.    GuiControl,,Logout_IfFood,0
  3200.    GuiControl,,ShutDown_IfFood,0
  3201.    GuiControl,,CastSpell_IfFood,0
  3202. }
  3203. return
  3204.  
  3205. Logout_IfFood:
  3206. GuiControlGet, PauseRunemaking_IfFood,,PauseRunemaking_IfFood
  3207. GuiControlGet, Logout_IfFood,,Logout_IfFood
  3208. GuiControlGet, PlaySound_IfFood,,PlaySound_IfFood
  3209. GuiControlGet, ShutDown_IfFood,,ShutDown_IfFood
  3210. GuiControlGet, WalkMethod_IfFood,,WalkMethod_IfFood
  3211. if (Logout_IfFood = 1){
  3212.    GuiControl,,PauseRunemaking_IfFood,1
  3213. }
  3214. return
  3215.  
  3216. PlaySound_IfFood:
  3217. return
  3218.  
  3219. ShutDown_IfFood:
  3220. GuiControlGet, PauseRunemaking_IfFood,,PauseRunemaking_IfFood
  3221. GuiControlGet, Logout_IfFood,,Logout_IfFood
  3222. GuiControlGet, PlaySound_IfFood,,PlaySound_IfFood
  3223. GuiControlGet, ShutDown_IfFood,,ShutDown_IfFood
  3224. GuiControlGet, WalkMethod_IfFood,,WalkMethod_IfFood
  3225. if (ShutDown_IfFood = 1){
  3226.    GuiControl,,PauseRunemaking_IfFood,1
  3227. }
  3228. return
  3229.  
  3230. WalkMethod_IfFood:
  3231. return
  3232.  
  3233.  
  3234. PauseRunemaking_IfBlank:
  3235. GuiControlGet, PauseRunemaking_IfBlank,,PauseRunemaking_IfBlank
  3236. GuiControlGet, Logout_IfBlank,,Logout_IfBlank
  3237. GuiControlGet, PlaySound_IfBlank,,PlaySound_IfBlank
  3238. GuiControlGet, ShutDown_IfBlank,,ShutDown_IfBlank
  3239. GuiControlGet, WalkMethod_IfBlank,,WalkMethod_IfBlank
  3240. GuiControlGet, CastSpell_IfBlank,,CastSpell_IfBlank
  3241. if (Logout_IfBlank = 1 or ShutDown_IfBlank = 1){
  3242.    GuiControl,,PauseRunemaking_IfBlank,1
  3243.    return
  3244. }
  3245. if (PauseRunemaking_IfBlank = 1){
  3246.    GuiControl,,Logout_IfBlank,0
  3247.    GuiControl,,ShutDown_IfBlank,0
  3248.    GuiControl,,CastSpell_IfBlank,0
  3249. }
  3250. return
  3251.  
  3252. Logout_IfBlank:
  3253. GuiControlGet, PauseRunemaking_IfBlank,,PauseRunemaking_IfBlank
  3254. GuiControlGet, Logout_IfBlank,,Logout_IfBlank
  3255. GuiControlGet, PlaySound_IfBlank,,PlaySound_IfBlank
  3256. GuiControlGet, ShutDown_IfBlank,,ShutDown_IfBlank
  3257. GuiControlGet, WalkMethod_IfBlank,,WalkMethod_IfBlank
  3258. if (Logout_IfBlank = 1){
  3259.    GuiControl,,CastSpell_IfBlank,0
  3260.    GuiControl,,PauseRunemaking_IfBlank,1
  3261. }
  3262. return
  3263.  
  3264. PlaySound_IfBlank:
  3265. return
  3266.  
  3267. ShutDown_IfBlank:
  3268. GuiControlGet, PauseRunemaking_IfBlank,,PauseRunemaking_IfBlank
  3269. GuiControlGet, Logout_IfBlank,,Logout_IfBlank
  3270. GuiControlGet, PlaySound_IfBlank,,PlaySound_IfBlank
  3271. GuiControlGet, ShutDown_IfBlank,,ShutDown_IfBlank
  3272. GuiControlGet, WalkMethod_IfBlank,,WalkMethod_IfBlank
  3273. if (ShutDown_IfBlank = 1){
  3274.    GuiControl,,CastSpell_IfBlank,0
  3275.    GuiControl,,PauseRunemaking_IfBlank,1
  3276. }
  3277. return
  3278.  
  3279. WalkMethod_IfBlank:
  3280. return
  3281.  
  3282. CastSpell_IfBlank:
  3283. GuiControlGet, PauseRunemaking_IfBlank,,PauseRunemaking_IfBlank
  3284. GuiControlGet, Logout_IfBlank,,Logout_IfBlank
  3285. GuiControlGet, PlaySound_IfBlank,,PlaySound_IfBlank
  3286. GuiControlGet, ShutDown_IfBlank,,ShutDown_IfBlank
  3287. GuiControlGet, WalkMethod_IfBlank,,WalkMethod_IfBlank
  3288. GuiControlGet, CastSpell_IfBlank,,CastSpell_IfBlank
  3289. GuiControlGet, Spell_to_cast_count,,Spell_to_cast_count
  3290. GuiControlGet, Spell_to_cast_name,,Spell_to_cast_name
  3291. if (Spell_to_cast_name = ""){
  3292.    notification(1, BOTName, "You should enter first valid spell key to casted, configurable in settings.")
  3293.    GuiControl,,CastSpell_IfBlank,0
  3294.    return
  3295. }
  3296. if (Spell_to_cast_count = ""){
  3297.    notification(1, BOTName, "First you should enter how many times spell will be casted, configurable in settings.")
  3298.    GuiControl,,CastSpell_IfBlank,0
  3299.    return
  3300. }
  3301. if ((Spell_to_cast_count < 1) or (Spell_to_cast_count > 10)){
  3302.    notification(1, BOTName, "The amount of times choosen spell will be casted can't be lower than 1 and higher than 10.")
  3303.    GuiControl,,CastSpell_IfBlank,0
  3304.    return
  3305. }
  3306. if (CastSpell_IfBlank = 1){
  3307.    GuiControl,,PauseRunemaking_IfBlank,0
  3308.    GuiControl,,ShutDown_IfBlank,0
  3309.    GuiControl,Choose,WalkMethod_IfBlank,1
  3310.    GuiControl,,Logout_IfBlank,0
  3311. }
  3312. return
  3313.  
  3314. PauseRunemaking_IfPlayer:
  3315. GuiControlGet, PauseRunemaking_IfPlayer,,PauseRunemaking_IfPlayer
  3316. GuiControlGet, Logout_IfPlayer,,Logout_IfPlayer
  3317. GuiControlGet, PlaySound_IfPlayer,,PlaySound_IfPlayer
  3318. GuiControlGet, ShutDown_IfPlayer,,ShutDown_IfPlayer
  3319. GuiControlGet, WalkMethod_IfPlayer,,WalkMethod_IfPlayer
  3320. GuiControlGet, CastSpell_IfPlayer,,CastSpell_IfPlayer
  3321. if (Logout_IfPlayer = 1 or ShutDown_IfPlayer = 1){
  3322.    GuiControl,,PauseRunemaking_IfPlayer,1
  3323.    return
  3324. }
  3325. if (PauseRunemaking_IfPlayer = 1){
  3326.    GuiControl,,Logout_IfPlayer,0
  3327.    GuiControl,,ShutDown_IfPlayer,0
  3328.    GuiControl,,CastSpell_IfPlayer,0
  3329. }
  3330. return
  3331.  
  3332. Logout_IfPlayer:
  3333. GuiControlGet, PauseRunemaking_IfPlayer,,PauseRunemaking_IfPlayer
  3334. GuiControlGet, Logout_IfPlayer,,Logout_IfPlayer
  3335. GuiControlGet, PlaySound_IfPlayer,,PlaySound_IfPlayer
  3336. GuiControlGet, ShutDown_IfPlayer,,ShutDown_IfPlayer
  3337. GuiControlGet, WalkMethod_IfPlayer,,WalkMethod_IfPlayer
  3338. if (Logout_IfPlayer = 1){
  3339.    GuiControl,,PauseRunemaking_IfPlayer,1
  3340. }
  3341. return
  3342.  
  3343. PlaySound_IfPlayer:
  3344. return
  3345.  
  3346. ShutDown_IfPlayer:
  3347. GuiControlGet, PauseRunemaking_IfPlayer,,PauseRunemaking_IfPlayer
  3348. GuiControlGet, Logout_IfPlayer,,Logout_IfPlayer
  3349. GuiControlGet, PlaySound_IfPlayer,,PlaySound_IfPlayer
  3350. GuiControlGet, ShutDown_IfPlayer,,ShutDown_IfPlayer
  3351. GuiControlGet, WalkMethod_IfPlayer,,WalkMethod_IfPlayer
  3352. if (ShutDown_IfPlayer = 1){
  3353.    GuiControl,,PauseRunemaking_IfPlayer,1
  3354. }
  3355. return
  3356.  
  3357. WalkMethod_IfPlayer:
  3358. return
  3359.  
  3360. PauseRunemaking_IfSoul:
  3361. GuiControlGet, PauseRunemaking_IfSoul,,PauseRunemaking_IfSoul
  3362. GuiControlGet, Logout_IfSoul,,Logout_IfSoul
  3363. GuiControlGet, PlaySound_IfSoul,,PlaySound_IfSoul
  3364. GuiControlGet, ShutDown_IfSoul,,ShutDown_IfSoul
  3365. GuiControlGet, WalkMethod_IfSoul,,WalkMethod_IfSoul
  3366. GuiControlGet, CastSpell_IfSoul,,CastSpell_IfSoul
  3367. if (Logout_IfSoul = 1 or ShutDown_IfSoul = 1){
  3368.    GuiControl,,PauseRunemaking_IfSoul,1
  3369.    return
  3370. }
  3371. if (PauseRunemaking_IfSoul = 1){
  3372.    GuiControl,,Logout_IfSoul,0
  3373.    GuiControl,,ShutDown_IfSoul,0
  3374.    GuiControl,,CastSpell_IfSoul,0
  3375. }
  3376. return
  3377.  
  3378. Logout_IfSoul:
  3379. GuiControlGet, PauseRunemaking_IfSoul,,PauseRunemaking_IfSoul
  3380. GuiControlGet, Logout_IfSoul,,Logout_IfSoul
  3381. GuiControlGet, PlaySound_IfSoul,,PlaySound_IfSoul
  3382. GuiControlGet, ShutDown_IfSoul,,ShutDown_IfSoul
  3383. GuiControlGet, WalkMethod_IfSoul,,WalkMethod_IfSoul
  3384. if (Logout_IfSoul = 1){
  3385.    GuiControl,,CastSpell_IfSoul,0
  3386.    GuiControl,,PauseRunemaking_IfSoul,1
  3387. }
  3388. return
  3389.  
  3390. PlaySound_IfSoul:
  3391. return
  3392.  
  3393. ShutDown_IfSoul:
  3394. GuiControlGet, PauseRunemaking_IfSoul,,PauseRunemaking_IfSoul
  3395. GuiControlGet, Logout_IfSoul,,Logout_IfSoul
  3396. GuiControlGet, PlaySound_IfSoul,,PlaySound_IfSoul
  3397. GuiControlGet, ShutDown_IfSoul,,ShutDown_IfSoul
  3398. GuiControlGet, WalkMethod_IfSoul,,WalkMethod_IfSoul
  3399. if (ShutDown_IfSoul = 1){
  3400.    GuiControl,,CastSpell_IfSoul,0
  3401.    GuiControl,,PauseRunemaking_IfSoul,1
  3402. }
  3403. return
  3404.  
  3405. WalkMethod_IfSoul:
  3406. return
  3407.  
  3408. CastSpell_IfSoul:
  3409. GuiControlGet, PauseRunemaking_IfSoul,,PauseRunemaking_IfSoul
  3410. GuiControlGet, Logout_IfSoul,,Logout_IfSoul
  3411. GuiControlGet, PlaySound_IfSoul,,PlaySound_IfSoul
  3412. GuiControlGet, ShutDown_IfSoul,,ShutDown_IfSoul
  3413. GuiControlGet, WalkMethod_IfSoul,,WalkMethod_IfSoul
  3414. GuiControlGet, CastSpell_IfSoul,,CastSpell_IfSoul
  3415. GuiControlGet, Spell_to_cast_count,,Spell_to_cast_count
  3416. GuiControlGet, Spell_to_cast_name,,Spell_to_cast_name
  3417. if (Spell_to_cast_name = ""){
  3418.    notification(1, BOTName, "You should enter first valid key of spell to casted, configurable in settings.")
  3419.    GuiControl,,CastSpell_IfSoul,0
  3420.    return
  3421. }
  3422. if (Spell_to_cast_count = ""){
  3423.    notification(1, BOTName, "You should enter first how many times spell will be casted, configurable in settings.")
  3424.    GuiControl,,CastSpell_IfSoul,0
  3425.    return
  3426. }
  3427. if ((Spell_to_cast_count < 1) or (Spell_to_cast_count > 10)){
  3428.    notification(1, BOTName, "The amount of times choosen spell will be casted can't be lower than 1 and higher than 10.")
  3429.    GuiControl,,CastSpell_IfSoul,0
  3430.    return
  3431. }
  3432. if (CastSpell_IfSoul = 1){
  3433.    GuiControl,,PauseRunemaking_IfSoul,0
  3434.    GuiControl,,ShutDown_IfSoul,0
  3435.    GuiControl,Choose,WalkMethod_IfSoul,1
  3436.    GuiControl,,Logout_IfSoul,0
  3437. }
  3438. return
  3439.  
  3440.  
  3441. Tab1:
  3442. Gui, Submit, NoHide
  3443. if ((Tab1 = "Alarms") or (Tab1 = "Settings") or (Tab1 = "Advanced"))
  3444.     GuiControl, Move, tab2, x800 y800
  3445. else
  3446.     GuiControl, Move, tab2, x32 y50
  3447. WinSet, Redraw, , A
  3448. return
  3449.  
  3450. ; ######################################################### SCREEN CHECKER #########################################################################
  3451.  
  3452. Area_screen_checker1:
  3453.   SetTimer, Read_scp_board1, Off
  3454.    GuiControl,,Enabled_screen_checker1,0
  3455.    GuiControl,CP:,CP_isActive_checker1,0
  3456.    Gdip_DisposeImage(bmparea_check1)
  3457.    if (!WinExist(title_tibia1)){
  3458.       notification(2, "Screen checker", "Window titled: " . title_tibia1 . " does not exist.")
  3459.       return
  3460.    }
  3461.    if (transparent_tibia1 = 1)
  3462.       gosub, hide_client_1
  3463.    WinActivate, ahk_pid %pid_tibia1%
  3464.    WinWait, ahk_pid %pid_tibia1%
  3465.    take_screenshot("area_check1", 85, 75)
  3466. return
  3467.  
  3468. Area_screen_checker2:
  3469.   SetTimer, Read_scp_board2, Off
  3470.    GuiControl,,Enabled_screen_checker2,0
  3471.    GuiControl,CP:,CP_isActive_checker2,0
  3472.    Gdip_DisposeImage(bmparea_check2)
  3473.    if (!WinExist(title_tibia2)){
  3474.       notification(2, "Screen checker", "Window titled: " . title_tibia2 . " does not exist.")
  3475.       return
  3476.    }
  3477.    if (transparent_tibia2 = 1)
  3478.       gosub, hide_client_2
  3479.    WinActivate, ahk_pid %pid_tibia2%
  3480.    WinWait, ahk_pid %pid_tibia2%
  3481.    take_screenshot("area_check2", 85, 75)
  3482. return
  3483.  
  3484. Help_screen_checker:
  3485. MsgBox, 32, Screen checker - help, "Affect on" determines on which window bot has to check if region of screen haven't changed. Bot relay on what is actually on screen so its impossible to check both windows at once. Runemake algorithm is constructed that way if there are two game windows the choosen game window will be active most of the time. What else there will be a short period about 3-10 seconds while the other window will be active to make rune and druing this time the choosen window will be not checked, what means there is still a risk to be killed.`n`n "Frequency" means how long each check will take. It is limited to once every 150ms but recommended value is about 400-500.`n`n"Select area" is a tool to obtain region to check and its position on screen. It is wise to use it for example on battelist or hp bar. Keep it mind that change of image will result in "if screen change" alert configurable in alarms tab. And it work only if game window is active and maximized (but not fullscreened)!`n`n"Double alarm effect" is while having two mc and screen region changes on one of the clients then alarm result affects two clients, not only choosen one. It is useful while having runemaking two characters in the same place, near house doors and in case of alarm both of them will go north.
  3486. return
  3487.  
  3488. Enabled_screen_checker1:
  3489.   GuiControlGet, Enabled_screen_checker1,,Enabled_screen_checker1
  3490.    if (!WinExist(title_tibia1)){
  3491.       notification(2, "Screen checker", "Window titled: " . title_tibia1 . " does not exist.")
  3492.       GuiControl,,Enabled_screen_checker1,0
  3493.       GuiControl,CP:,CP_isActive_checker1,0
  3494.       GuiControl,, Enabled_runemaking1, 0
  3495.       SetTimer, Read_scp_board1, Off
  3496.       Check_gui()
  3497.       return
  3498.    }
  3499.    else if (!FileExist("Data\Images\area_check1.bmp") or (area_start_x1 = "") or (area_start_y1 = "") or (sc_temp_img_dir1 !contains "area_check1.bmp")){
  3500.       notification(2, "Screen checker", "Capture image of region to check first")
  3501.       GuiControl,,Enabled_screen_checker1,0
  3502.       GuiControl,CP:,CP_isActive_checker1,0
  3503.       SetTimer, Read_scp_board1, Off
  3504.       return
  3505.    }
  3506.    IfWinNotExist, ahk_id %CommunicationPlatform%
  3507.    {
  3508.       GoSub, CP_GUI
  3509.       Sleep, 300
  3510.       Msgbox, CP_GUI launched.
  3511.    }
  3512.    ControlGet, SCP_HWND, Line,1,edit3, SCP_WRLBOT
  3513.    IfWinNotExist, ahk_id %SCP_HWND%
  3514.    {
  3515.       Run, Data\scp_wrlbot.exe, scp_pid
  3516.       sleep, 300
  3517.       ControlGet, SCP_HWND, Line,1,edit3, SCP_WRLBOT
  3518.       IfWinNotExist, ahk_id %SCP_HWND%
  3519.       {
  3520.          notification(1, "Screen checker", "There was communication problem with scp_wrlbot - (error 4001).")
  3521.          SetTimer, Read_scp_board2, Off
  3522.          GuiControl,,Enabled_screen_checker1,0
  3523.          GuiControl,CP:,CP_isActive_checker1,0
  3524.          return
  3525.       }
  3526.    }
  3527.    if (Enabled_screen_checker1 = 1){
  3528.       check1_x1 :=  area_start_x1 - 5
  3529.       check1_y1 :=  area_start_y1 - 5
  3530.       check1_x2 := 0 ; % area_start_x1 +100
  3531.       check1_y2 := 0 ; % area_start_y1 +90
  3532.       GuiControl,CP:,CP_check1_x1, %check1_x1%
  3533.       GuiControl,CP:,CP_check1_y1, %check1_y1%
  3534.       GuiControl,CP:,CP_isActive_checker1,1
  3535.       SetTimer, Read_scp_board1, %refresh_time%
  3536.    }
  3537.    else{
  3538.       GuiControl,CP:,CP_isActive_checker1,0
  3539.    }
  3540. return
  3541.  
  3542. Enabled_screen_checker2:
  3543.   GuiControlGet, Enabled_screen_checker2,,Enabled_screen_checker2
  3544.    if (!WinExist(title_tibia2)){
  3545.       notification(2, "Screen checker", "Window titled: " . title_tibia2 . " does not exist.")
  3546.       GuiControl,,Enabled_screen_checker2,0
  3547.       GuiControl,CP:,CP_isActive_checker2,0
  3548.       GuiControl,, Enabled_runemaking2, 0
  3549.       SetTimer, Read_scp_board2, Off
  3550.       Check_gui()
  3551.       return
  3552.    }
  3553.    else if (!FileExist("Data\Images\area_check2.bmp") or (area_start_x2 = "") or (area_start_y2 = "") or (sc_temp_img_dir2 !contains "area_check2.bmp")){
  3554.       notification(2, "Screen checker", "Capture image of region to check first")
  3555.       GuiControl,,Enabled_screen_checker2,0
  3556.       GuiControl,CP:,CP_isActive_checker2,0
  3557.       SetTimer, Read_scp_board2, Off
  3558.       return
  3559.    }
  3560.    IfWinNotExist, ahk_id %CommunicationPlatform%
  3561.    {
  3562.       GoSub, CP_GUI
  3563.       Sleep, 300
  3564.       Msgbox, CP_GUI launched.
  3565.    }
  3566.    ControlGet, SCP_HWND, Line,1,edit3, SCP_WRLBOT
  3567.    IfWinNotExist, ahk_id %SCP_HWND%
  3568.    {
  3569.       Run, Data\scp_wrlbot.exe, scp_pid
  3570.       sleep, 300
  3571.       ControlGet, SCP_HWND, Line,1,edit3, SCP_WRLBOT
  3572.       IfWinNotExist, ahk_id %SCP_HWND%
  3573.       {
  3574.          notification(1, "Screen checker", "There was communication problem with scp_wrlbot - (error 4001).")
  3575.          SetTimer, Read_scp_board2, Off
  3576.          GuiControl,,Enabled_screen_checker2,0
  3577.          GuiControl,CP:,CP_isActive_checker2,0
  3578.          return
  3579.       }
  3580.    }
  3581.    if (Enabled_screen_checker2 = 1){
  3582.       check2_x1 := area_start_x2 - 5
  3583.       check2_y1 := area_start_y2 - 5
  3584.       check2_x2 := 0 ; % area_start_x2 +100
  3585.       check2_y2 := 0 ; % area_start_y2 +90
  3586.       GuiControl,CP:,CP_check2_x1, %check2_x1%
  3587.       GuiControl,CP:,CP_check2_y1, %check2_y1%
  3588.       GuiControl,CP:,CP_isActive_checker2,1
  3589.       SetTimer, Read_scp_board2, %refresh_time%
  3590.    }
  3591.    else{
  3592.       GuiControl,CP:,CP_isActive_checker2,0
  3593.    }
  3594. return
  3595.  
  3596.  
  3597. Screen_check1:
  3598. return
  3599.  
  3600. Screen_check2:
  3601. return
  3602.  
  3603.  
  3604.  
  3605.  
  3606. CP_GUI:
  3607.   GuiControlGet, Enabled_screen_checker1,,Enabled_screen_checker1
  3608.    GuiControlGet, Enabled_screen_checker2,,Enabled_screen_checker2
  3609.    Gui, CP: New
  3610.    Gui, CP: +HwndCommunicationPlatform  +Caption +LastFound +ToolWindow +E0x20   ;  +AlwaysOnTop ; WS_EX_TRANSPARENT ; communication panel
  3611.    Gui, CP: Add, Edit, x12 y10 w60 h20 vCP_isActive_checker1 Disabled, %Enabled_screen_checker1%
  3612.    Gui, CP: Add, Edit, x12 y30 w60 h20 vCP_hwnd1 Disabled, empty
  3613.    Gui, CP: Add, Edit, x12 y50 w60 h20 vCP_check1_x1 Disabled, empty
  3614.    Gui, CP: Add, Edit, x12 y70 w60 h20 vCP_check1_y1 Disabled, empty
  3615.    Gui, CP: Add, Edit, x82 y10 w60 h20 vCP_isActive_checker2 Disabled, %Enabled_screen_checker2%
  3616.    Gui, CP: Add, Edit, x82 y30 w60 h20 vCP_hwnd2 Disabled, empty
  3617.    Gui, CP: Add, Edit, x82 y50 w60 h20 vCP_check2_x1 Disabled, empty
  3618.    Gui, CP: Add, Edit, x82 y70 w60 h20 vCP_check2_y1 Disabled, empty
  3619.    Gui, CP: Add, Edit, x12 y90 w60 h20 vCP_BOT_HWND Disabled, %MainBotWindow%
  3620.    Gui, CP: Add, Edit, x82 y90 w60 h20 vCP_CP_HWND Disabled, %CommunicationPlatform%
  3621. ;   DllCall("SetParent", UInt, WinExist() , UInt, ahk_id MainBotWindow)
  3622.    WinSet, Transparent, 0 ;, CP_WRLBOT ; ahk_id %CommunicationPlatform%
  3623.    Gui, CP: Show, w155 h120 NoActivate Center, CP_WRLBOT
  3624.    GuiControl,CP:,CP_hwnd1, %hwnd1%
  3625.    GuiControl,CP:,CP_hwnd2, %hwnd2%
  3626.    WinSet, Transparent, 0, ahk_id %CommunicationPlatform%
  3627. return
  3628.  
  3629.  
  3630. Read_scp_board1:
  3631.   GuiControlGet, Enabled_screen_checker1,,Enabled_screen_checker1
  3632.    if (Enabled_screen_checker1 = 1){
  3633.       ControlGet, result1, Line,1,edit1, SCP_WRLBOT
  3634.       if (result1 = 0){
  3635.          if (transparent_tibia1 = 1){                                                                ; double check with 100ms sleep to make sure if its not false positive in result of min/max hidden win fast
  3636.             sleep, 100
  3637.             ControlGet, result1, Line,1,edit1, SCP_WRLBOT
  3638.              if (result1 = 0){
  3639.                alarm(title_tibia1, "player")
  3640.                SetTimer, Read_scp_board1, Off
  3641.                GuiControl,,Enabled_screen_checker1,0
  3642.                GuiControl,CP:,CP_isActive_checker1,0
  3643.                return
  3644.             }
  3645.          }
  3646.          alarm(title_tibia1, "player")
  3647.          SetTimer, Read_scp_board1, Off
  3648.          GuiControl,,Enabled_screen_checker1,0
  3649.          GuiControl,CP:,CP_isActive_checker1,0
  3650.          return
  3651.       }
  3652.       if (result1 != "1"){
  3653.          if (result1 = "NE"){
  3654.             SetTimer, Read_scp_board1, Off
  3655.             GuiControl,,Enabled_screen_checker1,0
  3656.             GuiControl,CP:,CP_isActive_checker1,0
  3657.             notification(2, "Screen checker", "Window titled: " . title_tibia1 . " does not exist.")
  3658.          }
  3659.          if (result1 = "NA"){
  3660.             if (transparent_tibia1 = 1)
  3661.                WinActivate, %title_tibia1%
  3662.             else
  3663.                notification(1, "Screen checker", "Screen checker: window 1 must be maximized to be checked. Use 'hide/show' button if you want to hide game.")
  3664.          }
  3665.       }
  3666.    }
  3667. return
  3668.  
  3669. Read_scp_board2:
  3670.   GuiControlGet, Enabled_screen_checker2,,Enabled_screen_checker2
  3671.    if (Enabled_screen_checker2 = 1){
  3672.       ControlGet, result2, Line,1,edit2, SCP_WRLBOT
  3673.       if (result2 = 0){
  3674.          if (transparent_tibia2 = 1){
  3675.             sleep, 100
  3676.             ControlGet, result2, Line,1,edit2, SCP_WRLBOT
  3677.              if (result2 = 0){
  3678.                alarm(title_tibia2, "player")
  3679.                SetTimer, Read_scp_board2, Off
  3680.                GuiControl,,Enabled_screen_checker2,0
  3681.                GuiControl,CP:,CP_isActive_checker2,0
  3682.                return
  3683.             }
  3684.          }
  3685.          alarm(title_tibia2, "player")
  3686.          SetTimer, Read_scp_board2, Off
  3687.          GuiControl,,Enabled_screen_checker2,0
  3688.          GuiControl,CP:,CP_isActive_checker2,0
  3689.          return
  3690.       }
  3691.       if (result2 != "1"){
  3692.          if (result2 = "NE"){
  3693.             SetTimer, Read_scp_board2, Off
  3694.             GuiControl,,Enabled_screen_checker2,0
  3695.             GuiControl,CP:,CP_isActive_checker2,0
  3696.             notification(2, "Screen checker", "Window titled: " . title_tibia2 . " does not exist.")
  3697.          }
  3698.          if (result2 = "NA"){
  3699.             if (transparent_tibia2 = 1)
  3700.                WinActivate, %title_tibia2%
  3701.             else
  3702.                notification(1, "Screen checker", "Screen checker: window 2 must be maximized to be checked. Use 'hide/show' button if you want to hide game.")
  3703.          }
  3704.       }
  3705.    }
  3706. return
  3707.  
  3708. ; ################################################################# FISHING 1 ################################################################################
  3709. Fishing_setup1:
  3710.   if (!WinExist(title_tibia1)){
  3711.       notification(2, "Fishing tool", "Window titled: " . title_tibia1 . " does not exist.")
  3712.       GuiControl,,Fishing_enabled1, 0
  3713.       check_gui()
  3714.       return
  3715.    }
  3716.    If !(WinExist(Fishing_gui1_title)){
  3717.       GuiControl,,Fishing_enabled1, 0
  3718.       check_gui()
  3719.       Hotkey, ESC, Fishing_restore_windows1, On
  3720.       if (DllCall("IsWindowVisible", "UInt", WinExist(Fishing_gui2_title))){
  3721.          WinGetPos, win_temp_posX, win_temp_posY, , ,%Fishing_gui2_title%
  3722.          Gui, Fishing_gui1: Show, x%win_temp_posX% y%win_temp_posY% w149 h242, %Fishing_gui1_title%  
  3723.       }
  3724.       else
  3725.          Gui, Fishing_gui1: Show, xCenter yCenter w149 h242, %Fishing_gui1_title%  
  3726.    }
  3727.    if (DllCall("IsWindowVisible", "UInt", WinExist(Fishing_gui2_title))){
  3728.       global execution_allowed := 1
  3729.       i := 0
  3730.       j := 0
  3731.       while (i < 15){
  3732.           while (j < 11){
  3733.               Gui, second_sqm%i%x%j%: Hide
  3734.               j := j + 1
  3735.           }
  3736.           j := 0
  3737.           i := i + 1
  3738.       }
  3739.       GuiControl, Fishing_gui2:, Fishing_button_text2, show fishing spots
  3740.       Hotkey, ESC, Fishing_restore_windows2, Off
  3741.       RestoreCursors()
  3742.       Gui, Fishing_gui2: Hide
  3743.       Gui, Fishing_selectTopLeft2: Hide
  3744.       Gui, Fishing_selectBottomRight2: Hide
  3745.       Hotkey, ~LButton, Fishing_selectSqm2, Off
  3746.       Hotkey, LButton, Fishing_Mouse_selectTopLeft2, off
  3747.       Hotkey, LButton, Fishing_Mouse_selectBottomRight2, off
  3748.    }
  3749. return
  3750.  
  3751. Fishing_getSpots1:
  3752.   DetectHiddenWindows, On
  3753.    if winexist("x0y0zAABBCC1"){
  3754.          DetectHiddenWindows, Off
  3755.          goto, Fishing_showSqmsNet1
  3756.    }
  3757.    DetectHiddenWindows, Off
  3758.    Gui, Fishing_gui1: Hide
  3759.    Gui, Fishing_selectTopLeft1: Show, AutoSize xCenter yCenter
  3760.    if (transparent_tibia1 = 1)
  3761.       gosub, hide_client_1
  3762.    WinMinimize, ahk_id %MainBotWindow%
  3763.    WinActivate, ahk_pid %pid_tibia1%
  3764.    WinWait, ahk_pid %pid_tibia1%
  3765.    SetSystemCursor("IDC_CROSS")
  3766.    global execution_allowed := 0
  3767.    Hotkey, LButton, Fishing_Mouse_selectTopLeft1, on
  3768. return
  3769.  
  3770. Fishing_Mouse_selectTopLeft1:
  3771.   MouseGetPos, topleft_gamewindow1_x, topleft_gamewindow1_y
  3772.    Gui, Fishing_selectTopLeft1: Hide
  3773.    Hotkey, LButton, Fishing_Mouse_selectTopLeft1, off
  3774.    Sleep, 200
  3775.    Gui, Fishing_selectBottomRight1: Show, AutoSize xCenter yCenter
  3776.    Hotkey, LButton, Fishing_Mouse_selectBottomRight1, on
  3777. return
  3778.  
  3779. Fishing_Mouse_selectBottomRight1:
  3780.   MouseGetPos, bottomright_gamewindow1_x, bottomright_gamewindow1_y
  3781.    If ((bottomright_gamewindow1_x-topleft_gamewindow1_x) < 300) or  ((bottomright_gamewindow1_y-topleft_gamewindow1_y) < 300){
  3782.       GoSub, Fishing_restore_windows1
  3783.       MsgBox, Take proper measurments of top left and right bottom of game window.
  3784.       return
  3785.    }
  3786.    Hotkey, LButton, Fishing_Mouse_selectBottomRight1, off
  3787.    Gui, Fishing_selectBottomRight1: Hide
  3788.    RestoreCursors()
  3789.    Goto, Fishing_showSqmsNet1
  3790. return
  3791.  
  3792. Fishing_showSqmsNet1:
  3793.   sqm_width1 := round((bottomright_gamewindow1_x - topleft_gamewindow1_x)/15)
  3794.    sqm_height1 := round((bottomright_gamewindow1_y - topleft_gamewindow1_y)/11)
  3795.    i := 0
  3796.    j := 0
  3797.    a := 0
  3798.    DetectHiddenWindows, On
  3799.    if DllCall("IsWindowVisible", "UInt", WinExist("x0y0zAABBCC1"))
  3800.       fishing_sqms_hidden1 := 0
  3801.    else
  3802.        fishing_sqms_hidden1 := 1
  3803.    if (winexist("x0y0zAABBCC1") and (fishing_sqms_hidden1 = 0)){
  3804.       global execution_allowed := 1
  3805.       GuiControl, Fishing_gui1:, Fishing_button_text1, show fishing spots
  3806.       while (i < 15){
  3807.          while (j < 11){
  3808.               Gui, first_sqm%i%x%j%: Hide
  3809.               j := j + 1
  3810.           }
  3811.           j := 0
  3812.           i := i + 1
  3813.       }
  3814.    }
  3815.    else if (winexist("x0y0zAABBCC1") and (fishing_sqms_hidden1 = 1)){
  3816.       global execution_allowed := 0
  3817.       GuiControl, Fishing_gui1:, Fishing_button_text1, hide fishing spots
  3818.       if (transparent_tibia1 = 1)
  3819.          gosub, hide_client_1
  3820.       WinMinimize, ahk_id %MainBotWindow%
  3821.       WinActivate, ahk_pid %pid_tibia1%
  3822.       WinWait, ahk_pid %pid_tibia1%
  3823.       while (i < 15){
  3824.          while (j < 11){
  3825.               Gui, first_sqm%i%x%j%: Show
  3826.               j := j + 1
  3827.           }
  3828.           j := 0
  3829.           i := i + 1
  3830.       }
  3831.    }
  3832.    else{
  3833.       global execution_allowed := 0
  3834.       GuiControl, Fishing_gui1:, Fishing_button_text1, hide fishing spots
  3835.       while (i < 15){
  3836.           while (j < 11){
  3837.               Gui, first_sqm%i%x%j%: New
  3838.               Gui, first_sqm%i%x%j%: +alwaysontop -Caption +Border +ToolWindow +LastFound +OwnerFishing_gui1
  3839.               Gui, first_sqm%i%x%j%: Color, ADEBDA
  3840.               WinSet, Transparent, 50 ; Else Add transparency
  3841.               posx := topleft_gamewindow1_x + i*sqm_width1
  3842.               posy := topleft_gamewindow1_y + j*sqm_height1
  3843.               Gui, first_sqm%i%x%j%: Show, x%posx% y%posy% w%sqm_width1% h%sqm_height1% NoActivate, x%i%y%j%zAABBCC1
  3844.               fishing1_spot[i, j]   := a
  3845.               a := a + 1
  3846.               j := j + 1
  3847.           }
  3848.           j := 0
  3849.           i := i + 1
  3850.       }
  3851.    }
  3852.    DetectHiddenWindows, Off
  3853.    moveFishing_gui1_posx := topleft_gamewindow1_x + 15*sqm_width1
  3854.    Gui, Fishing_gui1: Show, x%moveFishing_gui1_posx% y%topleft_gamewindow1_y% w149 h242, %Fishing_gui1_title%
  3855.    ; WinMove, ahk_id %Fishing_gui1%,,
  3856.    Hotkey, ~LButton, Fishing_selectSqm1, ON
  3857. return
  3858.  
  3859.  
  3860. Fishing_reset1:
  3861. global execution_allowed := 1
  3862. GuiControl, Fishing_gui1:, Fishing_button_text1, get fishing spots
  3863. i := 0
  3864. j := 0
  3865. while (i < 15){
  3866.           while (j < 11){
  3867.               Gui, first_sqm%i%x%j%: Destroy
  3868.               first_value%i%x%j% := 0
  3869.               fishing1_stack.delete(fishing1_spot[i, j])
  3870.             j := j + 1
  3871.          }
  3872. j := 0
  3873. i := i + 1
  3874. }
  3875. return
  3876.  
  3877. Fishing_selectSqm1:
  3878.   Sleep, 30
  3879.    WinGetTitle, title, A
  3880.    if title contains AABBCC1
  3881.    {
  3882.        FoundPosX := InStr(title, "x")
  3883.        FoundPosY := InStr(title, "y")
  3884.        FoundPosZ := InStr(title, "z")
  3885.        FoundPosX2 := FoundPosX + 1
  3886.        length1 := FoundPosY - FoundPosX2
  3887.        FoundPosY2 := FoundPosY + 1
  3888.        length2 := FoundPosZ - FoundPosY2
  3889.        nr_i := SubStr(title, FoundPosX2, Length1)
  3890.        nr_j := SubStr(title, FoundPosY2, Length2)
  3891.        if (first_value%nr_i%x%nr_j% != 1){
  3892.            Gui, first_sqm%nr_i%x%nr_j%: Color, FF0000
  3893.            first_value%nr_i%x%nr_j% := 1
  3894.            pos_toFish := "x" . round(topleft_gamewindow1_x + sqm_width1*(nr_i + 0.5)) . "y" . round(topleft_gamewindow1_y + sqm_height1*(nr_j + 0.5))
  3895.            fishing1_stack[fishing1_spot[nr_i, nr_j]] := pos_toFish
  3896.            arrayChanged1:=1
  3897.        }
  3898.        else{
  3899.            Gui, first_sqm%nr_i%x%nr_j%: Color, ADEBDA
  3900.            first_value%nr_i%x%nr_j% := 0
  3901.            fishing1_stack.delete(fishing1_spot[nr_i, nr_j])
  3902.            arrayChanged1:=1
  3903.        }
  3904.    }
  3905. return
  3906.  
  3907. Fishing_gui1GuiClose:
  3908.   gosub,Fishing_done1
  3909. return
  3910.  
  3911. Fishing_done1:
  3912.   global execution_allowed := 1
  3913.    i := 0
  3914.    j := 0
  3915.    while (i < 15){
  3916.        while (j < 11){
  3917.            Gui, first_sqm%i%x%j%: Hide
  3918.            j := j + 1
  3919.        }
  3920.        j := 0
  3921.        i := i + 1
  3922.    }
  3923.    DetectHiddenWindows, On
  3924.    if (winexist("x0y0zAABBCC1"))
  3925.       GuiControl, Fishing_gui1:, Fishing_button_text1, show fishing spots
  3926.    DetectHiddenWindows, Off
  3927.    Gosub, Fishing_restore_windows1
  3928.    Gui, Fishing_gui1: Hide
  3929.    WinActivate, ahk_id %MainBotWindow%
  3930. return
  3931.  
  3932.  
  3933. Fishing_restore_windows1:
  3934.   Hotkey, ESC, Fishing_restore_windows1, Off
  3935.    RestoreCursors()
  3936.    Gui, Fishing_selectTopLeft1: Hide
  3937.    Gui, Fishing_selectBottomRight1: Hide
  3938.    Hotkey, ~LButton, Fishing_selectSqm1, Off
  3939.    Hotkey, LButton, Fishing_Mouse_selectTopLeft1, off
  3940.    Hotkey, LButton, Fishing_Mouse_selectBottomRight1, off
  3941. return
  3942.  
  3943. fishing_enabled1:
  3944.   GuiControlGet, fishing_enabled1,, fishing_enabled1
  3945.    IfWinNotExist, ahk_pid %pid_tibia1%
  3946.       {
  3947.       if (pid_tibia1 != ""){
  3948.          title_tibia1 := "Game client 1 - identyfied by " pid_tibia1
  3949.          WinActivate, ahk_pid %pid_tibia1%
  3950.          WinWait, ahk_pid %pid_tibia1%
  3951.          WinSetTitle, %title_tibia1%
  3952.          sleep, 50
  3953.       }
  3954.       IfWinNotExist, ahk_pid %pid_tibia1%
  3955.       {
  3956.          notification(2, title_tibia1, "Window " . title_tibia1 . " doesn't exist.")
  3957.          GuiControl,, fishing_enabled1, 0
  3958.          check_gui()
  3959.          return
  3960.       }
  3961.    }
  3962.    random_posToFish_template1 := getRandomArrayValue1(fishing1_stack,arrayChanged1)
  3963.    arrayChanged1:=0
  3964.    DetectHiddenWindows, On
  3965.     if (!(winexist("x0y0zAABBCC1")) or random_posToFish_template1 = ""){
  3966.       notification(2, title_tibia1, "You should first get spots you want to fish on.")
  3967.       GuiControl,, fishing_enabled1, 0
  3968.       Check_gui()
  3969.       DetectHiddenWindows, Off
  3970.    }
  3971.    if DllCall("IsWindowVisible", "UInt", WinExist("x0y0zAABBCC1"))
  3972.       fishing_sqms_hidden1 := 0
  3973.    else
  3974.        fishing_sqms_hidden1 := 1
  3975.    if (winexist("x0y0zAABBCC1") and (fishing_sqms_hidden1 = 0)){
  3976.       GuiControl, Fishing_gui1:, Fishing_button_text1, show fishing spots
  3977.       while (i < 15){
  3978.          while (j < 11){
  3979.               Gui, first_sqm%i%x%j%: Hide
  3980.               j := j + 1
  3981.           }
  3982.           j := 0
  3983.           i := i + 1
  3984.       }
  3985.    }
  3986.    DetectHiddenWindows, Off
  3987.    if (fishing_enabled1 = 1){
  3988.       SetTimer, fishing_execution, %fishing_time%
  3989.    }
  3990.    gosub, Fishing_done1
  3991.    check_gui()
  3992. return
  3993.  
  3994. ; ################################################################# FISHING 2 ################################################################################
  3995.  
  3996.  
  3997. Fishing_setup2:
  3998.   if (!WinExist(title_tibia2)){
  3999.       notification(2, "Fishing tool", "Window titled: " . title_tibia2 . " does not exist.")
  4000.       GuiControl,,Fishing_enabled2, 0
  4001.       check_gui()
  4002.       return
  4003.    }
  4004.    If !(WinExist(Fishing_gui2_title)){
  4005.       GuiControl,,Fishing_enabled2, 0
  4006.       check_gui()
  4007.       Hotkey, ESC, Fishing_restore_windows2, On
  4008.       if (DllCall("IsWindowVisible", "UInt", WinExist(Fishing_gui1_title))){
  4009.          WinGetPos, win_temp_posX, win_temp_posY, , ,%Fishing_gui1_title%
  4010.          Gui, Fishing_gui2: Show, x%win_temp_posX% y%win_temp_posY% w149 h242, %Fishing_gui2_title%  
  4011.       }
  4012.       else
  4013.          Gui, Fishing_gui2: Show, xCenter yCenter w149 h242, %Fishing_gui2_title%  
  4014.    }
  4015.    if (DllCall("IsWindowVisible", "UInt", WinExist(Fishing_gui1_title))){
  4016.       global execution_allowed := 1
  4017.       i := 0
  4018.       j := 0
  4019.       while (i < 15){
  4020.           while (j < 11){
  4021.               Gui, first_sqm%i%x%j%: Hide
  4022.               j := j + 1
  4023.           }
  4024.           j := 0
  4025.           i := i + 1
  4026.       }
  4027.       GuiControl, Fishing_gui1:, Fishing_button_text1, show fishing spots
  4028.       Hotkey, ESC, Fishing_restore_windows1, Off
  4029.       RestoreCursors()
  4030.       Gui, Fishing_gui1: Hide
  4031.       Gui, Fishing_selectTopLeft1: Hide
  4032.       Gui, Fishing_selectBottomRight1: Hide
  4033.       Hotkey, ~LButton, Fishing_selectSqm1, Off
  4034.       Hotkey, LButton, Fishing_Mouse_selectTopLeft1, off
  4035.       Hotkey, LButton, Fishing_Mouse_selectBottomRight1, off
  4036.    }
  4037. return
  4038.  
  4039. Fishing_getSpots2:
  4040.   DetectHiddenWindows, On
  4041.    if winexist("x0y0zAABBCC2"){
  4042.          DetectHiddenWindows, Off
  4043.          goto, Fishing_showSqmsNet2
  4044.    }
  4045.    DetectHiddenWindows, Off
  4046.    Gui, Fishing_gui2: Hide
  4047.    Gui, Fishing_selectTopLeft2: Show, AutoSize xCenter yCenter
  4048.    if (transparent_tibia2 = 1)
  4049.       gosub, hide_client_2
  4050.    WinMinimize, ahk_id %MainBotWindow%
  4051.    WinActivate, ahk_pid %pid_tibia2%
  4052.    WinWait, ahk_pid %pid_tibia2%
  4053.    SetSystemCursor("IDC_CROSS")
  4054.    global execution_allowed := 0
  4055.    Hotkey, LButton, Fishing_Mouse_selectTopLeft2, on
  4056. return
  4057.  
  4058. Fishing_Mouse_selectTopLeft2:
  4059.   MouseGetPos, topleft_gamewindow2_x, topleft_gamewindow2_y
  4060.    Gui, Fishing_selectTopLeft2: Hide
  4061.    Hotkey, LButton, Fishing_Mouse_selectTopLeft2, off
  4062.    Sleep, 200
  4063.    Gui, Fishing_selectBottomRight2: Show, AutoSize xCenter yCenter
  4064.    Hotkey, LButton, Fishing_Mouse_selectBottomRight2, on
  4065. return
  4066.  
  4067. Fishing_Mouse_selectBottomRight2:
  4068.   MouseGetPos, bottomright_gamewindow2_x, bottomright_gamewindow2_y
  4069.    If ((bottomright_gamewindow2_x-topleft_gamewindow2_x) < 300) or  ((bottomright_gamewindow2_y-topleft_gamewindow2_y) < 300){
  4070.       GoSub, Fishing_restore_windows2
  4071.       MsgBox, Take proper measurments of top left and right bottom of game window.
  4072.       return
  4073.    }
  4074.    Hotkey, LButton, Fishing_Mouse_selectBottomRight2, off
  4075.    Gui, Fishing_selectBottomRight2: Hide
  4076.    RestoreCursors()
  4077.    Goto, Fishing_showSqmsNet2
  4078. return
  4079.  
  4080. Fishing_showSqmsNet2:
  4081.   sqm_width2 := round((bottomright_gamewindow2_x - topleft_gamewindow2_x)/15)
  4082.    sqm_height2 := round((bottomright_gamewindow2_y - topleft_gamewindow2_y)/11)
  4083.    i := 0
  4084.    j := 0
  4085.    a := 0
  4086.    DetectHiddenWindows, On
  4087.    if DllCall("IsWindowVisible", "UInt", WinExist("x0y0zAABBCC2"))
  4088.       fishing_sqms_hidden2 := 0
  4089.    else
  4090.        fishing_sqms_hidden2 := 1
  4091.    if (winexist("x0y0zAABBCC2") and (fishing_sqms_hidden2 = 0)){
  4092.       global execution_allowed := 1
  4093.       GuiControl, Fishing_gui2:, Fishing_button_text2, show fishing spots
  4094.       while (i < 15){
  4095.          while (j < 11){
  4096.               Gui, second_sqm%i%x%j%: Hide
  4097.               j := j + 1
  4098.           }
  4099.           j := 0
  4100.           i := i + 1
  4101.       }
  4102.    }
  4103.    else if (winexist("x0y0zAABBCC2") and (fishing_sqms_hidden2 = 1)){
  4104.       global execution_allowed := 0
  4105.       GuiControl, Fishing_gui2:, Fishing_button_text2, hide fishing spots
  4106.        if (transparent_tibia2 = 1)
  4107.       gosub, hide_client_2
  4108.       WinMinimize, ahk_id %MainBotWindow%
  4109.       WinActivate, ahk_pid %pid_tibia2%
  4110.       WinWait, ahk_pid %pid_tibia2%
  4111.       while (i < 15){
  4112.          while (j < 11){
  4113.               Gui, second_sqm%i%x%j%: Show
  4114.               j := j + 1
  4115.           }
  4116.           j := 0
  4117.           i := i + 1
  4118.       }
  4119.    }
  4120.    else{
  4121.       global execution_allowed := 0
  4122.       GuiControl, Fishing_gui2:, Fishing_button_text2, hide fishing spots
  4123.       while (i < 15){
  4124.           while (j < 11){
  4125.               Gui, second_sqm%i%x%j%: New
  4126.               Gui, second_sqm%i%x%j%: +alwaysontop -Caption +Border +ToolWindow +LastFound +OwnerFishing_gui2
  4127.               Gui, second_sqm%i%x%j%: Color, ADEBDA
  4128.               WinSet, Transparent, 50 ; Else Add transparency
  4129.               posx := topleft_gamewindow2_x + i*sqm_width2
  4130.               posy := topleft_gamewindow2_y + j*sqm_height2
  4131.               Gui, second_sqm%i%x%j%: Show, x%posx% y%posy% w%sqm_width2% h%sqm_height2% NoActivate, x%i%y%j%zAABBCC2
  4132.               fishing2_spot[i, j] := a
  4133.               a := a + 1
  4134.               j := j + 1
  4135.           }
  4136.           j := 0
  4137.           i := i + 1
  4138.       }
  4139.    }
  4140.    DetectHiddenWindows, Off
  4141.    moveFishing_gui2_posx := topleft_gamewindow2_x + 15*sqm_width2
  4142.    Gui, Fishing_gui2: Show, x%moveFishing_gui2_posx% y%topleft_gamewindow2_y% w149 h242, %Fishing_gui2_title%
  4143.    ; WinMove, ahk_id %Fishing_gui2%,,
  4144.    Hotkey, ~LButton, Fishing_selectSqm2, ON
  4145. return
  4146.  
  4147.  
  4148. Fishing_reset2:
  4149. global execution_allowed := 1
  4150. GuiControl, Fishing_gui2:, Fishing_button_text2, get fishing spots
  4151. i := 0
  4152. j := 0
  4153. while (i < 15){
  4154.           while (j < 11){
  4155.               Gui, second_sqm%i%x%j%: Destroy
  4156.               first_value%i%x%j% := 0
  4157.               fishing2_stack.delete(fishing2_spot[i, j])
  4158.             j := j + 1
  4159.          }
  4160. j := 0
  4161. i := i + 1
  4162. }
  4163. return
  4164.  
  4165. Fishing_selectSqm2:
  4166.   Sleep, 30
  4167.    WinGetTitle, title, A
  4168.    if title contains AABBCC2
  4169.    {
  4170.        FoundPosX := InStr(title, "x")
  4171.        FoundPosY := InStr(title, "y")
  4172.        FoundPosZ := InStr(title, "z")
  4173.        FoundPosX2 := FoundPosX + 1
  4174.        length1 := FoundPosY - FoundPosX2
  4175.        FoundPosY2 := FoundPosY + 1
  4176.        length2 := FoundPosZ - FoundPosY2
  4177.        nr_i := SubStr(title, FoundPosX2, Length1)
  4178.        nr_j := SubStr(title, FoundPosY2, Length2)
  4179.        if (first_value%nr_i%x%nr_j% != 1){
  4180.            Gui, second_sqm%nr_i%x%nr_j%: Color, FF0000
  4181.            first_value%nr_i%x%nr_j% := 1
  4182.            pos_toFish := "x" . round(topleft_gamewindow2_x + sqm_width2*(nr_i + 0.5)) . "y" . round(topleft_gamewindow2_y + sqm_height2*(nr_j + 0.5))
  4183.            fishing2_stack[fishing2_spot[nr_i, nr_j]] := pos_toFish
  4184.            arrayChanged2:=1
  4185.        }
  4186.        else{
  4187.            Gui, second_sqm%nr_i%x%nr_j%: Color, ADEBDA
  4188.            first_value%nr_i%x%nr_j% := 0
  4189.            fishing2_stack.delete(fishing2_spot[nr_i, nr_j])
  4190.            arrayChanged2:=1
  4191.        }
  4192.    }
  4193. return
  4194.  
  4195. Fishing_gui2GuiClose:
  4196.   gosub,Fishing_done2
  4197. return
  4198.  
  4199. Fishing_done2:
  4200.   global execution_allowed := 1
  4201.    i := 0
  4202.    j := 0
  4203.    while (i < 15){
  4204.        while (j < 11){
  4205.            Gui, second_sqm%i%x%j%: Hide
  4206.            j := j + 1
  4207.        }
  4208.        j := 0
  4209.        i := i + 1
  4210.    }
  4211.    DetectHiddenWindows, On
  4212.    if (winexist("x0y0zAABBCC2"))
  4213.       GuiControl, Fishing_gui2:, Fishing_button_text2, show fishing spots
  4214.    DetectHiddenWindows, Off
  4215.    Gosub, Fishing_restore_windows2
  4216.    Gui, Fishing_gui2: Hide
  4217.    WinActivate, ahk_id %MainBotWindow%
  4218. return
  4219.  
  4220.  
  4221. Fishing_restore_windows2:
  4222.   Hotkey, ESC, Fishing_restore_windows2, Off
  4223.    RestoreCursors()
  4224.    Gui, Fishing_selectTopLeft2: Hide
  4225.    Gui, Fishing_selectBottomRight2: Hide
  4226.    Hotkey, ~LButton, Fishing_selectSqm2, Off
  4227.    Hotkey, LButton, Fishing_Mouse_selectTopLeft2, off
  4228.    Hotkey, LButton, Fishing_Mouse_selectBottomRight2, off
  4229. return
  4230.  
  4231. fishing_enabled2:
  4232.   GuiControlGet, fishing_enabled2,, fishing_enabled2
  4233.    IfWinNotExist, ahk_pid %pid_tibia2%
  4234.       {
  4235.       if (pid_tibia2 != ""){
  4236.          title_tibia2 := "Game client 2 - identyfied by " pid_tibia2
  4237.          WinActivate, ahk_pid %pid_tibia2%
  4238.          WinWait, ahk_pid %pid_tibia2%
  4239.          WinSetTitle, %title_tibia2%
  4240.          sleep, 50
  4241.       }
  4242.       IfWinNotExist, ahk_pid %pid_tibia2%
  4243.       {
  4244.          notification(2, title_tibia2, "Window " . title_tibia2 . " doesn't exist.")
  4245.          GuiControl,, fishing_enabled2, 0
  4246.          check_gui()
  4247.          return
  4248.       }
  4249.    }
  4250.    random_posToFish_template2 := getRandomArrayValue2(fishing2_stack,arrayChanged2)
  4251.    arrayChanged2:=0
  4252.    DetectHiddenWindows, On
  4253.     if (!(winexist("x0y0zAABBCC2")) or random_posToFish_template2 = ""){
  4254.       notification(2, title_tibia2, "You should first get spots you want to fish on.")
  4255.       GuiControl,, fishing_enabled2, 0
  4256.       Check_gui()
  4257.       DetectHiddenWindows, Off
  4258.    }
  4259.    if DllCall("IsWindowVisible", "UInt", WinExist("x0y0zAABBCC2"))
  4260.       fishing_sqms_hidden2 := 0
  4261.    else
  4262.        fishing_sqms_hidden2 := 1
  4263.    if (winexist("x0y0zAABBCC2") and (fishing_sqms_hidden2 = 0)){
  4264.       GuiControl, Fishing_gui2:, Fishing_button_text2, show fishing spots
  4265.       while (i < 15){
  4266.          while (j < 11){
  4267.               Gui, second_sqm%i%x%j%: Hide
  4268.               j := j + 1
  4269.           }
  4270.           j := 0
  4271.           i := i + 1
  4272.       }
  4273.    }
  4274.    DetectHiddenWindows, Off
  4275.    if (fishing_enabled2 = 1){
  4276.       SetTimer, fishing_execution, %fishing_time%
  4277.    }
  4278.    gosub, Fishing_done2
  4279.    check_gui()
  4280. return
  4281.  
  4282. hide_sqmnet_fishing(){
  4283.    if DllCall("IsWindowVisible", "UInt", WinExist("x0y0zAABBCC1"))
  4284.       gosub, Fishing_showSqmsNet1
  4285.    if DllCall("IsWindowVisible", "UInt", WinExist("x0y0zAABBCC2"))
  4286.       gosub, Fishing_showSqmsNet2
  4287. }
  4288. ;################################################################# FISHING EXECUTION ################################################################################
  4289.    fishing_execution:
  4290.   GuiControlGet, fishing_enabled1,, fishing_enabled1
  4291.    if (fishing_enabled1 = 1 and execution_allowed = 1){
  4292.       if (!WinExist(title_tibia1)){
  4293.          notification(1, "Fishing tool", "Window titled: " . title_tibia1 . " does not exist.")
  4294.          GuiControl,,Fishing_enabled1, 0
  4295.          check_gui()
  4296.          goto, Fishing2
  4297.       }
  4298.       GuiControlGet, Fishing_noFood_enabled1,Fishing_gui1:,Fishing_noFood_enabled1
  4299.       if (Fishing_noFood_enabled1 = 1){
  4300.          if (find(title_tibia1, "food1", "inventory", 1, 0) = 1) or (find(title_tibia1, "food2", "inventory", 1, 0) = 1) or (find(title_tibia1, "fish", "inventory", 1, 0) = 1)
  4301.             goto, Fishing2
  4302.       }
  4303.       GuiControlGet, Fishing_noSlot_enabled1,Fishing_gui1:,Fishing_noSlot_enabled1
  4304.       if (Fishing_noSlot_enabled1 = 1){
  4305.          if find_instances(title_tibia1, "free_slot", 1) < 2
  4306.             goto, Fishing2
  4307.       }
  4308.       pos_notEdited := getRandomArrayValue1(fishing1_stack,arrayChanged1)
  4309.       arrayChanged1:=0
  4310.       if (pos_notEdited = ""){
  4311.          notification(1, "Fishing tool", "Error while loading sqms to fish (0010)")
  4312.          goto, Fishing2
  4313.       }
  4314.       FoundPosY := InStr(pos_notEdited, "y")
  4315.       FoundPosY2 := FoundPosY + 1
  4316.       length1 := StrLen(pos_notEdited)-FoundPosY
  4317.       lenght2 := FoundPosY - 2
  4318.       posToFish1_x := SubStr(pos_notEdited, 2, lenght2)
  4319.       posToFish1_y := SubStr(pos_notEdited, FoundPosY2, length1)
  4320.       if (posToFish1_x = ""){
  4321.          notification(1, "Fishing tool", "Error while loading sqms to fish (0011)")
  4322.          GuiControl,,Fishing_enabled1, 0
  4323.          check_gui()
  4324.          goto, Fishing2
  4325.       }
  4326.       if (posToFish1_y = ""){
  4327.          notification(1, "Fishing tool", "Error while loading sqms to fish (0012)")
  4328.          GuiControl,,Fishing_enabled1, 0
  4329.          check_gui()
  4330.          goto, Fishing2
  4331.       }
  4332.       if (posToFish1_x < 0 or posToFish1_x > A_ScreenWidth){
  4333.          notification(1, "Fishing tool", "Error while loading sqms to fish (0013)")
  4334.          GuiControl,,Fishing_enabled1, 0
  4335.          check_gui()
  4336.          goto, Fishing2
  4337.       }
  4338.       if (posToFish1_y < 0 or posToFish1_y > A_ScreenHeight){
  4339.          notification(1, "Fishing tool", "Error while loading sqms to fish (0014)")
  4340.          GuiControl,,Fishing_enabled1, 0
  4341.          check_gui()
  4342.          goto, Fishing2
  4343.       }
  4344.       if (find(title_tibia1, "fishing_rod", "inventory", 1, 0) = 1){
  4345.          Random, random_pos_x, -randomization, randomization
  4346.          Random, random_pos_y, -randomization, randomization
  4347.          posToFish1_x := posToFish1_x + random_pos_x
  4348.          posToFish1_y := posToFish1_y + random_pos_y
  4349.          KeyWait, LButton
  4350.          KeyWait, RButton
  4351.          ;BlockInput, Mouse
  4352.          ;Hotkey, LButton, do_nothing, On
  4353.          BlockInput, on ;Hotkey, RButton, do_nothing, On
  4354.          sleep_random(5, 10)
  4355.          posToFish1_y := posToFish1_y - 35
  4356.          item_pos_y := item_pos_y - 35
  4357.          if (Bot_protection = 1)
  4358.             DllCall("Data\mousehook64.dll\useOn", "AStr", title_tibia1, "INT", false, "INT", item_pos_x, "INT", item_pos_y, "INT", posToFish1_x, "INT", posToFish1_y)
  4359.          else
  4360.             DllCall("Data\mousehook64.dll\useOn", "AStr", title_tibia1, "INT", true, "INT", item_pos_x, "INT", item_pos_y, "INT", posToFish1_x, "INT", posToFish1_y)  
  4361.          sleep_random(5, 10)
  4362.          ;Hotkey, LButton, do_nothing, Off
  4363.          ;Hotkey, RButton, do_nothing, Off
  4364.          BlockInput, Off
  4365.          Sleep_random(100,200)
  4366.          Auto_stack(title_tibia1, "fish")
  4367.       }
  4368.       else{
  4369.          ;notification(1, title_tibia1, "Couldn't find fishing rod in inventory. Fishing will stop now.")
  4370.          GuiControl,,Fishing_enabled1, 0
  4371.          check_gui()
  4372.       }
  4373.    }
  4374.    fishing2:
  4375.   GuiControlGet, fishing_enabled2,, fishing_enabled2
  4376.    if (fishing_enabled2 = 1 and execution_allowed = 1){
  4377.       sleep_random(100,300)
  4378.       if (!WinExist(title_tibia2)){
  4379.          notification(2, "Fishing tool", "Window titled: " . title_tibia2 . " does not exist.")
  4380.          GuiControl,,Fishing_enabled2, 0
  4381.          check_gui()
  4382.          return
  4383.       }
  4384.       GuiControlGet, Fishing_noFood_enabled2,Fishing_gui2:,Fishing_noFood_enabled2
  4385.       if (Fishing_noFood_enabled2 = 1){
  4386.          if (find(title_tibia1, "food1", "inventory", 1, 0) = 1) or (find(title_tibia1, "food2", "inventory", 1, 0) = 1) or (find(title_tibia1, "fish", "inventory", 1, 0) = 1)
  4387.             return
  4388.       }
  4389.       GuiControlGet, Fishing_noSlot_enabled2,Fishing_gui2:,Fishing_noSlot_enabled2
  4390.       if (Fishing_noSlot_enabled2 = 1){
  4391.          if find_instances(title_tibia2, "free_slot", 1) < 2
  4392.             return
  4393.       }
  4394.       pos_notEdited := getRandomArrayValue2(fishing2_stack,arrayChanged2)
  4395.       arrayChanged2:=0
  4396.       if (pos_notEdited = ""){
  4397.          notification(1, "Fishing tool", "Error while loading sqms to fish (0010)")
  4398.          return
  4399.       }
  4400.       FoundPosY := InStr(pos_notEdited, "y")
  4401.       FoundPosY2 := FoundPosY + 1
  4402.       length1 := StrLen(pos_notEdited)-FoundPosY
  4403.       lenght2 := FoundPosY - 2
  4404.       posToFish2_x := SubStr(pos_notEdited, 2, lenght2)
  4405.       posToFish2_y := SubStr(pos_notEdited, FoundPosY2, length1)
  4406.       if (posToFish2_x = ""){
  4407.          notification(1, "Fishing tool", "Error while loading sqms to fish (0011)")
  4408.          GuiControl,,Fishing_enabled2, 0
  4409.          check_gui()
  4410.          return
  4411.       }
  4412.       if (posToFish2_y = ""){
  4413.          notification(1, "Fishing tool", "Error while loading sqms to fish (0012)")
  4414.          GuiControl,,Fishing_enabled2, 0
  4415.          check_gui()
  4416.          return
  4417.       }
  4418.       if (posToFish2_x < 0 or posToFish2_x > A_ScreenWidth){
  4419.          notification(1, "Fishing tool", "Error while loading sqms to fish (0013)")
  4420.          GuiControl,,Fishing_enabled2, 0
  4421.          check_gui()
  4422.          return
  4423.       }
  4424.       if (posToFish2_y < 0 or posToFish2_y > A_ScreenHeight){
  4425.          notification(1, "Fishing tool", "Error while loading sqms to fish (0014)")
  4426.          GuiControl,,Fishing_enabled2, 0
  4427.          check_gui()
  4428.          return
  4429.       }
  4430.       if  (find(title_tibia2, "fishing_rod", "inventory", 1, 0) = 1){
  4431.          Random, random_pos_x, -randomization, randomization
  4432.          Random, random_pos_y, -randomization, randomization
  4433.          posToFish2_x := posToFish2_x + random_pos_x
  4434.          posToFish2_y := posToFish2_y + random_pos_y
  4435.          KeyWait, LButton
  4436.          KeyWait, RButton
  4437.          ;BlockInput, Mouse
  4438.          ;Hotkey, LButton, do_nothing, On
  4439.          BlockInput, on ;Hotkey, RButton, do_nothing, On
  4440.          sleep_random(5, 10)
  4441.          posToFish2_y := posToFish2_y - 35
  4442.          item_pos_y := item_pos_y - 35
  4443.          if (Bot_protection = 1)
  4444.             DllCall("Data\mousehook64.dll\useOn", "AStr", title_tibia2, "INT", false, "INT", item_pos_x, "INT", item_pos_y, "INT", posToFish2_x, "INT", posToFish2_y)
  4445.          else
  4446.             DllCall("Data\mousehook64.dll\useOn", "AStr", title_tibia2, "INT", true, "INT", item_pos_x, "INT", item_pos_y, "INT", posToFish2_x, "INT", posToFish2_y)  
  4447.          sleep_random(5, 10)
  4448.          ;Hotkey, LButton, do_nothing, Off
  4449.          ;Hotkey, RButton, do_nothing, Off
  4450.          BlockInput, Off
  4451.          Sleep_random(100,200)
  4452.          Auto_stack(title_tibia2, "fish")
  4453.       }
  4454.       else{
  4455.          ;notification(1, title_tibia2, "Couldn't find fishing rod in inventory. Fishing will stop now.")
  4456.          GuiControl,,Fishing_enabled2, 0
  4457.          check_gui()
  4458.       }
  4459.    }
  4460.    GuiControlGet, fishing_enabled1,, fishing_enabled1
  4461.    GuiControlGet, fishing_enabled2,, fishing_enabled2
  4462.    if (fishing_enabled1 = 0 and fishing_enabled2 = 0)
  4463.       Settimer, fishing_execution, off
  4464.    return
  4465.    
  4466.    
  4467. ;################################################################# MENU ################################################################################
  4468.  
  4469. MENU_CREATE:
  4470. menu, tray, NoStandard
  4471. menu, tray, add, Hide_client_1
  4472. menu, tray, add, Hide_client_2
  4473. menu, tray, add ; separator
  4474. menu, tray, add, Pause
  4475. menu, tray, add, Exit
  4476. If mc_count = 1
  4477.    menu, tray, Disable, Hide_client_2
  4478. return
  4479.  
  4480.  
  4481. Toggle_hide1:
  4482. Hide_client_1:
  4483. GuiControlGet,Enabled_screen_checker1,,Enabled_screen_checker1
  4484. if (Enabled_screen_checker1){
  4485.    GuiControl,,Enabled_screen_checker1,0
  4486.    sc_var1 := 1
  4487. }
  4488. if NewName1 <> Show_client_1
  4489. {
  4490.    if winexist(title_tibia1){
  4491.       ;WinGetActiveTitle, currently_active_title
  4492.       WinSet, Trans, 0,  %title_tibia1%
  4493.       WinActivate,  %title_tibia1%
  4494.       global transparent_tibia1 := 1
  4495.   ;    WinActivate, %currently_active_title%
  4496.    }
  4497.     OldName1 = Hide_client_1
  4498.     NewName1 = Show_client_1
  4499. }
  4500. else
  4501. {
  4502.    WinSet, Trans, 255,  %title_tibia1%
  4503.    WinActivate, %title_tibia1%
  4504.    global transparent_tibia1 := 0
  4505.     OldName1 = Show_client_1
  4506.     NewName1= Hide_client_1
  4507. }
  4508. menu, tray, rename, %OldName1%, %NewName1%
  4509. if (sc_var1){
  4510.    GuiControl,,Enabled_screen_checker1,1
  4511.    sc_var1 := 0
  4512. }
  4513. return
  4514.  
  4515. Toggle_hide2:
  4516. Hide_client_2:
  4517. GuiControlGet,Enabled_screen_checker2,,Enabled_screen_checker2
  4518. if (Enabled_screen_checker2){
  4519.    GuiControl,,Enabled_screen_checker2,0
  4520.    sc_var2 := 1
  4521. }
  4522. if NewName2 <> Show_client_2
  4523. {
  4524.    if winexist(title_tibia2){
  4525.       ;WinGetActiveTitle, currently_active_title
  4526.       WinSet, Trans, 0,  %title_tibia2%
  4527.       WinActivate,  %title_tibia2%
  4528.       global transparent_tibia2 := 1
  4529.   ;    WinActivate, %currently_active_title%
  4530.    }
  4531.     OldName2 = Hide_client_2
  4532.     NewName2 = Show_client_2
  4533. }
  4534. else
  4535. {
  4536.    WinSet, Trans, 255,  %title_tibia2%
  4537.    WinActivate, %title_tibia2%
  4538.    global transparent_tibia2 := 0
  4539.     OldName2 = Show_client_2
  4540.     NewName2= Hide_client_2
  4541. }
  4542. menu, tray, rename, %OldName2%, %NewName2%
  4543. if (sc_var2){
  4544.    GuiControl,,Enabled_screen_checker2,1
  4545.    sc_var2 := 0
  4546. }
  4547. return
  4548.  
  4549.  
  4550.  
  4551. ; ################################################################# HOTKEYS ################################################################################
  4552.  
  4553. !^F11::
  4554. Pause:
  4555. menu, tray, ToggleCheck, Pause
  4556. pause()
  4557. return
  4558.  
  4559. !^F12::
  4560. ExitApp
  4561. return
  4562.  
  4563.  
  4564. ; ################################################################### END ##################################################################################
  4565. Exit:
  4566. FileExit:    ; User chose "Exit" from the File menu.
  4567. GuiClose:  ; User closed the window.
  4568. WinSet, Trans, 255,  %title_tibia1%
  4569. WinSet, Trans, 255,  %title_tibia2%
  4570. ExitApp
RAW Paste Data