class ChooseConfig: def __init__(self, CharName): self.ChooseConfig = GUI('ChooseConfig', 'Choose You Config') self.ChooseConfig.MainWindow('Config', [414, 202], [2, 2.36]) def CreateDefaultJson(): ScriptToLoad = NameCreateJson.get() if os.path.isfile('Scripts/' + 'Scripts/' + ScriptToLoad + '.json'): with open('Scripts/' + 'Scripts/' + ScriptToLoad + '.json', 'r') as LoadsJson: data = json.load(LoadsJson) time.sleep(.5) print('') print('Your Configure Stats:', data['Stats']) if data['MouseOption'] != MouseMode.get(): data['MouseOption'] = MouseMode.get() with open('Scripts/' + 'Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) pyautogui.PAUSE = 0.005 if data['Stats']: print("\nOpening TibiaAuto...") self.ChooseConfig.destroyWindow() time.sleep(0.1) root(CharName, ScriptToLoad) else: os.remove('Scripts/' + 'Scripts/' + ScriptToLoad + '.json') CreateDefaultJson() else: print('Coping Default Json') start_configuration = time.time() Directory = os.getcwd() shutil.copyfile(Directory + '\\Scripts' + '\\Json.json', os.path.join(Directory + '\\Scripts' + '\\' + NameCreateJson.get() + '.json')) TibiaAuto = pygetwindow.getWindowsWithTitle("Choose You Config")[0] TibiaAuto.minimize() pyautogui.PAUSE = 0.005 time.sleep(.8) with open('Scripts/' + ScriptToLoad + '.json', 'r') as LoadsJson: data = json.load(LoadsJson) time.sleep(.5) time.sleep(.5) if HookMode.get() == 1: print("Hooking OBS") else: print("Grabing Screen") try: HealthLocation[0], HealthLocation[1] = GetHealthPosition(HookMode.get()) HealthLocation[0], HealthLocation[1] = int(HealthLocation[0]), int(HealthLocation[1]) print('') print(f"Health Location [X: {HealthLocation[0]} Y: {HealthLocation[1]}]") data['Positions']['LifePosition'][0]['x'] = HealthLocation[0] data['Positions']['LifePosition'][0]['y'] = HealthLocation[1] data['Positions']['LifePosition'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('Helth Position Error') data['Positions']['LifePosition'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: ManaLocation[0], ManaLocation[1] = GetManaPosition(HookMode.get()) ManaLocation[0], ManaLocation[1] = int(ManaLocation[0]), int(ManaLocation[1]) print('') print(f"Mana Location [X: {ManaLocation[0]} Y: {ManaLocation[1]}]") print('') data['Positions']['ManaPosition'][0]['x'] = ManaLocation[0] data['Positions']['ManaPosition'][0]['y'] = ManaLocation[1] data['Positions']['ManaPosition'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('Mana Position Error') data['Positions']['ManaPosition'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: BattlePositions[0], BattlePositions[1], BattlePositions[2], BattlePositions[3] = GetBattlePosition(HookMode.get()) print(f"Battle Location [X: {BattlePositions[0]} Y: {BattlePositions[1]}]") data['Positions']['BattlePosition'][0]['x'] = BattlePositions[0] data['Positions']['BattlePosition'][0]['y'] = BattlePositions[1] data['Positions']['BattlePosition'][0]['Stats'] = True time.sleep(.4) data['Boxes']['BattleBox'][0]['x'] = int(BattlePositions[0]) data['Boxes']['BattleBox'][0]['y'] = int(BattlePositions[1]) data['Boxes']['BattleBox'][0]['w'] = int(BattlePositions[2]) data['Boxes']['BattleBox'][0]['h'] = int(BattlePositions[3]) data['Boxes']['BattleBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('Battle Position Error') data['Positions']['BattlePosition'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: StatsPositions[0], StatsPositions[1], StatsPositions[2], StatsPositions[3] = GetStatsPosition(HookMode.get()) print('') 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) data['Boxes']['StatusBarBox'][0]['x'] = int(StatsPositions[0]) data['Boxes']['StatusBarBox'][0]['y'] = int(StatsPositions[1]) data['Boxes']['StatusBarBox'][0]['w'] = int(StatsPositions[2]) data['Boxes']['StatusBarBox'][0]['h'] = int(StatsPositions[3]) data['Boxes']['StatusBarBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('Status Bar Error') data['Boxes']['StatusBarBox'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: RingPositions[0], RingPositions[1] = StatsPositions[0], StatsPositions[1] - 58 RingPositions[2] = RingPositions[0] + ItemsSquare - 1 RingPositions[3] = RingPositions[1] + ItemsSquare - 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('') time.sleep(.2) data['Boxes']['RingBox'][0]['x'] = int(RingPositions[0]) data['Boxes']['RingBox'][0]['y'] = int(RingPositions[1]) data['Boxes']['RingBox'][0]['w'] = int(RingPositions[2]) data['Boxes']['RingBox'][0]['h'] = int(RingPositions[3]) data['Boxes']['RingBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('RingPosition Error') data['Boxes']['RingBox'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: AmuletPositions[0], AmuletPositions[1] = StatsPositions[0], StatsPositions[1] - 130 AmuletPositions[2] = AmuletPositions[0] + ItemsSquare - 1 AmuletPositions[3] = AmuletPositions[1] + ItemsSquare - 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('') time.sleep(.2) data['Boxes']['AmuletBox'][0]['x'] = int(AmuletPositions[0]) data['Boxes']['AmuletBox'][0]['y'] = int(AmuletPositions[1]) data['Boxes']['AmuletBox'][0]['w'] = int(AmuletPositions[2]) data['Boxes']['AmuletBox'][0]['h'] = int(AmuletPositions[3]) data['Boxes']['AmuletBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('AmuletPosition Error') data['Boxes']['AmuletBox'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: MapPositions[0], MapPositions[1], MapPositions[2], MapPositions[3] = GetMapPosition(HookMode.get()) time.sleep(.2) data['Boxes']['MapBox'][0]['x'] = int(MapPositions[0]) data['Boxes']['MapBox'][0]['y'] = int(MapPositions[1]) data['Boxes']['MapBox'][0]['w'] = int(MapPositions[2]) data['Boxes']['MapBox'][0]['h'] = int(MapPositions[3]) data['Boxes']['MapBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('MapPosition Error') data['Boxes']['MapBox'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: Player[0], Player[1], gameWindow[0], gameWindow[1], gameWindow[2], gameWindow[ 3] = GetPlayerPosition(HookMode.get()) 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('') time.sleep(.2) data['Positions']['PlayerPosition'][0]['x'] = Player[0] data['Positions']['PlayerPosition'][0]['y'] = Player[1] data['Positions']['PlayerPosition'][0]['Stats'] = True data['Boxes']['GameWindowBox'][0]['x'] = int(gameWindow[0]) data['Boxes']['GameWindowBox'][0]['y'] = int(gameWindow[1]) data['Boxes']['GameWindowBox'][0]['w'] = int(gameWindow[2]) data['Boxes']['GameWindowBox'][0]['h'] = int(gameWindow[3]) data['Boxes']['GameWindowBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('Player Position Error') data['Positions']['PlayerPosition'][0]['Stats'] = False data['Boxes']['GameWindowBox'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) try: 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] = SetSQMs(HookMode.get()) time.sleep(0.1) print(f"1° SQM Location [X: {SQMs[0]}, Y: {SQMs[1]}]") print(f"2° SQM Location [X: {SQMs[2]}, Y: {SQMs[3]}]") print(f"3° SQM Location [X: {SQMs[4]}, Y: {SQMs[5]}]") print(f"4° SQM Location [X: {SQMs[6]}, Y: {SQMs[7]}]") print(f"5° SQM Location [X: {SQMs[8]}, Y: {SQMs[9]}]") print(f"6° SQM Location [X: {SQMs[10]}, Y: {SQMs[11]}]") print(f"7° SQM Location [X: {SQMs[12]}, Y: {SQMs[13]}]") print(f"8° SQM Location [X: {SQMs[14]}, Y: {SQMs[15]}]") print(f"9° SQM Location [X: {SQMs[16]}, Y: {SQMs[17]}]") time.sleep(.4) data['SQM']['SQM1'][0]['x'] = int(SQMs[0]) data['SQM']['SQM1'][0]['y'] = int(SQMs[1]) data['SQM']['SQM1'][0]['Stats'] = True data['SQM']['SQM2'][0]['x'] = int(SQMs[2]) data['SQM']['SQM2'][0]['y'] = int(SQMs[3]) data['SQM']['SQM2'][0]['Stats'] = True data['SQM']['SQM3'][0]['x'] = int(SQMs[4]) data['SQM']['SQM3'][0]['y'] = int(SQMs[5]) data['SQM']['SQM3'][0]['Stats'] = True data['SQM']['SQM4'][0]['x'] = int(SQMs[6]) data['SQM']['SQM4'][0]['y'] = int(SQMs[7]) data['SQM']['SQM4'][0]['Stats'] = True data['SQM']['SQM5'][0]['x'] = int(SQMs[8]) data['SQM']['SQM5'][0]['y'] = int(SQMs[9]) data['SQM']['SQM5'][0]['Stats'] = True data['SQM']['SQM6'][0]['x'] = int(SQMs[10]) data['SQM']['SQM6'][0]['y'] = int(SQMs[11]) data['SQM']['SQM6'][0]['Stats'] = True data['SQM']['SQM7'][0]['x'] = int(SQMs[12]) data['SQM']['SQM7'][0]['y'] = int(SQMs[13]) data['SQM']['SQM7'][0]['Stats'] = True data['SQM']['SQM8'][0]['x'] = int(SQMs[14]) data['SQM']['SQM8'][0]['y'] = int(SQMs[15]) data['SQM']['SQM8'][0]['Stats'] = True data['SQM']['SQM9'][0]['x'] = int(SQMs[16]) data['SQM']['SQM9'][0]['y'] = int(SQMs[17]) data['SQM']['SQM9'][0]['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) except Errno: print('SQMs Error') data['SQM']['SQM1'][0]['Stats'] = False data['SQM']['SQM2'][0]['Stats'] = False data['SQM']['SQM3'][0]['Stats'] = False data['SQM']['SQM4'][0]['Stats'] = False data['SQM']['SQM5'][0]['Stats'] = False data['SQM']['SQM6'][0]['Stats'] = False data['SQM']['SQM7'][0]['Stats'] = False data['SQM']['SQM8'][0]['Stats'] = False data['SQM']['SQM9'][0]['Stats'] = False with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) data['Stats'] = True with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) data['MouseOption'] = MouseMode.get() with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) data['HookOption'] = HookMode.get() with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson: json.dump(data, wJson, indent=4) if CheckAuto.get(): with open('Scripts/Loads.json', 'r') as LoaderJson: data2 = json.load(LoaderJson) data2['Auto'] = True data2['ScriptName'] = ScriptToLoad with open('Scripts/Loads.json', 'w') as wwJson: json.dump(data2, wwJson, indent=4) end_configuration = time.time() - start_configuration print('') print(f"Your Setup Time Is: {end_configuration:.2f} Seconds") print('') print("Opening TibiaAuto...\n") time.sleep(.3) self.ChooseConfig.destroyWindow() time.sleep(.1) ScriptToLoad = NameCreateJson.get() root(CharName, ScriptToLoad) NameCreateJson = tk.StringVar() NameCreateJson.set('NewConfig') CheckAuto = tk.BooleanVar() CheckAuto.set(True) MouseMode = tk.IntVar() MouseMode.set(1) HookMode = tk.IntVar() HookMode.set(1) if os.path.isfile('Scripts/' + NameCreateJson.get() + '.json'): with open('Scripts/' + NameCreateJson.get() + '.json', 'r') as LoadsJson: data = json.load(LoadsJson) if data['Stats']: self.ChooseConfig.addButton('Load', CreateDefaultJson, [75, 23], [310, 166]) else: self.ChooseConfig.addButton('Create', CreateDefaultJson, [75, 23], [310, 166]) else: self.ChooseConfig.addButton('Create', CreateDefaultJson, [75, 23], [310, 166]) self.ChooseConfig.addEntry([165, 35], NameCreateJson, 28) self.ChooseConfig.addLabel('Name Of The Json Conf', [24, 35]) # RadioLoadAuto = self.ChooseConfig.addCheck(CheckAuto, [10, 114], 1, 'Load automatically This Script') # RadioLoadAuto.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, # 94, 48))) LabelSelectOP1 = self.ChooseConfig.addLabel('Select Your Mouse And Keyboard Option', [30, 76]) LabelSelectOP1.configure(bg=rgb((114, 94, 48)), fg='black') RadioMouseMoviment = self.ChooseConfig.addRadio('{Global} Movement Mouse On Focused Window', MouseMode, 1, [10, 95]) RadioMouseMoviment.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) RadioSenderMouse = self.ChooseConfig.addRadio("{OTServer} Send Mouse Events To Tibia's Window", MouseMode, 0, [10, 114]) RadioSenderMouse.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) LabelSelectOP2 = self.ChooseConfig.addLabel('Select Your Hook Mode', [30, 136]) LabelSelectOP2.configure(bg=rgb((114, 94, 48)), fg='black') RadioHookWindow = self.ChooseConfig.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))) RadioGrabScreen = self.ChooseConfig.addRadio('Grab Screen', HookMode, 0, [10, 174]) RadioGrabScreen.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)), selectcolor=rgb((114, 94, 48))) self.ChooseConfig.loop()
class CaveBot: def __init__(self, root, MapPositions, BattlePositions, SQMs, MOUSE_OPTION, HOOK_OPTION): self.CaveBot = GUI('CaveBot', 'Module: Cave Bot') self.CaveBot.DefaultWindow('CaveBot', [830, 634], [1.2, 2.29]) def SetCaveBot(): global EnabledCaveBot if not EnabledCaveBot: EnabledCaveBot = True ButtonEnabled.configure(text='CaveBot: ON', relief=SUNKEN, bg=rgb((158, 46, 34))) CheckingButtons() InitScan() else: EnabledCaveBot = False CheckingButtons() ButtonEnabled.configure(text='CaveBot: OFF', relief=RAISED, bg=rgb((127, 17, 8))) def InitScan(): global data, monster with open('Scripts/' + Script.get() + '.json', 'r') as rJson: data = json.load(rJson) print("The Script " + Script.get() + ".json Have a", len(data), "Marks") monster = SelectedMonster.get() try: ThreadCaveBot = threading.Thread(target=ScanCaveBot) ThreadCaveBot.start() except: print("Error: Unable To Start ThreadCaveBot!") def ScanCaveBot(): global data, monster while EnabledCaveBot: for i in range(len(data)): EngineCaveBot(data, i, MapPositions, BattlePositions, monster, SQMs, MOUSE_OPTION, HOOK_OPTION, Script.get()) time.sleep(1) def CheckClick(): Checking() CheckDebugging = tk.BooleanVar() CheckHotkeyPause = tk.BooleanVar() CheckHotkeyPause.set(True) HotkeyToPause = tk.StringVar() HotkeyToPause.set('Page Up') Script = tk.StringVar() Script.set(DefaultScript) BackImage = 'images/Fundo.png' Back = self.CaveBot.openImage(BackImage, [210, 60]) Back2 = self.CaveBot.openImage(BackImage, [210, 100]) self.CaveBot.addButton('Ok', self.CaveBot.destroyWindow, [74, 22], [378, 601]) global EnabledCaveBot if not EnabledCaveBot: ButtonEnabled = self.CaveBot.addButton('CaveBot: OFF', SetCaveBot, [810, 26], [10, 570]) else: ButtonEnabled = self.CaveBot.addButton('CaveBot: ON', SetCaveBot, [810, 26], [10, 570]) CheckboxDebugging = self.CaveBot.addCheck(CheckDebugging, [434, 484], 0, "Enable Cavebot Debugging") CheckboxHotkeyPause = self.CaveBot.addCheck( CheckHotkeyPause, [434, 526], 1, '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, [644, 526], 8) # region Functions Walker def ValidateRadius(*args): s = Radius.get() if len(s) > 2: if not s[-1].isdigit(): Radius.set(s[:-1]) else: Radius.set(s[:2]) def ValidateDelay(*args): s = Delay.get() if len(s) > 1: if not s[-1].isdigit(): Delay.set(s[:-1]) else: Delay.set(s[:1]) def ValidateWaypoint_X(*args): s = Waypoint_X.get() if len(s) > 5: if not s[-1].isdigit(): Waypoint_X.set(s[:-1]) else: Waypoint_X.set(s[:5]) def ValidateWaypoint_Y(*args): s = Waypoint_Y.get() if len(s) > 5: if not s[-1].isdigit(): Waypoint_Y.set(s[:-1]) else: Waypoint_Y.set(s[:5]) def ValidateWaypoint_Z(*args): s = Waypoint_Z.get() if len(s) > 2: if not s[-1].isdigit(): Waypoint_Z.set(s[:-1]) else: Waypoint_Z.set(s[:2]) def ValidateStand(*args): s = Stand.get() if len(s) > 1: if not s[-1].isdigit(): Stand.set(s[:-1]) else: Stand.set(s[:1]) def SetResearchMap(): if not ResearchMap.get(): ResearchMap.set(True) ButtonResearchMap.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: ResearchMap.set(False) ButtonResearchMap.configure(relief=RAISED, bg=rgb((127, 17, 8))) def RemoveWalker(): print('Clicked on remove wlaker') def AddWalker(): print('Clicked on add walker') def CheckMarkClick(): print('Check Mark Click') # endregion # region Functions MonstersAttacking def AddMonsterAttack(): print('AddMonsterAttack') def RemoveMonsterAttack(): print('RemoveMonsterAttack') def AddMonsterIgnore(): print('AddMonsterIgnore') def RemoveMonsterIgnore(): print('RemoveMonsterIgnore') def UpMonsterAttack(): print('UpMonsterAttack') def DownMonsterAttack(): print('DownMonsterAttack') def ValidateSuspendAfter(*args): s = SuspendAfter.get() if len(s) > 2: if not s[-1].isdigit(): SuspendAfter.set(s[:-1]) else: SuspendAfter.set(s[:2]) def ValidateMonstersRange(*args): s = MonstersRange.get() if len(s) > 2: if not s[-1].isdigit(): MonstersRange.set(s[:-1]) else: MonstersRange.set(s[:2]) # endregion # region Functions DepotWalker def SetLoadAutoSeller(): if not LoadAutoSeller.get(): LoadAutoSeller.set(True) ButtonAutoSeller.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: LoadAutoSeller.set(False) ButtonAutoSeller.configure(relief=RAISED, bg=rgb((127, 17, 8))) def SetLoadAutoBanker(): if not LoadAutoBanker.get(): LoadAutoBanker.set(True) ButtonAutoBanker.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: LoadAutoBanker.set(False) ButtonAutoBanker.configure(relief=RAISED, bg=rgb((127, 17, 8))) def SetLoadSortLoot(): if not LoadSortLoot.get(): LoadSortLoot.set(True) ButtonSortLoot.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: LoadSortLoot.set(False) ButtonSortLoot.configure(relief=RAISED, bg=rgb((127, 17, 8))) # endregion # region Variables MonsterAttacking PriorityOne = tk.IntVar() PriorityOne.set(priority[0]) PriorityTwo = tk.IntVar() PriorityTwo.set(priority[1]) PriorityThree = tk.IntVar() PriorityThree.set(priority[2]) PriorityFour = tk.IntVar() PriorityFour.set(priority[3]) SelectedMonster = tk.StringVar() SelectedMonster.set(monsters[0]) SelectedMonster2 = tk.StringVar() SelectedMonster2.set(monsters[1]) SelectedMonster3 = tk.StringVar() SelectedMonster3.set(monsters[2]) SelectedMonster4 = tk.StringVar() SelectedMonster4.set(monsters[3]) SelectedAttackMode = tk.StringVar() SelectedAttackMode.set(AttackModes[0]) CheckAttackOne = tk.BooleanVar() CheckAttackOne.set(True) CheckAttackTwo = tk.BooleanVar() CheckAttackTwo.set(False) CheckAttackThree = tk.BooleanVar() CheckAttackThree.set(False) CheckAttackFour = tk.BooleanVar() CheckAttackFour.set(False) CheckFollow = tk.BooleanVar() CheckCantAttack = tk.BooleanVar() CheckAttackPlayers = tk.BooleanVar() CheckPlayerSeen = tk.BooleanVar() CheckAttackingYou = tk.BooleanVar() CheckForceAttack = tk.BooleanVar() SuspendAfter = tk.StringVar() SuspendAfter.set('15') MonstersRange = tk.StringVar() MonstersRange.set('6') # endregion # region Variables Walker RadioCavebotMode = tk.IntVar() RadioCavebotMode.set(0) Radius = tk.StringVar() Radius.set('1') Delay = tk.StringVar() Delay.set('0') Waypoint_X = tk.StringVar() # Lembrar de setar posição atual do player Waypoint_X.set('32350') Waypoint_Y = tk.StringVar() # Lembrar de setar posição atual do player Waypoint_Y.set('32219') Waypoint_Z = tk.StringVar() # Lembrar de setar posição atual do player Waypoint_Z.set('6') Stand = tk.StringVar() Stand.set('2') ResearchMap = tk.BooleanVar() ResearchMap.set(True) ImageMark1 = ImageTk.PhotoImage( Image.open('images/MapSettings/CheckMark.png')) ImageMark2 = ImageTk.PhotoImage( Image.open('images/MapSettings/QuestionMark.png')) ImageMark3 = ImageTk.PhotoImage( Image.open('images/MapSettings/ExclimationMark.png')) ImageMark4 = ImageTk.PhotoImage( Image.open('images/MapSettings/Star.png')) ImageMark5 = ImageTk.PhotoImage( Image.open('images/MapSettings/Cross.png')) ImageMark6 = ImageTk.PhotoImage( Image.open('images/MapSettings/Church.png')) ImageMark7 = ImageTk.PhotoImage( Image.open('images/MapSettings/Mouth.png')) ImageMark8 = ImageTk.PhotoImage( Image.open('images/MapSettings/Shovel.png')) ImageMark9 = ImageTk.PhotoImage( Image.open('images/MapSettings/Sword.png')) ImageMark10 = ImageTk.PhotoImage( Image.open('images/MapSettings/Flag.png')) ImageMark11 = ImageTk.PhotoImage( Image.open('images/MapSettings/Lock.png')) ImageMark12 = ImageTk.PhotoImage( Image.open('images/MapSettings/Bag.png')) ImageMark13 = ImageTk.PhotoImage( Image.open('images/MapSettings/Skull.png')) ImageMark14 = ImageTk.PhotoImage( Image.open('images/MapSettings/Money.png')) ImageMark15 = ImageTk.PhotoImage( Image.open('images/MapSettings/ArrowUp.png')) ImageMark16 = ImageTk.PhotoImage( Image.open('images/MapSettings/ArrowDown.png')) ImageMark17 = ImageTk.PhotoImage( Image.open('images/MapSettings/ArrowRight.png')) ImageMark18 = ImageTk.PhotoImage( Image.open('images/MapSettings/ArrowLeft.png')) ImageMark19 = ImageTk.PhotoImage( Image.open('images/MapSettings/Above.png')) ImageMark20 = ImageTk.PhotoImage( Image.open('images/MapSettings/Bellow.png')) RadioMarkValue = tk.IntVar() RadioMarkValue.set(1) # endregion # region Variables DepotWalker CheckDropItems = tk.BooleanVar() CheckDropItems.set(True) LoadAutoSeller = tk.BooleanVar() LoadAutoSeller.set(True) LoadAutoBanker = tk.BooleanVar() LoadAutoBanker.set(True) LoadSortLoot = tk.BooleanVar() LoadSortLoot.set(True) CapBelowThan = tk.StringVar() CapBelowThan.set('150') # endregion # region Variables CorpseLooting CheckLootWhileKilling = tk.BooleanVar() CheckLootWhileKilling.set(True) CheckTibiaCustomLoot = tk.BooleanVar() CheckTibiaCustomLoot.set(True) CheckSQM1 = tk.StringVar() CheckSQM1.set(True) CheckSQM2 = tk.StringVar() CheckSQM2.set(True) CheckSQM3 = tk.StringVar() CheckSQM3.set(True) CheckSQM4 = tk.StringVar() CheckSQM4.set(True) CheckSQM5 = tk.StringVar() CheckSQM5.set(True) CheckSQM6 = tk.StringVar() CheckSQM6.set(True) CheckSQM7 = tk.StringVar() CheckSQM7.set(True) CheckSQM8 = tk.StringVar() CheckSQM8.set(True) CheckSQM9 = tk.StringVar() CheckSQM9.set(True) CapLimit = tk.StringVar() CapLimit.set('50') # endregion # region GUI MonsterAttacking OptionAttackMode = self.CaveBot.addOption(SelectedAttackMode, AttackModes, [103, 328], 10) CheckboxAttackOne = self.CaveBot.addCheck(CheckAttackOne, [25, 40], 1, '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], 0, '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], 0, '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], 0, '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], 1, 'Auto Follow Mode') CheckBoxCantAttack = self.CaveBot.addCheck( CheckCantAttack, [20, 220], 1, "Suspend When Can't Attack") CheckBoxAttackPlayers = self.CaveBot.addCheck(CheckAttackPlayers, [20, 240], 1, "Don't Attack Players") CheckBoxPlayerSeen = self.CaveBot.addCheck( CheckPlayerSeen, [195, 200], 1, 'Reduced Attack When Player Seen') CheckBoxAttackingYou = self.CaveBot.addCheck( CheckAttackingYou, [183, 240], 0, 'Attack Only Monsters Attacking You') CheckBoxForceAttack = self.CaveBot.addCheck( CheckForceAttack, [195, 220], 0, 'Force Attack When Attacked') 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) MonstersRange.trace("w", ValidateMonstersRange) # endregion # region GUI Walker RadioWaypoint = self.CaveBot.addRadio('Waypoints', RadioCavebotMode, 0, [26, 414], CheckClick) RadioMark = self.CaveBot.addRadio('Marks', RadioCavebotMode, 1, [115, 414], CheckClick) LabelStand = self.CaveBot.addLabel( 'Stand Still After Reaching Waypoint For:', [24, 520]) ButtonResearchMap = self.CaveBot.addButton('Auto Research Map', SetResearchMap, [130, 37], [268, 513]) # endregion # region GUI DepotWalker CheckboxDropItems = self.CaveBot.addCheck( CheckDropItems, [425, 28], 1, '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]) # endregion # region GUI CorpseLooting LabelCapLimit = self.CaveBot.addLabel('Loot Capacity Limit:', [435, 150]) EntryCapLimit = self.CaveBot.addEntry([551, 148], CapLimit, 5) CheckBoxLootWhileKilling = self.CaveBot.addCheck( CheckLootWhileKilling, [435, 180], 1, 'Loot While Killing') CheckBoxTibiaCustomLoot = self.CaveBot.addCheck( CheckTibiaCustomLoot, [585, 180], 1, 'Loot From Tibia Custom Loot') LabelLootAround = self.CaveBot.addLabel('Configure Loot Around:', [545, 220]) CheckBoxSQM1 = self.CaveBot.addCheck(CheckSQM1, [570, 310], 1) CheckBoxSQM2 = self.CaveBot.addCheck(CheckSQM2, [600, 310], 1) CheckBoxSQM3 = self.CaveBot.addCheck(CheckSQM3, [630, 310], 1) CheckBoxSQM4 = self.CaveBot.addCheck(CheckSQM4, [570, 280], 1) CheckBoxSQM5 = self.CaveBot.addCheck(CheckSQM5, [600, 280], 1) CheckBoxSQM6 = self.CaveBot.addCheck(CheckSQM6, [630, 280], 1) CheckBoxSQM7 = self.CaveBot.addCheck(CheckSQM7, [570, 250], 1) CheckBoxSQM8 = self.CaveBot.addCheck(CheckSQM8, [600, 250], 1) CheckBoxSQM9 = self.CaveBot.addCheck(CheckSQM9, [630, 250], 1) # endregion def Checking(): if RadioCavebotMode.get() == 0: print('Walker Mode:', RadioCavebotMode.get()) self.CaveBot.addImage(Back, [23, 440]) self.CaveBot.addImage(Back, [23, 450]) self.CaveBot.addImage(Back2, [197, 405]) LabelWaypoints = self.CaveBot.addLabel('Waypoints:', [236, 402]) LabelRadius = self.CaveBot.addLabel('Radius:', [24, 451]) LabelDelay = self.CaveBot.addLabel('Delay:', [111, 451]) EntryRadius = self.CaveBot.addEntry([70, 452], Radius, 5) Radius.trace("w", ValidateRadius) EntryDelay = self.CaveBot.addEntry([154, 452], Delay, 5) Delay.trace("w", ValidateDelay) LabelWaypointX = self.CaveBot.addLabel('X:', [26, 479]) EntryWaypointX = self.CaveBot.addEntry([42, 480], Waypoint_X, 5) Waypoint_X.trace("w", ValidateWaypoint_X) LabelWaypointY = self.CaveBot.addLabel('Y:', [81, 479]) EntryWaypointY = self.CaveBot.addEntry([97, 480], Waypoint_Y, 5) Waypoint_Y.trace("w", ValidateWaypoint_Y) LabelWaypointZ = self.CaveBot.addLabel('Z:', [135, 479]) EntryWaypointZ = self.CaveBot.addEntry([151, 480], Waypoint_Z, 5) Waypoint_Z.trace("w", ValidateWaypoint_Z) EntryStand = self.CaveBot.addEntry([244, 520], Stand, 2) Stand.trace("w", ValidateStand) ButtonRemoveWalker = self.CaveBot.addButton( '<<<', RemoveWalker, [29, 23], [197, 424]) ButtonAddWalker = self.CaveBot.addButton( '>>>', AddWalker, [29, 23], [197, 479]) if EnabledCaveBot: LabelWaypoints.configure(state='disabled') LabelRadius.configure(state='disabled') LabelDelay.configure(state='disabled') EntryRadius.configure(state='disabled') EntryDelay.configure(state='disabled') LabelWaypointX.configure(state='disabled') EntryWaypointX.configure(state='disabled') LabelWaypointY.configure(state='disabled') EntryWaypointY.configure(state='disabled') LabelWaypointZ.configure(state='disabled') EntryWaypointZ.configure(state='disabled') EntryStand.configure(state='disabled') ButtonResearchMap.configure(state='disabled') ButtonRemoveWalker.configure(state='disabled') ButtonAddWalker.configure(state='disabled') else: LabelWaypoints.configure(state='normal') LabelRadius.configure(state='normal') LabelDelay.configure(state='normal') EntryRadius.configure(state='normal') EntryDelay.configure(state='normal') LabelWaypointX.configure(state='normal') EntryWaypointX.configure(state='normal') LabelWaypointY.configure(state='normal') EntryWaypointY.configure(state='normal') LabelWaypointZ.configure(state='normal') EntryWaypointZ.configure(state='normal') EntryStand.configure(state='normal') ButtonResearchMap.configure(state='normal') ButtonRemoveWalker.configure(state='normal') ButtonAddWalker.configure(state='normal') elif RadioCavebotMode.get() == 1: print('Walker Mode:', RadioCavebotMode.get()) self.CaveBot.addImage(Back, [23, 450]) self.CaveBot.addImage(Back2, [197, 405]) LabelWaypoints = self.CaveBot.addLabel('Marks:', [246, 402]) self.CaveBot.addRadioImage('', RadioMarkValue, 1, [24, 441], CheckMarkClick, ImageMark1) self.CaveBot.addRadioImage('', RadioMarkValue, 2, [54, 441], CheckMarkClick, ImageMark2) self.CaveBot.addRadioImage('', RadioMarkValue, 3, [84, 441], CheckMarkClick, ImageMark3) self.CaveBot.addRadioImage('', RadioMarkValue, 4, [114, 441], CheckMarkClick, ImageMark4) self.CaveBot.addRadioImage('', RadioMarkValue, 5, [144, 441], CheckMarkClick, ImageMark5) self.CaveBot.addRadioImage('', RadioMarkValue, 6, [174, 441], CheckMarkClick, ImageMark6) self.CaveBot.addRadioImage('', RadioMarkValue, 7, [204, 441], CheckMarkClick, ImageMark7) self.CaveBot.addRadioImage('', RadioMarkValue, 8, [24, 461], CheckMarkClick, ImageMark8) self.CaveBot.addRadioImage('', RadioMarkValue, 9, [54, 461], CheckMarkClick, ImageMark9) self.CaveBot.addRadioImage('', RadioMarkValue, 0, [84, 461], CheckMarkClick, ImageMark10) self.CaveBot.addRadioImage('', RadioMarkValue, 11, [114, 461], CheckMarkClick, ImageMark11) self.CaveBot.addRadioImage('', RadioMarkValue, 12, [144, 461], CheckMarkClick, ImageMark12) self.CaveBot.addRadioImage('', RadioMarkValue, 13, [174, 461], CheckMarkClick, ImageMark13) self.CaveBot.addRadioImage('', RadioMarkValue, 14, [204, 461], CheckMarkClick, ImageMark14) self.CaveBot.addRadioImage('', RadioMarkValue, 15, [24, 481], CheckMarkClick, ImageMark15) self.CaveBot.addRadioImage('', RadioMarkValue, 16, [54, 481], CheckMarkClick, ImageMark16) self.CaveBot.addRadioImage('', RadioMarkValue, 17, [84, 481], CheckMarkClick, ImageMark17) self.CaveBot.addRadioImage('', RadioMarkValue, 18, [114, 481], CheckMarkClick, ImageMark18) self.CaveBot.addRadioImage('', RadioMarkValue, 19, [144, 481], CheckMarkClick, ImageMark19) self.CaveBot.addRadioImage('', RadioMarkValue, 20, [174, 481], CheckMarkClick, ImageMark20) if EnabledCaveBot: LabelWaypoints.configure(state='disabled') else: LabelWaypoints.configure(state='normal') def CheckingButtons(): if EnabledCaveBot: CheckboxDebugging.configure(state='disabled') CheckboxHotkeyPause.configure(state='disabled') ButtonHotkeyPause.configure(state='disabled') OptionAttackMode.configure(state='disabled') CheckboxAttackOne.configure(state='disabled') OptionMonstersOne.configure(state='disabled') PriorityMonstersOne.configure(state='disabled') CheckboxAttackTwo.configure(state='disabled') OptionMonstersTwo.configure(state='disabled') PriorityMonstersTwo.configure(state='disabled') CheckboxAttackThree.configure(state='disabled') OptionMonstersThree.configure(state='disabled') PriorityMonstersThree.configure(state='disabled') CheckboxAttackFour.configure(state='disabled') OptionMonstersFour.configure(state='disabled') PriorityMonstersFour.configure(state='disabled') CheckBoxFollow.configure(state='disabled') CheckBoxCantAttack.configure(state='disabled') CheckBoxAttackPlayers.configure(state='disabled') CheckBoxPlayerSeen.configure(state='disabled') CheckBoxAttackingYou.configure(state='disabled') CheckBoxForceAttack.configure(state='disabled') LabelSuspendAfter.configure(state='disabled') LabelMonstersRange.configure(state='disabled') LabelAttackMode.configure(state='disabled') EntrySuspendAfter.configure(state='disabled') EntryMonstersRange.configure(state='disabled') RadioWaypoint.configure(state='disabled') RadioMark.configure(state='disabled') LabelStand.configure(state='disabled') CheckboxDropItems.configure(state='disabled') LabelGoDepot.configure(state='disabled') EntryCapBelowThan.configure(state='disabled') ButtonAutoSeller.configure(state='disabled') ButtonAutoBanker.configure(state='disabled') ButtonSortLoot.configure(state='disabled') LabelCapLimit.configure(state='disabled') EntryCapLimit.configure(state='disabled') CheckBoxLootWhileKilling.configure(state='disabled') CheckBoxTibiaCustomLoot.configure(state='disabled') LabelLootAround.configure(state='disabled') CheckBoxSQM1.configure(state='disabled') CheckBoxSQM2.configure(state='disabled') CheckBoxSQM3.configure(state='disabled') CheckBoxSQM4.configure(state='disabled') CheckBoxSQM5.configure(state='disabled') CheckBoxSQM6.configure(state='disabled') CheckBoxSQM7.configure(state='disabled') CheckBoxSQM8.configure(state='disabled') CheckBoxSQM9.configure(state='disabled') else: CheckboxDebugging.configure(state='normal') CheckboxHotkeyPause.configure(state='normal') ButtonHotkeyPause.configure(state='normal') OptionAttackMode.configure(state='normal') CheckboxAttackOne.configure(state='normal') CheckboxAttackTwo.configure(state='normal') CheckboxAttackThree.configure(state='normal') CheckboxAttackFour.configure(state='normal') if not CheckAttackOne.get(): OptionMonstersOne.configure(state='disabled') PriorityMonstersOne.configure(state='disabled') else: OptionMonstersOne.configure(state='normal') PriorityMonstersOne.configure(state='normal') if not CheckAttackTwo.get(): OptionMonstersTwo.configure(state='disabled') PriorityMonstersTwo.configure(state='disabled') else: OptionMonstersTwo.configure(state='normal') PriorityMonstersTwo.configure(state='normal') if not CheckAttackThree.get(): OptionMonstersThree.configure(state='disabled') PriorityMonstersThree.configure(state='disabled') else: OptionMonstersThree.configure(state='normal') PriorityMonstersThree.configure(state='normal') if not CheckAttackFour.get(): OptionMonstersFour.configure(state='disabled') PriorityMonstersFour.configure(state='disabled') else: OptionMonstersFour.configure(state='normal') PriorityMonstersFour.configure(state='normal') CheckBoxFollow.configure(state='normal') CheckBoxCantAttack.configure(state='normal') CheckBoxAttackPlayers.configure(state='normal') CheckBoxPlayerSeen.configure(state='normal') CheckBoxAttackingYou.configure(state='normal') CheckBoxForceAttack.configure(state='normal') LabelSuspendAfter.configure(state='normal') LabelMonstersRange.configure(state='normal') LabelAttackMode.configure(state='normal') EntrySuspendAfter.configure(state='normal') EntryMonstersRange.configure(state='normal') RadioWaypoint.configure(state='normal') RadioMark.configure(state='normal') LabelStand.configure(state='normal') CheckboxDropItems.configure(state='normal') if CheckDropItems.get(): LabelGoDepot.configure(state='disabled') EntryCapBelowThan.configure(state='disabled') ButtonAutoSeller.configure(state='disabled') ButtonAutoBanker.configure(state='disabled') ButtonSortLoot.configure(state='disabled') else: LabelGoDepot.configure(state='normal') EntryCapBelowThan.configure(state='normal') ButtonAutoSeller.configure(state='normal') ButtonAutoBanker.configure(state='normal') ButtonSortLoot.configure(state='normal') LabelCapLimit.configure(state='normal') EntryCapLimit.configure(state='normal') CheckBoxLootWhileKilling.configure(state='normal') CheckBoxTibiaCustomLoot.configure(state='normal') LabelLootAround.configure(state='normal') CheckBoxSQM1.configure(state='normal') CheckBoxSQM2.configure(state='normal') CheckBoxSQM3.configure(state='normal') CheckBoxSQM4.configure(state='normal') CheckBoxSQM5.configure(state='normal') CheckBoxSQM6.configure(state='normal') CheckBoxSQM7.configure(state='normal') CheckBoxSQM8.configure(state='normal') CheckBoxSQM9.configure(state='normal') if ResearchMap.get(): ButtonResearchMap.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: ButtonResearchMap.configure(relief=RAISED, bg=rgb((127, 17, 8))) if LoadAutoSeller.get(): ButtonAutoSeller.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: ButtonAutoSeller.configure(relief=RAISED, bg=rgb((127, 17, 8))) if LoadAutoBanker.get(): ButtonAutoBanker.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: ButtonAutoBanker.configure(relief=RAISED, bg=rgb((127, 17, 8))) if LoadSortLoot.get(): ButtonSortLoot.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) else: ButtonSortLoot.configure(relief=RAISED, bg=rgb((127, 17, 8))) def ConstantVerify(): if not EnabledCaveBot: if not CheckAttackOne.get(): OptionMonstersOne.configure(state='disabled') PriorityMonstersOne.configure(state='disabled') else: OptionMonstersOne.configure(state='normal') PriorityMonstersOne.configure(state='normal') if not CheckAttackTwo.get(): OptionMonstersTwo.configure(state='disabled') PriorityMonstersTwo.configure(state='disabled') else: OptionMonstersTwo.configure(state='normal') PriorityMonstersTwo.configure(state='normal') if not CheckAttackThree.get(): OptionMonstersThree.configure(state='disabled') PriorityMonstersThree.configure(state='disabled') else: OptionMonstersThree.configure(state='normal') PriorityMonstersThree.configure(state='normal') if not CheckAttackFour.get(): OptionMonstersFour.configure(state='disabled') PriorityMonstersFour.configure(state='disabled') else: OptionMonstersFour.configure(state='normal') PriorityMonstersFour.configure(state='normal') if CheckDropItems.get(): LabelGoDepot.configure(state='disabled') EntryCapBelowThan.configure(state='disabled') ButtonAutoSeller.configure(state='disabled') ButtonAutoBanker.configure(state='disabled') ButtonSortLoot.configure(state='disabled') else: LabelGoDepot.configure(state='normal') EntryCapBelowThan.configure(state='normal') ButtonAutoSeller.configure(state='normal') ButtonAutoBanker.configure(state='normal') ButtonSortLoot.configure(state='normal') if not CheckHotkeyPause.get(): ButtonHotkeyPause.configure(state='disabled') elif CheckHotkeyPause.get(): ButtonHotkeyPause.configure(state='normal') self.CaveBot.After(300, ConstantVerify) CheckingButtons() ConstantVerify() Checking() self.CaveBot.loop()
class AutoRing: def __init__(self, root, RingPositions, HealthLocation, MOUSE_OPTION, HOOK_OPTION): self.AutoRing = GUI('AutoRing', 'Module: Auto Ring') self.AutoRing.DefaultWindow('AutoRing', [306, 397], [1.2, 2.29]) self.SendToClient = Hotkey(MOUSE_OPTION) def SetAutoRing(): global EnabledAutoRing if not EnabledAutoRing: EnabledAutoRing = True 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) ThreadAutoRing = threading.Thread(target=ScanAutoRing) ThreadAutoRing.start() else: EnabledAutoRing = False print('AutoRing: OFF') ButtonEnabled.configure(text='AutoRing: OFF', relief=RAISED, bg=rgb((127, 17, 8))) Checking() CheckingButtons() def ScanAutoRing(): if CheckLifeBellowThan.get(): BellowThan = LifeBellowThan.get() from Modules.AutoHeal import EnabledAutoHeal if EnabledAutoHeal: while EnabledAutoRing and EnabledAutoHeal: try: NoHasRing = ScanRing(RingPositions, HOOK_OPTION) except Exception: NoHasRing = False pass from Modules.AutoHeal import life if NoHasRing and life <= BellowThan: Execute() else: from Engine.ScanStages import ScanStages while EnabledAutoRing: try: life = ScanStages('Life From AutoRing', HOOK_OPTION).ScanStages( HealthLocation, lifeColor, lifeColorFull) except Exception: life = 100 pass if life is None: life = 0 try: NoHasRing = ScanRing(RingPositions, HOOK_OPTION) except Exception: NoHasRing = False pass if NoHasRing and life < BellowThan: Execute() else: while EnabledAutoRing: try: NoHasRing = ScanRing(RingPositions, HOOK_OPTION) except Exception: NoHasRing = False pass if NoHasRing: Execute() def Execute(): if RadioButton.get() == 0: self.SendToClient.Press(HotkeyRing.get()) print("Pressed ", HotkeyRing.get(), " To Reallocated Your Ring") time.sleep(1) elif RadioButton.get() == 1: try: X = int(TextEntryX.get()) Y = int(TextEntryY.get()) except: X = None Y = None print("Error To Get Type Of Position") time.sleep(1) if X and Y is not None: if X < WidthScreen and Y < HeightScreen: MousePosition = pyautogui.position() pyautogui.moveTo(X, Y) pyautogui.mouseDown(button='left') pyautogui.moveTo(RingPositions[0] + 16, RingPositions[1] + 16) pyautogui.mouseUp(button='left') pyautogui.moveTo(MousePosition) print("Ring Reallocated On: X =", RingPositions[0] + 16, "Y =", RingPositions[1] + 16, "From: X =", X, "Y =", Y) time.sleep(0.3) else: print("Lower Resolution Than Entered") time.sleep(1) def Recapture(): global WaitingForClick, Ring WaitingForClick = True Ring = NameRing.get() AutoRingWindow = pygetwindow.getWindowsWithTitle( "Module: Auto Ring")[0] TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0] RootWindowX = root.winfo_x() RootWindowY = root.winfo_y() AutoRingWindowX = self.AutoRing.PositionOfWindow('X') AutoRingWindowY = self.AutoRing.PositionOfWindow('Y') time.sleep(0.1) TibiaAuto.minimize() AutoRingWindow.minimize() Invisible = GUI('InvisibleWindow', 'InvisibleWindow') Invisible.InvisibleWindow('Recapture') while WaitingForClick: X, Y = GetPosition() if keyboard.is_pressed("c"): sX, sY = GetPosition() time.sleep(0.03) pyautogui.screenshot('images/Rings/' + Ring + '.png', region=(sX - 5, sY - 5, 12, 12)) WaitingForClick = False Invisible.destroyWindow() TibiaAuto.maximize() TibiaAuto.moveTo(RootWindowX, RootWindowY) time.sleep(0.04) AutoRingWindow.maximize() AutoRingWindow.moveTo(AutoRingWindowX, AutoRingWindowY) break Invisible.UpdateWindow(X, Y) def AddNewAmulet(): print('....') def CheckClick(): Checking() def ReturnGetPosition(): global WaitingForClick WaitingForClick = True AutoRingWindow = pygetwindow.getWindowsWithTitle( "Module: Auto Ring")[0] TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0] RootWindowX = root.winfo_x() RootWindowY = root.winfo_y() AutoRingWindowX = self.AutoRing.PositionOfWindow('X') AutoRingWindowY = self.AutoRing.PositionOfWindow('Y') time.sleep(0.1) TibiaAuto.minimize() AutoRingWindow.minimize() Invisible = GUI('InvisibleWindow', 'InvisibleWindow') Invisible.InvisibleWindow('GetPosition') while WaitingForClick: X, Y = GetPosition() if keyboard.is_pressed("c"): X, Y = GetPosition() WaitingForClick = False print(f"Your Click Is Located In: [X: {X}, Y: {Y}]") TextEntryX.set(X) TextEntryY.set(Y) Invisible.destroyWindow() TibiaAuto.maximize() TibiaAuto.moveTo(RootWindowX, RootWindowY) time.sleep(0.08) AutoRingWindow.maximize() AutoRingWindow.moveTo(AutoRingWindowX, AutoRingWindowY) break Invisible.UpdateWindow(X, Y) def ValidateEntryX(*args): s = TextEntryX.get() if len(s) > MaxLen: if not s[-1].isdigit(): TextEntryX.set(s[:-1]) else: TextEntryX.set(s[:MaxLen]) def ValidateEntryY(*args): s = TextEntryY.get() if len(s) > MaxLen: if not s[-1].isdigit(): TextEntryY.set(s[:-1]) else: TextEntryY.set(s[:MaxLen]) WidthScreen, HeightScreen = pyautogui.size() CheckPrint = tk.BooleanVar() LowMana = tk.BooleanVar() RadioButton = tk.IntVar() NameRing = tk.StringVar() NameRing.set('MightRing') HotkeyRing = tk.StringVar() HotkeyRing.set("Shift + F3") TextEntryX = tk.StringVar() TextEntryY = tk.StringVar() CheckLifeBellowThan = tk.BooleanVar() CheckLifeBellowThan.set(False) LifeBellowThan = tk.IntVar() LifeBellowThan.set(30) self.AutoRing.addButton('Ok', self.AutoRing.destroyWindow, [73, 21], [115, 365]) global EnabledAutoRing if not EnabledAutoRing: ButtonEnabled = self.AutoRing.addButton('AutoRing: OFF', SetAutoRing, [287, 23], [11, 336]) else: ButtonEnabled = self.AutoRing.addButton('AutoRing: ON', SetAutoRing, [287, 23], [11, 336]) ButtonEnabled.configure(relief=SUNKEN, bg=rgb((158, 46, 34))) CheckPrint = self.AutoRing.addCheck(CheckPrint, [11, 285], 0, "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(LowMana, [11, 305], 0, "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]) RingImg = 'images/Rings/MightRing.png' ImageID = self.AutoRing.openImage(RingImg, [64, 64]) ImgLabel = self.AutoRing.addLabel('Image To Search', [16, 22]) self.AutoRing.addImage(ImageID, [28, 43]) RingLabel = self.AutoRing.addLabel('Select Name Of Ring', [135, 55]) OptionNameRing = self.AutoRing.addOption(NameRing, Rings, [120, 80], width=21) ButtonAddNewRing = self.AutoRing.addButton('Add New Ring', AddNewAmulet, [167, 24], [120, 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) CheckBoxLifeBellowThan = self.AutoRing.addCheck( CheckLifeBellowThan, [60, 210], 0, 'Use Only If Life Is Bellow Than') LabelLifeBellowThan = self.AutoRing.addLabel('Life <= ', [90, 245]) PercentageLifeBellowThan = self.AutoRing.addOption( LifeBellowThan, percentage, [140, 240]) def Checking(): global FoundedImg, Ring if RadioButton.get() == 0: 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) if EnabledAutoRing: HotkeyOption.configure(state='disabled') else: HotkeyOption.configure(state='normal') elif RadioButton.get() == 1: DescLabel.configure(text='Position To Search') self.AutoRing.addImage(Back, [120, 165]) FoundedImg = False 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) TextEntryX.trace("w", ValidateEntryX) LabelY = self.AutoRing.addLabel('Y:', [135, 185]) EntryY = self.AutoRing.addEntry([150, 185], TextEntryY, width=4) TextEntryY.trace("w", ValidateEntryY) if EnabledAutoRing: ButtonGetPosition.configure(state='disabled') LabelX.configure(state='disabled') EntryX.configure(state='disabled') LabelY.configure(state='disabled') EntryY.configure(state='disabled') else: ButtonGetPosition.configure(state='normal') LabelX.configure(state='normal') EntryX.configure(state='normal') LabelY.configure(state='normal') EntryY.configure(state='normal') if not CheckLifeBellowThan.get(): LabelLifeBellowThan.configure(state='disabled') PercentageLifeBellowThan.configure(state='disabled') elif CheckLifeBellowThan.get(): LabelLifeBellowThan.configure(state='normal') PercentageLifeBellowThan.configure(state='normal') def CheckingButtons(): if EnabledAutoRing: CheckPrint.configure(state='disabled') CheckBuff.configure(state='disabled') DescLabel.configure(state='disabled') ImgLabel.configure(state='disabled') ButtonRecapture.configure(state='disabled') ButtonAddNewRing.configure(state='disabled') RButton1.configure(state='disabled') RButton2.configure(state='disabled') RingLabel.configure(state='disabled') OptionNameRing.configure(state='disabled') CheckBoxLifeBellowThan.configure(state='disabled') LabelLifeBellowThan.configure(state='disabled') PercentageLifeBellowThan.configure(state='disabled') else: CheckPrint.configure(state='normal') CheckBuff.configure(state='normal') DescLabel.configure(state='normal') ImgLabel.configure(state='normal') ButtonRecapture.configure(state='normal') ButtonAddNewRing.configure(state='normal') RButton1.configure(state='normal') RButton2.configure(state='normal') RingLabel.configure(state='normal') OptionNameRing.configure(state='normal') CheckBoxLifeBellowThan.configure(state='normal') if not CheckLifeBellowThan.get(): LabelLifeBellowThan.configure(state='disabled') PercentageLifeBellowThan.configure(state='disabled') elif CheckLifeBellowThan.get(): LabelLifeBellowThan.configure(state='normal') PercentageLifeBellowThan.configure(state='normal') def ConstantVerify(): if not EnabledAutoRing: if not CheckLifeBellowThan.get(): LabelLifeBellowThan.configure(state='disabled') PercentageLifeBellowThan.configure(state='disabled') elif CheckLifeBellowThan.get(): LabelLifeBellowThan.configure(state='normal') PercentageLifeBellowThan.configure(state='normal') self.AutoRing.After(1, ConstantVerify) Checking() CheckingButtons() ConstantVerify() self.AutoRing.loop()