From 766d1ba0e3494759af3c4cf237fc60b9ebb5e51a Mon Sep 17 00:00:00 2001 From: Gustavo Alves Date: Mon, 24 Oct 2022 10:12:49 -0300 Subject: [PATCH] Overall adjustments -Added auto gold exchange feature -Merged auto health and auto mana modules in only one named AutoHeal -Improved AutoHur -Improved ThreadManager -Fixed a few application errors --- conf/Constants.py | 39 ++ conf/Hotkeys.py | 4 + core/GUI.py | 32 +- core/Getters.py | 82 +++- core/HookWindow.py | 110 ++--- core/MoveMouse.py | 39 +- core/SendToClient.py | 67 ++- core/ThreadManager.py | 155 ++----- engine/Scanners/ScanAmulet.py | 16 + engine/Scanners/ScanAutoExchangeGold.py | 37 ++ engine/Scanners/ScanBars.py | 6 + engine/Scanners/ScanCap.py | 10 + engine/Scanners/ScanFood.py | 12 + engine/Scanners/ScanHur.py | 32 ++ engine/Scanners/ScanRing.py | 16 + engine/Scanners/ScanStages.py | 18 + engine/Toggler.py | 20 + images/BackgroundImages/Recapture.png | Bin 962 -> 1226 bytes images/Items/Gold/gold.png | Bin 0 -> 1852 bytes images/Items/Gold/platinum.png | Bin 0 -> 1915 bytes images/Modules/AutoExchangeGold.png | Bin 0 -> 1733 bytes images/Modules/AutoHeal.png | Bin 2397 -> 2479 bytes images/Modules/AutoHeal2.png | Bin 2176 -> 3331 bytes images/Modules/AutoHur.png | Bin 1480 -> 1449 bytes modules/AutoBanker.py | 34 +- modules/AutoExchangeGold.py | 255 ++++++++++++ modules/AutoHeal.py | 518 +++++++++++++++--------- modules/AutoHur.py | 129 ++++-- modules/AutoMana.py | 157 ------- modules/AutoRing.py | 132 +++--- modules/AutoSSA.py | 140 ++++--- modules/CaveBot.py | 447 +++++++++++++------- modules/ChooseConfig.py | 149 ++++--- modules/FoodEater.py | 36 +- modules/Root.py | 214 ++++++---- modules/TimedSpells.py | 55 ++- modules/__init__.py | 27 +- scripts/GUILoader.json | 46 ++- scripts/Json.json | 9 + 39 files changed, 1974 insertions(+), 1069 deletions(-) create mode 100644 engine/Scanners/ScanAmulet.py create mode 100644 engine/Scanners/ScanAutoExchangeGold.py create mode 100644 engine/Scanners/ScanBars.py create mode 100644 engine/Scanners/ScanCap.py create mode 100644 engine/Scanners/ScanFood.py create mode 100644 engine/Scanners/ScanHur.py create mode 100644 engine/Scanners/ScanRing.py create mode 100644 engine/Scanners/ScanStages.py create mode 100644 engine/Toggler.py create mode 100644 images/Items/Gold/gold.png create mode 100644 images/Items/Gold/platinum.png create mode 100644 images/Modules/AutoExchangeGold.png create mode 100644 modules/AutoExchangeGold.py delete mode 100644 modules/AutoMana.py diff --git a/conf/Constants.py b/conf/Constants.py index 6afe3e0..cea9445 100644 --- a/conf/Constants.py +++ b/conf/Constants.py @@ -4,6 +4,45 @@ Percentage = [100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5] Priority = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# Auto healing types +HealingType = ["Life", "Mana"] + +# Containers +Containers = [ + "Backpack", + "Bag", + "Basket", + "BeachBackpack", + "BlueBackpack", + "BrocadeBag", + "BuggyBackpack", + "CamouflageBackpack", + "CrownBackpack", + "DeeplingBackpack", + "DemonBackpack", + "DragonBackpack", + "ExpeditionBackpack", + "FurBackpack", + "FurBag", + "GloothBackpack", + "GoldenBackpack", + "GreenBackpack", + "GreenBag", + "GreyBackpack", + "JewelledBackpack", + "MinotaurBackpack", + "OrangeBackpack", + "PirateBackpack", + "PirateBag", + "Present", + "PurpleBackpack", + "RedBackpack", + "RedBag", + "ShoppingBag", + "StampedParcel", + "YellowBackpack" +] + # RGB Of Life Color Pixel For Analyze In ScanStages.py LifeColorFull = [194, 74, 74] LifeColor = [219, 79, 79] diff --git a/conf/Hotkeys.py b/conf/Hotkeys.py index 026ab7d..52285ea 100644 --- a/conf/Hotkeys.py +++ b/conf/Hotkeys.py @@ -74,6 +74,10 @@ def LeftClick(self, X, Y): def RightClick(self, X, Y): Position = X, Y self.SendToClient.RightClick(Position) + + def RawRightClick(self, X, Y): + Position = X, Y + self.SendToClient.RawRightClick(Position) def MoveTo(self, X, Y): self.SendToClient.MoveTo(X, Y) diff --git a/core/GUI.py b/core/GUI.py index 36b2f7a..48ce480 100644 --- a/core/GUI.py +++ b/core/GUI.py @@ -1,10 +1,12 @@ import pyautogui import tkinter as tk -from tkinter import SUNKEN, RAISED, ttk +from tkinter import ttk from PIL import Image, ImageTk from core.Defaults import * +MainWindow = None + class GUI: def __init__(self, windowID, name): @@ -12,6 +14,8 @@ def __init__(self, windowID, name): self.name = name def MainWindow(self, BackgroundImage, sizes, positions): + global MainWindow + self.windowID = tk.Tk() w = sizes[0] h = sizes[1] @@ -24,11 +28,12 @@ def MainWindow(self, BackgroundImage, sizes, positions): self.windowID.resizable(width=False, height=False) self.windowID.configure(background='#000', takefocus=True) self.windowID.iconbitmap('images/icon.ico') - image = Image.open('images/Modules/' + BackgroundImage + '.png') + image = Image.open(f'images/Modules/{BackgroundImage}.png') photo = ImageTk.PhotoImage(image) label = tk.Label(self.windowID, image=photo, bg='#000') label.image = photo label.pack() + MainWindow = self.windowID def DefaultWindow(self, BackgroundImage, sizes, positions): self.windowID = tk.Toplevel() @@ -57,7 +62,8 @@ def InvisibleWindow(self, BackgroundImage): self.windowID.grab_set() self.windowID.resizable(width=False, height=False) self.windowID.geometry('130x130') - self.windowID.image = tk.PhotoImage(file='images/BackgroundImages/' + BackgroundImage + '.png') + self.windowID.image = tk.PhotoImage( + file='images/BackgroundImages/' + BackgroundImage + '.png') label = tk.Label(self.windowID, image=self.windowID.image, bg='black') label.place(x=0, y=0) self.windowID.overrideredirect(True) @@ -139,7 +145,8 @@ def addList(self, columns, height, sizes, position): frame = tk.Frame(self.windowID, height=sizes[1], width=sizes[0]) frame.place(x=position[0], y=position[1]) - table = ttk.Treeview(self.windowID, columns=columns, height=height, show='headings') + table = ttk.Treeview(self.windowID, columns=columns, + height=height, show='headings') table.place(x=position[0], y=position[1]) return table @@ -179,14 +186,11 @@ def addEntry(self, position, var, width=12): entryID.place(x=position[0], y=position[1]) return entryID - def addOption(self, variable, options, position, width=4): - optionID = tk.OptionMenu(self.windowID, variable, *options) - optionID['bg'] = rgb((114, 0, 0)) - optionID['fg'] = 'white' - optionID['activebackground'] = rgb((103, 13, 5)) - optionID["highlightthickness"] = 0 - optionID['width'] = width - optionID['cursor'] = "hand2" + def addOption(self, variable, options, position, width=4, command=None): + optionID = tk.OptionMenu( + self.windowID, variable, *options, command=command) + optionID.config(bg=rgb((114, 0, 0)), fg='white', activebackground=rgb( + (103, 13, 5)), highlightthickness=0, width=width, cursor='hand2', ) optionID.place(x=position[0], y=position[1]) return optionID @@ -224,6 +228,10 @@ def addRadioImage(self, text, variable, value, position, command=None, image=Non def After(self, Time, Function): return self.windowID.after(Time, Function) + def ExitGUI(): + MainWindow.destroy() + raise SystemExit + def deiconify(self): return self.windowID.deiconify() diff --git a/core/Getters.py b/core/Getters.py index 1d025f8..a087016 100644 --- a/core/Getters.py +++ b/core/Getters.py @@ -1,6 +1,7 @@ -from core.HookWindow import LocateCenterImage, LocateImage +from core.HookWindow import LocateCenterImage, LocateImage, TakeImage BattlePositions = [0, 0, 0, 0] +MainContainerPositions = [0, 0, 0, 0] MapPositions = [0, 0, 0, 0] StatsPositions = [0, 0, 0, 0] GameWindow = [0, 0, 0, 0] @@ -8,16 +9,24 @@ SQMs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] SQMsSizes = [0, 0] +SavedTakenImage = [] + + +def GetClientScreenshot(): + TakeImage().save('screen.jpg') + def GetAccountNamePosition(): - AccountName = LocateCenterImage('images/TibiaSettings/AccountName.png', Precision=0.9) + AccountName = LocateCenterImage( + 'images/TibiaSettings/AccountName.png', Precision=0.9) if AccountName[0] != 0 and AccountName[1] != 0: return AccountName[0], AccountName[1] return 0, 0 def GetBattlePosition(): - BattlePositions[0], BattlePositions[1] = LocateCenterImage('images/TibiaSettings/BattleList.png', Precision=0.85) + BattlePositions[0], BattlePositions[1] = LocateCenterImage( + 'images/TibiaSettings/BattleList.png', Precision=0.85) if BattlePositions[0] == 0 and BattlePositions[1] == 0: return 0, 0, 0, 0 @@ -31,28 +40,34 @@ def GetBattlePosition(): def GetHealthPosition(): - HealthPositions = LocateCenterImage('images/PlayerSettings/health.png', Precision=0.8) + HealthPositions = LocateCenterImage( + 'images/PlayerSettings/health.png', Precision=0.8) if HealthPositions[0] != 0 and HealthPositions[1] != 0: return HealthPositions[0], HealthPositions[1] return 0, 0 def GetManaPosition(): - ManaPositions = LocateCenterImage('images/PlayerSettings/mana.png', Precision=0.8) + ManaPositions = LocateCenterImage( + 'images/PlayerSettings/mana.png', Precision=0.8) if ManaPositions[0] != 0 and ManaPositions[1] != 0: return ManaPositions[0], ManaPositions[1] def GetMapPosition(): - top_right = LocateImage("images/MapSettings/MapSettings.png", Precision=0.8) + top_right = LocateImage( + "images/MapSettings/MapSettings.png", Precision=0.8) map_size = 110 # 110px square - MapPositions[0], MapPositions[1] = top_right[0] - map_size + 4, top_right[1] + 1 - MapPositions[2], MapPositions[3] = top_right[0] - 1, top_right[1] + map_size - 1 + MapPositions[0], MapPositions[1] = top_right[0] - \ + map_size + 4, top_right[1] + 1 + MapPositions[2], MapPositions[3] = top_right[0] - \ + 1, top_right[1] + map_size - 1 if top_right[0] != -1: print(f"MiniMap Start [X: {MapPositions[0]}, Y: {MapPositions[1]}]") print(f"MiniMap End [X: {MapPositions[2]}, Y: {MapPositions[3]}]") print("") - print(f"Size of MiniMap [X: {MapPositions[2] - MapPositions[0]}, Y: {MapPositions[3] - MapPositions[1]}]") + print( + f"Size of MiniMap [X: {MapPositions[2] - MapPositions[0]}, Y: {MapPositions[3] - MapPositions[1]}]") return MapPositions[0], MapPositions[1], MapPositions[2], MapPositions[3] print("Error To Get Map Positions") @@ -60,7 +75,8 @@ def GetMapPosition(): def GetStatsPosition(): - StatsPositions[0], StatsPositions[1] = LocateImage('images/TibiaSettings/Stop.png', Precision=0.8) + StatsPositions[0], StatsPositions[1] = LocateImage( + 'images/TibiaSettings/Stop.png', Precision=0.8) if StatsPositions[0] != 0 and StatsPositions[1] != 0: StatsPositions[0] = StatsPositions[0] - 117 StatsPositions[1] = StatsPositions[1] + 1 @@ -71,13 +87,31 @@ def GetStatsPosition(): return 0, 0, 0, 0 +def GetMainContainerPosition(name='Bag'): + main_container_position = LocateImage( + f'images/Items/ContainersName/{name}.png', Precision=.9) + print('main_container_position', main_container_position) + MainContainerPositions[0], MainContainerPositions[1] = main_container_position[0], main_container_position[1] + if main_container_position[0] != -1: + print( + f"Main Container Start [X: {MainContainerPositions[0]}, Y: {MainContainerPositions[1]}]") + print("") + return MainContainerPositions[0], MainContainerPositions[1] + + print("Error To Get Container Positions") + return -1, -1 + + def GetPlayerPosition(): - LeftGameWindow = LocateImage("images/PlayerSettings/LeftOption1.png", Precision=0.75) + LeftGameWindow = LocateImage( + "images/PlayerSettings/LeftOption1.png", Precision=0.75) if LeftGameWindow[0] == 0 and LeftGameWindow[1] == 0: - LeftGameWindow = LocateImage("images/PlayerSettings/LeftOption2.png", Precision=0.75) + LeftGameWindow = LocateImage( + "images/PlayerSettings/LeftOption2.png", Precision=0.75) if LeftGameWindow[0] == 0 and LeftGameWindow[1] == 0: - LeftGameWindow = LocateImage("images/PlayerSettings/LeftOption3.png", Precision=0.75) + LeftGameWindow = LocateImage( + "images/PlayerSettings/LeftOption3.png", Precision=0.75) try: GameWindow[0] = int(LeftGameWindow[0]) @@ -85,21 +119,26 @@ def GetPlayerPosition(): except Exception as errno: return 0, 0, 0, 0, 0, 0 - RightGameWindow = LocateImage("images/PlayerSettings/RightOption1.png", Precision=0.75) + RightGameWindow = LocateImage( + "images/PlayerSettings/RightOption1.png", Precision=0.75) if RightGameWindow[0] == 0 and RightGameWindow[1] == 0: - RightGameWindow = LocateImage("images/PlayerSettings/RightOption2.png", Precision=0.75) + RightGameWindow = LocateImage( + "images/PlayerSettings/RightOption2.png", Precision=0.75) if RightGameWindow[0] == 0 and RightGameWindow[1] == 0: - RightGameWindow = LocateImage("images/PlayerSettings/RightOption3.png", Precision=0.75) + RightGameWindow = LocateImage( + "images/PlayerSettings/RightOption3.png", Precision=0.75) if RightGameWindow[0] == 0 and RightGameWindow[1] == 0: - RightGameWindow = LocateImage("images/PlayerSettings/RightOption4.png", Precision=0.75) + RightGameWindow = LocateImage( + "images/PlayerSettings/RightOption4.png", Precision=0.75) try: GameWindow[2] = int(RightGameWindow[0]) except Exception as errno: return 0, 0, 0, 0, 0, 0 - ButtomGameWindow = LocateImage("images/PlayerSettings/EndLocation.png", Precision=0.7) + ButtomGameWindow = LocateImage( + "images/PlayerSettings/EndLocation.png", Precision=0.7) if ButtomGameWindow[0] == 0 and ButtomGameWindow[1] == 0: return 0, 0, 0, 0, 0, 0 else: @@ -126,7 +165,8 @@ def SetSQMs(): if GameWindow[0] and GameWindow[1] != 0: SQMsSizes[0] = int((GameWindow[2] - GameWindow[0]) / 15) SQMsSizes[1] = int((GameWindow[3] - GameWindow[1]) / 11) - print(f"Size of Your SQM [Width: {SQMsSizes[0]}px, Height: {SQMsSizes[1]}px]") + print( + f"Size of Your SQM [Width: {SQMsSizes[0]}px, Height: {SQMsSizes[1]}px]") print('') else: print("Reconfiguring The Player Position") @@ -155,8 +195,8 @@ def SetSQMs(): SQMs[16] = Player[0] + SQMsSizes[0] SQMs[17] = Player[1] - SQMsSizes[1] return SQMs[0], SQMs[1], SQMs[2], SQMs[3], SQMs[4], SQMs[5], SQMs[6], \ - SQMs[7], SQMs[8], SQMs[9], SQMs[10], SQMs[11], SQMs[12], SQMs[13], \ - SQMs[14], SQMs[15], SQMs[16], SQMs[17] + SQMs[7], SQMs[8], SQMs[9], SQMs[10], SQMs[11], SQMs[12], SQMs[13], \ + SQMs[14], SQMs[15], SQMs[16], SQMs[17] print("Setting Player Position...") Player[0], Player[1], GameWindow[0], GameWindow[1], GameWindow[2], GameWindow[ diff --git a/core/HookWindow.py b/core/HookWindow.py index baa96cd..5ffd992 100644 --- a/core/HookWindow.py +++ b/core/HookWindow.py @@ -1,19 +1,22 @@ -import numpy as np +import time import cv2 -from PIL import Image, ImageOps +import multiprocessing as mp +import numpy as np +from datetime import datetime +from tkinter import messagebox +from PIL import ImageOps -from conf.conf_manager import ConfManager +from core.GUI import * +from conf.conf_manager import ConfManager -data = ConfManager.get('conf.json') +platform = ConfManager.get('conf.json')['platform'] -if data['platform'] == "windows": +if platform == "windows": from ctypes import windll import win32ui import win32gui - - hwnd = data['hwnd'] -elif data['platform'] == "linux": +elif platform == "linux": import os from core.LinuxClient import Execute, FindAnotherWindow, FindWindow @@ -24,58 +27,58 @@ class Hooker: - if data['platform'] == 'windows': + if platform == 'windows': def __init__(self): - self.hwnd = hwnd - self.win32gui = win32gui - self.win32ui = win32ui + self.hwnd = ConfManager.get('conf.json')['hwnd'] + while win32gui.IsIconic(self.hwnd): + time.sleep(1) self.dll = windll.user32 - self.hwndDC = self.win32gui.GetWindowDC(self.hwnd) - self.mfcDC = self.win32ui.CreateDCFromHandle(self.hwndDC) + try: + self.hwndDC = win32gui.GetWindowDC(self.hwnd) + except: + messagebox.showerror( + 'Tibia window not detected!', 'Please open a Tibia instance or focus the existing window again.') + GUI.ExitGUI() + self.mfcDC = win32ui.CreateDCFromHandle(self.hwndDC) self.saveDC = self.mfcDC.CreateCompatibleDC() - self.saveBitMap = self.win32ui.CreateBitmap() - self.left, self.top, self.right, self.bot = self.win32gui.GetClientRect(self.hwnd) + self.saveBitMap = win32ui.CreateBitmap() + self.left, self.top, self.right, self.bot = win32gui.GetClientRect( + self.hwnd) self.left = self.left + 8 self.top = self.top + 8 self.right = self.right + 8 self.bot = self.bot + 8 self.w = self.right - self.left self.h = self.bot - self.top - self.saveBitMap.CreateCompatibleBitmap(self.mfcDC, self.w, self.h) + self.saveBitMap.CreateCompatibleBitmap( + self.mfcDC, self.w, self.h) self.saveDC.SelectObject(self.saveBitMap) - self.result = self.dll.PrintWindow(self.hwnd, self.saveDC.GetSafeHdc(), 1) + self.targetWindowIsFocused = self.dll.PrintWindow( + self.hwnd, self.saveDC.GetSafeHdc(), 1) self.bmpinfo = self.saveBitMap.GetInfo() self.bmpstr = self.saveBitMap.GetBitmapBits(True) - self.TakedImage = Image.frombuffer( + self.TakenImage = Image.frombuffer( 'RGB', (self.bmpinfo['bmWidth'], self.bmpinfo['bmHeight']), self.bmpstr, 'raw', 'BGRX', 0, 1) - self.win32gui.DeleteObject(self.saveBitMap.GetHandle()) + win32gui.DeleteObject(self.saveBitMap.GetHandle()) self.saveDC.DeleteDC() self.mfcDC.DeleteDC() - self.win32gui.ReleaseDC(self.hwnd, self.hwndDC) + win32gui.ReleaseDC(self.hwnd, self.hwndDC) - elif data['platform'] == 'linux': - def __init__(self, FileName="images/tmp_screen.png"): - Execute(["scrot", "-u", FileName]) - self.TakedImage = cv2.imread(FileName) + elif platform == 'linux': + def __init__(self, Filename="images/tmp_screen.png"): + Execute(["scrot", "-u", Filename]) + self.TakenImage = cv2.imread(Filename) - if self.TakedImage is not None: - self.result = 1 + if self.TakenImage is not None: + self.targetWindowIsFocused = 1 def HookWindow(self): - if self.result == 1: - return self.TakedImage - else: - self.win32gui.SetForegroundWindow(self.hwnd) - self.TakedImage = Hooker().HookWindow() - if self.result == 1: - return self.TakedImage - else: - return print('Debugged From HookWindow') + return self.TakenImage ''' @@ -88,14 +91,17 @@ def TakeImage(Region=None): Except = True while Except: try: - TakedImage = Hooker().HookWindow() + TakenImage = Hooker().HookWindow() if Region is not None: - TakedImage = TakedImage.crop( + TakenImage = TakenImage.crop( (Region[0], Region[1], Region[0] + (Region[2] - Region[0]), Region[1] + (Region[3] - Region[1]))) - return TakedImage + Except = False + return TakenImage else: - return TakedImage + Except = False + return TakenImage except Exception as Ex: + print('Ex', Ex) # print("Debugged From TakeImage: ", Ex) Except = True pass @@ -117,9 +123,9 @@ def TakeImage(Region=None): def LocateImage(image, Region=None, Precision=0.8): - TakedImage = TakeImage(Region) + TakenImage = TakeImage(Region) - img_rgb = np.array(TakedImage) + img_rgb = np.array(TakenImage) img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) template = cv2.imread(image, 0) @@ -140,9 +146,9 @@ def LocateImage(image, Region=None, Precision=0.8): def LocateCenterImage(image, Region=None, Precision=0.8): - TakedImage = TakeImage(Region) + TakenImage = TakeImage(Region) - img_rgb = np.array(TakedImage) + img_rgb = np.array(TakenImage) img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) template = cv2.imread(image, 0) @@ -169,10 +175,10 @@ def LocateCenterImage(image, Region=None, Precision=0.8): def LocateAllImages(image, Region=None, Precision=0.8): - TakedImage = TakeImage(Region) + TakenImage = TakeImage(Region) - TakedImage = np.array(TakedImage) - img_gray = cv2.cvtColor(TakedImage, cv2.COLOR_BGR2GRAY) + TakenImage = np.array(TakenImage) + img_gray = cv2.cvtColor(TakenImage, cv2.COLOR_BGR2GRAY) template = cv2.imread(image, 0) w, h = template.shape[::-1] @@ -210,8 +216,8 @@ def LocateBoolRGBImage(image, Region=None, Precision=0.9): def PixelMatchesColor(X, Y, expectedRGBColor): - TakedImage = TakeImage(Region=(X, Y, X + 1, Y + 1)) - rgb = TakedImage.getpixel((0, 0)) + TakenImage = TakeImage(Region=(X, Y, X + 1, Y + 1)) + rgb = TakenImage.getpixel((0, 0)) if rgb == expectedRGBColor: return True else: @@ -221,15 +227,15 @@ def PixelMatchesColor(X, Y, expectedRGBColor): ''' When Called, It Save The Image On Folder And Name Passed Per Argument, Examples: - 1°: SaveImage('TakedImage.png') == Save The Image In Current Directory, + 1°: SaveImage('TakenImage.png') == Save The Image In Current Directory, 2°: SaveImage('images/Foods/Cheese.png', (1234, 435, 1280, 460)) == Save The Image On Passed Folder, And Crop Then In X: 1234 Up Until 1280 And Y: 435 Up Until 460. ''' def SaveImage(Name, Region=None): - TakedImage = TakeImage(Region) - return TakedImage.save(Name) + TakenImage = TakeImage(Region) + return TakenImage.save(Name) def GetImageSize(needleImage): diff --git a/core/MoveMouse.py b/core/MoveMouse.py index bc34518..988a1aa 100644 --- a/core/MoveMouse.py +++ b/core/MoveMouse.py @@ -1,6 +1,7 @@ -import json import ctypes import ctypes.wintypes +import win32api +import win32con from conf.HexMapKeys import KeyToHex from conf.conf_manager import ConfManager @@ -39,36 +40,48 @@ def Position(self): return Cursor.x, Cursor.y - 24 def Press(self, Key): - self.DLL.keybd_event(KeyToHex.get(Key, ""), 0, self.KEYEVENTF_KEYDOWN, 0) + self.DLL.keybd_event(KeyToHex.get(Key, ""), 0, + self.KEYEVENTF_KEYDOWN, 0) self.DLL.keybd_event(KeyToHex.get(Key, ""), 0, self.KEYEVENTF_KEYUP, 0) def PressHotkey(self, Option, Key): - self.DLL.keybd_event(KeyToHex.get(Option, ""), 0, self.KEYEVENTF_KEYDOWN, 0) - self.DLL.keybd_event(KeyToHex.get(Key, ""), 0, self.KEYEVENTF_KEYDOWN, 0) + self.DLL.keybd_event(KeyToHex.get(Option, ""), 0, + self.KEYEVENTF_KEYDOWN, 0) + self.DLL.keybd_event(KeyToHex.get(Key, ""), 0, + self.KEYEVENTF_KEYDOWN, 0) self.DLL.keybd_event(KeyToHex.get(Key, ""), 0, self.KEYEVENTF_KEYUP, 0) - self.DLL.keybd_event(KeyToHex.get(Option, ""), 0, self.KEYEVENTF_KEYUP, 0) + self.DLL.keybd_event(KeyToHex.get(Option, ""), + 0, self.KEYEVENTF_KEYUP, 0) def LeftClick(self, Position): self.DLL.SetCursorPos(Position[0], Position[1] + 24) - self.DLL.mouse_event(self.MOUSEEVENTF_LEFTCLICK, ctypes.c_long(Position[0]), ctypes.c_long(Position[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_LEFTCLICK, ctypes.c_long( + Position[0]), ctypes.c_long(Position[1] + 24), 0, 0) def RightClick(self, Position): self.DLL.SetCursorPos(Position[0], Position[1] + 24) - self.DLL.mouse_event(self.MOUSEEVENTF_RIGHTCLICK, ctypes.c_long(Position[0]), ctypes.c_long(Position[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_RIGHTCLICK, ctypes.c_long( + Position[0]), ctypes.c_long(Position[1] + 24), 0, 0) def MoveTo(self, X, Y): self.DLL.SetCursorPos(X, Y + 24) def DragTo(self, From, To): self.DLL.SetCursorPos(From[0], From[1]) - self.DLL.mouse_event(self.MOUSEEVENTF_LEFTDOWN, ctypes.c_long(From[0]), ctypes.c_long(From[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_LEFTDOWN, ctypes.c_long( + From[0]), ctypes.c_long(From[1] + 24), 0, 0) self.DLL.SetCursorPos(To[0], To[1] + 24) - self.DLL.mouse_event(self.MOUSEEVENTF_LEFTUP, ctypes.c_long(To[0]), ctypes.c_long(To[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_LEFTUP, ctypes.c_long( + To[0]), ctypes.c_long(To[1] + 24), 0, 0) def UseOn(self, From, To): self.DLL.SetCursorPos(From[0], From[1] + 24) - self.DLL.mouse_event(self.MOUSEEVENTF_RIGHTDOWN, ctypes.c_long(From[0]), ctypes.c_long(From[1] + 24), 0, 0) - self.DLL.mouse_event(self.MOUSEEVENTF_RIGHTUP, ctypes.c_long(From[0]), ctypes.c_long(From[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_RIGHTDOWN, ctypes.c_long( + From[0]), ctypes.c_long(From[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_RIGHTUP, ctypes.c_long( + From[0]), ctypes.c_long(From[1] + 24), 0, 0) self.DLL.SetCursorPos(To[0], To[1] + 24) - self.DLL.mouse_event(self.MOUSEEVENTF_LEFTDOWN, ctypes.c_long(To[0]), ctypes.c_long(To[1] + 24), 0, 0) - self.DLL.mouse_event(self.MOUSEEVENTF_LEFTUP, ctypes.c_long(To[0]), ctypes.c_long(To[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_LEFTDOWN, ctypes.c_long( + To[0]), ctypes.c_long(To[1] + 24), 0, 0) + self.DLL.mouse_event(self.MOUSEEVENTF_LEFTUP, ctypes.c_long( + To[0]), ctypes.c_long(To[1] + 24), 0, 0) diff --git a/core/SendToClient.py b/core/SendToClient.py index b4256df..db45270 100644 --- a/core/SendToClient.py +++ b/core/SendToClient.py @@ -69,8 +69,10 @@ def IsFocused(self): ''' def Press(self, Key): - win32api.SendMessage(self.hwnd, win32con.WM_KEYDOWN, KeyToHex.get(Key, ""), 0) - win32api.SendMessage(self.hwnd, win32con.WM_KEYUP, KeyToHex.get(Key, ""), 0) + win32api.SendMessage(self.hwnd, win32con.WM_KEYDOWN, + KeyToHex.get(Key, ""), 0) + win32api.SendMessage(self.hwnd, win32con.WM_KEYUP, + KeyToHex.get(Key, ""), 0) ''' Send One Press HotKey For Client @@ -84,10 +86,13 @@ def Press(self, Key): def PressHotkey(self, Option, Key): win32api.keybd_event(KeyToHex.get(Option, ""), 0, 0, 0) sleep(.05) - win32api.SendMessage(self.hwnd, win32con.WM_KEYDOWN, KeyToHex.get(Key, ""), 0) - win32api.SendMessage(self.hwnd, win32con.WM_KEYUP, KeyToHex.get(Key, ""), 0) + win32api.SendMessage(self.hwnd, win32con.WM_KEYDOWN, + KeyToHex.get(Key, ""), 0) + win32api.SendMessage(self.hwnd, win32con.WM_KEYUP, + KeyToHex.get(Key, ""), 0) sleep(.05) - win32api.keybd_event(KeyToHex.get(Option, ""), 0, win32con.KEYEVENTF_KEYUP, 0) + win32api.keybd_event(KeyToHex.get(Option, ""), 0, + win32con.KEYEVENTF_KEYUP, 0) ''' Here He Send One Mouse Click At One Position Received From Arg @@ -100,17 +105,35 @@ def PressHotkey(self, Option, Key): def LeftClick(self, Position): ClientPosition = win32gui.ScreenToClient(self.hwnd, Position) - PositionToClick = win32api.MAKELONG(ClientPosition[0], ClientPosition[1]) - win32api.PostMessage(self.hwnd, win32con.WM_MOUSEMOVE, 0, PositionToClick) - win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, PositionToClick) - win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, PositionToClick) + PositionToClick = win32api.MAKELONG( + ClientPosition[0], ClientPosition[1]) + win32api.PostMessage( + self.hwnd, win32con.WM_MOUSEMOVE, 0, PositionToClick) + win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN, + win32con.MK_LBUTTON, PositionToClick) + win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONUP, + win32con.MK_LBUTTON, PositionToClick) def RightClick(self, Position): ClientPosition = win32gui.ScreenToClient(self.hwnd, Position) - PositionToClick = win32api.MAKELONG(ClientPosition[0], ClientPosition[1]) - win32api.PostMessage(self.hwnd, win32con.WM_MOUSEMOVE, 0, PositionToClick) - win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONDOWN, win32con.MK_RBUTTON, PositionToClick) - win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONUP, win32con.MK_RBUTTON, PositionToClick) + PositionToClick = win32api.MAKELONG( + ClientPosition[0], ClientPosition[1]) + win32api.PostMessage( + self.hwnd, win32con.WM_MOUSEMOVE, 0, PositionToClick) + win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONDOWN, + win32con.MK_RBUTTON, PositionToClick) + win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONUP, + win32con.MK_RBUTTON, PositionToClick) + + def RawRightClick(self, Position): + if (self.IsFocused()): + (previousCursorX, previousCursorY) = win32api.GetCursorPos() + win32api.SetCursorPos((Position[0], Position[1] + 24)) + win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, + Position[0], Position[1] + 24, 0, 0) + win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, + Position[0], Position[1] + 24, 0, 0) + win32api.SetCursorPos((previousCursorX, previousCursorY)) ''' Usage Just For Tibia... @@ -125,21 +148,27 @@ def DragTo(self, From, To): FromPosition = win32api.MAKELONG(ClientFrom[0], ClientFrom[1]) ClientTo = win32gui.ScreenToClient(self.hwnd, To) ToPosition = win32api.MAKELONG(ClientTo[0], ClientTo[1]) - win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, FromPosition) + win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN, + win32con.MK_LBUTTON, FromPosition) win32api.SendMessage(self.hwnd, win32con.WM_MOUSEMOVE, 0, ToPosition) - win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, ToPosition) + win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONUP, + win32con.MK_LBUTTON, ToPosition) def UseOn(self, From, To): ClientFrom = win32gui.ScreenToClient(self.hwnd, From) FromPosition = win32api.MAKELONG(ClientFrom[0], ClientFrom[1]) win32api.PostMessage(self.hwnd, win32con.WM_MOUSEMOVE, 0, FromPosition) - win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONDOWN, win32con.MK_RBUTTON, FromPosition) - win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONUP, win32con.MK_RBUTTON, FromPosition) + win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONDOWN, + win32con.MK_RBUTTON, FromPosition) + win32api.SendMessage(self.hwnd, win32con.WM_RBUTTONUP, + win32con.MK_RBUTTON, FromPosition) ClientTo = win32gui.ScreenToClient(self.hwnd, To) ToPosition = win32api.MAKELONG(ClientTo[0], ClientTo[1]) win32api.PostMessage(self.hwnd, win32con.WM_MOUSEMOVE, 0, ToPosition) - win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, ToPosition) - win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, ToPosition) + win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN, + win32con.MK_LBUTTON, ToPosition) + win32api.SendMessage(self.hwnd, win32con.WM_LBUTTONUP, + win32con.MK_LBUTTON, ToPosition) @staticmethod def MainWindowSize(): diff --git a/core/ThreadManager.py b/core/ThreadManager.py index f9a03fa..af97518 100644 --- a/core/ThreadManager.py +++ b/core/ThreadManager.py @@ -1,124 +1,39 @@ -from threading import Event, Thread -from queue import Queue +import threading +from multiprocessing import Process -ActivatedThreads = [] -Queue = Queue(maxsize=19) -Event = Event() +ActiveThreads = {} class ThreadManager: - """ - This Class Has Been Rewritten So That We Can Pause The Modules Enabled, - In Original Class, It's Not Possible, There He Had To Keep Creating New Threads - And That, Overloads The System. - - Example For Usage: - - # Import The Module Fist - from Core.ThreadManager import ThreadManager - - # And Create The Instance - ThreadManager = ThreadManager("NameOfYourThread") - - # For Start The New Thread - ThreadManager.NewThread(TargetFunctionHere) [DOES NOT ACCEPT ARGUMENTS YET] - - # For Pause All Threads - ThreadManager.PauseThread() - - # For UnPause All Threads - ThreadManager.UnPauseThread() - - # - # The Kill Threads Functions Not Ready Yet !!! Sorry - # - """ - - def __init__(self, Name): - self.Name = Name - self.Queue = Queue - self.Target = None - - # Create One New Thread And Put Them In The Pipeline - def NewThread(self, _Target): - # The Handle Need The 1st Arg to Work.. - def HandleTarget(PipeOBJ): - # print(f"PipeObject: {PipeOBJ}") - _Target() - - self.Target = Pipeline(HandleTarget) - self.Queue.put(self.Target) - Event.set() - TheThread = self.ThreadHandler(Target=self.Target, Qqueue=Queue, Name=self.Name) - - # This thread dies when main thread - TheThread.daemon = True - - TheThread.start() - ActivatedThreads.append((TheThread, str(self.Name))) - - # Pause The All Threads Created From Manager Object - def PauseThread(self): - for i in range(len(ActivatedThreads)): - if ActivatedThreads[i][1] == self.Name: - ActivatedThreads[i][0].PauseOn() - # print(self.Queue.queue) - - # UnPause The All Threads Created From Manager Object - def UnPauseThread(self): - for i in range(len(ActivatedThreads)): - if ActivatedThreads[i][1] == self.Name: - ActivatedThreads[i][0].PauseOff() - - # This Function Is Not Ready To Use !!! - def KillThread(self): - for i in range(len(ActivatedThreads)): - if 1 not in ActivatedThreads[i] and ActivatedThreads[i][1] == self.Name: - ActivatedThreads.remove(ActivatedThreads[i]) - Queue.put('Kill') - # print(f"{self.Name} Killed") - - def __repr__(self) -> str: - return str(self.Name) - - ''' - This Is Thread Class Rewrited, To Can Pause Them. - ''' - - class ThreadHandler(Thread): - def __init__(self, Target, Qqueue, *, Name='Handler'): - super().__init__() - self.Name = Name - self.Queue = Qqueue - self._target = Target - self._stoped = False - # print(self.Name, "Created") - - def run(self): - # Event.wait() - while not self.Queue.empty(): - SelectedThread = self.Queue.get() - # print(self.Name, "Pipeline To Handle:",SelectedThread) - if SelectedThread == 'Kill': - self.Queue.put(SelectedThread) - self._stoped = True - # self.Queue.pop(-1) - break - self._target(SelectedThread) - - def PauseOn(self): - self._stoped = False - - def PauseOff(self): - self._stoped = True - - def __repr__(self) -> str: - return str(self.Name) - - -def Pipeline(*funcs): - def Inner(argument): - state = argument - for func in funcs: - state = func(state) - return Inner + def __init__(self, ThreadName): + self.ThreadName = ThreadName + self.Thread = None + + def NewThread(self, fn): + global ActiveThreads + self.Thread = MyThread(fn) + target = self.Thread.start() + ActiveThreads[self.ThreadName] = self.Thread + + def StopThread(self): + ActiveThreads[self.ThreadName].stop() + ActiveThreads.pop(self.ThreadName) + + +class MyThread(threading.Thread): + def __init__(self, target): + super(MyThread, self).__init__(group=None, target=target, daemon=True) + self.target = target + self._stop = threading.Event() + + def stop(self): + self._stop.set() + + def stopped(self): + return self._stop.isSet() + + def run(self): + while True: + if self.stopped(): + return + self.target() diff --git a/engine/Scanners/ScanAmulet.py b/engine/Scanners/ScanAmulet.py new file mode 100644 index 0000000..fc114a9 --- /dev/null +++ b/engine/Scanners/ScanAmulet.py @@ -0,0 +1,16 @@ +from core.HookWindow import LocateCenterImage, LocateBoolRGBImage + + +def ScanAmulet(AmuletPositions, Amulet, Precision): + return not LocateBoolRGBImage('images/Amulets/' + Amulet + '.png', Precision=Precision, Region=( + AmuletPositions[0] - 1, AmuletPositions[1] - 1, AmuletPositions[2] + 1, AmuletPositions[3] + 1)) + + +def SearchForAmulet(Amulet): + FoundAmulet = [0, 0] + + FoundAmulet[0], FoundAmulet[1] = LocateCenterImage('images/Amulets/' + Amulet + '.png', Precision=0.9) + if FoundAmulet[0] != 0 and FoundAmulet[1] != 0: + return FoundAmulet[0], FoundAmulet[1] + else: + return 0, 0 diff --git a/engine/Scanners/ScanAutoExchangeGold.py b/engine/Scanners/ScanAutoExchangeGold.py new file mode 100644 index 0000000..8175d39 --- /dev/null +++ b/engine/Scanners/ScanAutoExchangeGold.py @@ -0,0 +1,37 @@ +import time + +from core.HookWindow import LocateImage + +CoinsImagePath = 'images/Items/Gold' + + +def ScanAutoExchangeGold(enabled_auto_exchange_gold, main_container_position, main_container_size, right_click): + while True: + ExchangePositions = [0, 0] + MainContainerRegion = main_container_position[0], main_container_position[1], main_container_position[ + 0] + main_container_size[0], main_container_position[1] + main_container_size[1] + + # look for platinum coins to exchange + ExchangePositions[0], ExchangePositions[1] = LocateImage( + f'{CoinsImagePath}/platinum.png', Precision=.92, Region=(MainContainerRegion)) + + # look for gold coins to exchange only if platinum coins were not found + if ExchangePositions[0] != 0 and ExchangePositions[1] != 0: + ExchangePositions[0], ExchangePositions[1] = LocateImage( + f'{CoinsImagePath}/gold.png', Precision=.9, Region=(MainContainerRegion)) + + if ExchangePositions[0] == 0 and ExchangePositions[1] == 0: + # break the loop if no exchangeable money found + break + else: + # else, exchange money + x = ( + main_container_position[0] + ExchangePositions[0]) + y = ( + main_container_position[1] + ExchangePositions[1]) + 24 + right_click(x, y) + + time.sleep(.3) + + if not enabled_auto_exchange_gold: + break diff --git a/engine/Scanners/ScanBars.py b/engine/Scanners/ScanBars.py new file mode 100644 index 0000000..a08a857 --- /dev/null +++ b/engine/Scanners/ScanBars.py @@ -0,0 +1,6 @@ +from conf.Constants import LifeColor, LifeColorFull, ManaColor, ManaColorFull +from engine.Scanners.ScanStages import ScanStages + + +def ScanBars(health_location, mana_location): + return (ScanStages('Life').ScanStages(health_location, LifeColor, LifeColorFull), ScanStages('Mana').ScanStages(mana_location, ManaColor, ManaColorFull)) diff --git a/engine/Scanners/ScanCap.py b/engine/Scanners/ScanCap.py new file mode 100644 index 0000000..9bf0940 --- /dev/null +++ b/engine/Scanners/ScanCap.py @@ -0,0 +1,10 @@ +import pyautogui + + +def ScanCap(NumberBox, EndNumberBox): + for i in range(9, -1, -1): + FirstNumber = pyautogui.locateOnScreen('images/PlayerStats/Numbers/' + str(i) + '.png', region=( + NumberBox[0], NumberBox[1], EndNumberBox[0], EndNumberBox[1]), + confidence=0.92) + if FirstNumber: + return int(i) diff --git a/engine/Scanners/ScanFood.py b/engine/Scanners/ScanFood.py new file mode 100644 index 0000000..a0ae7e4 --- /dev/null +++ b/engine/Scanners/ScanFood.py @@ -0,0 +1,12 @@ +from core.HookWindow import LocateImage + + +def scan_food(stats_positions): + starving = [0, 0] + + starving[0], starving[1] = LocateImage('images/PlayerStats/Starving.png', Precision=0.9, Region=( + stats_positions[0], stats_positions[1], stats_positions[2], stats_positions[3])) + + if starving[0] != 0 and starving[1] != 0: + return True + return False diff --git a/engine/Scanners/ScanHur.py b/engine/Scanners/ScanHur.py new file mode 100644 index 0000000..a79f3cf --- /dev/null +++ b/engine/Scanners/ScanHur.py @@ -0,0 +1,32 @@ +from core.HookWindow import LocateImage + + +def ScanHur(stats_position, check_pz, check_low_mana, current_mana, minimum_mana): + is_in_pz = False + is_low_mana = False + + stats_region = stats_position[0], stats_position[1], stats_position[2], stats_position[3] + hur_pos = [0, 0] + pz_pos = [0, 0] + + if (check_pz): + pz_pos[0], pz_pos[1] = LocateImage( + 'images/PlayerStats/PZ.png', Precision=0.9, Region=(stats_region) + ) + is_in_pz = pz_pos[0] != 0 and pz_pos[1] != 0 + + if is_in_pz: + return False + + if (check_low_mana): + is_low_mana = current_mana <= minimum_mana + + if is_low_mana: + return False + + hur_pos[0], hur_pos[1] = LocateImage( + 'images/PlayerStats/Hur.png', Precision=0.9, Region=(stats_region) + ) + HasHur = hur_pos[0] != 0 and hur_pos[1] != 0 + + return not HasHur diff --git a/engine/Scanners/ScanRing.py b/engine/Scanners/ScanRing.py new file mode 100644 index 0000000..9666d40 --- /dev/null +++ b/engine/Scanners/ScanRing.py @@ -0,0 +1,16 @@ +from core.HookWindow import LocateCenterImage, LocateBoolRGBImage + + +def ScanRing(RingPositions): + return LocateBoolRGBImage('images/PlayerStats/NoRing.png', Precision=0.9, Region=( + RingPositions[0], RingPositions[1], RingPositions[2], RingPositions[3])) + + +def SearchForRing(Ring): + FoundRing = [0, 0] + + FoundRing[0], FoundRing[1] = LocateCenterImage('images/Rings/' + Ring + '.png', Precision=0.9) + if FoundRing[0] != 0 and FoundRing[1] != 0: + return FoundRing[0], FoundRing[1] + else: + return 0, 0 diff --git a/engine/Scanners/ScanStages.py b/engine/Scanners/ScanStages.py new file mode 100644 index 0000000..e9e30c9 --- /dev/null +++ b/engine/Scanners/ScanStages.py @@ -0,0 +1,18 @@ +from core.HookWindow import PixelMatchesColor + + +class ScanStages: + def __init__(self, name): + self.stage = 0 + self.name = name + + def ScanStages(self, Localization, color, colorFull): + if PixelMatchesColor(Localization[0] + 100, Localization[1], + (colorFull[0], colorFull[1], colorFull[2])): + return 100 + + for i in range(95, 5, -5): + if PixelMatchesColor(Localization[0] + i, Localization[1], (color[0], color[1], color[2])): + return i + + return 0 diff --git a/engine/Toggler.py b/engine/Toggler.py new file mode 100644 index 0000000..fc6374b --- /dev/null +++ b/engine/Toggler.py @@ -0,0 +1,20 @@ +from tkinter import RAISED, SUNKEN + +from core.Defaults import rgb + + +def ToggleState(state, button, checking_buttons, start_thread_fn, stop_thread_fn): + if not state: + state = True + button.configure( + text='AutoHealing: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + print("AutoHealing: ON") + checking_buttons() + start_thread_fn() + else: + state = False + print("AutoHealing: OFF") + checking_buttons() + button.configure( + text='AutoHealing: OFF', relief=RAISED, bg=rgb((114, 0, 0))) + stop_thread_fn() diff --git a/images/BackgroundImages/Recapture.png b/images/BackgroundImages/Recapture.png index 3041e25fef827a9cb7b739d0bc528432e13fe151..e64aaf1ed9aa964136a510820f4ad62e119edcb0 100644 GIT binary patch literal 1226 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucHSwMxR~FA(G3(UJaDXR4T>4R?E;qf_FRPKQ{{o98Bp>BiV_+;Y0utMrBW zh->%Dns;{=rynyedR8_!&FZ~)&Cc?3wsOZU<=@+uyYT`Y0R)v9Q*MW>E$Y5_sd(Oe zt?eg77*ELHMRyJ`UC7#+clG4S&b8~;-~REV;%4@i7du}+kBErSkjswG-Mi;^-_7s$ zXUN(X*8YFB#-0DP-?@Va9Sx^ty!lXlC3iu3!{Niu*(Or1zCJ!TZrz%7_Uzf4=gyrw z(dIC1`t;L#@0om@Z)0X{ZC-u$Q!E`v33zO)gAt=(E!@|GDG5(uT{cxT9ZuxB)pQF#q-@kiTSMK-eV{hK%7;c-rBkBJ4V&Uj7 z!S&mZY1|SM7mvPu`*!Wul~H*YuNQIenP$!H($BvkOIX@wrHUAX@1mCL7WN-!U3j;( zalhIs{~PO0PB!qc)2K^Io_c9{R^}s723EzgnugHXHy(JZCNg|!`rUa=rKPsE`pxzL zVV#Yfmw!Bx|Gn>F6+kP?wdJl~x|>^l8&_($bc_xtN)p zy!g&;LrcrZJ4!#ZlQZh;_ut8mj*QgYHhcE$XXjKdMxUKxw?oi7JjipssYCfsV~01_ z)Lnm+-YV}t`pM(@)_wEsLSG%MertSSar?)|%xi8PVe{8osm-wRam&(;e_qB-j@{~S z|MipiTZR|44L3eAhUF$Tt53Zm$k1B|1gmYg{#m4Nwr%|syOm2%hI5Ft0hNUMJO8vh z5W8*Lww#=tGk4ZT-Mlpa^XJb=)n#R2Imto4mi+pVyxIPr$?sRio5knpOS?zt#Coch z&S4C(vVASK@n%lk_Lp^W@#6Q)UYSSM{`neHTk?%#zPs1_`sga|A1^$2Z;>l-++nxO zx@G!&MnV zosF}8=m2#es66`SWs$ix%YmO)-@FGga2Q!5QNnJ=!vr;$Fy-Ky_MhRl^aPIWq7%D7 O$~|5ET-G@yGywpOHZX_) literal 962 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSoCO|{#S9F5he4R}c>anMprAss zN02WALzOB}aWezM&;LOBB?CjL0RzLU1O^7H84L{K`IF+0x-l>?dw9AyhE&{obMxTZ z#Reh{fo38TZt{9ZCD>X=d2nYoid}L7(px5QO~`n-{XkAnN~GBY`^EaImfhN}hTAsY zuif@I6zL2>d^P4pS%@MWZ$h0y4Ln@UF(54PIIHb+%@f4t9`|?-K?Lh zfIm5N@`Cx!@}IT2Ht;PHS)s*MGAnlb+^XdoC!Ckrs5?w&`5?rq9T)25*!{cm&6C(4p8hiXZqZ9wUjJTi2YT@er zaS}_ie}frUMCPVo#%teia2?xF$X1!+@?z0n| z#@Ahiw=-AIezmMNl~L}$XG8Fm-p_7g@BVV_aLxT5SpC*h? z-2cn=z$U|;SC82q2!HrNRQ}wpLrb2$V>~z0y2b8SO=n&G@tgDIn2vv_jlMB!owfS! zph;h5Za(p$EBZjq2ex-JXCK&m_~~Zz#^i?r5vtpp`g`{5j6QMv;Nf`9)9q(|&yD}Y z!%)xG$e_T$!NAmjLjB>WulpOfkCXA9N5d;m4hIINJyRK^pMI74vAC4ugBz2}dBF#h zS$|x&Vo_jV1W5}tFu<7y<~x#@8c9jMYK;s)1axx)|C9F&U(Py-OR1RM2j)KpPgg&e IbxsLQ0K2MiWB>pF diff --git a/images/Items/Gold/gold.png b/images/Items/Gold/gold.png new file mode 100644 index 0000000000000000000000000000000000000000..4a517025b5f04598e7bf64fe3d921dae319dcdec GIT binary patch literal 1852 zcmV-C2gCS@P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D03mcmSad^jWnpw_ zZ*Cw|X>DZyGB7eSIxsmpGcX`BGCDIgIx{eGA*^};00yKcZA^gJ2UN?pWBpYmG7S!N$b22_|Y{j4X|AL1d{|S}3dXSV&uH zfkMz=FhU>q(cb6WneqG1+#hZ(#R}rr+|K;3^Pm5m@0|aPH99&P0Ag8|5PT<0+d%u# zr~Py!+zT>*6?$c%G+E3+p3zCLl8g8OdZyIy*C=0(Teh zO0iIsTCFB7gqGGySlGZOw%Cp>o^BL_aurpiqoYIT)iJ-(@Fb2g9@F=HY(y*BP%2c| z!vUz6<3yl*R1#1)kw`*DTDEN2BF^5udp}uTUY0d%TBIc^6$tn6q(y4j#MP7fULf^) z4fEEdf;lu{wTf}KE-Nc5(tyIWOvCkbtW+wg^~{s=c#vo`26?VTA`!`EvtrXL^o@%N zH3+2eVxb_ldR5A$vd}$coP2R{QGHygl+i9rK3`D5{B?GAs-ir^BCJ^`7S%!(xRG-y zgEEWgUs+kknn1_6uT5<^!Grl~wJJ8i$>BemmS&?Fi>nX_1u1|hAV+A4rKKggbLWmK zN7vBb5GPA$b7NYOMB{wWR+XjIcnDIHV{i}r19N!3ryVZL!%e9S6^le8(vj{^;SIMT zWmt&s$z)REiMT`~QT2JDke75irSoI4xVn;Vq0Eqo5j8ux#gkVdU&+k|eN3j(Ea`L_ z3W3ScR!;>>@Z@B%DvKvkDwlK(&$lpk*Fsq$3L#$F^Q1d26+ zD7ZX3t6{eYla@i6Xf!IhTwWD%Aeb9pxiYUCZ-njJx9cW6R1KufWHM?w$FZcVs~gsB z$mY#G8cDsqy-);;c)Cgz+F|1=LW?oQSS9F72cby(_*S<}zuPUjFS6nvb0nC`O7QzW z@s~f=lZLQV7Og-f3Lqb4kWCzaA)*+ zYWK+*3jUeU{lCfS7Lz{=U>1%Ep1$o#>4FiM;UBS)inhb;x zZ+x4VzOV8!H6O_AR7Ubs*!aSPSl5n-_2)-w39s;(&Lv679hy9s%c(^vmthh^LL%`s z4Ee8)NhDD`o={RTQ5Y>#sRT?|QlXCmv`k_$#n+J7ctDz7l`$@0-ewx6mR`e` z4iJZK;U9gPMCv3A2L@lXowlye)qAb+Mlw6{qV%oqOM!$c8uoQ!f&` z<^g6z%BMAKo|sHUOUcvS-6d;CJQ2kA!ooGVdiAQz&CRLMN5S=l1-UXm4^G^WKW^QU znVDI*C86n@R%h4~5xnc^8UM_9%-zXU8lmIr1fKdC==bb4gwZzSgKgl$)_w^x{o+Sp zsoZIu_w##))jI3Vvz{8!P^Lwasg$N^MuG+ajm+Fkrl*nd$kw^bm-XaN3MNAI@?xYx z5r!q9BqW%EHQbu*jr=VWhsFN&Q=PjJg32jGntos@*fkAE*`C(p`- z^XFxHdRiwxF4hZCx~Vlp8(!#M0vx!1;#Oau9MkRxaPot%oAWxQOWcBvoHHA)2a^L# zwrqzz4Au|k#CmQ_=Ne+(b3vODJY0=mN0D^Yv!rE%-`*zx4HmglUCw(SL<v!C?_OYrvfhYlUm5&&iSNDx*&WI-s9k-Rct9H2eV4%i00002ZZ>EP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D03mcmSad^jWnpw_ zZ*Cw|X>DZyGB7eSIxsmpGcX`BGCDIgIx{eGA*^};00!epL_t(oN5xl5Y*b|wK6B^& zY>9YTQ zv?#CAQrb>wY3Dt2@12L=ckbL_sFg>9@taKU|2+Ts&-u>z|KHQPVnt2k2Qj&k!H7do>(PT|gRYK{z|E`#&?`uZFtve~SZN+q#uTZ)B(epwHP zLQ<_(b)I1uVx!$32#94`DyLj7OCT5&ui=p@G3qZl5Die#vbex6p z<#I)W=;L;)l`0mawG1fcC|$uOsGQg9!v_2kg3_T-7&4;L-rg>QgM(slm!)D!iuk89 z8Oh>LOBAqRE}um`i@u^1@V zWFZtvQi$IVPM|H9%gNl_oXpJ3sDczm|C4)jsB>{znB?PlP+1i&=|&6iok!hA9iM6wBdoSc0LT_>8eB7|(Ktiq`bg(jz`<>t)^ znVg)|@-4W5u3(w}>FFtTLkpu{{P zfPQBzQwjQ(@l5P_^MJ(St&(V6r7nns{j%YycIjB(F3)XzObN<6LPK{L^O%mY+_@f_D3ihOhUfP8gmuS`u`mh?gr%9=9#=M5Pc z`dz*|H7q~aZ|^Vxa1P^0&@s0OSyDG07;9%&<;F6W<%vcxeC9>)kXZ#$6=&df}D73?;&~o z$!DZx#cGL0g7R$VTIufECR;YHm6u;!FE4C;LdV{*YE|9KG|f0*p5QS+`Lv3o1S%v8 zT9i<&tu2U<3WvUyP5(p~cLtU-F{J_kZ z2N%MTC=!#cgYFd(A^3LW(hVK=>1SW7mF^Wev`jb>(Ui^zae{)DfB@!lMnDu{MHY{b zjj075HRuYBKq$jwfoKquV7k^&tk>`7|L=b|D<}HS>e&0?^7V{gj&2 z)F9@mQzzy8x$|;yWJIoAyQUMCi>1PsE^7|oa>a2qQRl>+oj3b_^2T4ailS> zP_$)qY+Bpjd*==12)S`Toc+bIV1IwVyuNFfbDvlYD)4V)d>By9^wfl0xH#5u-;rZy z)GAD51P?MjJ028UH?`?^--n0w+YGnQ#m5Iv)JqONdjGY0$${$uo~R9XFeSU7YnpN8 z(gpe8-B)C2Xh`c_U0w3+$qS7z-MFEp(dU9=E{&$Oyi`BA$o#}p6pDDIySrPqzqDPp zJ-@9!3F(B)~s10t8pd&uc3JY&e1!i7pG_h={k-#MF5u? zx{1dzvDh+?63+Dwmf*dQ84UWcSsyI=O2X;6sk2i$Iy%^K7kIDulQ8$Fq?An(6K!mCTujA zdFk|xqxa5j%$}c{yM5m0*LtNJ@B8~%oIh85Ebhzcoog3{{a+ev=kUNh`vCV^2UqQY zi(DaFm_$*SPrvot-?V1$+KCPd8T;J!ZjrCN*Yjz;)6}n0-omRVPu;!tf9}ueH+pL9 ztkch{r3r0x|Lp%LE!c8Di-Op35)qzrV9E|IhOF$@@jOg?!3*`p8{=zSZ}0U%qU~y`84L?f#*d zOFef&_I;C1kMwPH$nZaX;==aw{P;=(!>n!7Kj$s|eI{D@@Zs)Gm$Jf(Cj)(KBg%T& zi;f#Mf1Pqhv`zGPR9Laap7j6!`p)%DT)5t?{qx#8hQUwwM8CB9`|ND?b+!HSGbCj; z8A}?szuoftK(P1fQtpU*5tiY);_LtZZCv(Z=RM}wSp7NgBzOM&`r^ZZWl@rQs!IQC zKE1#0)5@6#%(%C1pM9|_OEW~{O<3vmum2_;co*w_zyAG9Zt-35w(swCm7IU`q;PML z`~M?JQ@w5Cc80tOh~WxendPmt@!ceE{keKN>$w%a{_G024a>2#p8GA%Xr^w|rk~1= zAD@dQt&HM1|48cIsm_zH_jQE@6g57c#l3cc!;Z3LqAN03D=+nOuT3~AcGviE{b|j; zA%&+~!xk)>>ZTsMO5_4OLN)Gi>E7p=y5D;<&sr0kg_D$`4r+am$zT;-_035;;$flC zBGD;DV4WZ{wW1ok!Z!S}I48SyLBsd7#cXjqFK~H%tYKw3KUrXH!b@Gwqm28lT|)mQ zY*3Z)JAdYfZoG}0ebJYtwGTUHMmGcPhnqqd=G3;dbfc9in^dK?%Eqe*&D>-DOGVPS zIQs(Ew2w0lRa@y)R{y`GX&kfo^NrK7>-W@c+W!9Af&Sp@>-}p!E}iQ&d*|8Wy+MAeLTN2; zr~FU9c}XnKzWUn{c5(jiCBJJw+t(CVe!12#Q}6j*uk$ze?KaQ0Hc zT=;w0qwgl}i(5^%h5suN%;0tppFdu=Gs$dParV;>o7MZ~S`_d3T@xJeZ+`fy?;*h%{A$O}aC}X={q0aqQqrI2 zD}R@tT~?I0_Dyc@7S}~hJn?6Q%#^%z-(x-NA{Uo22 z$vHFdZO}?q<3rPKEnJ(x{%EHzMj47F8c+*ax+u8tqvk);vu1078u8@!z^aGA)78&q Iol`;+02;j)djJ3c literal 0 HcmV?d00001 diff --git a/images/Modules/AutoHeal.png b/images/Modules/AutoHeal.png index d93412a81c25a9070f162deb3993dab288965b69..8f78bd5a71487de4ac6454e969237fa3b51726c5 100644 GIT binary patch literal 2479 zcmeAS@N?(olHy`uVBq!ia0y~yVAN+|U^3xg0*V}VweSK`jKx9jP7LeL$-D$|SkfJR z9T^xl_H+M9WCij$3p^r=85sBugD~Uq{1qucF&9r4$B>G+w|CF>N}ptG2<%(WcTl{2 zL2m-jk9WE^9w~(v?^p zF;j>76^e>|a`*Pu7Beu_ZT`dg=hhVt(X19OQ>Rv`g-*Qz3*A-(D2J>N)WQ(1c=owh zzV1h%C6n3Lf4|>PTO4l_|M>Fd%SB8%Pd9Pan`_dm_KVdC-Q$G_jN-#+Khqn}dK zl@o&FW0VWbhNnC9yc!Bxl-AS;<3kRb~XQMYNFlZAJlvjxBb)l%+!6&nXoH6mVW2wf1N9NOV+l3 zF|gKn9P#>m`|;>gHC5FqWw|v)Hv9ad-PN8ei_i7nZMJF7pPF5AGWSbs&S+ZhXG%x@3h0@n& zKA*gN;w?{}&9}Dh`n@lIJStvm+^_yQE9;NhoFfMFDX$(rbOS6`@y0)s;ChQxPAaQ#>DFIHy%GA^_4v%ZJaf3kj@ z(4)UjaEJ7IX+&jPA)a0>|NWoamh3bE)4cpuAM;N?yjNo-^Kap?#49`Y?mYIl_CxBw z{V`W8`mXmf|NZv)`Tln=UVn-;?Acpb{ra9o?2-4=Hs;?ue)ysOw_^w2^fIrN@4eq> zTdNXBJ%Q3YW>9v`MtQ zd9K6Ma^bPYcl+n_coi1?fB*FV1S$4ipX-eDj&|<-$alr!!n|+7)sJOY6fUrSuYUP* zZ}zc!73^6uFaG^LxkKS?Z~1~_jdfH1rUXp*b_{Iisu|N_^Tm}V1)n_QF7oST=Dp>= zEcNdWKvKeJjcKi2qd%lsSC?;U!X-)7oxG{4s<#XjrX8$Pgg&ebxsLQ0Lt_QNB{r; literal 2397 zcmeAS@N?(olHy`uVBq!ia0y~yU^D{a8ysvvk#mwMia?67ILO_JVcj{Imp~3nx}&cn z1H;CC?mvmFKt5-IM`SSr1K$x4W}K?cC(XdX@yXN0F{C2y?cKAzx1TXNT%5Vxm-FTl zmgP;H6aGdoVPN;*{AMR>(Ooh@WWv$g>>olVgg1G6unQXsGWI$3svQ5dGyWVS$3&6( zl!JSIv@u`)o*%crY8Nxd@AKb86}(S0*eEi8YT-E{Y^2~%h~rl!cXRjry4&X%W6s^q z-+$-aT5HRc{{H^kstup3D=IAfPyG9S_4;j7hUcH}f8Q@BYV@6ui9}jFs*LD38V#z^ zpdukl52EC<=ePO#c-!3P{8isC=a(ajl^xZ;-%h{1v{b#F=fNer%o7ZG6RT4k=1pL% zbYgqLDLFxXNOH>mKl{3R`P)B^@qhmOe=Bn!bR-uzqhx1c6`S9@|T}4sihR=zkfg9caM+4 zaTQR&@Mir~zV%KcC9eFntX4~=jPYt-`_c%Pxk$UrWxI~g3f?|n=GOBo=RX_HZ@m3L zzPEjCY{lmlNmcolha&XezuR86aJ_8$&a8`(!ORXQDulc<{ex7rHmS)pU5F6sGT?MJLLbk{mhuX|MP82H^r3Z8BX6Gm(44EZ+=;Sw&#gs z%0Ln4XD3x&+vO~Kxm$3P;ZAq61?T6@d$;fVuQyXSN>1cWvQ(O_chCH?*S{}^(|+X{ zOHS-P-I3#PdilIZzkiquY+|fryHUKa|0CzkhINKaGtcduGmTGo{_Umbk3R(p>De;P zbTXVd^GaEY*3JN0?|*`=?3D7a%!B+7G$?1Sv@bR z(v+LtcT@HJ(NYeCORm|SzqPA)=aZc~_!Oll2%dmCw8vrI=h_~iIVQah%iOQmy!(1S z9B4_U+)agN&nH$E{jZznZl=fp%!{zmVIzW%0qS4a%8kb6grl&d z06O)N?`i`LJNjl4*SGG(ac}_8m=8h+%DYv!T0EQb| zy$oAoVsSh7(y0KTWb@M*$8Ul_ChlzWzX@Sii&Hnng-H$PX2ibs;OTL#c;Wy8p^;^r zgw(&KyD=fTW3C7b0N2eU_EYW_^H+8c2KRS@%_=D*t)H&i zEY&UPdCRmxbekKFZ&pyTS99dcejFFqta;Q$48sgQn|9}P$9e-HPdQIDtgGKn(%Aa9 zZcdgp2dh0D=NryGqk*R zot?7d4Hi^!gKLMcv#OX=5+D)1Zk#uxO9{mwot_ibhN`n2Lbya961srvCnjU?`yQL$ zItlu=qfbBVFYepan9ShnBf*f_+lzgjF5uai5i8b_Q$f-UO?!XdO}SP%*|!wIU+L}+ z^!1O>2>jQ0K6)i3W9M)=hzmd0iD?1fijkGHQ|Ut(29-2K{!V)1fHj$_(o86mI@L>M zgm-KQE@9obm5`%$Dxlpglhz_g^Rlts3#+_Cgh$m?(1ALT4)}v>{8veI?^k>>c_=ma z0Jza$2xQzi2@jN%8oQI_PHI&dCgmEV51k*PwCu_)p^XG-1)Ww z8M5Bv9P+I1de5F{{a{16YFDXk+ngz-ysLWP!c0C(s5(p2_kedrs~3h+^Atbj_RHU? z3>CW0Cj*6OE12o$xXG?ySu=G}pA~ZVbcVAqxp3-@dTxyBaFt(m5;Xf}{`sQ7jls=y zc7PvAe?5pmfn#~4J`dJbXT`PLsav_qLk`oZ^fd6Hwe+ZS%&&@Cj`N2XxZDn*3GKp9ZXQ z_X`cpY*WedG$Zlok-npgfXC+YWgVYH(}I3*3hUK^WCxcVImro%;qWly<{1-!`z#Uv zG70s_IIHg}6^hlLvX~(meRyJR%NT@$X9Bl8O(Cal!UcX%H2x!rjKU)ga3=cLqNIumxwSDICVTpn>3X@-ZVf0F6AIc-|_?2Z< z7Yiu4Dtsm!0Nq1jZ4hYZ0ho7^?9GLCFDQrJu~oDoqC_0ceD0#EmnswK z8&OwGN6}?ZHB(cq*~eOaIczB|sGb%l ziSc#~g*AVqBNz?^J3rwOHO+T=0y?elYjKO^d(YJFkQHriB+DIZ4-#S0gYV^~;Ck<` z3;LeC!@F@a$7!`%sYf1dKkn@@$>!m{56L!x{gR!QAT#_SpX=0&Bc+z7N(XE;{I2WQ z%`!+P>`>4}(3*CCgn(%{!G5+^i4ir;@yZAfgV&~N^G(E596cISF|J7I4a>!M%IVIlhi8f+t@m(s82~YBz zh4qSzqo=))Ic+0@Mm5p2fg%`DI3&isB30DX8du^?|EB?5VnjWX^iCz)$QA4P>H=dN z$P)I&kFkJXsq1pF2xKSL8IzF&?hoR2y)EF^N49Aj7XFm^bX@Q}id zeX7N{2Y}>8Qn&EWTgx2_e$SwHFk}*A;c689%Tb?xsQ-6ZS{h8#+n%=h(jjEy#|01? L7#2`}EGGXSNc#Zo literal 2176 zcmeAS@N?(olHy`uVBq!ia0y~yU^D{a5)L+?$b#crw*V=|;vjb?hIQv;UIIBR>5jgR z3=A9lx&I`x0{NT;9+AZi417mGm~pB$pELslhp4BEV@O5Z+q-9brJpl4JiM!5K7B&B z_XO<-=AFMMFr^$2Ww~T4d%_^dfnj-rOb!2nwFmSZRhKj{%${q?J|nfwyGZxnp850H zC3v3CSF_Q#n~o$mL^`oO;gp=9p5icX0%Ij^jynI%cKQ0cS!I#8 z_q~^BSh`wz;#tP(|8K+niyLbDe%WqHcJnOm=;OVd{hj^T*7fY}?Qj15tK0l#)BJxQ zuP^_(&p>y3zI&!!+Vx*2&F}x+P|4Es;@!J2J7*_utZ4Yi*Un@cdh(Gh0D#jT>>98h3Udc$w|*@9nF+ zVRP^G>H2@0Dp?BTR$fT z>A!6^jZg7$=(R@%>u-zqn;w5>f3y6|#`Dij&o{n)px@iR_HM=J6-l?Y$t3Db-`*d+ z`{MO;oA0DozFS&3fBHJpXzTkmdn@2w|~ET&n|LZ^tF@|Rl$HyQry$#ICcvAOf- z?4O%+HcC$9O|n#)op-PNve&$t{}#31EhH!Qp6 zcCGD?nwA`g>lREqLyoAqr92ki#3WtfmrE<=Sf@STBQ{+T;gYCoyX@C~Pv=~JWCXOv zO#$jqBc{r8uMI)wm@v((+x5)`<9M9}`e>VMh`RD4C$3mMNeH4G6erC9v z^X80}9D(2y7CjSs-GNn={5NLYRdJ!Y`G4k3hC%LP2U6AmTMZ1Ju6{1-oD!M} zUK_Ln8s2R7VC0)1^rY5mg80h=nhM=-m?K0jRClzLEa0(`XHoWAmf26N@aK+B2(RSAThgSb(y)Bmd&ptcl8s{q!4R!PKuP8~&>UFs5_3hh}zuvsv z-M!H&<<|jg{(JX#CjXD)zgxTe|I_+;(@(5kba)xlw&ORV&ivb3R{l)m`Kj{qb2Hb! zi49(mT)OT`<@K_*w|(n=e)%}}rt@!^gP+eOTCaF^_Gd}deaVE+=idE$ckbW6J@b5) zCvPqO__Ji&@5awb-w$6u{`nlx*k{Re>bK258gizl=X1O5rxSmxbIae|{WIzI+S%*h zwEIrY>6VPiR6L0>1rPpSGEc6@3W3*l1;6>96Kp6*TulkIj2{t^_K&_Gi}L zySMhsZu|9q`qmB zXU@?#bN&UbKX$MCd*0@sSKq`;el2=-wrQ;%`&`$#*;UQwBKO`r@y6!fpL<(=N<{zP zfBoIBkZC*8rroSuvU1YPO}CTnXZ>V+{GoV$E`%q-!}#kto^ z^3R;x`t#K1v|V?LcxTSd{`~d%*`mf-K!(oew1p05&uxud0W#_Fy^LubU!I8T7+d$7 z$Cg$1tle9E*Rpok+o4w3qr-n5BPQ)gkT$Ew|7zQ%J7af5y^TUe1ckRZM}!D}$%2 KpUXO@geCxZ#sYKz literal 1480 zcmeAS@N?(olHy`uVBq!ia0vp^4;UC2nK;;htmoHm-vLsL#X;^)4C~IxyaaMs(j9#r z85lP9bN@+X1@buyJR*x382FBWFymBhK4}I9)>uy$$B>G+w|5Wb-VS4ENZftB?}E2m zfm%W1z3LYXd=~`gRGWM7-BplX(0-5mi0~5Sl$N{)vsQLo>JpjQvNXPMKfi*DZKRmu zhv&>QJ@)O{yK~om2BG^od5sMWiYg8qoB~cvEfdh0y1(`>$iG*6V+~{bp1Q9^o44J6 z#PI&zJG1W%wd>Ze?-zd{fB*jmNycq|fBZXtlhKMD(**41j*4OgHHkqoeY<)1_t{^Y z@9p_rP*`5ReJA^y;@aBUkH4;-KD+m?7(2(A&rcYc{7+jdw6Jg}GCFxQ2nf-esh6L> z?w$E-_Psyeu0Jca;r#FRr$^6T-CxcZA@kt=?9vCt^77LbPF&2U;dCSSO>$ntIYvZE z>^5-!@a*5`?O(n=eVUd#^I`ehs(1T7#(v8^zwqrGyM1N9|L4cFSPCEJvyRRBy)C`E zrYDc5rh3kDRfjZ5r6(^rKO9+ReCFF4qrS7U^0HNPK0lTDz_HDF#yPpi$&YUo)L(yN z)R%9+&vxJYk1G>%vTACoYc~Ad?RI0I=3Lm!2VMdOr z6QLJo-utCKk5+xy(5 zL3_??!TlZi1?%1)zwQ9!Jr>;Gm7l;C zLR-=f0PQ1DSQ4GvlG94t~~IR#p1HS1OM5j--I6+G0n;3 rm{7@LF`q&4i4qUaY%sICyPl!-TjKw{T|eFcOJ4?0S3j3^P6 Life or stage_three == Life: - self.SendToClient.Press(LifeHotkeyStageThree.get()) - print("Pressed ", LifeHotkeyStageThree.get()) - time.sleep(.15) - elif LifeCheckStageTwo.get(): - stage_two = LifePercentageStageTwo.get() - if stage_two > Life or stage_two == Life: - self.SendToClient.Press(LifeHotkeyStageTwo.get()) - print("Pressed ", LifeHotkeyStageTwo.get()) - time.sleep(.15) - elif LifeCheckStageOne.get(): - stage_one = LifePercentageStageOne.get() - if stage_one > Life or stage_one == Life: - self.SendToClient.Press(LifeHotkeyStageOne.get()) - print("Pressed ", LifeHotkeyStageOne.get()) - time.sleep(.15) - elif LifeCheckStageOne.get(): - stage_one = LifePercentageStageOne.get() - if stage_one > Life or stage_one == Life: - self.SendToClient.Press(LifeHotkeyStageOne.get()) - print("Pressed ", LifeHotkeyStageOne.get()) - time.sleep(.15) - elif LifeCheckStageTwo.get(): - stage_two = LifePercentageStageTwo.get() - if stage_two > Life or stage_two == Life: - self.SendToClient.Press(LifeHotkeyStageTwo.get()) - print("Pressed ", LifeHotkeyStageTwo.get()) - time.sleep(.15) - elif LifeCheckStageThree.get(): - stage_three = LifePercentageStageThree.get() - if stage_three > Life or stage_three == Life: - self.SendToClient.Press(LifeHotkeyStageThree.get()) - print("Pressed ", LifeHotkeyStageThree.get()) - time.sleep(.15) - elif LifeCheckStageOne.get(): - stage_one = LifePercentageStageOne.get() - if stage_one > Life or stage_one == Life: - self.SendToClient.Press(LifeHotkeyStageOne.get()) - print("Pressed ", LifeHotkeyStageOne.get()) - time.sleep(.15) - elif LifeCheckStageOne.get(): - stage_one = LifePercentageStageOne.get() - if stage_one > Life or stage_one == Life: - self.SendToClient.Press(LifeHotkeyStageOne.get()) - print("Pressed ", LifeHotkeyStageOne.get()) - time.sleep(.15) - elif LifeCheckStageOne.get(): - stage_one = LifePercentageStageOne.get() - if stage_one > Life or stage_one == Life: - self.SendToClient.Press(LifeHotkeyStageOne.get()) - print("Pressed ", LifeHotkeyStageOne.get()) - time.sleep(.15) - elif LifeCheckStageTwo.get(): - stage_two = LifePercentageStageTwo.get() - if stage_two > Life or stage_two == Life: - self.SendToClient.Press(LifeHotkeyStageTwo.get()) - print("Pressed ", LifeHotkeyStageTwo.get()) - time.sleep(.15) - elif LifeCheckStageThree.get(): - stage_three = LifePercentageStageThree.get() - if stage_three > Life or stage_three == Life: - self.SendToClient.Press(LifeHotkeyStageThree.get()) - print("Pressed ", LifeHotkeyStageThree.get()) - time.sleep(.15) - elif LifeCheckStageThree.get(): - stage_three = LifePercentageStageThree.get() - if stage_three > Life or stage_three == Life: - self.SendToClient.Press(LifeHotkeyStageThree.get()) - print("Pressed ", LifeHotkeyStageThree.get()) - time.sleep(.15) - else: - print("Module Not Configured") - time.sleep(1) - - VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool('CheckPrint') - VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool('CheckBuff') - - LifeCheckStageOne, InitiatedLifeCheckStageOne = self.Setter.Variables.Bool('LifeCheckStageOne') - LifeCheckStageTwo, InitiatedLifeCheckStageTwo = self.Setter.Variables.Bool('LifeCheckStageTwo') - LifeCheckStageThree, InitiatedLifeCheckStageThree = self.Setter.Variables.Bool('LifeCheckStageThree') - - VarCheckCureStats, InitiatedCheckCureStats = self.Setter.Variables.Bool('CheckCureStats') - - VarCheckParalyze, InitiatedCheckParalyze = self.Setter.Variables.Bool('CheckParalyze') - VarCheckPoison, InitiatedCheckPoison = self.Setter.Variables.Bool('CheckPoison') - VarCheckFire, InitiatedCheckFire = self.Setter.Variables.Bool('CheckFire') - VarCheckElectrify, InitiatedCheckElectrify = self.Setter.Variables.Bool('CheckElectrify') - VarCheckMort, InitiatedCheckMort = self.Setter.Variables.Bool('CheckMort') - VarCheckBlood, InitiatedCheckBlood = self.Setter.Variables.Bool('CheckBlood') - - LifePercentageStageOne, InitiatedLifePercentageStageOne = self.Setter.Variables.Int('LifePercentageStageOne') - LifeHotkeyStageOne, InitiatedLifeHotkeyStageOne = self.Setter.Variables.Str('LifeHotkeyStageOne') - - LifePercentageStageTwo, InitiatedLifePercentageStageTwo = self.Setter.Variables.Int('LifePercentageStageTwo') - LifeHotkeyStageTwo, InitiatedLifeHotkeyStageTwo = self.Setter.Variables.Str('LifeHotkeyStageTwo') - - LifePercentageStageThree, InitiatedLifePercentageStageThree = self.Setter.Variables.Int('LifePercentageStageThree') - LifeHotkeyStageThree, InitiatedLifeHotkeyStageThree = self.Setter.Variables.Str('LifeHotkeyStageThree') + from modules.Root import Life, Mana + for StageChecked, StagePercentage, StageType, StageHotkey in Stages: + if StageChecked.get() and StagePercentage.get() >= locals()[StageType.get()]: + self.SendToClient.Press(StageHotkey.get()) + print( + f'{StageType.get()} is less than {StagePercentage.get()}.') + print(f"Pressed {StageHotkey.get()}") + sleep(.7) + break + + VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool( + 'CheckPrint') + VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool( + 'CheckBuff') + + LifeCheckStageOne, InitiatedLifeCheckStageOne = self.Setter.Variables.Bool( + 'LifeCheckStageOne') + LifeCheckStageTwo, InitiatedLifeCheckStageTwo = self.Setter.Variables.Bool( + 'LifeCheckStageTwo') + LifeCheckStageThree, InitiatedLifeCheckStageThree = self.Setter.Variables.Bool( + 'LifeCheckStageThree') + LifeCheckStageFour, InitiatedLifeCheckStageFour = self.Setter.Variables.Bool( + 'LifeCheckStageFour') + LifeCheckStageFive, InitiatedLifeCheckStageFive = self.Setter.Variables.Bool( + 'LifeCheckStageFive') + LifeCheckStageSix, InitiatedLifeCheckStageSix = self.Setter.Variables.Bool( + 'LifeCheckStageSix') + + VarCheckCureStats, InitiatedCheckCureStats = self.Setter.Variables.Bool( + 'CheckCureStats') + + VarCheckParalyze, InitiatedCheckParalyze = self.Setter.Variables.Bool( + 'CheckParalyze') + VarCheckPoison, InitiatedCheckPoison = self.Setter.Variables.Bool( + 'CheckPoison') + VarCheckFire, InitiatedCheckFire = self.Setter.Variables.Bool( + 'CheckFire') + VarCheckElectrify, InitiatedCheckElectrify = self.Setter.Variables.Bool( + 'CheckElectrify') + VarCheckMort, InitiatedCheckMort = self.Setter.Variables.Bool( + 'CheckMort') + VarCheckBlood, InitiatedCheckBlood = self.Setter.Variables.Bool( + 'CheckBlood') + + LifePercentageStageOne, InitiatedLifePercentageStageOne = self.Setter.Variables.Int( + 'LifePercentageStageOne') + LifeHotkeyStageOne, InitiatedLifeHotkeyStageOne = self.Setter.Variables.Str( + 'LifeHotkeyStageOne') + TypeStageOne, InitiatedTypeStageOne = self.Setter.Variables.Str( + 'TypeStageOne') + + LifePercentageStageTwo, InitiatedLifePercentageStageTwo = self.Setter.Variables.Int( + 'LifePercentageStageTwo') + LifeHotkeyStageTwo, InitiatedLifeHotkeyStageTwo = self.Setter.Variables.Str( + 'LifeHotkeyStageTwo') + TypeStageTwo, InitiatedTypeStageTwo = self.Setter.Variables.Str( + 'TypeStageTwo') + + LifePercentageStageThree, InitiatedLifePercentageStageThree = self.Setter.Variables.Int( + 'LifePercentageStageThree') + LifeHotkeyStageThree, InitiatedLifeHotkeyStageThree = self.Setter.Variables.Str( + 'LifeHotkeyStageThree') + TypeStageThree, InitiatedTypeStageThree = self.Setter.Variables.Str( + 'TypeStageThree') + + LifePercentageStageFour, InitiatedLifePercentageStageFour = self.Setter.Variables.Int( + 'LifePercentageStageFour') + LifeHotkeyStageFour, InitiatedLifeHotkeyStageFour = self.Setter.Variables.Str( + 'LifeHotkeyStageFour') + TypeStageFour, InitiatedTypeStageFour = self.Setter.Variables.Str( + 'TypeStageFour') + + LifePercentageStageFive, InitiatedLifePercentageStageFive = self.Setter.Variables.Int( + 'LifePercentageStageFive') + LifeHotkeyStageFive, InitiatedLifeHotkeyStageFive = self.Setter.Variables.Str( + 'LifeHotkeyStageFive') + TypeStageFive, InitiatedTypeStageFive = self.Setter.Variables.Str( + 'TypeStageFive') + + LifePercentageStageSix, InitiatedLifePercentageStageSix = self.Setter.Variables.Int( + 'LifePercentageStageSix') + LifeHotkeyStageSix, InitiatedLifeHotkeyStageSix = self.Setter.Variables.Str( + 'LifeHotkeyStageSix') + TypeStageSix, InitiatedTypeStageSix = self.Setter.Variables.Str( + 'TypeStageSix') + + global Stages + Stages = [ + ( + LifeCheckStageOne, + LifePercentageStageOne, + TypeStageOne, + LifeHotkeyStageOne + ), + ( + LifeCheckStageTwo, + LifePercentageStageTwo, + TypeStageTwo, + LifeHotkeyStageTwo + ), + ( + LifeCheckStageThree, + LifePercentageStageThree, + TypeStageThree, + LifeHotkeyStageThree + ), + ( + LifeCheckStageFour, + LifePercentageStageFour, + TypeStageFour, + LifeHotkeyStageFour + ), + ( + LifeCheckStageFive, + LifePercentageStageFive, + TypeStageFive, + LifeHotkeyStageFive + ), + ( + LifeCheckStageSix, + LifePercentageStageSix, + TypeStageSix, + LifeHotkeyStageSix + ), + + ] for i in range(len(Stats)): ImageStatus = Image.open('images/Stats/' + Stats[i] + '.webp') @@ -168,83 +188,199 @@ def CheckingGUI(Init, Get, Name): def Destroy(): CheckingGUI(InitiatedCheckPrint, VarCheckPrint.get(), 'CheckPrint') CheckingGUI(InitiatedCheckBuff, VarCheckBuff.get(), 'CheckBuff') - CheckingGUI(InitiatedLifeCheckStageOne, LifeCheckStageOne.get(), 'LifeCheckStageOne') - CheckingGUI(InitiatedLifeCheckStageTwo, LifeCheckStageTwo.get(), 'LifeCheckStageTwo') - CheckingGUI(InitiatedLifeCheckStageThree, LifeCheckStageThree.get(), 'LifeCheckStageThree') - CheckingGUI(InitiatedCheckCureStats, VarCheckCureStats.get(), 'CheckCureStats') - CheckingGUI(InitiatedCheckParalyze, VarCheckParalyze.get(), 'CheckParalyze') - CheckingGUI(InitiatedCheckPoison, VarCheckPoison.get(), 'CheckPoison') + CheckingGUI(InitiatedLifeCheckStageOne, + LifeCheckStageOne.get(), 'LifeCheckStageOne') + CheckingGUI(InitiatedLifeCheckStageTwo, + LifeCheckStageTwo.get(), 'LifeCheckStageTwo') + CheckingGUI(InitiatedLifeCheckStageThree, + LifeCheckStageThree.get(), 'LifeCheckStageThree') + CheckingGUI(InitiatedLifeCheckStageFour, + LifeCheckStageFour.get(), 'LifeCheckStageFour') + CheckingGUI(InitiatedLifeCheckStageFive, + LifeCheckStageFive.get(), 'LifeCheckStageFive') + CheckingGUI(InitiatedLifeCheckStageSix, + LifeCheckStageSix.get(), 'LifeCheckStageSix') + CheckingGUI(InitiatedCheckCureStats, + VarCheckCureStats.get(), 'CheckCureStats') + CheckingGUI(InitiatedCheckParalyze, + VarCheckParalyze.get(), 'CheckParalyze') + CheckingGUI(InitiatedCheckPoison, + VarCheckPoison.get(), 'CheckPoison') CheckingGUI(InitiatedCheckFire, VarCheckFire.get(), 'CheckFire') - CheckingGUI(InitiatedCheckElectrify, VarCheckElectrify.get(), 'CheckElectrify') + CheckingGUI(InitiatedCheckElectrify, + VarCheckElectrify.get(), 'CheckElectrify') CheckingGUI(InitiatedCheckMort, VarCheckMort.get(), 'CheckMort') CheckingGUI(InitiatedCheckBlood, VarCheckBlood.get(), 'CheckBlood') - CheckingGUI(InitiatedLifePercentageStageOne, LifePercentageStageOne.get(), 'LifePercentageStageOne') - CheckingGUI(InitiatedLifeHotkeyStageOne, LifeHotkeyStageOne.get(), 'LifeHotkeyStageOne') - CheckingGUI(InitiatedLifePercentageStageTwo, LifePercentageStageTwo.get(), 'LifePercentageStageTwo') - CheckingGUI(InitiatedLifeHotkeyStageTwo, LifeHotkeyStageTwo.get(), 'LifeHotkeyStageTwo') - CheckingGUI(InitiatedLifePercentageStageThree, LifePercentageStageThree.get(), 'LifePercentageStageThree') - CheckingGUI(InitiatedLifeHotkeyStageThree, LifeHotkeyStageThree.get(), 'LifeHotkeyStageThree') + CheckingGUI(InitiatedLifePercentageStageOne, + LifePercentageStageOne.get(), 'LifePercentageStageOne') + CheckingGUI(InitiatedLifeHotkeyStageOne, + LifeHotkeyStageOne.get(), 'LifeHotkeyStageOne') + CheckingGUI(InitiatedTypeStageOne, + TypeStageOne.get(), 'TypeStageOne') + CheckingGUI(InitiatedLifePercentageStageTwo, + LifePercentageStageTwo.get(), 'LifePercentageStageTwo') + CheckingGUI(InitiatedLifeHotkeyStageTwo, + LifeHotkeyStageTwo.get(), 'LifeHotkeyStageTwo') + CheckingGUI(InitiatedTypeStageTwo, + TypeStageTwo.get(), 'TypeStageTwo') + CheckingGUI(InitiatedLifePercentageStageThree, + LifePercentageStageThree.get(), 'LifePercentageStageThree') + CheckingGUI(InitiatedLifeHotkeyStageThree, + LifeHotkeyStageThree.get(), 'LifeHotkeyStageThree') + CheckingGUI(InitiatedTypeStageThree, + TypeStageThree.get(), 'TypeStageThree') + CheckingGUI(InitiatedLifePercentageStageFour, + LifePercentageStageFour.get(), 'LifePercentageStageFour') + CheckingGUI(InitiatedLifeHotkeyStageFour, + LifeHotkeyStageFour.get(), 'LifeHotkeyStageFour') + CheckingGUI(InitiatedTypeStageFour, + TypeStageFour.get(), 'TypeStageFour') + CheckingGUI(InitiatedLifePercentageStageFive, + LifePercentageStageFive.get(), 'LifePercentageStageFive') + CheckingGUI(InitiatedLifeHotkeyStageFive, + LifeHotkeyStageFive.get(), 'LifeHotkeyStageFive') + CheckingGUI(InitiatedTypeStageFive, + TypeStageFive.get(), 'TypeStageFive') + CheckingGUI(InitiatedLifePercentageStageSix, + LifePercentageStageSix.get(), 'LifePercentageStageSix') + CheckingGUI(InitiatedLifeHotkeyStageSix, + LifeHotkeyStageSix.get(), 'LifeHotkeyStageSix') + CheckingGUI(InitiatedTypeStageSix, + TypeStageSix.get(), 'TypeStageSix') if len(GUIChanges) != 0: for EachChange in range(len(GUIChanges)): - self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1]) + self.Setter.SetVariables.SetVar( + GUIChanges[EachChange][0], GUIChanges[EachChange][1]) self.AutoHeal.destroyWindow() - self.AutoHeal.addButton('Ok', Destroy, [73, 21], [115, 340]) + self.AutoHeal.addButton('OK', Destroy, [75, 23], [196, 480]) - ''' button enable healing ''' + ''' Button enable auto healing ''' global EnabledAutoHeal if not EnabledAutoHeal: - ButtonEnabled = self.AutoHeal.addButton('AutoHealing: OFF', SetAutoHeal, [287, 23], [11, 311]) + ButtonEnabled = self.AutoHeal.addButton( + 'AutoHealing: OFF', ToggleState, [287, 23], [91, 452]) else: - ButtonEnabled = self.AutoHeal.addButton('AutoHealing: ON', SetAutoHeal, [287, 23], [11, 311]) + ButtonEnabled = self.AutoHeal.addButton( + 'AutoHealing: ON', ToggleState, [287, 23], [91, 452]) ButtonEnabled.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - CheckPrint = self.AutoHeal.addCheck(VarCheckPrint, [11, 260], InitiatedCheckPrint, "Print on Tibia's screen") - CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - CheckBuff = self.AutoHeal.addCheck(VarCheckBuff, [11, 280], InitiatedCheckBuff, "Don't Buff") - CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - - LabelPercentage = self.AutoHeal.addLabel('% Percentage', [145, 24]) - LabelHotkey = self.AutoHeal.addLabel('HotKey', [230, 24]) - - StageOne = self.AutoHeal.addCheck(LifeCheckStageOne, [17, 55], InitiatedLifeCheckStageOne, "Enable Stage One") - StageTwo = self.AutoHeal.addCheck(LifeCheckStageTwo, [17, 105], InitiatedLifeCheckStageTwo, "Enable Stage Two") - StageThree = self.AutoHeal.addCheck(LifeCheckStageThree, [17, 155], InitiatedLifeCheckStageThree, "Enable Stage Three") - CheckStats = self.AutoHeal.addCheck(VarCheckCureStats, [95, 192], InitiatedCheckCureStats, "Enable Cure Stats") - - Paralyze = self.AutoHeal.addCheck(VarCheckParalyze, [40, 226], InitiatedCheckParalyze, '', ImageStats[0]) - Poison = self.AutoHeal.addCheck(VarCheckPoison, [80, 226], InitiatedCheckPoison, '', ImageStats[1]) - Fire = self.AutoHeal.addCheck(VarCheckFire, [120, 226], InitiatedCheckFire, '', ImageStats[2]) - Electrify = self.AutoHeal.addCheck(VarCheckElectrify, [160, 226], InitiatedCheckElectrify, '', ImageStats[3]) - Mort = self.AutoHeal.addCheck(VarCheckMort, [200, 226], InitiatedCheckMort, '', ImageStats[4]) - Blood = self.AutoHeal.addCheck(VarCheckBlood, [240, 226], InitiatedCheckBlood, '', ImageStats[5]) - - PercentageStageOne = self.AutoHeal.addOption(LifePercentageStageOne, Percentage, [148, 54]) - HotkeyStageOne = self.AutoHeal.addOption(LifeHotkeyStageOne, self.SendToClient.Hotkeys, [223, 54]) - - PercentageStageTwo = self.AutoHeal.addOption(LifePercentageStageTwo, Percentage, [148, 104]) - HotkeyStageTwo = self.AutoHeal.addOption(LifeHotkeyStageTwo, self.SendToClient.Hotkeys, [223, 104]) - - PercentageStageThree = self.AutoHeal.addOption(LifePercentageStageThree, Percentage, [148, 154]) - HotkeyStageThree = self.AutoHeal.addOption(LifeHotkeyStageThree, self.SendToClient.Hotkeys, [223, 154]) + CheckPrint = self.AutoHeal.addCheck( + VarCheckPrint, [11, 402], InitiatedCheckPrint, "Print on Tibia's screen") + CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckBuff = self.AutoHeal.addCheck( + VarCheckBuff, [11, 422], InitiatedCheckBuff, "Don't Buff") + CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) + + LabelType = self.AutoHeal.addLabel('Type', [144, 24]) + LabelPercentage = self.AutoHeal.addLabel('% Perc.', [228, 24]) + LabelHotkey = self.AutoHeal.addLabel('Hotkey', [312, 24]) + + StageOne = self.AutoHeal.addCheck( + LifeCheckStageOne, [17, 55], InitiatedLifeCheckStageOne, "Enable Stage One") + StageTwo = self.AutoHeal.addCheck( + LifeCheckStageTwo, [17, 105], InitiatedLifeCheckStageTwo, "Enable Stage Two") + StageThree = self.AutoHeal.addCheck(LifeCheckStageThree, [ + 17, 155], InitiatedLifeCheckStageThree, "Enable Stage Three") + StageFour = self.AutoHeal.addCheck( + LifeCheckStageFour, [17, 205], InitiatedLifeCheckStageFour, "Enable Stage Four") + StageFive = self.AutoHeal.addCheck( + LifeCheckStageFive, [17, 255], InitiatedLifeCheckStageFive, "Enable Stage Five") + StageSix = self.AutoHeal.addCheck( + LifeCheckStageSix, [17, 305], InitiatedLifeCheckStageSix, "Enable Stage Six") + CheckStats = self.AutoHeal.addCheck( + VarCheckCureStats, [170, 339], InitiatedCheckCureStats, "Enable Cure Stats") + + Paralyze = self.AutoHeal.addCheck( + VarCheckParalyze, [114, 364], InitiatedCheckParalyze, '', ImageStats[0]) + Poison = self.AutoHeal.addCheck( + VarCheckPoison, [155, 364], InitiatedCheckPoison, '', ImageStats[1]) + Fire = self.AutoHeal.addCheck( + VarCheckFire, [195, 364], InitiatedCheckFire, '', ImageStats[2]) + Electrify = self.AutoHeal.addCheck( + VarCheckElectrify, [235, 364], InitiatedCheckElectrify, '', ImageStats[3]) + Mort = self.AutoHeal.addCheck( + VarCheckMort, [275, 364], InitiatedCheckMort, '', ImageStats[4]) + Blood = self.AutoHeal.addCheck( + VarCheckBlood, [315, 364], InitiatedCheckBlood, '', ImageStats[5]) + + TypeStageOneOption = self.AutoHeal.addOption( + TypeStageOne, HealingType, [148, 54], width=6) + PercentageStageOneOption = self.AutoHeal.addOption( + LifePercentageStageOne, Percentage, [232, 54], width=6) + HotkeyStageOneOption = self.AutoHeal.addOption( + LifeHotkeyStageOne, self.SendToClient.Hotkeys, [316, 54], width=6) + + TypeStageTwoOption = self.AutoHeal.addOption( + TypeStageTwo, HealingType, [148, 104], width=6) + PercentageStageTwoOption = self.AutoHeal.addOption( + LifePercentageStageTwo, Percentage, [232, 104], width=6) + HotkeyStageTwoOption = self.AutoHeal.addOption( + LifeHotkeyStageTwo, self.SendToClient.Hotkeys, [316, 104], width=6) + + TypeStageThreeOption = self.AutoHeal.addOption( + TypeStageThree, HealingType, [148, 154], width=6) + PercentageStageThreeOption = self.AutoHeal.addOption( + LifePercentageStageThree, Percentage, [232, 154], width=6) + HotkeyStageThreeOption = self.AutoHeal.addOption( + LifeHotkeyStageThree, self.SendToClient.Hotkeys, [316, 154], width=6) + + TypeStageFourOption = self.AutoHeal.addOption( + TypeStageFour, HealingType, [148, 204], width=6) + PercentageStageFourOption = self.AutoHeal.addOption( + LifePercentageStageFour, Percentage, [232, 204], width=6) + HotkeyStageFourOption = self.AutoHeal.addOption( + LifeHotkeyStageFour, self.SendToClient.Hotkeys, [316, 204], width=6) + + TypeStageFiveOption = self.AutoHeal.addOption( + TypeStageFive, HealingType, [148, 254], width=6) + PercentageStageFiveOption = self.AutoHeal.addOption( + LifePercentageStageFive, Percentage, [232, 254], width=6) + HotkeyStageFiveOption = self.AutoHeal.addOption( + LifeHotkeyStageFive, self.SendToClient.Hotkeys, [316, 254], width=6) + + TypeStageSixOption = self.AutoHeal.addOption( + TypeStageSix, HealingType, [148, 304], width=6) + PercentageStageSixOption = self.AutoHeal.addOption( + LifePercentageStageSix, Percentage, [232, 304], width=6) + HotkeyStageSixOption = self.AutoHeal.addOption( + LifeHotkeyStageSix, self.SendToClient.Hotkeys, [316, 304], width=6) def CheckingButtons(): if EnabledAutoHeal: Disable(CheckStats) + Disable(StageSix) + Disable(StageFive) + Disable(StageFour) Disable(StageThree) Disable(StageTwo) Disable(StageOne) Disable(LabelHotkey) Disable(LabelPercentage) - Disable(PercentageStageOne) - Disable(HotkeyStageOne) - Disable(PercentageStageTwo) - Disable(HotkeyStageTwo) - Disable(PercentageStageThree) - Disable(HotkeyStageThree) + Disable(LabelType) + Disable(TypeStageOneOption) + Disable(PercentageStageOneOption) + Disable(HotkeyStageOneOption) + Disable(TypeStageTwoOption) + Disable(PercentageStageTwoOption) + Disable(HotkeyStageTwoOption) + Disable(TypeStageThreeOption) + Disable(PercentageStageThreeOption) + Disable(HotkeyStageThreeOption) + Disable(TypeStageFourOption) + Disable(PercentageStageFourOption) + Disable(HotkeyStageFourOption) + Disable(TypeStageFiveOption) + Disable(PercentageStageFiveOption) + Disable(HotkeyStageFiveOption) + Disable(TypeStageSixOption) + Disable(PercentageStageSixOption) + Disable(HotkeyStageSixOption) Disable(Paralyze) Disable(Poison) Disable(Fire) @@ -255,17 +391,33 @@ def CheckingButtons(): Disable(CheckBuff) else: Enable(CheckStats) + Enable(StageSix) + Enable(StageFive) + Enable(StageFour) Enable(StageThree) Enable(StageTwo) Enable(StageOne) Enable(LabelHotkey) Enable(LabelPercentage) - Enable(PercentageStageOne) - Enable(HotkeyStageOne) - Enable(PercentageStageTwo) - Enable(HotkeyStageTwo) - Enable(PercentageStageThree) - Enable(HotkeyStageThree) + Enable(LabelType) + Enable(TypeStageOneOption) + Enable(PercentageStageOneOption) + Enable(HotkeyStageOneOption) + Enable(TypeStageTwoOption) + Enable(PercentageStageTwoOption) + Enable(HotkeyStageTwoOption) + Enable(TypeStageThreeOption) + Enable(PercentageStageThreeOption) + Enable(HotkeyStageThreeOption) + Enable(TypeStageFourOption) + Enable(PercentageStageFourOption) + Enable(HotkeyStageFourOption) + Enable(TypeStageFiveOption) + Enable(PercentageStageFiveOption) + Enable(HotkeyStageFiveOption) + Enable(TypeStageSixOption) + Enable(PercentageStageSixOption) + Enable(HotkeyStageSixOption) Enable(CheckPrint) Enable(CheckBuff) if not VarCheckCureStats.get(): diff --git a/modules/AutoHur.py b/modules/AutoHur.py index ee49b32..845f53e 100644 --- a/modules/AutoHur.py +++ b/modules/AutoHur.py @@ -1,4 +1,9 @@ import time +from datetime import datetime +from tkinter import RAISED, SUNKEN + +from pynput.keyboard import Listener as KeyboardListener +from conf.Constants import Percentage from conf.Hotkeys import Hotkey @@ -7,93 +12,122 @@ from core.GUISetter import GUISetter from core.ThreadManager import ThreadManager -from engine.ScanHur import ScanHur +from engine.Scanners.ScanHur import ScanHur EnabledAutoHur = False - ThreadStarted = False GUIChanges = [] class AutoHur: - def __init__(self, StatsPositions, MOUSE_OPTION): + def __init__(self, StatsPositions, SetScanningHPMP, MOUSE_OPTION): self.AutoHur = GUI('AutoHur', 'Module: Auto Hur') - self.AutoHur.DefaultWindow('AutoHur', [224, 258], [1.2, 2.29]) self.Setter = GUISetter("HurLoader") self.SendToClient = Hotkey(MOUSE_OPTION) self.ThreadManager = ThreadManager("ThreadAutoHur") + self.OtherThreadManager = ThreadManager("OtherThread") + self.AutoHur.DefaultWindow( + 'AutoHur', [224, 278], [1.2, 2.29]) - def SetAutoHur(): + def ToggleState(): global EnabledAutoHur if not EnabledAutoHur: EnabledAutoHur = True - ButtonEnabled.configure(text='AutoHur: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonEnabled.configure( + text='AutoHur: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) print("AutoHur: ON") CheckingButtons() - if not ThreadStarted: - self.ThreadManager.NewThread(ScanAutoHur) - else: - self.ThreadManager.UnPauseThread() + SetScanningHPMP('AutoHur', 'on') + self.ThreadManager.NewThread(Scan) else: EnabledAutoHur = False CheckingButtons() print("AutoHur: OFF") - ButtonEnabled.configure(text='AutoHur: OFF', relief=RAISED, bg=rgb((127, 17, 8))) - self.ThreadManager.PauseThread() + ButtonEnabled.configure( + text='AutoHur: OFF', relief=RAISED, bg=rgb((127, 17, 8))) + SetScanningHPMP('AutoHur', 'off') + self.ThreadManager.StopThread() - def ScanAutoHur(): + def Scan(): while EnabledAutoHur: - try: - NeedHur = ScanHur(StatsPositions) - except Exception: - NeedHur = False - pass + from modules.Root import Mana + + NeedHur = ScanHur( + StatsPositions, VarCheckPZ.get(), CheckLowMana.get(), Mana, ManaLessThan.get()) + if NeedHur: self.SendToClient.Press(VarHotkeyHur.get()) print("Hur Pressed ", VarHotkeyHur.get()) - time.sleep(.3) - time.sleep(.3) + time.sleep(3) def Recapture(): print("recapture") - VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool('CheckPrint') - VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool('CheckBuff') + VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool( + 'CheckPrint') + VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool( + 'CheckBuff') + VarCheckPZ, InitiatedCheckPZ = self.Setter.Variables.Bool( + 'CheckPZ') - VarHotkeyHur, InitiatedHotkeyHur = self.Setter.Variables.Str('HotkeyHur') + VarHotkeyHur, InitiatedHotkeyHur = self.Setter.Variables.Str( + 'HotkeyHur') - CheckLowMana, InitiatedCheckLowMana = self.Setter.Variables.Bool('CheckLowMana') + CheckLowMana, InitiatedCheckLowMana = self.Setter.Variables.Bool( + 'CheckLowMana') + + ManaLessThan, InitiatedManaLessThan = self.Setter.Variables.Int( + 'ManaLessThan') def CheckingGUI(Init, Get, Name): if Get != Init: GUIChanges.append((Name, Get)) def Destroy(): - CheckingGUI(InitiatedCheckPrint, VarCheckPrint.get(), 'CheckPrint') - CheckingGUI(InitiatedCheckBuff, VarCheckBuff.get(), 'CheckBuff') - CheckingGUI(InitiatedHotkeyHur, VarHotkeyHur.get(), 'HotkeyHur') - CheckingGUI(InitiatedCheckLowMana, CheckLowMana.get(), 'CheckLowMana') + CheckingGUI(InitiatedCheckPrint, + VarCheckPrint.get(), 'CheckPrint') + CheckingGUI(InitiatedCheckBuff, + VarCheckBuff.get(), 'CheckBuff') + CheckingGUI(InitiatedCheckPZ, VarCheckPZ.get(), 'CheckPZ') + CheckingGUI(InitiatedHotkeyHur, + VarHotkeyHur.get(), 'HotkeyHur') + CheckingGUI(InitiatedCheckLowMana, + CheckLowMana.get(), 'CheckLowMana') + CheckingGUI(InitiatedManaLessThan, + ManaLessThan.get(), 'ManaLessThan') if len(GUIChanges) != 0: for EachChange in range(len(GUIChanges)): - self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1]) + self.Setter.SetVariables.SetVar( + GUIChanges[EachChange][0], GUIChanges[EachChange][1]) self.AutoHur.destroyWindow() - self.AutoHur.addButton('Ok', Destroy, [73, 21], [75, 225]) + self.AutoHur.addButton('OK', Destroy, [74, 23], [75, 245]) global EnabledAutoHur if not EnabledAutoHur: - ButtonEnabled = self.AutoHur.addButton('AutoHur: OFF', SetAutoHur, [203, 23], [11, 195]) + ButtonEnabled = self.AutoHur.addButton( + 'AutoHur: OFF', ToggleState, [203, 24], [11, 215]) else: - ButtonEnabled = self.AutoHur.addButton('AutoHur: ON', SetAutoHur, [203, 23], [11, 195]) - ButtonEnabled.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - - CheckPrint = self.AutoHur.addCheck(VarCheckPrint, [11, 150], InitiatedCheckPrint, "Print on Tibia's screen") - CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - CheckBuff = self.AutoHur.addCheck(VarCheckBuff, [11, 170], InitiatedCheckBuff, "Don't Buff") - CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) + ButtonEnabled = self.AutoHur.addButton( + 'AutoHur: ON', ToggleState, [203, 24], [11, 215]) + ButtonEnabled.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) + + CheckPrint = self.AutoHur.addCheck( + VarCheckPrint, [11, 150], InitiatedCheckPrint, "Print on Tibia's screen") + CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckBuff = self.AutoHur.addCheck( + VarCheckBuff, [11, 170], InitiatedCheckBuff, "Don't Buff") + CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckPZ = self.AutoHur.addCheck( + VarCheckPZ, [11, 190], InitiatedCheckPZ, "Hur only outside PZ") + CheckPZ.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) ImgHur = 'images/PlayerStats/Hur.png' ImageID = self.AutoHur.openImage(ImgHur, [64, 64]) @@ -101,34 +135,44 @@ def Destroy(): ImgLabel = self.AutoHur.addLabel('Image To Search', [16, 14]) LabelImage = self.AutoHur.addImage(ImageID, [28, 33]) - LabelHotkey = self.AutoHur.addLabel('Hotkey', [135, 48]) - HotkeyHur = self.AutoHur.addOption(VarHotkeyHur, self.SendToClient.Hotkeys, [113, 72], 8) + LabelHotkey = self.AutoHur.addLabel('Hotkey', [135, 14]) + HotkeyHur = self.AutoHur.addOption( + VarHotkeyHur, self.SendToClient.Hotkeys, [113, 34], 8) - ButtonRecapture = self.AutoHur.addButton('Recapture', Recapture, [85, 24], [20, 111]) + ButtonRecapture = self.AutoHur.addButton( + 'Recapture', Recapture, [85, 24], [20, 111]) - CheckBoxLowMana = self.AutoHur.addCheck(CheckLowMana, [118, 103], InitiatedCheckLowMana, 'Stop With\nLowMana') + CheckBoxLowMana = self.AutoHur.addCheck( + CheckLowMana, [108, 60], InitiatedCheckLowMana, 'Stop when\nMana is less\nthan (%)') + + OptionManaLessThan = self.AutoHur.addOption( + ManaLessThan, Percentage, [128, 110]) def CheckingButtons(): if EnabledAutoHur: Disable(CheckPrint) Disable(CheckBuff) + Disable(CheckPZ) Disable(LabelImage) Disable(ImgLabel) Disable(ButtonRecapture) Disable(CheckBoxLowMana) + Disable(OptionManaLessThan) Disable(LabelHotkey) Disable(HotkeyHur) else: Enable(CheckPrint) Enable(CheckBuff) + Enable(CheckPZ) Enable(LabelImage) Enable(ImgLabel) Enable(ButtonRecapture) Enable(CheckBoxLowMana) + Enable(OptionManaLessThan) Enable(LabelHotkey) Enable(HotkeyHur) ExecGUITrigger() @@ -137,4 +181,3 @@ def CheckingButtons(): self.AutoHur.Protocol(Destroy) self.AutoHur.loop() - diff --git a/modules/AutoMana.py b/modules/AutoMana.py deleted file mode 100644 index e46ad32..0000000 --- a/modules/AutoMana.py +++ /dev/null @@ -1,157 +0,0 @@ -import time - -from conf.Hotkeys import Hotkey -from conf.Constants import ManaColor, ManaColorFull, Percentage - -from core.GUI import * -from core.GUIManager import * -from core.GUISetter import GUISetter -from core.ThreadManager import ThreadManager - -from engine.ScanStages import ScanStages - -EnabledAutoMana = False -ThreadStarted = False - -GUIChanges = [] - - -class AutoMana: - def __init__(self, ManaLocation, MOUSE_OPTION): - self.AutoMana = GUI('AutoMana', 'Module: Auto Mana') - self.AutoMana.DefaultWindow('AutoMana', [306, 272], [1.2, 2.29]) - self.Setter = GUISetter("ManaLoader") - self.SendToClient = Hotkey(MOUSE_OPTION) - self.Scan = ScanStages('Mana') - self.ThreadManager = ThreadManager("ThreadAutoMana") - - def SetAutoMana(): - global EnabledAutoMana - if not EnabledAutoMana: - ButtonEnabled.configure(text='AutoMana: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) - print("AutoMana: ON") - EnabledAutoMana = True - CheckingButtons() - if not ThreadStarted: - self.ThreadManager.NewThread(ScanAutoMana) - else: - self.ThreadManager.UnPauseThread() - else: - print("AutoMana: OFF") - EnabledAutoMana = False - CheckingButtons() - ButtonEnabled.configure(text='AutoMana: OFF', relief=RAISED, bg=rgb((127, 17, 8))) - self.ThreadManager.PauseThread() - - def ScanAutoMana(): - while EnabledAutoMana: - Mana = self.Scan.ScanStages(ManaLocation, ManaColor, ManaColorFull) - - if Mana is None: - Mana = 0 - - if ManaCheckStageTwo.get(): - stage_two = ManaPercentageStageTwo.get() - if stage_two > Mana or stage_two == Mana: - self.SendToClient.Press(ManaHotkeyStageTwo.get()) - print("Pressed ", ManaHotkeyStageTwo.get()) - time.sleep(.1) - elif ManaCheckStageOne.get(): - stage_one = ManaPercentageStageOne.get() - if stage_one > Mana or stage_one == Mana: - self.SendToClient.Press(ManaHotkeyStageOne.get()) - print("Pressed ", ManaHotkeyStageOne.get()) - time.sleep(.1) - else: - print("Modulo Not Configured") - time.sleep(1) - - VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool('CheckPrint') - VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool('CheckBuff') - - ManaCheckStageOne, InitiatedManaCheckStageOne = self.Setter.Variables.Bool('ManaCheckStageOne') - ManaCheckStageTwo, InitiatedManaCheckStageTwo = self.Setter.Variables.Bool('ManaCheckStageTwo') - - ManaPercentageStageOne, InitiatedManaPercentageStageOne = self.Setter.Variables.Int('ManaPercentageStageOne') - ManaHotkeyStageOne, InitiatedManaHotkeyStageOne = self.Setter.Variables.Str('ManaHotkeyStageOne') - - ManaPercentageStageTwo, InitiatedManaPercentageStageTwo = self.Setter.Variables.Int('ManaPercentageStageTwo') - ManaHotkeyStageTwo, InitiatedManaHotkeyStageTwo = self.Setter.Variables.Str('ManaHotkeyStageTwo') - - def CheckingGUI(Init, Get, Name): - if Get != Init: - GUIChanges.append((Name, Get)) - - def Destroy(): - CheckingGUI(InitiatedCheckPrint, VarCheckPrint.get(), 'CheckPrint') - CheckingGUI(InitiatedCheckBuff, VarCheckBuff.get(), 'CheckBuff') - CheckingGUI(InitiatedManaCheckStageOne, ManaCheckStageOne.get(), 'ManaCheckStageOne') - CheckingGUI(InitiatedManaCheckStageTwo, ManaCheckStageTwo.get(), 'ManaCheckStageTwo') - CheckingGUI(InitiatedManaPercentageStageOne, ManaPercentageStageOne.get(), 'ManaPercentageStageOne') - CheckingGUI(InitiatedManaHotkeyStageOne, ManaHotkeyStageOne.get(), 'ManaHotkeyStageOne') - CheckingGUI(InitiatedManaPercentageStageTwo, ManaPercentageStageTwo.get(), 'ManaPercentageStageTwo') - CheckingGUI(InitiatedManaHotkeyStageTwo, ManaHotkeyStageTwo.get(), 'ManaHotkeyStageTwo') - - if len(GUIChanges) != 0: - for EachChange in range(len(GUIChanges)): - self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1]) - - self.AutoMana.destroyWindow() - - self.AutoMana.addButton('Ok', Destroy, [73, 21], [115, 240]) - - ''' button enable healing ''' - - global EnabledAutoMana - if not EnabledAutoMana: - ButtonEnabled = self.AutoMana.addButton('AutoMana: OFF', SetAutoMana, [287, 23], [11, 211]) - else: - ButtonEnabled = self.AutoMana.addButton('AutoMana: ON', SetAutoMana, [287, 23], [11, 211]) - ButtonEnabled.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - - LabelPercentage = self.AutoMana.addLabel('% Percentage', [145, 24]) - LabelHotkey = self.AutoMana.addLabel('HotKey', [230, 24]) - - CheckPrint = self.AutoMana.addCheck(VarCheckPrint, [11, 160], InitiatedCheckPrint, "Print on Tibia's screen") - CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - CheckBuff = self.AutoMana.addCheck(VarCheckBuff, [11, 180], InitiatedCheckBuff, "Don't Buff") - CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - - StageOne = self.AutoMana.addCheck(ManaCheckStageOne, [17, 55], InitiatedManaCheckStageOne, "Enable Stage One") - StageTwo = self.AutoMana.addCheck(ManaCheckStageTwo, [17, 105], InitiatedManaCheckStageTwo, "Enable Stage Two") - - PercentageStageOne = self.AutoMana.addOption(ManaPercentageStageOne, Percentage, [148, 54]) - HotkeyStageOne = self.AutoMana.addOption(ManaHotkeyStageOne, self.SendToClient.Hotkeys, [223, 54]) - - PercentageStageTwo = self.AutoMana.addOption(ManaPercentageStageTwo, Percentage, [148, 104]) - HotkeyStageTwo = self.AutoMana.addOption(ManaHotkeyStageTwo, self.SendToClient.Hotkeys, [223, 104]) - - def CheckingButtons(): - if EnabledAutoMana: - Disable(CheckPrint) - Disable(CheckBuff) - Disable(StageOne) - Disable(StageTwo) - Disable(PercentageStageOne) - Disable(HotkeyStageOne) - Disable(PercentageStageTwo) - Disable(HotkeyStageTwo) - Disable(LabelPercentage) - Disable(LabelHotkey) - else: - Enable(CheckPrint) - Enable(CheckBuff) - Enable(StageOne) - Enable(StageTwo) - Enable(PercentageStageOne) - Enable(HotkeyStageOne) - Enable(PercentageStageTwo) - Enable(HotkeyStageTwo) - Enable(LabelPercentage) - Enable(LabelHotkey) - ExecGUITrigger() - - CheckingButtons() - - self.AutoMana.Protocol(Destroy) - self.AutoMana.loop() diff --git a/modules/AutoRing.py b/modules/AutoRing.py index 1ac9fa6..8ce0ad2 100644 --- a/modules/AutoRing.py +++ b/modules/AutoRing.py @@ -1,4 +1,5 @@ import time +from tkinter import RAISED, SUNKEN import keyboard import pygetwindow @@ -10,7 +11,7 @@ from core.GUISetter import GUISetter from core.ThreadManager import ThreadManager -from engine.ScanRing import ScanRing +from engine.Scanners.ScanRing import ScanRing GUIChanges = [] @@ -33,30 +34,29 @@ def __init__(self, root, RingPositions, HealthLocation, MOUSE_OPTION, ItemsPath) self.SendToClient = Hotkey(MOUSE_OPTION) self.ThreadManager = ThreadManager("ThreadAutoRing") - def SetAutoRing(): + def ToggleState(): global EnabledAutoRing if not EnabledAutoRing: EnabledAutoRing = True - ButtonEnabled.configure(text='AutoRing: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonEnabled.configure( + text='AutoRing: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) print("AutoRing: ON") global Ring Ring = NameRing.get() Checking() CheckingButtons() time.sleep(0.03) - if not ThreadStarted: - self.ThreadManager.NewThread(ScanAutoRing) - else: - self.ThreadManager.UnPauseThread() + self.ThreadManager.NewThread(Scan) else: EnabledAutoRing = False print('AutoRing: OFF') - ButtonEnabled.configure(text='AutoRing: OFF', relief=RAISED, bg=rgb((127, 17, 8))) + ButtonEnabled.configure( + text='AutoRing: OFF', relief=RAISED, bg=rgb((127, 17, 8))) Checking() CheckingButtons() - self.ThreadManager.PauseThread() + self.ThreadManager.StopThread() - def ScanAutoRing(): + def Scan(): global Ring Ring = NameRing.get() if CheckLifeBellowThan.get(): @@ -66,13 +66,14 @@ def ScanAutoRing(): while EnabledAutoRing and EnabledAutoHeal: NoHasRing = ScanRing(RingPositions) - from Modules.AutoHeal import Life + from .Modules import Life if NoHasRing and Life <= BellowThan: Execute() else: - from engine.ScanStages import ScanStages + from engine.Scanners.ScanStages import ScanStages while EnabledAutoRing: - Life = ScanStages('Life From AutoRing').ScanStages(HealthLocation, LifeColor, LifeColorFull) + Life = ScanStages('Life From AutoRing').ScanStages( + HealthLocation, LifeColor, LifeColorFull) if Life is None: Life = 0 @@ -91,7 +92,8 @@ def ScanAutoRing(): def Execute(): if RadioButton.get() == 0: self.SendToClient.Press(HotkeyRing.get()) - print("Pressed ", HotkeyRing.get(), " To Reallocated Your Ring") + print("Pressed ", HotkeyRing.get(), + " To Reallocated Your Ring") time.sleep(1) elif RadioButton.get() == 1: try: @@ -110,10 +112,12 @@ def Execute(): else: MousePosition = [0, 0] - self.SendToClient.DragTo([X, Y], [RingPositions[0] + 16, RingPositions[1] + 16]) + self.SendToClient.DragTo( + [X, Y], [RingPositions[0] + 16, RingPositions[1] + 16]) if MOUSE_OPTION == 1: - self.SendToClient.MoveTo(MousePosition[0], MousePosition[1]) + self.SendToClient.MoveTo( + MousePosition[0], MousePosition[1]) print("Ring Reallocated On: X =", RingPositions[0] + 16, "Y =", RingPositions[1] + 16, "From: X =", @@ -127,7 +131,8 @@ def Recapture(): global WaitingForClick, Ring WaitingForClick = True Ring = NameRing.get() - AutoRingWindow = pygetwindow.getWindowsWithTitle("Module: Auto Ring")[0] + AutoRingWindow = pygetwindow.getWindowsWithTitle("Module: Auto Ring")[ + 0] TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0] AutoRingWindowX = self.AutoRing.PositionOfWindow('X') AutoRingWindowY = self.AutoRing.PositionOfWindow('Y') @@ -142,7 +147,8 @@ def Recapture(): sX, sY = GetPosition() time.sleep(0.03) from core.HookWindow import SaveImage - SaveImage(ItemsPath + 'Rings/' + Ring + '.png', Region=(sX - 6, sY - 28, sX + 6, sY - 16)) + SaveImage(ItemsPath + 'Rings/' + Ring + '.png', + Region=(sX - 6, sY - 28, sX + 6, sY - 16)) WaitingForClick = False Invisible.destroyWindow() TibiaAuto.maximize() @@ -163,7 +169,8 @@ def CheckClick(): def ReturnGetPosition(): global WaitingForClick WaitingForClick = True - AutoRingWindow = pygetwindow.getWindowsWithTitle("Module: Auto Ring")[0] + AutoRingWindow = pygetwindow.getWindowsWithTitle("Module: Auto Ring")[ + 0] TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0] AutoRingWindowX = self.AutoRing.PositionOfWindow('X') AutoRingWindowY = self.AutoRing.PositionOfWindow('Y') @@ -204,19 +211,27 @@ def ValidateEntryY(*args): else: TextEntryY.set(s[:MaxLen]) - VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool('CheckPrint') - VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool('CheckBuff') + VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool( + 'CheckPrint') + VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool( + 'CheckBuff') - RadioButton, InitiatedRadioButton = self.Setter.Variables.Int('RadioButton') + RadioButton, InitiatedRadioButton = self.Setter.Variables.Int( + 'RadioButton') NameRing, InitiatedNameRing = self.Setter.Variables.Str('NameRing') - HotkeyRing, InitiatedHotkeyRing = self.Setter.Variables.Str('HotkeyRing') + HotkeyRing, InitiatedHotkeyRing = self.Setter.Variables.Str( + 'HotkeyRing') - TextEntryX, InitiatedTextEntryX = self.Setter.Variables.Str('TextEntryX') - TextEntryY, InitiatedTextEntryY = self.Setter.Variables.Str('TextEntryY') + TextEntryX, InitiatedTextEntryX = self.Setter.Variables.Str( + 'TextEntryX') + TextEntryY, InitiatedTextEntryY = self.Setter.Variables.Str( + 'TextEntryY') - CheckLifeBellowThan, InitiatedLifeBellowThan = self.Setter.Variables.Bool('LifeBellowThan') - LifeBellowThan, InitiatedBellowThan = self.Setter.Variables.Int('BellowThan') + CheckLifeBellowThan, InitiatedLifeBellowThan = self.Setter.Variables.Bool( + 'LifeBellowThan') + LifeBellowThan, InitiatedBellowThan = self.Setter.Variables.Int( + 'BellowThan') def CheckingGUI(Init, Get, Name): if Get != Init: @@ -230,12 +245,15 @@ def Destroy(): CheckingGUI(InitiatedHotkeyRing, HotkeyRing.get(), 'HotkeyRing') CheckingGUI(InitiatedTextEntryX, TextEntryX.get(), 'TextEntryX') CheckingGUI(InitiatedTextEntryY, TextEntryY.get(), 'TextEntryY') - CheckingGUI(InitiatedLifeBellowThan, CheckLifeBellowThan.get(), 'LifeBellowThan') - CheckingGUI(InitiatedBellowThan, LifeBellowThan.get(), 'BellowThan') + CheckingGUI(InitiatedLifeBellowThan, + CheckLifeBellowThan.get(), 'LifeBellowThan') + CheckingGUI(InitiatedBellowThan, + LifeBellowThan.get(), 'BellowThan') if len(GUIChanges) != 0: for EachChange in range(len(GUIChanges)): - self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1]) + self.Setter.SetVariables.SetVar( + GUIChanges[EachChange][0], GUIChanges[EachChange][1]) self.AutoRing.destroyWindow() @@ -243,15 +261,21 @@ def Destroy(): global EnabledAutoRing if not EnabledAutoRing: - ButtonEnabled = self.AutoRing.addButton('AutoRing: OFF', SetAutoRing, [287, 23], [11, 336]) + ButtonEnabled = self.AutoRing.addButton( + 'AutoRing: OFF', ToggleState, [287, 23], [11, 336]) else: - ButtonEnabled = self.AutoRing.addButton('AutoRing: ON', SetAutoRing, [287, 23], [11, 336]) + ButtonEnabled = self.AutoRing.addButton( + 'AutoRing: ON', ToggleState, [287, 23], [11, 336]) ButtonEnabled.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - CheckPrint = self.AutoRing.addCheck(VarCheckPrint, [11, 285], InitiatedCheckPrint, "Print on Tibia's screen") - CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - CheckBuff = self.AutoRing.addCheck(VarCheckBuff, [11, 305], InitiatedCheckBuff, "Don't Buff") - CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckPrint = self.AutoRing.addCheck( + VarCheckPrint, [11, 285], InitiatedCheckPrint, "Print on Tibia's screen") + CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckBuff = self.AutoRing.addCheck( + VarCheckBuff, [11, 305], InitiatedCheckBuff, "Don't Buff") + CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) BackImage = 'images/Fundo.png' Back = self.AutoRing.openImage(BackImage, [150, 45]) @@ -260,7 +284,8 @@ def Destroy(): RingName = [] for NameOfCurrentRing in Rings: CurrentRingName = ItemsPath + 'Rings/' + NameOfCurrentRing + '.png' - CurrentRingImage = self.AutoRing.openImage(CurrentRingName, [64, 64]) + CurrentRingImage = self.AutoRing.openImage( + CurrentRingName, [64, 64]) RingImages.append(CurrentRingImage) RingName.append(NameOfCurrentRing) @@ -270,7 +295,8 @@ def Destroy(): def UpdateImg(): for XRing in Rings: if NameRing.get() == XRing: - self.AutoRing.addImage(RingImages[RingName.index(XRing)], [28, 43]) + self.AutoRing.addImage( + RingImages[RingName.index(XRing)], [28, 43]) global Ring Ring = NameRing.get() @@ -280,21 +306,27 @@ def UpdateImg(): WidthScreen, HeightScreen = self.SendToClient.MainWindowSize() RingLabel = self.AutoRing.addLabel('Select Name Of Ring', [135, 55]) - OptionNameRing = self.AutoRing.addOption(NameRing, Rings, [120, 80], width=21) + OptionNameRing = self.AutoRing.addOption( + NameRing, Rings, [120, 80], width=21) - ButtonAddNewRing = self.AutoRing.addButton('Add New Ring', AddNewAmulet, [167, 24], [120, 115]) + ButtonAddNewRing = self.AutoRing.addButton( + 'Add New Ring', AddNewAmulet, [167, 24], [120, 115]) - ButtonRecapture = self.AutoRing.addButton('Recapture', Recapture, [88, 24], [22, 115]) + ButtonRecapture = self.AutoRing.addButton( + 'Recapture', Recapture, [88, 24], [22, 115]) DescLabel = self.AutoRing.addLabel('', [150, 140]) - RButton1 = self.AutoRing.addRadio('Hotkey', RadioButton, 0, [22, 155], CheckClick) - RButton2 = self.AutoRing.addRadio('Position', RadioButton, 1, [22, 175], CheckClick) + RButton1 = self.AutoRing.addRadio( + 'Hotkey', RadioButton, 0, [22, 155], CheckClick) + RButton2 = self.AutoRing.addRadio( + 'Position', RadioButton, 1, [22, 175], CheckClick) CheckBoxLifeBellowThan = self.AutoRing.addCheck(CheckLifeBellowThan, [60, 210], InitiatedLifeBellowThan, 'Use Only If Life Is Bellow Than') LabelLifeBellowThan = self.AutoRing.addLabel('Life <= ', [90, 245]) - PercentageLifeBellowThan = self.AutoRing.addOption(LifeBellowThan, Percentage, [140, 240]) + PercentageLifeBellowThan = self.AutoRing.addOption( + LifeBellowThan, Percentage, [140, 240]) def Checking(): global FoundedImg, Ring @@ -302,7 +334,8 @@ def Checking(): DescLabel.configure(text='Hotkey To Press') self.AutoRing.addImage(Back, [130, 165]) FoundedImg = False - HotkeyOption = self.AutoRing.addOption(HotkeyRing, self.SendToClient.Hotkeys, [145, 170], 10) + HotkeyOption = self.AutoRing.addOption( + HotkeyRing, self.SendToClient.Hotkeys, [145, 170], 10) if EnabledAutoRing: Disable(HotkeyOption) else: @@ -312,13 +345,16 @@ def Checking(): self.AutoRing.addImage(Back, [120, 165]) FoundedImg = False - ButtonGetPosition = self.AutoRing.addButton('GetPosition', ReturnGetPosition, [80, 29], [195, 173]) + ButtonGetPosition = self.AutoRing.addButton( + 'GetPosition', ReturnGetPosition, [80, 29], [195, 173]) LabelX = self.AutoRing.addLabel('X:', [135, 165]) - EntryX = self.AutoRing.addEntry([150, 165], TextEntryX, width=4) + EntryX = self.AutoRing.addEntry( + [150, 165], TextEntryX, width=4) TextEntryX.trace("w", ValidateEntryX) LabelY = self.AutoRing.addLabel('Y:', [135, 185]) - EntryY = self.AutoRing.addEntry([150, 185], TextEntryY, width=4) + EntryY = self.AutoRing.addEntry( + [150, 185], TextEntryY, width=4) TextEntryY.trace("w", ValidateEntryY) if EnabledAutoRing: Disable(ButtonGetPosition) diff --git a/modules/AutoSSA.py b/modules/AutoSSA.py index 8952708..058b01a 100644 --- a/modules/AutoSSA.py +++ b/modules/AutoSSA.py @@ -1,4 +1,5 @@ import time +from tkinter import RAISED, SUNKEN import keyboard import pygetwindow @@ -10,15 +11,14 @@ from core.GUISetter import GUISetter from core.ThreadManager import ThreadManager -from engine.ScanAmulet import ScanAmulet +from engine.Scanners.ScanAmulet import ScanAmulet GUIChanges = [] -ThreadStarted = False - FoundedImg = False EnabledAutoSSA = False WaitingForClick = False +ThreadStarted = False Amulet = 'StoneSkinAmulet' AmuletLocate = [0, 0] @@ -37,24 +37,23 @@ def SetAutoAmulet(): global EnabledAutoSSA if not EnabledAutoSSA: EnabledAutoSSA = True - ButtonEnabled.configure(text='AutoSSA: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonEnabled.configure( + text='AutoSSA: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) print("AutoSSA: ON") global Amulet Amulet = NameAmulet.get() Checking() CheckingButtons() time.sleep(0.03) - if not ThreadStarted: - self.ThreadManager.NewThread(ScanAutoAmulet) - else: - self.ThreadManager.UnPauseThread() + self.ThreadManager.NewThread(ScanAutoAmulet) else: EnabledAutoSSA = False - ButtonEnabled.configure(text='AutoSSA: OFF', relief=RAISED, bg=rgb((127, 17, 8))) + ButtonEnabled.configure( + text='AutoSSA: OFF', relief=RAISED, bg=rgb((127, 17, 8))) print("AutoSSA: OFF") Checking() CheckingButtons() - self.ThreadManager.PauseThread() + self.ThreadManager.StopThread() def ScanAutoAmulet(): global Amulet @@ -64,26 +63,30 @@ def ScanAutoAmulet(): from modules.AutoHeal import EnabledAutoHeal if EnabledAutoHeal: while EnabledAutoSSA and EnabledAutoHeal: - NoHasAmulet = ScanAmulet(AmuletPositions, Amulet, Amulets[Amulet]["Precision"]) + NoHasAmulet = ScanAmulet( + AmuletPositions, Amulet, Amulets[Amulet]["Precision"]) - from Modules.AutoHeal import Life + from modules.AutoHeal import Life if NoHasAmulet and Life <= BellowThan: Execute() else: - from engine.ScanStages import ScanStages + from engine.Scanners.ScanStages import ScanStages while EnabledAutoSSA: - Life = ScanStages('Life From AutoAmulet').ScanStages(HealthLocation, LifeColor, LifeColorFull) + Life = ScanStages('Life From AutoAmulet').ScanStages( + HealthLocation, LifeColor, LifeColorFull) if Life is None: Life = 0 - NoHasAmulet = ScanAmulet(AmuletPositions, Amulet, Amulets[Amulet]["Precision"]) + NoHasAmulet = ScanAmulet( + AmuletPositions, Amulet, Amulets[Amulet]["Precision"]) if NoHasAmulet and Life < BellowThan: Execute() elif not CheckLifeBellowThan.get(): while EnabledAutoSSA: - NoHasAmulet = ScanAmulet(AmuletPositions, Amulet, Amulets[Amulet]["Precision"]) + NoHasAmulet = ScanAmulet( + AmuletPositions, Amulet, Amulets[Amulet]["Precision"]) if NoHasAmulet: Execute() @@ -91,7 +94,8 @@ def ScanAutoAmulet(): def Execute(): if RadioButton.get() == 0: self.SendToClient.Press(HotkeyAmulet.get()) - print("Pressed ", HotkeyAmulet.get(), " To Reallocated Your Amulet") + print("Pressed ", HotkeyAmulet.get(), + " To Reallocated Your Amulet") time.sleep(1) elif RadioButton.get() == 1: try: @@ -109,10 +113,12 @@ def Execute(): else: MousePosition = [0, 0] - self.SendToClient.DragTo([X, Y], [AmuletPositions[0] + 16, AmuletPositions[1] + 16]) + self.SendToClient.DragTo( + [X, Y], [AmuletPositions[0] + 16, AmuletPositions[1] + 16]) if MOUSE_OPTION == 1: - self.SendToClient.MoveTo(MousePosition[0], MousePosition[1]) + self.SendToClient.MoveTo( + MousePosition[0], MousePosition[1]) print("Amulet Reallocated On: X =", AmuletPositions[0] + 16, "Y =", AmuletPositions[1] + 16, "From: X =", @@ -126,7 +132,8 @@ def Recapture(): global WaitingForClick, Amulet WaitingForClick = True Amulet = NameAmulet.get() - AutoSSAWindow = pygetwindow.getWindowsWithTitle("Module: Auto SSA")[0] + AutoSSAWindow = pygetwindow.getWindowsWithTitle("Module: Auto SSA")[ + 0] TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0] AutoSSAWindowX = self.AutoSSA.PositionOfWindow('X') AutoSSAWindowY = self.AutoSSA.PositionOfWindow('Y') @@ -141,7 +148,8 @@ def Recapture(): sX, sY = GetPosition() time.sleep(0.03) from core.HookWindow import SaveImage - SaveImage(ItemsPath + 'Amulets/' + Amulet + '.png', Region=(sX - 6, sY - 28, sX + 6, sY - 16)) + SaveImage(ItemsPath + 'Amulets/' + Amulet + '.png', + Region=(sX - 6, sY - 28, sX + 6, sY - 16)) WaitingForClick = False Invisible.destroyWindow() TibiaAuto.maximize() @@ -160,7 +168,8 @@ def CheckClick(): def ReturnGetPosition(): global WaitingForClick WaitingForClick = True - AutoSSAWindow = pygetwindow.getWindowsWithTitle("Module: Auto SSA")[0] + AutoSSAWindow = pygetwindow.getWindowsWithTitle("Module: Auto SSA")[ + 0] TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0] AutoSSAWindowX = self.AutoSSA.PositionOfWindow('X') AutoSSAWindowY = self.AutoSSA.PositionOfWindow('Y') @@ -203,19 +212,28 @@ def ValidateEntryY(*args): WidthScreen, HeightScreen = pyautogui.size() - VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool('CheckPrint') - VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool('CheckBuff') + VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool( + 'CheckPrint') + VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool( + 'CheckBuff') - RadioButton, InitiatedRadioButton = self.Setter.Variables.Int('RadioButton') + RadioButton, InitiatedRadioButton = self.Setter.Variables.Int( + 'RadioButton') - NameAmulet, InitiatedNameAmulet = self.Setter.Variables.Str('NameAmulet') - HotkeyAmulet, InitiatedHotkeyAmulet = self.Setter.Variables.Str('HotkeyAmulet') + NameAmulet, InitiatedNameAmulet = self.Setter.Variables.Str( + 'NameAmulet') + HotkeyAmulet, InitiatedHotkeyAmulet = self.Setter.Variables.Str( + 'HotkeyAmulet') - TextEntryX, InitiatedTextEntryX = self.Setter.Variables.Str('TextEntryX') - TextEntryY, InitiatedTextEntryY = self.Setter.Variables.Str('TextEntryY') + TextEntryX, InitiatedTextEntryX = self.Setter.Variables.Str( + 'TextEntryX') + TextEntryY, InitiatedTextEntryY = self.Setter.Variables.Str( + 'TextEntryY') - CheckLifeBellowThan, InitiatedLifeBellowThan = self.Setter.Variables.Bool('LifeBellowThan') - LifeBellowThan, InitiatedBellowThan = self.Setter.Variables.Int('BellowThan') + CheckLifeBellowThan, InitiatedLifeBellowThan = self.Setter.Variables.Bool( + 'LifeBellowThan') + LifeBellowThan, InitiatedBellowThan = self.Setter.Variables.Int( + 'BellowThan') def CheckingGUI(Init, Get, Name): if Get != Init: @@ -226,15 +244,19 @@ def Destroy(): CheckingGUI(InitiatedCheckBuff, VarCheckBuff.get(), 'CheckBuff') CheckingGUI(InitiatedRadioButton, RadioButton.get(), 'RadioButton') CheckingGUI(InitiatedNameAmulet, NameAmulet.get(), 'NameAmulet') - CheckingGUI(InitiatedHotkeyAmulet, HotkeyAmulet.get(), 'HotkeyAmulet') + CheckingGUI(InitiatedHotkeyAmulet, + HotkeyAmulet.get(), 'HotkeyAmulet') CheckingGUI(InitiatedTextEntryX, TextEntryX.get(), 'TextEntryX') CheckingGUI(InitiatedTextEntryY, TextEntryY.get(), 'TextEntryY') - CheckingGUI(InitiatedLifeBellowThan, CheckLifeBellowThan.get(), 'LifeBellowThan') - CheckingGUI(InitiatedBellowThan, LifeBellowThan.get(), 'BellowThan') + CheckingGUI(InitiatedLifeBellowThan, + CheckLifeBellowThan.get(), 'LifeBellowThan') + CheckingGUI(InitiatedBellowThan, + LifeBellowThan.get(), 'BellowThan') if len(GUIChanges) != 0: for EachChange in range(len(GUIChanges)): - self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1]) + self.Setter.SetVariables.SetVar( + GUIChanges[EachChange][0], GUIChanges[EachChange][1]) self.AutoSSA.destroyWindow() @@ -242,15 +264,21 @@ def Destroy(): global EnabledAutoSSA if not EnabledAutoSSA: - ButtonEnabled = self.AutoSSA.addButton('AutoSSA: OFF', SetAutoAmulet, [287, 23], [11, 336]) + ButtonEnabled = self.AutoSSA.addButton( + 'AutoSSA: OFF', SetAutoAmulet, [287, 23], [11, 336]) else: - ButtonEnabled = self.AutoSSA.addButton('AutoSSA: ON', SetAutoAmulet, [287, 23], [11, 336]) + ButtonEnabled = self.AutoSSA.addButton( + 'AutoSSA: ON', SetAutoAmulet, [287, 23], [11, 336]) ButtonEnabled.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - CheckPrint = self.AutoSSA.addCheck(VarCheckPrint, [11, 285], InitiatedCheckPrint, "Print on Tibia's screen") - CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - CheckBuff = self.AutoSSA.addCheck(VarCheckBuff, [11, 305], InitiatedCheckBuff, "Don't Buff") - CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckPrint = self.AutoSSA.addCheck( + VarCheckPrint, [11, 285], InitiatedCheckPrint, "Print on Tibia's screen") + CheckPrint.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) + CheckBuff = self.AutoSSA.addCheck( + VarCheckBuff, [11, 305], InitiatedCheckBuff, "Don't Buff") + CheckBuff.configure(bg=rgb((114, 94, 48)), activebackground=rgb( + (114, 94, 48)), selectcolor=rgb((114, 94, 48))) BackImage = 'images/Fundo.png' Back = self.AutoSSA.openImage(BackImage, [150, 45]) @@ -259,7 +287,8 @@ def Destroy(): AmuletName = [] for NameOfCurrentAmulet in Amulets: CurrentAmuletName = ItemsPath + 'Amulets/' + NameOfCurrentAmulet + '.png' - CurrentAmuletImage = self.AutoSSA.openImage(CurrentAmuletName, [64, 64]) + CurrentAmuletImage = self.AutoSSA.openImage( + CurrentAmuletName, [64, 64]) AmuletImages.append(CurrentAmuletImage) AmuletName.append(NameOfCurrentAmulet) @@ -269,7 +298,8 @@ def Destroy(): def UpdateImg(): for XAmulet in Amulets: if NameAmulet.get() == XAmulet: - self.AutoSSA.addImage(AmuletImages[AmuletName.index(XAmulet)], [28, 43]) + self.AutoSSA.addImage( + AmuletImages[AmuletName.index(XAmulet)], [28, 43]) global Amulet Amulet = NameAmulet.get() @@ -279,21 +309,27 @@ def UpdateImg(): WidthScreen, HeightScreen = self.SendToClient.MainWindowSize() AmuletLabel = self.AutoSSA.addLabel('Select Name Of Amulet', [135, 55]) - OptionNameAmulet = self.AutoSSA.addOption(NameAmulet, Amulets, [120, 80], width=21) + OptionNameAmulet = self.AutoSSA.addOption( + NameAmulet, Amulets, [120, 80], width=21) - ButtonAddNewAmulet = self.AutoSSA.addButton('Add New Amulet', AddNewAmulet, [167, 24], [120, 115]) + ButtonAddNewAmulet = self.AutoSSA.addButton( + 'Add New Amulet', AddNewAmulet, [167, 24], [120, 115]) - ButtonRecapture = self.AutoSSA.addButton('Recapture', Recapture, [88, 24], [22, 115]) + ButtonRecapture = self.AutoSSA.addButton( + 'Recapture', Recapture, [88, 24], [22, 115]) DescLabel = self.AutoSSA.addLabel('', [150, 140]) - RButton1 = self.AutoSSA.addRadio('Hotkey', RadioButton, 0, [22, 155], CheckClick) - RButton2 = self.AutoSSA.addRadio('Position', RadioButton, 1, [22, 175], CheckClick) + RButton1 = self.AutoSSA.addRadio( + 'Hotkey', RadioButton, 0, [22, 155], CheckClick) + RButton2 = self.AutoSSA.addRadio( + 'Position', RadioButton, 1, [22, 175], CheckClick) CheckBoxLifeBellowThan = self.AutoSSA.addCheck(CheckLifeBellowThan, [60, 210], InitiatedLifeBellowThan, 'Use Only If Life Is Bellow Than') LabelLifeBellowThan = self.AutoSSA.addLabel('Life <= ', [90, 245]) - PercentageLifeBellowThan = self.AutoSSA.addOption(LifeBellowThan, Percentage, [140, 240]) + PercentageLifeBellowThan = self.AutoSSA.addOption( + LifeBellowThan, Percentage, [140, 240]) def Checking(): global FoundedImg, Amulet @@ -301,7 +337,8 @@ def Checking(): DescLabel.configure(text='Hotkey To Press') self.AutoSSA.addImage(Back, [130, 165]) FoundedImg = False - HotkeyOption = self.AutoSSA.addOption(HotkeyAmulet, self.SendToClient.Hotkeys, [145, 170], 10) + HotkeyOption = self.AutoSSA.addOption( + HotkeyAmulet, self.SendToClient.Hotkeys, [145, 170], 10) if EnabledAutoSSA: HotkeyOption.configure(state='disabled') else: @@ -311,7 +348,8 @@ def Checking(): self.AutoSSA.addImage(Back, [120, 165]) FoundedImg = False - ButtonGetPosition = self.AutoSSA.addButton('GetPosition', ReturnGetPosition, [80, 29], [195, 173]) + ButtonGetPosition = self.AutoSSA.addButton( + 'GetPosition', ReturnGetPosition, [80, 29], [195, 173]) LabelX = self.AutoSSA.addLabel('X:', [135, 165]) EntryX = self.AutoSSA.addEntry([150, 165], TextEntryX, width=4) diff --git a/modules/CaveBot.py b/modules/CaveBot.py index df20e33..531cd1a 100644 --- a/modules/CaveBot.py +++ b/modules/CaveBot.py @@ -2,6 +2,7 @@ import json import time import shutil +from tkinter import RAISED, SUNKEN from conf.MarksConf import * from conf.Constants import Monsters, Priority, Hotkeys, AttackModes @@ -16,8 +17,8 @@ GUIChanges = [] EnabledCaveBot = False -ThreadStarted = False LoadedScript = False +ThreadStarted = False class CaveBot: @@ -31,18 +32,17 @@ def SetCaveBot(): global EnabledCaveBot if not EnabledCaveBot: EnabledCaveBot = True - ButtonEnabled.configure(text='CaveBot: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonEnabled.configure( + text='CaveBot: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) CheckingButtons() - if not ThreadStarted: - self.ThreadManager.NewThread(ScanCaveBot) - self.ThreadManager.NewThread(ScanForPause) - else: - self.ThreadManager.UnPauseThread() + self.ThreadManager.NewThread(ScanCaveBot) + self.ThreadManager.NewThread(ScanForPause) else: EnabledCaveBot = False CheckingButtons() - ButtonEnabled.configure(text='CaveBot: OFF', relief=RAISED, bg=rgb((127, 17, 8))) - self.ThreadManager.PauseThread() + ButtonEnabled.configure( + text='CaveBot: OFF', relief=RAISED, bg=rgb((127, 17, 8))) + self.ThreadManager.StopThread() def ScanCaveBot(): ScriptName = Script.get() @@ -78,27 +78,34 @@ def ScanForPause(): if keyboard.is_pressed("page_up"): SetCaveBot() - CheckDebugging, InitiatedDebugging = self.Setter.Variables.Bool('Debugging') + CheckDebugging, InitiatedDebugging = self.Setter.Variables.Bool( + 'Debugging') - CheckHotkeyPause, InitiatedHotkeyPause = self.Setter.Variables.Bool('HotkeyPause') - HotkeyToPause, InitiatedHotkeyToPause = self.Setter.Variables.Str('HotkeyToPause') + CheckHotkeyPause, InitiatedHotkeyPause = self.Setter.Variables.Bool( + 'HotkeyPause') + HotkeyToPause, InitiatedHotkeyToPause = self.Setter.Variables.Str( + 'HotkeyToPause') Script, InitiatedScript = self.Setter.Variables.Str('Script') global EnabledCaveBot if not EnabledCaveBot: - ButtonEnabled = self.CaveBot.addButton('CaveBot: OFF', SetCaveBot, [810, 26], [10, 570]) + ButtonEnabled = self.CaveBot.addButton( + 'CaveBot: OFF', SetCaveBot, [810, 26], [10, 570]) else: - ButtonEnabled = self.CaveBot.addButton('CaveBot: ON', SetCaveBot, [810, 26], [10, 570]) + ButtonEnabled = self.CaveBot.addButton( + 'CaveBot: ON', SetCaveBot, [810, 26], [10, 570]) - CheckboxDebugging = self.CaveBot.addCheck(CheckDebugging, [22, 511], InitiatedDebugging, "Enable Cavebot Debugging") + CheckboxDebugging = self.CaveBot.addCheck( + CheckDebugging, [22, 511], InitiatedDebugging, "Enable Cavebot Debugging") CheckboxHotkeyPause = self.CaveBot.addCheck(CheckHotkeyPause, [22, 542], InitiatedHotkeyPause, 'Enable Hotkey To Break a Cavebot') CheckboxHotkeyPause.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - ButtonHotkeyPause = self.CaveBot.addOption(HotkeyToPause, Hotkeys, [232, 542], 8) + ButtonHotkeyPause = self.CaveBot.addOption( + HotkeyToPause, Hotkeys, [232, 542], 8) # region Functions Walker @@ -113,10 +120,12 @@ def ValidateStand(*args): def SetResearchMap(): if not ResearchMap.get(): ResearchMap.set(True) - ButtonResearchMap.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonResearchMap.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: ResearchMap.set(False) - ButtonResearchMap.configure(relief=RAISED, bg=rgb((127, 17, 8))) + ButtonResearchMap.configure( + relief=RAISED, bg=rgb((127, 17, 8))) def RemoveWalker(): global LoadedScript @@ -167,7 +176,8 @@ def AddWalker(): print(len(DataMark)) if DataMark[0]['status'] == "NotConfigured": - DataMark.insert(0, {"mark": MarkToAdd, "type": TypeToAdd, "status": True}) + DataMark.insert( + 0, {"mark": MarkToAdd, "type": TypeToAdd, "status": True}) del DataMark[1] with open('Scripts/' + Script.get() + '.json', 'w') as wJson: json.dump(DataMark, wJson, indent=4) @@ -177,7 +187,8 @@ def AddWalker(): for j in range(len(DataMark)): if DataMark[j]['status']: - DataMark.insert(j + 1, {"mark": MarkToAdd, "type": TypeToAdd, "status": False}) + DataMark.insert( + j + 1, {"mark": MarkToAdd, "type": TypeToAdd, "status": False}) with open('Scripts/' + Script.get() + '.json', 'w') as wJson: json.dump(DataMark, wJson, indent=4) DataMark[j]['status'] = False @@ -203,7 +214,8 @@ def LoadPrevious(DataMark, index): PreviousMarkData = DataMark[index - 1]['mark'] PreviousWaypoint.configure(text=PreviousMarkData) - PreviousImage.configure(image=ImageMarks[MarkDecoder.get(PreviousMarkData) - 1]) + PreviousImage.configure( + image=ImageMarks[MarkDecoder.get(PreviousMarkData) - 1]) if DataMark[index] == DataMark[0]: PreviousTypeData = DataMark[-1]['type'] @@ -214,8 +226,10 @@ def LoadPrevious(DataMark, index): def LoadCurrent(DataMark, index): CurrentMarkData = DataMark[index]['mark'] CurrentWaypoint.configure(text=CurrentMarkData) - CurrentImage.configure(image=ImageMarks[MarkDecoder.get(CurrentMarkData) - 1]) - CurrentType.configure(text=TypeDecoder.get(DataMark[index]['type'])) + CurrentImage.configure( + image=ImageMarks[MarkDecoder.get(CurrentMarkData) - 1]) + CurrentType.configure( + text=TypeDecoder.get(DataMark[index]['type'])) def LoadNext(DataMark, index): if DataMark[index] == DataMark[-1]: @@ -224,7 +238,8 @@ def LoadNext(DataMark, index): NextMarkData = DataMark[index + 1]['mark'] NextWaypoint.configure(text=NextMarkData) - NextImage.configure(image=ImageMarks[MarkDecoder.get(NextMarkData) - 1]) + NextImage.configure( + image=ImageMarks[MarkDecoder.get(NextMarkData) - 1]) if DataMark[index] == DataMark[-1]: NextTypeData = DataMark[0]['type'] @@ -362,7 +377,8 @@ def ValidateMonstersRange(*args): def SetLoadAutoSeller(): if not LoadAutoSeller.get(): LoadAutoSeller.set(True) - ButtonAutoSeller.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonAutoSeller.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: LoadAutoSeller.set(False) ButtonAutoSeller.configure(relief=RAISED, bg=rgb((127, 17, 8))) @@ -370,7 +386,8 @@ def SetLoadAutoSeller(): def SetLoadAutoBanker(): if not LoadAutoBanker.get(): LoadAutoBanker.set(True) - ButtonAutoBanker.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonAutoBanker.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: LoadAutoBanker.set(False) ButtonAutoBanker.configure(relief=RAISED, bg=rgb((127, 17, 8))) @@ -391,77 +408,123 @@ def CheckingGUI(Init, Get, Name): def Destroy(): CheckingGUI(InitiatedDebugging, CheckDebugging.get(), 'Debugging') - CheckingGUI(InitiatedHotkeyPause, CheckHotkeyPause.get(), 'HotkeyPause') - CheckingGUI(InitiatedHotkeyToPause, HotkeyToPause.get(), 'HotkeyToPause') + CheckingGUI(InitiatedHotkeyPause, + CheckHotkeyPause.get(), 'HotkeyPause') + CheckingGUI(InitiatedHotkeyToPause, + HotkeyToPause.get(), 'HotkeyToPause') CheckingGUI(InitiatedPriorityOne, PriorityOne.get(), 'PriorityOne') CheckingGUI(InitiatedPriorityTwo, PriorityTwo.get(), 'PriorityTwo') - CheckingGUI(InitiatedPriorityThree, PriorityThree.get(), 'PriorityThree') - CheckingGUI(InitiatedPriorityFour, PriorityFour.get(), 'PriorityFour') - CheckingGUI(InitiatedSelectedMonster, SelectedMonster.get(), 'SelectedMonster') - CheckingGUI(InitiatedSelectedMonster2, SelectedMonster2.get(), 'SelectedMonster2') - CheckingGUI(InitiatedSelectedMonster3, SelectedMonster3.get(), 'SelectedMonster3') - CheckingGUI(InitiatedSelectedMonster4, SelectedMonster4.get(), 'SelectedMonster4') - CheckingGUI(InitiatedSelectedAttackMode, SelectedAttackMode.get(), 'SelectedAttackMode') + CheckingGUI(InitiatedPriorityThree, + PriorityThree.get(), 'PriorityThree') + CheckingGUI(InitiatedPriorityFour, + PriorityFour.get(), 'PriorityFour') + CheckingGUI(InitiatedSelectedMonster, + SelectedMonster.get(), 'SelectedMonster') + CheckingGUI(InitiatedSelectedMonster2, + SelectedMonster2.get(), 'SelectedMonster2') + CheckingGUI(InitiatedSelectedMonster3, + SelectedMonster3.get(), 'SelectedMonster3') + CheckingGUI(InitiatedSelectedMonster4, + SelectedMonster4.get(), 'SelectedMonster4') + CheckingGUI(InitiatedSelectedAttackMode, + SelectedAttackMode.get(), 'SelectedAttackMode') CheckingGUI(InitiatedAttackOne, CheckAttackOne.get(), 'AttackOne') CheckingGUI(InitiatedAttackTwo, CheckAttackTwo.get(), 'AttackTwo') - CheckingGUI(InitiatedAttackThree, CheckAttackThree.get(), 'AttackThree') - CheckingGUI(InitiatedAttackFour, CheckAttackFour.get(), 'AttackFour') + CheckingGUI(InitiatedAttackThree, + CheckAttackThree.get(), 'AttackThree') + CheckingGUI(InitiatedAttackFour, + CheckAttackFour.get(), 'AttackFour') CheckingGUI(InitiatedFollow, CheckFollow.get(), 'Follow') - CheckingGUI(InitiatedCantAttack, CheckCantAttack.get(), 'CantAttack') - CheckingGUI(InitiatedAttackPlayers, CheckAttackPlayers.get(), 'AttackPlayers') - CheckingGUI(InitiatedPlayerSeen, CheckPlayerSeen.get(), 'PlayerSeen') - CheckingGUI(InitiatedAttackingYou, CheckAttackingYou.get(), 'AttackingYou') - CheckingGUI(InitiatedForceAttack, CheckForceAttack.get(), 'ForceAttack') - CheckingGUI(InitiatedSuspendAfter, SuspendAfter.get(), 'SuspendAfter') - CheckingGUI(InitiatedMonstersRange, MonstersRange.get(), 'MonstersRange') - CheckingGUI(InitiatedCavebotMode, RadioCavebotMode.get(), 'CavebotMode') + CheckingGUI(InitiatedCantAttack, + CheckCantAttack.get(), 'CantAttack') + CheckingGUI(InitiatedAttackPlayers, + CheckAttackPlayers.get(), 'AttackPlayers') + CheckingGUI(InitiatedPlayerSeen, + CheckPlayerSeen.get(), 'PlayerSeen') + CheckingGUI(InitiatedAttackingYou, + CheckAttackingYou.get(), 'AttackingYou') + CheckingGUI(InitiatedForceAttack, + CheckForceAttack.get(), 'ForceAttack') + CheckingGUI(InitiatedSuspendAfter, + SuspendAfter.get(), 'SuspendAfter') + CheckingGUI(InitiatedMonstersRange, + MonstersRange.get(), 'MonstersRange') + CheckingGUI(InitiatedCavebotMode, + RadioCavebotMode.get(), 'CavebotMode') CheckingGUI(InitiatedRadius, Radius.get(), 'Radius') CheckingGUI(InitiatedDelay, Delay.get(), 'Delay') - CheckingGUI(InitiatedEnableWalking, CheckEnableWalking.get(), 'EnableWalking') + CheckingGUI(InitiatedEnableWalking, + CheckEnableWalking.get(), 'EnableWalking') CheckingGUI(InitiatedTypeValue, RadioTypeValue.get(), 'TypeValue') CheckingGUI(InitiatedStand, Stand.get(), 'Stand') CheckingGUI(InitiatedResearchMap, ResearchMap.get(), 'ResearchMap') CheckingGUI(InitiatedMarkValue, RadioMarkValue.get(), 'MarkValue') CheckingGUI(InitiatedDropItems, CheckDropItems.get(), 'DropItems') - CheckingGUI(InitiatedLoadAutoSeller, LoadAutoSeller.get(), 'LoadAutoSeller') - CheckingGUI(InitiatedLoadAutoBanker, LoadAutoBanker.get(), 'LoadAutoBanker') - CheckingGUI(InitiatedLoadSortLoot, LoadSortLoot.get(), 'LoadSortLoot') - CheckingGUI(InitiatedCapBelowThan, CapBelowThan.get(), 'CapBelowThan') + CheckingGUI(InitiatedLoadAutoSeller, + LoadAutoSeller.get(), 'LoadAutoSeller') + CheckingGUI(InitiatedLoadAutoBanker, + LoadAutoBanker.get(), 'LoadAutoBanker') + CheckingGUI(InitiatedLoadSortLoot, + LoadSortLoot.get(), 'LoadSortLoot') + CheckingGUI(InitiatedCapBelowThan, + CapBelowThan.get(), 'CapBelowThan') CheckingGUI(InitiatedScript, Script.get(), 'Script') - CheckingGUI(InitiatedWalkForDebug, CheckWalkForDebug.get(), 'WalkForDebug') + CheckingGUI(InitiatedWalkForDebug, + CheckWalkForDebug.get(), 'WalkForDebug') if len(GUIChanges) != 0: for EachChange in range(len(GUIChanges)): - self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1]) + self.Setter.SetVariables.SetVar( + GUIChanges[EachChange][0], GUIChanges[EachChange][1]) self.CaveBot.destroyWindow() # region Variables MonsterAttacking - PriorityOne, InitiatedPriorityOne = self.Setter.Variables.Int('PriorityOne') - PriorityTwo, InitiatedPriorityTwo = self.Setter.Variables.Int('PriorityTwo') - PriorityThree, InitiatedPriorityThree = self.Setter.Variables.Int('PriorityThree') - PriorityFour, InitiatedPriorityFour = self.Setter.Variables.Int('PriorityFour') - - SelectedMonster, InitiatedSelectedMonster = self.Setter.Variables.Str('SelectedMonster') - SelectedMonster2, InitiatedSelectedMonster2 = self.Setter.Variables.Str('SelectedMonster2') - SelectedMonster3, InitiatedSelectedMonster3 = self.Setter.Variables.Str('SelectedMonster3') - SelectedMonster4, InitiatedSelectedMonster4 = self.Setter.Variables.Str('SelectedMonster4') - - SelectedAttackMode, InitiatedSelectedAttackMode = self.Setter.Variables.Str('SelectedAttackMode') - CheckAttackOne, InitiatedAttackOne = self.Setter.Variables.Bool('AttackOne') - CheckAttackTwo, InitiatedAttackTwo = self.Setter.Variables.Bool('AttackTwo') - CheckAttackThree, InitiatedAttackThree = self.Setter.Variables.Bool('AttackThree') - CheckAttackFour, InitiatedAttackFour = self.Setter.Variables.Bool('AttackFour') + PriorityOne, InitiatedPriorityOne = self.Setter.Variables.Int( + 'PriorityOne') + PriorityTwo, InitiatedPriorityTwo = self.Setter.Variables.Int( + 'PriorityTwo') + PriorityThree, InitiatedPriorityThree = self.Setter.Variables.Int( + 'PriorityThree') + PriorityFour, InitiatedPriorityFour = self.Setter.Variables.Int( + 'PriorityFour') + + SelectedMonster, InitiatedSelectedMonster = self.Setter.Variables.Str( + 'SelectedMonster') + SelectedMonster2, InitiatedSelectedMonster2 = self.Setter.Variables.Str( + 'SelectedMonster2') + SelectedMonster3, InitiatedSelectedMonster3 = self.Setter.Variables.Str( + 'SelectedMonster3') + SelectedMonster4, InitiatedSelectedMonster4 = self.Setter.Variables.Str( + 'SelectedMonster4') + + SelectedAttackMode, InitiatedSelectedAttackMode = self.Setter.Variables.Str( + 'SelectedAttackMode') + CheckAttackOne, InitiatedAttackOne = self.Setter.Variables.Bool( + 'AttackOne') + CheckAttackTwo, InitiatedAttackTwo = self.Setter.Variables.Bool( + 'AttackTwo') + CheckAttackThree, InitiatedAttackThree = self.Setter.Variables.Bool( + 'AttackThree') + CheckAttackFour, InitiatedAttackFour = self.Setter.Variables.Bool( + 'AttackFour') CheckFollow, InitiatedFollow = self.Setter.Variables.Bool('Follow') - CheckCantAttack, InitiatedCantAttack = self.Setter.Variables.Bool('CantAttack') - CheckAttackPlayers, InitiatedAttackPlayers = self.Setter.Variables.Bool('AttackPlayers') - CheckPlayerSeen, InitiatedPlayerSeen = self.Setter.Variables.Bool('PlayerSeen') - CheckAttackingYou, InitiatedAttackingYou = self.Setter.Variables.Bool('AttackingYou') - CheckForceAttack, InitiatedForceAttack = self.Setter.Variables.Bool('ForceAttack') - SuspendAfter, InitiatedSuspendAfter = self.Setter.Variables.Str('SuspendAfter') - MonstersRange, InitiatedMonstersRange = self.Setter.Variables.Str('MonstersRange') + CheckCantAttack, InitiatedCantAttack = self.Setter.Variables.Bool( + 'CantAttack') + CheckAttackPlayers, InitiatedAttackPlayers = self.Setter.Variables.Bool( + 'AttackPlayers') + CheckPlayerSeen, InitiatedPlayerSeen = self.Setter.Variables.Bool( + 'PlayerSeen') + CheckAttackingYou, InitiatedAttackingYou = self.Setter.Variables.Bool( + 'AttackingYou') + CheckForceAttack, InitiatedForceAttack = self.Setter.Variables.Bool( + 'ForceAttack') + SuspendAfter, InitiatedSuspendAfter = self.Setter.Variables.Str( + 'SuspendAfter') + MonstersRange, InitiatedMonstersRange = self.Setter.Variables.Str( + 'MonstersRange') # endregion @@ -470,38 +533,50 @@ def Destroy(): BackImage = 'images/Fundo.png' Back = self.CaveBot.openImage(BackImage, [20, 20]) - RadioCavebotMode, InitiatedCavebotMode = self.Setter.Variables.Int('CavebotMode') + RadioCavebotMode, InitiatedCavebotMode = self.Setter.Variables.Int( + 'CavebotMode') Radius, InitiatedRadius = self.Setter.Variables.Int('Radius') Delay, InitiatedDelay = self.Setter.Variables.Int('Delay') Stand, InitiatedStand = self.Setter.Variables.Int('Stand') - ResearchMap, InitiatedResearchMap = self.Setter.Variables.Bool('ResearchMap') + ResearchMap, InitiatedResearchMap = self.Setter.Variables.Bool( + 'ResearchMap') - CheckWalkForDebug, InitiatedWalkForDebug = self.Setter.Variables.Bool('WalkForDebug') + CheckWalkForDebug, InitiatedWalkForDebug = self.Setter.Variables.Bool( + 'WalkForDebug') for i in range(len(NameMarks)): - ImageMark = Image.open('images/MapSettings/' + NameMarks[i] + '.png') + ImageMark = Image.open( + 'images/MapSettings/' + NameMarks[i] + '.png') ImageMark = ImageMark.resize((20, 20), Image.ANTIALIAS) ImageMark = ImageTk.PhotoImage(ImageMark) ImageMarks.append(ImageMark) - RadioMarkValue, InitiatedMarkValue = self.Setter.Variables.Int('MarkValue') - RadioTypeValue, InitiatedTypeValue = self.Setter.Variables.Int('TypeValue') + RadioMarkValue, InitiatedMarkValue = self.Setter.Variables.Int( + 'MarkValue') + RadioTypeValue, InitiatedTypeValue = self.Setter.Variables.Int( + 'TypeValue') - CheckEnableWalking, InitiatedEnableWalking = self.Setter.Variables.Bool('EnableWalking') + CheckEnableWalking, InitiatedEnableWalking = self.Setter.Variables.Bool( + 'EnableWalking') # endregion # region Variables DepotWalker - CheckDropItems, InitiatedDropItems = self.Setter.Variables.Bool('DropItems') + CheckDropItems, InitiatedDropItems = self.Setter.Variables.Bool( + 'DropItems') - LoadAutoSeller, InitiatedLoadAutoSeller = self.Setter.Variables.Bool('LoadAutoSeller') - LoadAutoBanker, InitiatedLoadAutoBanker = self.Setter.Variables.Bool('LoadAutoBanker') - LoadSortLoot, InitiatedLoadSortLoot = self.Setter.Variables.Bool('LoadSortLoot') + LoadAutoSeller, InitiatedLoadAutoSeller = self.Setter.Variables.Bool( + 'LoadAutoSeller') + LoadAutoBanker, InitiatedLoadAutoBanker = self.Setter.Variables.Bool( + 'LoadAutoBanker') + LoadSortLoot, InitiatedLoadSortLoot = self.Setter.Variables.Bool( + 'LoadSortLoot') - CapBelowThan, InitiatedCapBelowThan = self.Setter.Variables.Str('CapBelowThan') + CapBelowThan, InitiatedCapBelowThan = self.Setter.Variables.Str( + 'CapBelowThan') # endregion @@ -509,25 +584,39 @@ def Destroy(): # region GUI MonsterAttacking - OptionAttackMode = self.CaveBot.addOption(SelectedAttackMode, AttackModes, [103, 328], 10) - - CheckboxAttackOne = self.CaveBot.addCheck(CheckAttackOne, [25, 40], InitiatedAttackOne, 'Monster One') - OptionMonstersOne = self.CaveBot.addOption(SelectedMonster, Monsters, [155, 40], 16) - PriorityMonstersOne = self.CaveBot.addOption(PriorityOne, Priority, [300, 40]) - - CheckboxAttackTwo = self.CaveBot.addCheck(CheckAttackTwo, [25, 80], InitiatedAttackTwo, 'Monster Two') - OptionMonstersTwo = self.CaveBot.addOption(SelectedMonster2, Monsters, [155, 80], 16) - PriorityMonstersTwo = self.CaveBot.addOption(PriorityTwo, Priority, [300, 80]) - - CheckboxAttackThree = self.CaveBot.addCheck(CheckAttackThree, [25, 120], InitiatedAttackThree, 'Monster Three') - OptionMonstersThree = self.CaveBot.addOption(SelectedMonster3, Monsters, [155, 120], 16) - PriorityMonstersThree = self.CaveBot.addOption(PriorityThree, Priority, [300, 120]) - - CheckboxAttackFour = self.CaveBot.addCheck(CheckAttackFour, [25, 160], InitiatedAttackFour, 'Monster Four') - OptionMonstersFour = self.CaveBot.addOption(SelectedMonster4, Monsters, [155, 160], 16) - PriorityMonstersFour = self.CaveBot.addOption(PriorityFour, Priority, [300, 160]) - - CheckBoxFollow = self.CaveBot.addCheck(CheckFollow, [20, 200], InitiatedFollow, 'Auto Follow Mode') + OptionAttackMode = self.CaveBot.addOption( + SelectedAttackMode, AttackModes, [103, 328], 10) + + CheckboxAttackOne = self.CaveBot.addCheck( + CheckAttackOne, [25, 40], InitiatedAttackOne, 'Monster One') + OptionMonstersOne = self.CaveBot.addOption( + SelectedMonster, Monsters, [155, 40], 16) + PriorityMonstersOne = self.CaveBot.addOption( + PriorityOne, Priority, [300, 40]) + + CheckboxAttackTwo = self.CaveBot.addCheck( + CheckAttackTwo, [25, 80], InitiatedAttackTwo, 'Monster Two') + OptionMonstersTwo = self.CaveBot.addOption( + SelectedMonster2, Monsters, [155, 80], 16) + PriorityMonstersTwo = self.CaveBot.addOption( + PriorityTwo, Priority, [300, 80]) + + CheckboxAttackThree = self.CaveBot.addCheck( + CheckAttackThree, [25, 120], InitiatedAttackThree, 'Monster Three') + OptionMonstersThree = self.CaveBot.addOption( + SelectedMonster3, Monsters, [155, 120], 16) + PriorityMonstersThree = self.CaveBot.addOption( + PriorityThree, Priority, [300, 120]) + + CheckboxAttackFour = self.CaveBot.addCheck( + CheckAttackFour, [25, 160], InitiatedAttackFour, 'Monster Four') + OptionMonstersFour = self.CaveBot.addOption( + SelectedMonster4, Monsters, [155, 160], 16) + PriorityMonstersFour = self.CaveBot.addOption( + PriorityFour, Priority, [300, 160]) + + CheckBoxFollow = self.CaveBot.addCheck( + CheckFollow, [20, 200], InitiatedFollow, 'Auto Follow Mode') CheckBoxCantAttack = self.CaveBot.addCheck(CheckCantAttack, [20, 220], InitiatedCantAttack, "Suspend When Can't Attack") CheckBoxAttackPlayers = self.CaveBot.addCheck(CheckAttackPlayers, [20, 240], InitiatedAttackPlayers, @@ -539,13 +628,16 @@ def Destroy(): CheckBoxForceAttack = self.CaveBot.addCheck(CheckForceAttack, [195, 220], InitiatedForceAttack, 'Force Attack When Attacked') - LabelSuspendAfter = self.CaveBot.addLabel('Suspend After Unreachable:', [100, 280]) - LabelMonstersRange = self.CaveBot.addLabel('Consider Monsters In Range:', [100, 300]) + LabelSuspendAfter = self.CaveBot.addLabel( + 'Suspend After Unreachable:', [100, 280]) + LabelMonstersRange = self.CaveBot.addLabel( + 'Consider Monsters In Range:', [100, 300]) LabelAttackMode = self.CaveBot.addLabel('Attack Mode:', [20, 331]) EntrySuspendAfter = self.CaveBot.addEntry([270, 280], SuspendAfter, 5) SuspendAfter.trace("w", ValidateSuspendAfter) - EntryMonstersRange = self.CaveBot.addEntry([270, 300], MonstersRange, 5) + EntryMonstersRange = self.CaveBot.addEntry( + [270, 300], MonstersRange, 5) MonstersRange.trace("w", ValidateMonstersRange) # endregion @@ -556,44 +648,72 @@ def Destroy(): self.CaveBot.addLabel("Script Name:", [430, 160]) EntryCurrentScript = self.CaveBot.addEntry([440, 185], Script, 22) - ButtonLoadScript = self.CaveBot.addButton('Load Script', LoadScript, [110, 30], [590, 176]) - ButtonSaveScript = self.CaveBot.addButton('Save Script', SaveScript, [100, 30], [710, 176]) + ButtonLoadScript = self.CaveBot.addButton( + 'Load Script', LoadScript, [110, 30], [590, 176]) + ButtonSaveScript = self.CaveBot.addButton( + 'Save Script', SaveScript, [100, 30], [710, 176]) self.CaveBot.addLabel('Marks:', [431, 210]) - RadioImage1 = self.CaveBot.addRadioImage('', RadioMarkValue, 1, [470, 230], CheckMarkClick, ImageMarks[0]) - RadioImage2 = self.CaveBot.addRadioImage('', RadioMarkValue, 2, [510, 230], CheckMarkClick, ImageMarks[1]) - RadioImage3 = self.CaveBot.addRadioImage('', RadioMarkValue, 3, [550, 230], CheckMarkClick, ImageMarks[2]) - RadioImage4 = self.CaveBot.addRadioImage('', RadioMarkValue, 4, [590, 230], CheckMarkClick, ImageMarks[3]) - RadioImage5 = self.CaveBot.addRadioImage('', RadioMarkValue, 5, [630, 230], CheckMarkClick, ImageMarks[4]) - RadioImage6 = self.CaveBot.addRadioImage('', RadioMarkValue, 6, [670, 230], CheckMarkClick, ImageMarks[5]) - RadioImage7 = self.CaveBot.addRadioImage('', RadioMarkValue, 7, [710, 230], CheckMarkClick, ImageMarks[6]) - RadioImage8 = self.CaveBot.addRadioImage('', RadioMarkValue, 8, [470, 260], CheckMarkClick, ImageMarks[7]) - RadioImage9 = self.CaveBot.addRadioImage('', RadioMarkValue, 9, [510, 260], CheckMarkClick, ImageMarks[8]) - RadioImage10 = self.CaveBot.addRadioImage('', RadioMarkValue, 10, [550, 260], CheckMarkClick, ImageMarks[9]) - RadioImage11 = self.CaveBot.addRadioImage('', RadioMarkValue, 11, [590, 260], CheckMarkClick, ImageMarks[10]) - RadioImage12 = self.CaveBot.addRadioImage('', RadioMarkValue, 12, [630, 260], CheckMarkClick, ImageMarks[11]) - RadioImage13 = self.CaveBot.addRadioImage('', RadioMarkValue, 13, [670, 260], CheckMarkClick, ImageMarks[12]) - RadioImage14 = self.CaveBot.addRadioImage('', RadioMarkValue, 14, [710, 260], CheckMarkClick, ImageMarks[13]) - RadioImage15 = self.CaveBot.addRadioImage('', RadioMarkValue, 15, [470, 290], CheckMarkClick, ImageMarks[14]) - RadioImage16 = self.CaveBot.addRadioImage('', RadioMarkValue, 16, [510, 290], CheckMarkClick, ImageMarks[15]) - RadioImage17 = self.CaveBot.addRadioImage('', RadioMarkValue, 17, [550, 290], CheckMarkClick, ImageMarks[16]) - RadioImage18 = self.CaveBot.addRadioImage('', RadioMarkValue, 18, [590, 290], CheckMarkClick, ImageMarks[17]) - RadioImage19 = self.CaveBot.addRadioImage('', RadioMarkValue, 19, [630, 290], CheckMarkClick, ImageMarks[18]) - RadioImage20 = self.CaveBot.addRadioImage('', RadioMarkValue, 20, [670, 290], CheckMarkClick, ImageMarks[19]) + RadioImage1 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 1, [470, 230], CheckMarkClick, ImageMarks[0]) + RadioImage2 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 2, [510, 230], CheckMarkClick, ImageMarks[1]) + RadioImage3 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 3, [550, 230], CheckMarkClick, ImageMarks[2]) + RadioImage4 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 4, [590, 230], CheckMarkClick, ImageMarks[3]) + RadioImage5 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 5, [630, 230], CheckMarkClick, ImageMarks[4]) + RadioImage6 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 6, [670, 230], CheckMarkClick, ImageMarks[5]) + RadioImage7 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 7, [710, 230], CheckMarkClick, ImageMarks[6]) + RadioImage8 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 8, [470, 260], CheckMarkClick, ImageMarks[7]) + RadioImage9 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 9, [510, 260], CheckMarkClick, ImageMarks[8]) + RadioImage10 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 10, [550, 260], CheckMarkClick, ImageMarks[9]) + RadioImage11 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 11, [590, 260], CheckMarkClick, ImageMarks[10]) + RadioImage12 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 12, [630, 260], CheckMarkClick, ImageMarks[11]) + RadioImage13 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 13, [670, 260], CheckMarkClick, ImageMarks[12]) + RadioImage14 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 14, [710, 260], CheckMarkClick, ImageMarks[13]) + RadioImage15 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 15, [470, 290], CheckMarkClick, ImageMarks[14]) + RadioImage16 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 16, [510, 290], CheckMarkClick, ImageMarks[15]) + RadioImage17 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 17, [550, 290], CheckMarkClick, ImageMarks[16]) + RadioImage18 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 18, [590, 290], CheckMarkClick, ImageMarks[17]) + RadioImage19 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 19, [630, 290], CheckMarkClick, ImageMarks[18]) + RadioImage20 = self.CaveBot.addRadioImage( + '', RadioMarkValue, 20, [670, 290], CheckMarkClick, ImageMarks[19]) self.CaveBot.addLabel('Type Of Waypoint:', [470, 325]) - RadioWalk = self.CaveBot.addRadio('Walk', RadioTypeValue, 1, [580, 324]) - RadioRope = self.CaveBot.addRadio('Rope', RadioTypeValue, 2, [635, 324]) - RadioShovel = self.CaveBot.addRadio('Shovel', RadioTypeValue, 3, [690, 324]) + RadioWalk = self.CaveBot.addRadio( + 'Walk', RadioTypeValue, 1, [580, 324]) + RadioRope = self.CaveBot.addRadio( + 'Rope', RadioTypeValue, 2, [635, 324]) + RadioShovel = self.CaveBot.addRadio( + 'Shovel', RadioTypeValue, 3, [690, 324]) - ButtonRemoveWalker = self.CaveBot.addButton("Remove", RemoveWalker, [70, 21], [615, 355]) - ButtonAddWalker = self.CaveBot.addButton("Add", AddWalker, [50, 21], [555, 355]) + ButtonRemoveWalker = self.CaveBot.addButton( + "Remove", RemoveWalker, [70, 21], [615, 355]) + ButtonAddWalker = self.CaveBot.addButton( + "Add", AddWalker, [50, 21], [555, 355]) self.CaveBot.addLabel('Waypoints In Current Script:', [431, 385]) - ButtonResetMarks = self.CaveBot.addButton('Reset Marks', ResetMarks, [100, 24], [701, 385]) + ButtonResetMarks = self.CaveBot.addButton( + 'Reset Marks', ResetMarks, [100, 24], [701, 385]) self.CaveBot.addLabel("PreviousWaypoint:", [431, 410]) self.CaveBot.addLabel("CurrentWaypoint:", [570, 410]) @@ -615,31 +735,40 @@ def Destroy(): CurrentType = self.CaveBot.addLabel("", [612, 480]) NextType = self.CaveBot.addLabel("", [752, 480]) - ButtonPreviousWaypoint = self.CaveBot.addButton('<<<', SelectPreviousWaypoint, [30, 21], [430, 456]) - ButtonNextWaypoint = self.CaveBot.addButton('>>>', SelectNextWaypoint, [30, 21], [786, 456]) + ButtonPreviousWaypoint = self.CaveBot.addButton( + '<<<', SelectPreviousWaypoint, [30, 21], [430, 456]) + ButtonNextWaypoint = self.CaveBot.addButton( + '>>>', SelectNextWaypoint, [30, 21], [786, 456]) CheckboxWalkForDebug = self.CaveBot.addCheck(CheckWalkForDebug, [431, 497], InitiatedWalkForDebug, "Enable Walk For Refresh Map (RECOMMENDED)") - self.CaveBot.addLabel('Stand Still After Reaching Waypoint Per:', [431, 520]) + self.CaveBot.addLabel( + 'Stand Still After Reaching Waypoint Per:', [431, 520]) EntryStand = self.CaveBot.addEntry([653, 521], Stand, 2) Stand.trace("w", ValidateStand) - ButtonResearchMap = self.CaveBot.addButton('Auto Research Map', SetResearchMap, [130, 37], [684, 519]) + ButtonResearchMap = self.CaveBot.addButton( + 'Auto Research Map', SetResearchMap, [130, 37], [684, 519]) # endregion # region GUI DepotWalker - CheckboxDropItems = self.CaveBot.addCheck(CheckDropItems, [425, 28], InitiatedDropItems, 'Drop Items Instead Of Deposit') - LabelGoDepot = self.CaveBot.addLabel('Go To Depot When Cap Below Than:', [480, 50]) + CheckboxDropItems = self.CaveBot.addCheck( + CheckDropItems, [425, 28], InitiatedDropItems, 'Drop Items Instead Of Deposit') + LabelGoDepot = self.CaveBot.addLabel( + 'Go To Depot When Cap Below Than:', [480, 50]) EntryCapBelowThan = self.CaveBot.addEntry([680, 50], CapBelowThan, 5) - ButtonAutoSeller = self.CaveBot.addButton('Load AutoSeller', SetLoadAutoSeller, [110, 28], [450, 80]) - ButtonAutoBanker = self.CaveBot.addButton('Load AutoBanker', SetLoadAutoBanker, [120, 28], [570, 80]) - ButtonSortLoot = self.CaveBot.addButton('Load SortLoot', SetLoadSortLoot, [100, 28], [700, 80]) + ButtonAutoSeller = self.CaveBot.addButton( + 'Load AutoSeller', SetLoadAutoSeller, [110, 28], [450, 80]) + ButtonAutoBanker = self.CaveBot.addButton( + 'Load AutoBanker', SetLoadAutoBanker, [120, 28], [570, 80]) + ButtonSortLoot = self.CaveBot.addButton( + 'Load SortLoot', SetLoadSortLoot, [100, 28], [700, 80]) # endregion @@ -680,7 +809,7 @@ def CheckingButtons(): Disable(ButtonAutoSeller) Disable(ButtonAutoBanker) Disable(ButtonSortLoot) - + Disable(CheckboxEnableWalking) Disable(EntryCurrentScript) @@ -798,21 +927,29 @@ def CheckingButtons(): Enable(ButtonSortLoot) if ResearchMap.get(): - ButtonResearchMap.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonResearchMap.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: - ButtonResearchMap.configure(relief=RAISED, bg=rgb((127, 17, 8))) + ButtonResearchMap.configure( + relief=RAISED, bg=rgb((127, 17, 8))) if LoadAutoSeller.get(): - ButtonAutoSeller.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonAutoSeller.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: - ButtonAutoSeller.configure(relief=RAISED, bg=rgb((127, 17, 8))) + ButtonAutoSeller.configure( + relief=RAISED, bg=rgb((127, 17, 8))) if LoadAutoBanker.get(): - ButtonAutoBanker.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonAutoBanker.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: - ButtonAutoBanker.configure(relief=RAISED, bg=rgb((127, 17, 8))) + ButtonAutoBanker.configure( + relief=RAISED, bg=rgb((127, 17, 8))) if LoadSortLoot.get(): - ButtonSortLoot.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) + ButtonSortLoot.configure( + relief=SUNKEN, bg=rgb((158, 46, 34))) else: - ButtonSortLoot.configure(relief=RAISED, bg=rgb((127, 17, 8))) + ButtonSortLoot.configure( + relief=RAISED, bg=rgb((127, 17, 8))) if CheckEnableWalking.get(): Enable(EntryCurrentScript) @@ -863,7 +1000,7 @@ def CheckingButtons(): Enable(EntryStand) Enable(CheckboxWalkForDebug) - + ExecGUITrigger() def ConstantVerify(): diff --git a/modules/ChooseConfig.py b/modules/ChooseConfig.py index ad343ba..07c8596 100644 --- a/modules/ChooseConfig.py +++ b/modules/ChooseConfig.py @@ -23,7 +23,7 @@ class ChooseConfig: windows are now created from GUI.py on 'core' folder. """ - def __init__(self, selected_window_name): + def __init__(self, selected_window_name, hwnd): self.window = GUI('ChooseConfig', 'Choose your config') self.window.MainWindow('Config', [414, 202], [2, 2.36]) @@ -37,10 +37,10 @@ def bootstrap(): """ When This Function Is Called, He Takes A Name From EntryBox, To Do Some Checks In The File. - + If The File Already Exist, He Just Throws You For Root Window Because You Already Configure Your File. - + Else He Creates One File With The Name Got And Starts The Configuration """ @@ -70,7 +70,7 @@ def bootstrap(): else: os.remove(preferences_path) bootstrap() - + return ''' @@ -94,16 +94,20 @@ def bootstrap(): shutil.copyfile(Directory + '\\scripts' + '\\Json.json', os.path.join(Directory + '\\scripts' + '\\' + NameCreateJson.get() + '.json')) - TibiaAuto = pygetwindow.getWindowsWithTitle("Choose your config")[0] + TibiaAuto = pygetwindow.getWindowsWithTitle( + "Choose your config")[0] TibiaAuto.minimize() with open(preferences_path, 'r') as LoadedJson: preferences = json.load(LoadedJson) + GetClientScreenshot() + try: HealthLocation = GetHealthPosition() print('') - print(f"Health Location [X: {HealthLocation[0]} Y: {HealthLocation[1]}]") + print( + f"Health Location [X: {HealthLocation[0]} Y: {HealthLocation[1]}]") preferences['Positions']['LifePosition'][0]['x'] = HealthLocation[0] preferences['Positions']['LifePosition'][0]['y'] = HealthLocation[1] preferences['Positions']['LifePosition'][0]['Stats'] = True @@ -122,7 +126,8 @@ def bootstrap(): try: ManaLocation = GetManaPosition() print('') - print(f"Mana Location [X: {ManaLocation[0]} Y: {ManaLocation[1]}]") + print( + f"Mana Location [X: {ManaLocation[0]} Y: {ManaLocation[1]}]") print('') preferences['Positions']['ManaPosition'][0]['x'] = ManaLocation[0] preferences['Positions']['ManaPosition'][0]['y'] = ManaLocation[1] @@ -140,17 +145,23 @@ def bootstrap(): pass try: - BattlePositions[0], BattlePositions[1], BattlePositions[2], BattlePositions[3] = GetBattlePosition() + BattlePositions[0], BattlePositions[1], BattlePositions[2], BattlePositions[3] = GetBattlePosition( + ) if BattlePositions[0] and BattlePositions[1] and BattlePositions[2] and BattlePositions[3] != 0: - print(f"Battle Location [X: {BattlePositions[0]} Y: {BattlePositions[1]}]") + print( + f"Battle Location [X: {BattlePositions[0]} Y: {BattlePositions[1]}]") preferences['Positions']['BattlePosition'][0]['x'] = BattlePositions[0] preferences['Positions']['BattlePosition'][0]['y'] = BattlePositions[1] preferences['Positions']['BattlePosition'][0]['Stats'] = True time.sleep(.4) - preferences['Boxes']['BattleBox'][0]['x'] = int(BattlePositions[0]) - preferences['Boxes']['BattleBox'][0]['y'] = int(BattlePositions[1]) - preferences['Boxes']['BattleBox'][0]['w'] = int(BattlePositions[2]) - preferences['Boxes']['BattleBox'][0]['h'] = int(BattlePositions[3]) + preferences['Boxes']['BattleBox'][0]['x'] = int( + BattlePositions[0]) + preferences['Boxes']['BattleBox'][0]['y'] = int( + BattlePositions[1]) + preferences['Boxes']['BattleBox'][0]['w'] = int( + BattlePositions[2]) + preferences['Boxes']['BattleBox'][0]['h'] = int( + BattlePositions[3]) preferences['Boxes']['BattleBox'][0]['Stats'] = True with open(preferences_path, 'w') as wJson: json.dump(preferences, wJson, indent=4) @@ -167,16 +178,23 @@ def bootstrap(): pass try: - StatsPositions[0], StatsPositions[1], StatsPositions[2], StatsPositions[3] = GetStatsPosition() + StatsPositions[0], StatsPositions[1], StatsPositions[2], StatsPositions[3] = GetStatsPosition( + ) print('') - print(f"Status Bar Start [X: {StatsPositions[0]}, Y: {StatsPositions[1]}]") - print(f"Status Bar End [X: {StatsPositions[2]}, Y: {StatsPositions[3]}]") + print( + f"Status Bar Start [X: {StatsPositions[0]}, Y: {StatsPositions[1]}]") + print( + f"Status Bar End [X: {StatsPositions[2]}, Y: {StatsPositions[3]}]") print('') time.sleep(.2) - preferences['Boxes']['StatusBarBox'][0]['x'] = int(StatsPositions[0]) - preferences['Boxes']['StatusBarBox'][0]['y'] = int(StatsPositions[1]) - preferences['Boxes']['StatusBarBox'][0]['w'] = int(StatsPositions[2]) - preferences['Boxes']['StatusBarBox'][0]['h'] = int(StatsPositions[3]) + preferences['Boxes']['StatusBarBox'][0]['x'] = int( + StatsPositions[0]) + preferences['Boxes']['StatusBarBox'][0]['y'] = int( + StatsPositions[1]) + preferences['Boxes']['StatusBarBox'][0]['w'] = int( + StatsPositions[2]) + preferences['Boxes']['StatusBarBox'][0]['h'] = int( + StatsPositions[3]) preferences['Boxes']['StatusBarBox'][0]['Stats'] = True with open(preferences_path, 'w') as wJson: json.dump(preferences, wJson, indent=4) @@ -194,8 +212,10 @@ def bootstrap(): RingPositions[0], RingPositions[1] = StatsPositions[0], StatsPositions[1] - 58 RingPositions[2] = RingPositions[0] + items_square - 1 RingPositions[3] = RingPositions[1] + items_square - 1 - print(f"Ring's Square Start [X: {RingPositions[0]}, Y: {RingPositions[1]}]") - print(f"Ring's Square End [X: {RingPositions[2]}, Y: {RingPositions[3]}]") + print( + f"Ring's Square Start [X: {RingPositions[0]}, Y: {RingPositions[1]}]") + print( + f"Ring's Square End [X: {RingPositions[2]}, Y: {RingPositions[3]}]") print('') time.sleep(.2) preferences['Boxes']['RingBox'][0]['x'] = int(RingPositions[0]) @@ -219,14 +239,20 @@ def bootstrap(): AmuletPositions[0], AmuletPositions[1] = StatsPositions[0], StatsPositions[1] - 130 AmuletPositions[2] = AmuletPositions[0] + items_square - 1 AmuletPositions[3] = AmuletPositions[1] + items_square - 1 - print(f"Amulet's Square Start [X: {AmuletPositions[0]}, Y: {AmuletPositions[1]}]") - print(f"Amulet's Square End [X: {AmuletPositions[2]}, Y: {AmuletPositions[3]}]") + print( + f"Amulet's Square Start [X: {AmuletPositions[0]}, Y: {AmuletPositions[1]}]") + print( + f"Amulet's Square End [X: {AmuletPositions[2]}, Y: {AmuletPositions[3]}]") print('') time.sleep(.2) - preferences['Boxes']['AmuletBox'][0]['x'] = int(AmuletPositions[0]) - preferences['Boxes']['AmuletBox'][0]['y'] = int(AmuletPositions[1]) - preferences['Boxes']['AmuletBox'][0]['w'] = int(AmuletPositions[2]) - preferences['Boxes']['AmuletBox'][0]['h'] = int(AmuletPositions[3]) + preferences['Boxes']['AmuletBox'][0]['x'] = int( + AmuletPositions[0]) + preferences['Boxes']['AmuletBox'][0]['y'] = int( + AmuletPositions[1]) + preferences['Boxes']['AmuletBox'][0]['w'] = int( + AmuletPositions[2]) + preferences['Boxes']['AmuletBox'][0]['h'] = int( + AmuletPositions[3]) preferences['Boxes']['AmuletBox'][0]['Stats'] = True with open(preferences_path, 'w') as wJson: json.dump(preferences, wJson, indent=4) @@ -241,7 +267,8 @@ def bootstrap(): pass try: - MapPositions[0], MapPositions[1], MapPositions[2], MapPositions[3] = GetMapPosition() + MapPositions[0], MapPositions[1], MapPositions[2], MapPositions[3] = GetMapPosition( + ) time.sleep(.2) preferences['Boxes']['MapBox'][0]['x'] = int(MapPositions[0]) preferences['Boxes']['MapBox'][0]['y'] = int(MapPositions[1]) @@ -266,17 +293,23 @@ def bootstrap(): print('') print(f"Player Position [X: {Player[0]}, Y: {Player[1]}]") print('') - print(f"Game Window Start [X: {GameWindow[0]}, Y: {GameWindow[1]}]") - print(f"Game Window End [X: {GameWindow[2]}, Y: {GameWindow[3]}]") + print( + f"Game Window Start [X: {GameWindow[0]}, Y: {GameWindow[1]}]") + print( + f"Game Window End [X: {GameWindow[2]}, Y: {GameWindow[3]}]") print('') time.sleep(.2) preferences['Positions']['PlayerPosition'][0]['x'] = Player[0] preferences['Positions']['PlayerPosition'][0]['y'] = Player[1] preferences['Positions']['PlayerPosition'][0]['Stats'] = True - preferences['Boxes']['GameWindowBox'][0]['x'] = int(GameWindow[0]) - preferences['Boxes']['GameWindowBox'][0]['y'] = int(GameWindow[1]) - preferences['Boxes']['GameWindowBox'][0]['w'] = int(GameWindow[2]) - preferences['Boxes']['GameWindowBox'][0]['h'] = int(GameWindow[3]) + preferences['Boxes']['GameWindowBox'][0]['x'] = int( + GameWindow[0]) + preferences['Boxes']['GameWindowBox'][0]['y'] = int( + GameWindow[1]) + preferences['Boxes']['GameWindowBox'][0]['w'] = int( + GameWindow[2]) + preferences['Boxes']['GameWindowBox'][0]['h'] = int( + GameWindow[3]) preferences['Boxes']['GameWindowBox'][0]['Stats'] = True with open(preferences_path, 'w') as wJson: json.dump(preferences, wJson, indent=4) @@ -294,7 +327,7 @@ def bootstrap(): try: SQMs[0], SQMs[1], SQMs[2], SQMs[3], SQMs[4], SQMs[5], SQMs[6], SQMs[7], SQMs[8], SQMs[9], SQMs[10], \ - SQMs[ + SQMs[ 11], SQMs[12], SQMs[13], SQMs[14], SQMs[15], SQMs[16], SQMs[17] = SetSQMs() time.sleep(0.1) print(f"1° SQM Location [X: {SQMs[0]}, Y: {SQMs[1]}]") @@ -389,15 +422,18 @@ def bootstrap(): if len(number_of_exceptions) != 0: print("\nSome Errors Occurred... Opening The Manual Config.") - print("Unfortunately, You Will Have To Manually Configure The Following Errors:\n") + print( + "Unfortunately, You Will Have To Manually Configure The Following Errors:\n") time.sleep(.3) self.window.destroyWindow() time.sleep(.1) def ManualConfig(ErrorName): - ManualConfiguration = GUI('ManualConfiguration', 'Manual Configuration') - ManualConfiguration.MainWindow('Config', [414, 202], [2, 2.36]) + ManualConfiguration = GUI( + 'ManualConfiguration', 'Manual Configuration') + ManualConfiguration.MainWindow( + 'Config', [414, 202], [2, 2.36]) def Solving(): ManualConfiguration.destroyWindow() @@ -406,16 +442,20 @@ def Solving(): '''LabelError = ManualConfiguration.addLabel("Solving Manually: " + ErrorName, [85, 31]) LabelError.configure(font=24)''' - ManualConfiguration.addMinimalLabel("One Error Was Occured In: " + ErrorName, [35, 31], 10) - ManualConfiguration.addMinimalLabel("... But This Option Is In Development.", [35, 51]) + ManualConfiguration.addMinimalLabel( + "One Error Was Occured In: " + ErrorName, [35, 31], 10) + ManualConfiguration.addMinimalLabel( + "... But This Option Is In Development.", [35, 51]) - ManualConfiguration.addButton('Ok', Solving, [75, 23], [310, 166]) + ManualConfiguration.addButton( + 'Ok', Solving, [75, 23], [310, 166]) ManualConfiguration.Protocol(Solving) ManualConfiguration.loop() for i in range(len(number_of_exceptions)): - print("Error[" + str(i + 1) + "] =", number_of_exceptions[i]) + print("Error[" + str(i + 1) + "] =", + number_of_exceptions[i]) for i in range(len(number_of_exceptions)): ManualConfig(number_of_exceptions[i]) @@ -430,6 +470,7 @@ def Solving(): conf['configured'] = True conf['preferences_name'] = preferences_name + conf['hwnd'] = hwnd ConfManager.set(conf, 'conf.json') end_configuration = time.time() - start_configuration @@ -473,38 +514,42 @@ def Solving(): self.window.addLabel('Name Of The Json Conf', [24, 35]) - LabelSelectOP1 = self.window.addLabel('Select Your Mouse And Keyboard Option', [30, 76]) + LabelSelectOP1 = self.window.addLabel( + 'Select Your Mouse And Keyboard Option', [30, 76]) LabelSelectOP1.configure(bg=rgb((114, 94, 48)), fg='black') RadioMouseMoviment = self.window.addRadio('{Global} Movement Mouse On Focused Window', MouseMode, 1, - [10, 95]) + [10, 95]) RadioMouseMoviment.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) RadioSenderMouse = self.window.addRadio("{OTServer} Send Mouse Events To Tibia's Window", MouseMode, 0, - [10, 114]) + [10, 114]) RadioSenderMouse.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - LabelSelectOP2 = self.window.addLabel('Select Your Hook Mode', [30, 136]) + LabelSelectOP2 = self.window.addLabel( + 'Select Your Hook Mode', [30, 136]) LabelSelectOP2.configure(bg=rgb((114, 94, 48)), fg='black') - RadioHookWindow = self.window.addRadio("{Global} Hook Directly OBS Screen", HookMode, 1, [10, 155]) + RadioHookWindow = self.window.addRadio( + "{Global} Hook Directly OBS Screen", HookMode, 1, [10, 155]) RadioHookWindow.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) - LabelSelectOP3 = self.window.addLabel('Select The Items Mode', [280, 76]) + LabelSelectOP3 = self.window.addLabel( + 'Select The Items Mode', [280, 76]) LabelSelectOP3.configure(bg=rgb((114, 94, 48)), fg='black') RadioFrames = self.window.addRadio('Frames', ItemsMode, "Frames", - [310, 95]) + [310, 95]) RadioFrames.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) RadioCorners = self.window.addRadio("Corners", ItemsMode, "Corners", - [310, 114]) + [310, 114]) RadioCorners.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) RadioNone = self.window.addRadio("None", ItemsMode, "None", - [310, 133]) + [310, 133]) RadioNone.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) diff --git a/modules/FoodEater.py b/modules/FoodEater.py index ae375a8..8f23f59 100644 --- a/modules/FoodEater.py +++ b/modules/FoodEater.py @@ -11,7 +11,7 @@ from core.GUISetter import GUISetter, check_gui from core.ThreadManager import ThreadManager -from engine.ScanFood import scan_food +from engine.Scanners.ScanFood import scan_food class FoodEater: @@ -41,11 +41,13 @@ def __init__(self, root, stats_positions, MOUSE_OPTION): def trigger(self): if FoodEater.enabled: FoodEater.enabled = False - self.enabled_button.configure(text='FoodEater: OFF', relief=RAISED, bg=rgb((127, 17, 8))) + self.enabled_button.configure( + text='FoodEater: OFF', relief=RAISED, bg=rgb((127, 17, 8))) self.pause() else: FoodEater.enabled = True - self.enabled_button.configure(text='FoodEater: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + self.enabled_button.configure( + text='FoodEater: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) self.run() self.check() @@ -60,7 +62,7 @@ def run(self): print('FoodEater: ON') def pause(self): - self.ThreadManager.PauseThread() + self.ThreadManager.StopThread() print('FoodEater: OFF') def execute(self): @@ -71,8 +73,10 @@ def execute(self): sleep(0.5) def destroy(self): - check_gui(FoodEater.gui_changes, self.init_check_print, self.check_print.get(), 'CheckPrint') - check_gui(FoodEater.gui_changes, self.init_food_hotkey, self.food_hotkey.get(), 'HotkeyFood') + check_gui(FoodEater.gui_changes, self.init_check_print, + self.check_print.get(), 'CheckPrint') + check_gui(FoodEater.gui_changes, self.init_food_hotkey, + self.food_hotkey.get(), 'HotkeyFood') if len(FoodEater.gui_changes) != 0: for each_change in range(len(FoodEater.gui_changes)): @@ -88,26 +92,32 @@ def destroy(self): self.window.destroyWindow() def gui_vars(self): - self.check_print, self.init_check_print = self.Setter.Variables.Bool('CheckPrint') - self.food_hotkey, self.init_food_hotkey = self.Setter.Variables.Str('HotkeyFood') + self.check_print, self.init_check_print = self.Setter.Variables.Bool( + 'CheckPrint') + self.food_hotkey, self.init_food_hotkey = self.Setter.Variables.Str( + 'HotkeyFood') def gui(self): self.label = self.window.addLabel('Hotkey To Press', [110, 24]) - self.hotkey_button = self.window.addOption(self.food_hotkey, self.SendToClient.Hotkeys, [105, 50], 10) + self.hotkey_button = self.window.addOption( + self.food_hotkey, self.SendToClient.Hotkeys, [105, 50], 10) self.check_print_button = self.window.addCheck(self.check_print, [11, 100], self.init_check_print, "Print on Tibia's screen") self.check_print_button.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), - selectcolor=rgb((114, 94, 48))) + selectcolor=rgb((114, 94, 48))) if not FoodEater.enabled: - self.enabled_button = self.window.addButton('FoodEater: OFF', self.trigger, [287, 23], [11, 132]) + self.enabled_button = self.window.addButton( + 'FoodEater: OFF', self.trigger, [287, 23], [11, 132]) else: - self.enabled_button = self.window.addButton('FoodEater: ON', self.trigger, [287, 23], [11, 132]) + self.enabled_button = self.window.addButton( + 'FoodEater: ON', self.trigger, [287, 23], [11, 132]) self.enabled_button.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - self.ok_button = self.window.addButton('Ok', self.destroy, [73, 21], [115, 161]) + self.ok_button = self.window.addButton( + 'Ok', self.destroy, [73, 21], [115, 161]) def check(self): if FoodEater.enabled: diff --git a/modules/Root.py b/modules/Root.py index 39565b0..d97f78d 100644 --- a/modules/Root.py +++ b/modules/Root.py @@ -1,35 +1,38 @@ import json from core.GUI import * - -# from modules.AdjustConfig import AdjustConfig -# from modules.AmmoRestack import AmmoRestack -# from modules.ShowMap import ShowMap -# from modules.AutoBanker import AutoBanker -# from modules.AutoFish import AutoFish -# from modules.AutoGrouping import AutoGrouping -from modules.AutoHeal import AutoHeal -from modules.AutoHur import AutoHur -# from modules.AutoLogin import AutoLogin -# from modules.AutoLooter import AutoLooter -from modules.AutoMana import AutoMana -from modules.AutoRing import AutoRing -# from modules.AutoSeller import AutoSeller -from modules.AutoSSA import AutoSSA -from modules.CaveBot import CaveBot -# from modules.ColorChange import ColorChange -# from modules.CreatureInfo import CreatureInfo -from modules.FoodEater import FoodEater -# from modules.FPSChanger import FPSChanger -# from modules.GeneralOptions import GeneralOptions -# from modules.HealerFriend import HealerFriend -# from modules.LoadConfig import LoadConfig -# from modules.Modules import Modules -# from modules.Monsters import Monsters -# from modules.PythonScripts import PythonScripts -# from modules.SaveConfig import SaveConfig -# from modules.SortLoot import SortLoot -from modules.TimedSpells import TimedSpells +from core.ThreadManager import ThreadManager +from engine.Scanners.ScanBars import ScanBars +# from core.GUISetter import GUISetter, GetData + +# from modules.AdjustConfig import AdjustConfig as AdjustConfigModule +# from modules.AmmoRestack import AmmoRestack as AmmoRestackModule +# from modules.ShowMap import ShowMap as ShowMapModule +# from modules.AutoBanker import AutoBanker as AutoBankerModule +# from modules.AutoFish import AutoFish as AutoFishModule +# from modules.AutoGrouping import AutoGrouping as AutoGroupingModule +from modules.AutoExchangeGold import AutoExchangeGold as AutoExchangeGoldModule +from modules.AutoHeal import AutoHeal as AutoHealModule +from modules.AutoHur import AutoHur as AutoHurModule +# from modules.AutoLogin import AutoLogin as AutoLoginModule +# from modules.AutoLooter import AutoLooter as AutoLooterModule +from modules.AutoRing import AutoRing as AutoRingModule +# from modules.AutoSeller import AutoSeller as AutoSellerModule +from modules.AutoSSA import AutoSSA as AutoSSAModule +from modules.CaveBot import CaveBot as CaveBotModule +# from modules.ColorChange import ColorChange as ColorChangeModule +# from modules.CreatureInfo import CreatureInfo as CreatureInfoModule +from modules.FoodEater import FoodEater as FoodEaterModule +# from modules.FPSChanger import FPSChanger as FPSChangerModule +# from modules.GeneralOptions import GeneralOptions as GeneralOptionsModule +# from modules.HealerFriend import HealerFriend as HealerFriendModule +# from modules.LoadConfig import LoadConfig as LoadConfigModule +# from modules.Modules import Modules as ModulesModule +# from modules.Monsters import Monsters as MonstersModule +# from modules.PythonScripts import PythonScripts as PythonScriptsModule +# from modules.SaveConfig import SaveConfig as SaveConfigModule +# from modules.SortLoot import SortLoot as SortLootModule +from modules.TimedSpells import TimedSpells as TimedSpellsModule SETTED_VARIABLES = False @@ -46,6 +49,7 @@ RingPositions = [0, 0, 0, 0] StatsPositions = [0, 0, 0, 0] HealthLocation = [0, 0] +MainContainerPositions = [0, 0, 0, 0] BattlePositions = [0, 0, 0, 0] AmuletPositions = [0, 0, 0, 0] SQMs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] @@ -55,9 +59,43 @@ ContainersNamePath = None CavebotScriptsPath = None +ScanningHPMP = False +ModulesWatchingHPMP = [] + +Life = 100 +Mana = 100 + class root: def __init__(self, CharName, LoadedJson): + self.ThreadManager = ThreadManager("ThreadRoot") + + def SetScanningHPMP(module_name, set_to='off'): + global ScanningHPMP + global ModulesWatchingHPMP + + if set_to == 'on': + print(f'Module {module_name} started watching HP/MP') + + if ScanningHPMP == False: + self.ThreadManager.NewThread(ScanHPMP) + ModulesWatchingHPMP.append(module_name) + + ScanningHPMP = True + else: + print(f"Module {module_name} is no longer watching HP/MP") + + if len(ModulesWatchingHPMP) == 1: + self.ThreadManager.StopThread() + ModulesWatchingHPMP.remove(module_name) + + ScanningHPMP = False + + def ScanHPMP(): + global Life, Mana + while ScanningHPMP: + Life, Mana = ScanBars(HealthLocation, ManaLocation) + self.root = GUI('root', 'TibiaAuto V12') self.root.MainWindow('Main', [357, 530], [2, 2.36]) self.root.deiconify() @@ -65,41 +103,64 @@ def __init__(self, CharName, LoadedJson): self.root.addMinimalLabel(f'Logged as: {CharName}', [14, 14]) # regions Buttons - - self.root.addButton('Healer Friend', OpenHealerFriend, [92, 23], [23, 56]).configure(state='disabled') - self.root.addButton('Color Change', OpenColorChange, [92, 23], [23, 108]).configure(state='disabled') - self.root.addButton('Ammo Restack', OpenAmmoRestack, [92, 23], [23, 135]).configure(state='disabled') - self.root.addButton('Auto Looter', OpenAutoLooter, [92, 23], [23, 160]).configure(state='disabled') + self.root.addButton('Healer Friend', OpenHealerFriend, [ + 92, 23], [23, 56]).configure(state='disabled') + self.root.addButton('Color Change', OpenColorChange, [92, 23], [ + 23, 108]).configure(state='disabled') + self.root.addButton('Ammo Restack', OpenAmmoRestack, [92, 23], [ + 23, 135]).configure(state='disabled') + self.root.addButton('Auto Looter', OpenAutoLooter, [92, 23], [ + 23, 160]).configure(state='disabled') self.root.addButton('Food Eater', OpenFoodEater, [92, 23], [23, 210]) - self.root.addButton('Auto Grouping', OpenAutoGrouping, [92, 23], [23, 236]).configure(state='disabled') - self.root.addButton('Sort Loot', OpenSortLoot, [92, 23], [23, 262]).configure(state='disabled') - self.root.addButton('Auto Banker', OpenAutoBanker, [92, 23], [23, 288]).configure(state='disabled') - self.root.addButton('Auto Seller', OpenAutoSeller, [92, 23], [23, 340]).configure(state='disabled') - self.root.addButton('FPS Changer', OpenFPSChanger, [92, 23], [23, 366]).configure(state='disabled') - - self.root.addButton('Auto Life', OpenAutoHeal, [92, 23], [147, 56]) - self.root.addButton('Auto Hur', OpenAutoHur, [92, 23], [245, 56]) - self.root.addButton('Auto Mana', OpenAutoMana, [92, 23], [147, 83]) - self.root.addButton('Auto Fish', OpenAutoFish, [92, 23], [245, 83]).configure(state='disabled') + self.root.addButton('Auto Grouping', OpenAutoGrouping, [92, 23], [ + 23, 236]).configure(state='disabled') + self.root.addButton('Sort Loot', OpenSortLoot, [92, 23], [ + 23, 262]).configure(state='disabled') + self.root.addButton('Auto Banker', OpenAutoBanker, [92, 23], [ + 23, 288]).configure(state='disabled') + self.root.addButton('Auto Seller', OpenAutoSeller, [92, 23], [ + 23, 340]).configure(state='disabled') + self.root.addButton('FPS Changer', OpenFPSChanger, [92, 23], [ + 23, 366]).configure(state='disabled') + + self.root.addButton('Auto Heal', lambda: OpenAutoHeal( + SetScanningHPMP), [92, 23], [147, 56]) + self.root.addButton('Auto Hur', lambda: OpenAutoHur( + SetScanningHPMP), [92, 23], [245, 56]) + self.root.addButton('Auto Gold', OpenAutoExchangeGold, [ + 92, 23], [147, 83]) + self.root.addButton('Auto Fish', OpenAutoFish, [92, 23], [ + 245, 83]).configure(state='disabled') self.root.addButton('Auto Amulet', OpenAutoSSA, [92, 23], [147, 108]) self.root.addButton('Auto Ring', OpenAutoRing, [92, 23], [245, 108]) - self.root.addButton('Timed Spells', OpenTimedSpells, [92, 23], [147, 135]) - self.root.addButton('Auto Login', OpenAutoLogin, [92, 23], [245, 135]).configure(state='disabled') - - self.root.addButton('Creature Info', OpenCreatureInfo, [92, 23], [147, 188]).configure(state='disabled') - self.root.addButton('Monsters', OpenMonsters, [92, 23], [245, 188]).configure(state='disabled') - - self.root.addButton('Show Map', OpenShowMap, [92, 23], [147, 290]).configure(state='disabled') + self.root.addButton('Timed Spells', OpenTimedSpells, [ + 92, 23], [147, 135]) + self.root.addButton('Auto Login', OpenAutoLogin, [92, 23], [ + 245, 135]).configure(state='disabled') + + self.root.addButton('Creature Info', OpenCreatureInfo, [92, 23], [ + 147, 188]).configure(state='disabled') + self.root.addButton('Monsters', OpenMonsters, [92, 23], [ + 245, 188]).configure(state='disabled') + + self.root.addButton('Show Map', OpenShowMap, [92, 23], [ + 147, 290]).configure(state='disabled') self.root.addButton('Cave Bot', OpenCaveBot, [92, 23], [245, 290]) - self.root.addButton('Load Config', OpenLoadConfig, [92, 23], [147, 340]).configure(state='disabled') - self.root.addButton('Save Config', OpenSaveConfig, [92, 23], [245, 340]).configure(state='disabled') - self.root.addButton('Adjust Config', OpenAdjustConfig, [92, 23], [147, 366]).configure(state='disabled') - self.root.addButton('Modules', OpenModules, [92, 23], [245, 366]).configure(state='disabled') - self.root.addButton('Python Scripts', OpenPythonScripts, [92, 23], [245, 392]).configure(state='disabled') + self.root.addButton('Load Config', OpenLoadConfig, [92, 23], [ + 147, 340]).configure(state='disabled') + self.root.addButton('Save Config', OpenSaveConfig, [92, 23], [ + 245, 340]).configure(state='disabled') + self.root.addButton('Adjust Config', OpenAdjustConfig, [92, 23], [ + 147, 366]).configure(state='disabled') + self.root.addButton('Modules', OpenModules, [92, 23], [ + 245, 366]).configure(state='disabled') + self.root.addButton('Python Scripts', OpenPythonScripts, [ + 92, 23], [245, 392]).configure(state='disabled') - self.root.addButton('General Options', OpenGeneralOptions, [213, 23], [134, 426]).configure(state='disabled') + self.root.addButton('General Options', OpenGeneralOptions, [ + 213, 23], [134, 426]).configure(state='disabled') def Exit(): print("Exiting...") @@ -135,6 +196,11 @@ def SetVariablesFromLoadedJson(): if data['Positions']['ManaPosition'][0]['Stats']: ManaLocation[0] = data['Positions']['ManaPosition'][0]['x'] ManaLocation[1] = data['Positions']['ManaPosition'][0]['y'] + if data['Boxes']['MainContainerBox'][0]['Stats']: + MainContainerPositions[0] = data['Boxes']['MainContainerBox'][0]['x'] + MainContainerPositions[1] = data['Boxes']['MainContainerBox'][0]['y'] + MainContainerPositions[2] = data['Boxes']['MainContainerBox'][0]['w'] + MainContainerPositions[3] = data['Boxes']['MainContainerBox'][0]['h'] if data['Boxes']['BattleBox'][0]['Stats']: BattlePositions[0] = data['Boxes']['BattleBox'][0]['x'] - 3 BattlePositions[1] = data['Boxes']['BattleBox'][0]['y'] - 3 @@ -168,9 +234,9 @@ def SetVariablesFromLoadedJson(): Player[0] = data['Positions']['PlayerPosition'][0]['x'] Player[1] = data['Positions']['PlayerPosition'][0]['y'] if data['SQM']['SQM1'][0]['Stats'] and data['SQM']['SQM2'][0]['Stats'] and data['SQM']['SQM3'][0][ - 'Stats'] and data['SQM']['SQM4'][0]['Stats'] and data['SQM']['SQM5'][0]['Stats'] and data['SQM'][ - 'SQM6'][0]['Stats'] and data['SQM']['SQM7'][0]['Stats'] and data['SQM']['SQM8'][0][ - 'Stats'] and data['SQM']['SQM9'][0]['Stats']: + 'Stats'] and data['SQM']['SQM4'][0]['Stats'] and data['SQM']['SQM5'][0]['Stats'] and data['SQM'][ + 'SQM6'][0]['Stats'] and data['SQM']['SQM7'][0]['Stats'] and data['SQM']['SQM8'][0][ + 'Stats'] and data['SQM']['SQM9'][0]['Stats']: SQMs[0] = data['SQM']['SQM1'][0]['x'] SQMs[1] = data['SQM']['SQM1'][0]['y'] SQMs[2] = data['SQM']['SQM2'][0]['x'] @@ -242,12 +308,16 @@ def OpenAutoGrouping(): # AutoGrouping(root) -def OpenAutoHeal(): - AutoHeal(HealthLocation, MOUSE_OPTION) +def OpenAutoExchangeGold(): + AutoExchangeGoldModule(MainContainerPositions, MOUSE_OPTION) -def OpenAutoHur(): - AutoHur(StatsPositions, MOUSE_OPTION) +def OpenAutoHeal(set_scanning_hpmp): + AutoHealModule(set_scanning_hpmp, MOUSE_OPTION) + + +def OpenAutoHur(set_scanning_hpmp): + AutoHurModule(StatsPositions, set_scanning_hpmp, MOUSE_OPTION) def OpenAutoLogin(): @@ -260,12 +330,9 @@ def OpenAutoLooter(): # AutoLooter(Player, SQMs) -def OpenAutoMana(): - AutoMana(ManaLocation, MOUSE_OPTION) - - def OpenAutoRing(): - AutoRing(root, RingPositions, HealthLocation, MOUSE_OPTION, ItemsPath) + AutoRingModule(root, RingPositions, HealthLocation, + MOUSE_OPTION, ItemsPath) def OpenAutoSeller(): @@ -274,11 +341,12 @@ def OpenAutoSeller(): def OpenAutoSSA(): - AutoSSA(root, AmuletPositions, HealthLocation, MOUSE_OPTION, ItemsPath) + AutoSSAModule(root, AmuletPositions, HealthLocation, + MOUSE_OPTION, ItemsPath) def OpenCaveBot(): - CaveBot(MapPositions, BattlePositions, SQMs, MOUSE_OPTION) + CaveBotModule(MapPositions, BattlePositions, SQMs, MOUSE_OPTION) def OpenColorChange(): @@ -292,7 +360,7 @@ def OpenCreatureInfo(): def OpenFoodEater(): - FoodEater(root, StatsPositions, MOUSE_OPTION) + FoodEaterModule(root, StatsPositions, MOUSE_OPTION) def OpenFPSChanger(): @@ -341,6 +409,6 @@ def OpenSortLoot(): def OpenTimedSpells(): - TimedSpells(root, MOUSE_OPTION) + TimedSpellsModule(root, MOUSE_OPTION) # endregion diff --git a/modules/TimedSpells.py b/modules/TimedSpells.py index e146cd9..2b2c599 100644 --- a/modules/TimedSpells.py +++ b/modules/TimedSpells.py @@ -14,7 +14,7 @@ from core.ThreadManager import ThreadManager -from engine.ScanFood import scan_food +from engine.Scanners.ScanFood import scan_food class TimedSpells: @@ -43,11 +43,13 @@ def __init__(self, root, MOUSE_OPTION): def trigger(self): if TimedSpells.enabled: TimedSpells.enabled = False - self.enabled_button.configure(text='TimedSpells: OFF', relief=RAISED, bg=rgb((127, 17, 8))) + self.enabled_button.configure( + text='TimedSpells: OFF', relief=RAISED, bg=rgb((127, 17, 8))) self.pause() else: TimedSpells.enabled = True - self.enabled_button.configure(text='TimedSpells: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) + self.enabled_button.configure( + text='TimedSpells: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) self.run() self.check() @@ -66,7 +68,7 @@ def run(self): print('TimedSpells: ON') def pause(self): - self.ThreadManager.PauseThread() + self.ThreadManager.StopThread() print('TimedSpells: OFF') def execute(self): @@ -96,9 +98,12 @@ def execute(self): sleep(1) def destroy(self): - check_gui(TimedSpells.gui_changes, self.init_check_print, self.check_print.get(), 'CheckPrint') - check_gui(TimedSpells.gui_changes, self.init_instant, self.check_instant.get(), 'InstantExecute') - check_gui(TimedSpells.gui_changes, self.init_food_hotkey, self.food_hotkey.get(), 'Hotkey') + check_gui(TimedSpells.gui_changes, self.init_check_print, + self.check_print.get(), 'CheckPrint') + check_gui(TimedSpells.gui_changes, self.init_instant, + self.check_instant.get(), 'InstantExecute') + check_gui(TimedSpells.gui_changes, self.init_food_hotkey, + self.food_hotkey.get(), 'Hotkey') spells = [] @@ -121,10 +126,14 @@ def destroy(self): self.window.destroyWindow() def gui_vars(self): - self.check_print, self.init_check_print = self.Setter.Variables.Bool('CheckPrint') - self.check_instant, self.init_instant = self.Setter.Variables.Bool('InstantExecute') - self.food_hotkey, self.init_food_hotkey = self.Setter.Variables.Str('Hotkey') - self.cast_every, self.init_cast_every = self.Setter.Variables.Str('CastEvery') + self.check_print, self.init_check_print = self.Setter.Variables.Bool( + 'CheckPrint') + self.check_instant, self.init_instant = self.Setter.Variables.Bool( + 'InstantExecute') + self.food_hotkey, self.init_food_hotkey = self.Setter.Variables.Str( + 'Hotkey') + self.cast_every, self.init_cast_every = self.Setter.Variables.Str( + 'CastEvery') self.spells, self.init_spells = self.Setter.Variables.array('Spells') def validate_cast_every(self, *args): @@ -162,17 +171,22 @@ def add_item(self): def gui(self): self.label = self.window.addLabel('Hotkey to press', [40, 45]) - self.hotkey_button = self.window.addOption(self.food_hotkey, self.SendToClient.Hotkeys, [145, 40], 10) + self.hotkey_button = self.window.addOption( + self.food_hotkey, self.SendToClient.Hotkeys, [145, 40], 10) self.label2 = self.window.addLabel('Cast every', [40, 75]) self.label3 = self.window.addLabel('seconds', [230, 75]) - self.entry_cast_every = self.window.addEntry([145, 75], self.cast_every, 12) + self.entry_cast_every = self.window.addEntry( + [145, 75], self.cast_every, 12) self.cast_every.trace("w", self.validate_cast_every) - self.add_button = self.window.addButton('Add', self.add_item, [75, 23], [70, 110]) - self.remove_button = self.window.addButton('Remove', self.remove_item, [75, 23], [170, 110]) + self.add_button = self.window.addButton( + 'Add', self.add_item, [75, 23], [70, 110]) + self.remove_button = self.window.addButton( + 'Remove', self.remove_item, [75, 23], [170, 110]) - self.table = self.window.addList(('hotkey', 'time'), 8, [230, 100], [40, 150]) + self.table = self.window.addList( + ('hotkey', 'time'), 8, [230, 100], [40, 150]) self.table.column('hotkey', width=115) self.table.column('time', anchor=CENTER, width=115) @@ -202,12 +216,15 @@ def gui(self): selectcolor=rgb((114, 94, 48))) if not TimedSpells.enabled: - self.enabled_button = self.window.addButton('TimedSpells: OFF', self.trigger, [287, 23], [11, 411]) + self.enabled_button = self.window.addButton( + 'TimedSpells: OFF', self.trigger, [287, 23], [11, 411]) else: - self.enabled_button = self.window.addButton('TimedSpells: ON', self.trigger, [287, 23], [11, 411]) + self.enabled_button = self.window.addButton( + 'TimedSpells: ON', self.trigger, [287, 23], [11, 411]) self.enabled_button.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) - self.ok_button = self.window.addButton('Ok', self.destroy, [73, 21], [115, 440]) + self.ok_button = self.window.addButton( + 'Ok', self.destroy, [73, 21], [115, 440]) def check(self): if TimedSpells.enabled: diff --git a/modules/__init__.py b/modules/__init__.py index 8243aab..62abf42 100644 --- a/modules/__init__.py +++ b/modules/__init__.py @@ -1,10 +1,7 @@ """ starts the selection page to choose window of capture """ - -import time import os -import threading from core.GUI import * from conf.conf_manager import ConfManager @@ -67,21 +64,37 @@ def bootstrap(): if conf['preferences_name'] is None: conf['preferences_name'] = 'NewConfig.json' - conf['hwnd'] = list(titles.keys())[list(titles.values()).index(selected_window.get())] + conf['hwnd'] = list(titles.keys())[list( + titles.values()).index(selected_window.get())] ConfManager.set(conf, 'conf.json') window.destroy() if not conf['configured']: - ChooseConfig(selected_window.get()) + ChooseConfig(selected_window.get(), conf['hwnd']) return root(selected_window.get(), conf['preferences_name']) + sorted_windows = {} + + for el in titles.items(): + if(el[0] == conf['hwnd']): + sorted_windows.update({el[0]: el[1]}) + + for el in titles.items(): + if(el[1].upper().__contains__('TIBIA')): + sorted_windows.update({el[0]: el[1]}) + + sorted_windows.update(titles.items()) + selected_window = tk.StringVar() - selected_window.set(list(titles.values())[1]) + selected_window.set(list(sorted_windows.values())[0]) + + select_window_list = tk.OptionMenu( + window, selected_window, *list(sorted_windows.values()), - select_window_list = tk.OptionMenu(window, selected_window, *list(titles.values())) + ) select_window_list.configure(anchor='w') select_window_list.pack() select_window_list.place(w=230, h=24, x=15, y=17) diff --git a/scripts/GUILoader.json b/scripts/GUILoader.json index ec148ef..e2ceed2 100644 --- a/scripts/GUILoader.json +++ b/scripts/GUILoader.json @@ -1,11 +1,14 @@ { "Loaders": { - "HealthLoader": { + "HealLoader": { "CheckPrint": false, "CheckBuff": false, "LifeCheckStageOne": true, "LifeCheckStageTwo": true, "LifeCheckStageThree": false, + "LifeCheckStageFour": false, + "LifeCheckStageFive": false, + "LifeCheckStageSix": false, "CheckCureStats": false, "CheckParalyze": false, "CheckPoison": false, @@ -13,30 +16,37 @@ "CheckElectrify": false, "CheckMort": false, "CheckBlood": false, - "LifePercentageStageOne": 85, - "LifeHotkeyStageOne": "F1", - "LifePercentageStageTwo": 60, - "LifeHotkeyStageTwo": "F2", - "LifePercentageStageThree": 55, - "LifeHotkeyStageThree": "F2", + "TypeStageOne": "Life", + "LifePercentageStageOne": 75, + "LifeHotkeyStageOne": "F12", + "TypeStageTwo": "Mana", + "LifePercentageStageTwo": 80, + "LifeHotkeyStageTwo": "F9", + "TypeStageThree": "Life", + "LifePercentageStageThree": 75, + "LifeHotkeyStageThree": "F12", + "TypeStageFour": "Life", + "LifePercentageStageFour": 90, + "LifeHotkeyStageFour": "F11", + "TypeStageFive": "Life", + "LifePercentageStageFive": 95, + "LifeHotkeyStageFive": "F11", + "TypeStageSix": "Life", + "LifePercentageStageSix": 70, + "LifeHotkeyStageSix": "Ctrl + F3", "HotkeyStageTwo": "Ctrl + F1" }, - "ManaLoader": { + "ExchangeGoldLoader": { "CheckPrint": false, - "CheckBuff": false, - "ManaCheckStageOne": true, - "ManaCheckStageTwo": false, - "ManaPercentageStageOne": 70, - "ManaHotkeyStageOne": "F3", - "ManaPercentageStageTwo": 45, - "ManaHotkeyStageTwo": "F3", - "CheckLowMana": false + "MainContainerName": "Bag" }, "HurLoader": { "CheckPrint": false, "CheckBuff": false, - "HotkeyHur": "F6", - "CheckLowMana": false, + "CheckPZ": true, + "HotkeyHur": "F3", + "CheckLowMana": true, + "ManaLessThan": 80, "CheckStageOne": true }, "AmuletLoader": { diff --git a/scripts/Json.json b/scripts/Json.json index be23569..4d43708 100644 --- a/scripts/Json.json +++ b/scripts/Json.json @@ -40,6 +40,15 @@ ] }, "Boxes": { + "MainContainerBox": [ + { + "x": 0, + "y": 0, + "w": 156, + "h": 198, + "Stats": false + } + ], "StatusBarBox": [ { "x": 0,