Пример #1
0
class AdjustConfig:
    def __init__(self, root):
        self.AdjustConfig = GUI('AdjustConfig', 'Module: Adjust Config')
        self.AdjustConfig.DefaultWindow('AdjustConfig', [830, 616],
                                        [2.25, 2.40])

        def ScanAdjustConfig():
            print("Try Lock AdjustConfig")
            print("Try This")

        self.AdjustConfig.addButton('Ok', self.AdjustConfig.destroyWindow,
                                    [810, 25], [10, 580])

        self.AdjustConfig.loop()
Пример #2
0
                    def ManualConfig(ErrorName):
                        ManualConfiguration = GUI('ManualConfiguration', 'Manual Configuration')
                        ManualConfiguration.MainWindow('Config', [414, 202], [2, 2.36])

                        def Solving():
                            ManualConfiguration.destroyWindow()
                            return True

                        '''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.addButton('Ok', Solving, [75, 23], [310, 166])

                        ManualConfiguration.Protocol(Solving)
                        ManualConfiguration.loop()
Пример #3
0
class AutoHur:
    def __init__(self, StatsPositions, 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")

        def SetAutoHur():
            global EnabledAutoHur
            if not EnabledAutoHur:
                EnabledAutoHur = True
                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()
            else:
                EnabledAutoHur = False
                CheckingButtons()
                print("AutoHur: OFF")
                ButtonEnabled.configure(text='AutoHur: OFF',
                                        relief=RAISED,
                                        bg=rgb((127, 17, 8)))
                self.ThreadManager.PauseThread()

        def ScanAutoHur():
            while EnabledAutoHur:
                try:
                    NeedHur = ScanHur(StatsPositions)
                except Exception:
                    NeedHur = False
                    pass
                if NeedHur:
                    self.SendToClient.Press(VarHotkeyHur.get())
                    print("Hur Pressed ", VarHotkeyHur.get())
                    time.sleep(.3)
                time.sleep(.3)

        def Recapture():
            print("recapture")

        VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool(
            'CheckPrint')
        VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool(
            'CheckBuff')

        VarHotkeyHur, InitiatedHotkeyHur = self.Setter.Variables.Str(
            'HotkeyHur')

        CheckLowMana, InitiatedCheckLowMana = self.Setter.Variables.Bool(
            'CheckLowMana')

        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')

            if len(GUIChanges) != 0:
                for EachChange in range(len(GUIChanges)):
                    self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0],
                                                    GUIChanges[EachChange][1])

            self.AutoHur.destroyWindow()

        self.AutoHur.addButton('Ok', Destroy, [73, 21], [75, 225])

        global EnabledAutoHur
        if not EnabledAutoHur:
            ButtonEnabled = self.AutoHur.addButton('AutoHur: OFF', SetAutoHur,
                                                   [203, 23], [11, 195])
        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)))

        ImgHur = 'images/PlayerStats/Hur.png'
        ImageID = self.AutoHur.openImage(ImgHur, [64, 64])

        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)

        ButtonRecapture = self.AutoHur.addButton('Recapture', Recapture,
                                                 [85, 24], [20, 111])

        CheckBoxLowMana = self.AutoHur.addCheck(CheckLowMana, [118, 103],
                                                InitiatedCheckLowMana,
                                                'Stop With\nLowMana')

        def CheckingButtons():
            if EnabledAutoHur:
                Disable(CheckPrint)
                Disable(CheckBuff)

                Disable(LabelImage)
                Disable(ImgLabel)

                Disable(ButtonRecapture)
                Disable(CheckBoxLowMana)
                Disable(LabelHotkey)
                Disable(HotkeyHur)
            else:
                Enable(CheckPrint)
                Enable(CheckBuff)

                Enable(LabelImage)
                Enable(ImgLabel)

                Enable(ButtonRecapture)
                Enable(CheckBoxLowMana)
                Enable(LabelHotkey)
                Enable(HotkeyHur)
            ExecGUITrigger()

        CheckingButtons()

        self.AutoHur.Protocol(Destroy)
        self.AutoHur.loop()
Пример #4
0
class AutoSSA:
    def __init__(self, root, AmuletPositions, HealthLocation, MOUSE_OPTION,
                 ItemsPath):
        self.AutoSSA = GUI('AutoSSA', 'Module: Auto SSA')
        self.AutoSSA.DefaultWindow('AutoAmulet', [306, 397], [1.2, 2.29])
        self.Setter = GUISetter("AmuletLoader")
        self.SendToClient = Hotkey(MOUSE_OPTION)
        self.ThreadManager = ThreadManager("ThreadAutoAmulet")

        def SetAutoAmulet():
            global EnabledAutoSSA
            if not EnabledAutoSSA:
                EnabledAutoSSA = True
                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()
            else:
                EnabledAutoSSA = False
                ButtonEnabled.configure(text='AutoSSA: OFF',
                                        relief=RAISED,
                                        bg=rgb((127, 17, 8)))
                print("AutoSSA: OFF")
                Checking()
                CheckingButtons()
                self.ThreadManager.PauseThread()

        def ScanAutoAmulet():
            global Amulet
            Amulet = NameAmulet.get()
            if CheckLifeBellowThan.get():
                BellowThan = LifeBellowThan.get()
                from Modules.AutoHeal import EnabledAutoHeal
                if EnabledAutoHeal:
                    while EnabledAutoSSA and EnabledAutoHeal:
                        NoHasAmulet = ScanAmulet(AmuletPositions, Amulet,
                                                 Amulets[Amulet]["Precision"])

                        from Modules.AutoHeal import Life
                        if NoHasAmulet and Life <= BellowThan:
                            Execute()
                else:
                    from Engine.ScanStages import ScanStages
                    while EnabledAutoSSA:
                        Life = ScanStages('Life From AutoAmulet').ScanStages(
                            HealthLocation, LifeColor, LifeColorFull)

                        if Life is None:
                            Life = 0

                        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"])

                    if NoHasAmulet:
                        Execute()

        def Execute():
            if RadioButton.get() == 0:
                self.SendToClient.Press(HotkeyAmulet.get())
                print("Pressed ", HotkeyAmulet.get(),
                      " To Reallocated Your Amulet")
                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:
                        if MOUSE_OPTION == 1:
                            MousePosition = self.SendToClient.Position()
                        else:
                            MousePosition = [0, 0]

                        self.SendToClient.DragTo(
                            [X, Y],
                            [AmuletPositions[0] + 16, AmuletPositions[1] + 16])

                        if MOUSE_OPTION == 1:
                            self.SendToClient.MoveTo(MousePosition[0],
                                                     MousePosition[1])

                        print("Amulet Reallocated On: X =",
                              AmuletPositions[0] + 16, "Y =",
                              AmuletPositions[1] + 16, "From: X =", X, "Y =",
                              Y)
                        time.sleep(0.3)
                    else:
                        print("Lower Resolution Than Entered")
                        time.sleep(1)

        def Recapture():
            global WaitingForClick, Amulet
            WaitingForClick = True
            Amulet = NameAmulet.get()
            AutoSSAWindow = pygetwindow.getWindowsWithTitle(
                "Module: Auto SSA")[0]
            TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0]
            AutoSSAWindowX = self.AutoSSA.PositionOfWindow('X')
            AutoSSAWindowY = self.AutoSSA.PositionOfWindow('Y')
            time.sleep(0.1)
            TibiaAuto.minimize()
            AutoSSAWindow.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)
                    from Core.HookWindow import SaveImage
                    SaveImage(ItemsPath + 'Amulets/' + Amulet + '.png',
                              Region=(sX - 6, sY - 28, sX + 6, sY - 16))
                    WaitingForClick = False
                    Invisible.destroyWindow()
                    TibiaAuto.maximize()
                    time.sleep(0.04)
                    AutoSSAWindow.maximize()
                    AutoSSAWindow.moveTo(AutoSSAWindowX, AutoSSAWindowY)
                    break
                Invisible.UpdateWindow(X, Y)

        def AddNewAmulet():
            print('Option In Development...')

        def CheckClick():
            Checking()

        def ReturnGetPosition():
            global WaitingForClick
            WaitingForClick = True
            AutoSSAWindow = pygetwindow.getWindowsWithTitle(
                "Module: Auto SSA")[0]
            TibiaAuto = pygetwindow.getWindowsWithTitle("TibiaAuto V12")[0]
            AutoSSAWindowX = self.AutoSSA.PositionOfWindow('X')
            AutoSSAWindowY = self.AutoSSA.PositionOfWindow('Y')
            time.sleep(0.1)
            TibiaAuto.minimize()
            AutoSSAWindow.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()
                    time.sleep(0.08)
                    AutoSSAWindow.maximize()
                    AutoSSAWindow.moveTo(AutoSSAWindowX, AutoSSAWindowY)
                    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()

        VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool(
            'CheckPrint')
        VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool(
            'CheckBuff')

        RadioButton, InitiatedRadioButton = self.Setter.Variables.Int(
            'RadioButton')

        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')

        CheckLifeBellowThan, InitiatedLifeBellowThan = self.Setter.Variables.Bool(
            'LifeBellowThan')
        LifeBellowThan, InitiatedBellowThan = self.Setter.Variables.Int(
            'BellowThan')

        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(InitiatedRadioButton, RadioButton.get(), 'RadioButton')
            CheckingGUI(InitiatedNameAmulet, NameAmulet.get(), 'NameAmulet')
            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')

            if len(GUIChanges) != 0:
                for EachChange in range(len(GUIChanges)):
                    self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0],
                                                    GUIChanges[EachChange][1])

            self.AutoSSA.destroyWindow()

        self.AutoSSA.addButton('Ok', Destroy, [73, 21], [115, 365])

        global EnabledAutoSSA
        if not EnabledAutoSSA:
            ButtonEnabled = self.AutoSSA.addButton('AutoSSA: OFF',
                                                   SetAutoAmulet, [287, 23],
                                                   [11, 336])
        else:
            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)))

        BackImage = 'images/Fundo.png'
        Back = self.AutoSSA.openImage(BackImage, [150, 45])

        AmuletImages = []
        AmuletName = []
        for NameOfCurrentAmulet in Amulets:
            CurrentAmuletName = ItemsPath + 'Amulets/' + NameOfCurrentAmulet + '.png'
            CurrentAmuletImage = self.AutoSSA.openImage(
                CurrentAmuletName, [64, 64])

            AmuletImages.append(CurrentAmuletImage)
            AmuletName.append(NameOfCurrentAmulet)

        ImgLabel = self.AutoSSA.addLabel('Image To Search', [16, 22])

        def UpdateImg():
            for XAmulet in Amulets:
                if NameAmulet.get() == XAmulet:
                    self.AutoSSA.addImage(
                        AmuletImages[AmuletName.index(XAmulet)], [28, 43])

            global Amulet
            Amulet = NameAmulet.get()

        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)

        ButtonAddNewAmulet = self.AutoSSA.addButton('Add New Amulet',
                                                    AddNewAmulet, [167, 24],
                                                    [120, 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)

        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])

        def Checking():
            global FoundedImg, Amulet
            if RadioButton.get() == 0:
                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)
                if EnabledAutoSSA:
                    HotkeyOption.configure(state='disabled')
                else:
                    HotkeyOption.configure(state='normal')
            elif RadioButton.get() == 1:
                DescLabel.configure(text='Position To Search')
                self.AutoSSA.addImage(Back, [120, 165])
                FoundedImg = False

                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)
                TextEntryX.trace("w", ValidateEntryX)
                LabelY = self.AutoSSA.addLabel('Y:', [135, 185])
                EntryY = self.AutoSSA.addEntry([150, 185], TextEntryY, width=4)
                TextEntryY.trace("w", ValidateEntryY)
                if EnabledAutoSSA:
                    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 EnabledAutoSSA:
                Disable(CheckPrint)
                Disable(CheckBuff)

                Disable(DescLabel)
                Disable(ImgLabel)
                Disable(ButtonRecapture)
                Disable(ButtonAddNewAmulet)

                Disable(RButton1)
                Disable(RButton2)
                Disable(AmuletLabel)
                Disable(OptionNameAmulet)

                Disable(CheckBoxLifeBellowThan)
                Disable(LabelLifeBellowThan)
                Disable(PercentageLifeBellowThan)
            else:
                Enable(CheckPrint)
                Enable(CheckBuff)

                Enable(DescLabel)
                Enable(ImgLabel)
                Enable(ButtonRecapture)
                Enable(ButtonAddNewAmulet)

                Enable(RButton1)
                Enable(RButton2)
                Enable(AmuletLabel)
                Enable(OptionNameAmulet)

                Enable(CheckBoxLifeBellowThan)

                if not CheckLifeBellowThan.get():
                    Disable(LabelLifeBellowThan)
                    Disable(PercentageLifeBellowThan)
                elif CheckLifeBellowThan.get():
                    Enable(LabelLifeBellowThan)
                    Enable(PercentageLifeBellowThan)
            ExecGUITrigger()

        def ConstantVerify():
            if not EnabledAutoSSA:
                if not CheckLifeBellowThan.get():
                    Disable(LabelLifeBellowThan)
                    Disable(PercentageLifeBellowThan)
                elif CheckLifeBellowThan.get():
                    Enable(LabelLifeBellowThan)
                    Enable(PercentageLifeBellowThan)

                if NameAmulet.get() != Amulet:
                    UpdateImg()

                ExecGUITrigger()

            self.AutoSSA.After(200, ConstantVerify)

        Checking()
        CheckingButtons()

        ConstantVerify()

        self.AutoSSA.Protocol(Destroy)
        self.AutoSSA.loop()
Пример #5
0
class ChooseConfig:
    def __init__(self, CharName):
        self.ChooseConfig = GUI('ChooseConfig', 'Choose You Config')
        self.ChooseConfig.MainWindow('Config', [414, 202], [2, 2.36])

        '''
            This Is The Main Function If The ChooseConfig...
            
            He Is Called When The Player Click On 'Load' Or 'Create' Button.
        '''

        def CreateDefaultJson():
            ScriptToLoad = NameCreateJson.get()

            '''
                When This Function Is Called, He Take A Name From EntryBox, 
                To Do Some Checks In The File.
                
                If The File Already Exist, He Just Throw You For Root Window
                Because You Already Configure Your File.
                
                Else He Create One File With The Name Getted And Starts The Configuration
            '''

            if os.path.isfile('Scripts/' + ScriptToLoad + '.json'):
                with open('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/' + 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/' + ScriptToLoad + '.json')
                    CreateDefaultJson()
            else:

                '''
                    Here, He Copy The Base To Default Configuration,
                    
                    After The Copy, He Starts The Search For Configurations,
                    You Can See The Progress On Console,
                    If You Dont Have Any Error, It Takes, Usually Around 4 or 5 seconds
                    For Complete The Configuration
                    
                    I recommended You, If You Dont Have Any Errors In The Configuration,
                    Save Your Configuration File In Other Folder, Because If You
                    Download Another Actualization In The Github, You Can Throw The 
                    Files, To Not Have Configure Again.
                '''

                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 LoadedJson:
                    data = json.load(LoadedJson)

                time.sleep(.5)
                time.sleep(.5)

                try:
                    HealthLocation = GetHealthPosition()
                    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 Exception:
                    print('Helth Position Error')
                    data['Positions']['LifePosition'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("LifePosition")

                    pass

                try:
                    ManaLocation = GetManaPosition()
                    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 Exception:
                    print('Mana Position Error')
                    data['Positions']['ManaPosition'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("ManaPosition")

                    pass

                try:
                    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]}]")
                        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)
                    else:
                        raise Exception
                except Exception:
                    print('Battle Position Error')
                    data['Positions']['BattlePosition'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("BattlePosition")

                    pass

                try:
                    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('')
                    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 Exception:
                    print('Status Bar Error')
                    data['Boxes']['StatusBarBox'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("StatusBarBox")

                    pass

                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 Exception:
                    print('RingPosition Error')
                    data['Boxes']['RingBox'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("RingBox")

                    pass

                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 Exception:
                    print('AmuletPosition Error')
                    data['Boxes']['AmuletBox'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("AmuletBox")

                    pass

                try:
                    MapPositions[0], MapPositions[1], MapPositions[2], MapPositions[3] = GetMapPosition()
                    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 Exception:
                    print('MapPosition Error')
                    data['Boxes']['MapBox'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("MapBox")

                    pass

                try:
                    Player[0], Player[1], GameWindow[0], GameWindow[1], GameWindow[2], GameWindow[
                        3] = GetPlayerPosition()
                    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 Exception:
                    print('Player Position Error')
                    data['Positions']['PlayerPosition'][0]['Stats'] = False
                    data['Boxes']['GameWindowBox'][0]['Stats'] = False
                    with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                        json.dump(data, wJson, indent=4)

                    NumberOfExcepts.append("PlayerPosition")
                    NumberOfExcepts.append("GameWindowBox")

                    pass

                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()
                    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 Exception:
                    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)

                    NumberOfExcepts.append("SQM'sPositionError")

                    pass

                data['MouseOption'] = MouseMode.get()
                with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                    json.dump(data, wJson, indent=4)

                data['ItemsMode'] = ItemsMode.get()
                with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                    json.dump(data, wJson, indent=4)

                # Paths Setter
                from Conf.Constants import MainPath, ChestsPath, CavebotScriptsPath, ContainersNamePath

                data['Paths']['MainPath'] = MainPath

                if ItemsMode.get() == "Frames":
                    from Conf.Constants import FramesItemsPath

                    data['Paths']['ItemsPath'] = FramesItemsPath
                elif ItemsMode.get() == "Corners":
                    from Conf.Constants import CornersItemsPath

                    data['Paths']['ItemsPath'] = CornersItemsPath
                elif ItemsMode.get() == "None":
                    from Conf.Constants import NoneItemsPath

                    data['Paths']['ItemsPath'] = NoneItemsPath

                data['Paths']['ChestsPath'] = ChestsPath
                data['Paths']['ContainersNamePath'] = ContainersNamePath
                data['Paths']['CavebotScriptsPath'] = CavebotScriptsPath
                with open('Scripts/' + ScriptToLoad + '.json', 'w') as wJson:
                    json.dump(data, wJson, indent=4)

                if len(NumberOfExcepts) != 0:
                    print("\nSome Errors Occurred... Opening The Manual Config.")

                    print("Unfortunately, You Will Have To Manually Configure The Following Errors:\n")

                    time.sleep(.3)
                    self.ChooseConfig.destroyWindow()
                    time.sleep(.1)

                    def ManualConfig(ErrorName):
                        ManualConfiguration = GUI('ManualConfiguration', 'Manual Configuration')
                        ManualConfiguration.MainWindow('Config', [414, 202], [2, 2.36])

                        def Solving():
                            ManualConfiguration.destroyWindow()
                            return True

                        '''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.addButton('Ok', Solving, [75, 23], [310, 166])

                        ManualConfiguration.Protocol(Solving)
                        ManualConfiguration.loop()

                    for i in range(len(NumberOfExcepts)):
                        print("Error[" + str(i + 1) + "] =", NumberOfExcepts[i])

                    for i in range(len(NumberOfExcepts)):
                        ManualConfig(NumberOfExcepts[i])

                    print("\nExiting Of The Program... Please Solve The Errors")

                    exit(1)

                data['Stats'] = True
                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()

                '''
                    If Dont Have Any Error, He Throw You For The Root Window, In The 'Modules'
                    In the 'Root.py' File.
                '''

                root(CharName, ScriptToLoad)

        # region Valiables

        NameCreateJson = tk.StringVar()
        NameCreateJson.set('NewConfig')
        CheckAuto = tk.BooleanVar()
        CheckAuto.set(True)
        MouseMode = tk.IntVar()
        MouseMode.set(1)
        HookMode = tk.IntVar()
        HookMode.set(1)
        ItemsMode = tk.StringVar()
        ItemsMode.set("Frames")

        # endregion

        # region Buttons

        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])

        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)))

        LabelSelectOP3 = self.ChooseConfig.addLabel('Select The Items Mode', [280, 76])
        LabelSelectOP3.configure(bg=rgb((114, 94, 48)), fg='black')

        RadioFrames = self.ChooseConfig.addRadio('Frames', ItemsMode, "Frames",
                                                 [310, 95])
        RadioFrames.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)),
                              selectcolor=rgb((114, 94, 48)))
        RadioCorners = self.ChooseConfig.addRadio("Corners", ItemsMode, "Corners",
                                                  [310, 114])
        RadioCorners.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)),
                               selectcolor=rgb((114, 94, 48)))
        RadioNone = self.ChooseConfig.addRadio("None", ItemsMode, "None",
                                               [310, 133])
        RadioNone.configure(bg=rgb((114, 94, 48)), activebackground=rgb((114, 94, 48)),
                            selectcolor=rgb((114, 94, 48)))

        # endregion

        self.ChooseConfig.loop()
Пример #6
0
class ChooseConfig:
    def __init__(self, CharName):
        self.ChooseConfig = GUI('ChooseConfig', 'Choose You Config')
        self.ChooseConfig.MainWindow('Config', [414, 202], [2, 2.36])
        '''
            This Is The Main Function If The ChooseConfig...
            
            He Is Called When The Player Click On 'Load' Or 'Create' Button.
        '''
        def CreateDefaultJson():
            ScriptToLoad = NameCreateJson.get()
            '''
                When This Function Is Called, He Take A Name From EntryBox, 
                To Do Some Checks In The File.
                
                If The File Already Exist, He Just Throw You For Root Window
                Because You Already Configure Your File.
                
                Else He Create One File With The Name Getted And Starts The Configuration
            '''

            if os.path.isfile('Scripts/' + ScriptToLoad + '.json'):
                with open('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/' + 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/' + ScriptToLoad + '.json')
                    CreateDefaultJson()
            else:
                '''
                    Here, He Copy The Base To Default Configuration,
                    
                    After The Copy, He Starts The Search For Configurations,
                    You Can See The Progress On Console,
                    If You Dont Have Any Error, It Takes, Usually Around 4 or 5 seconds
                    For Complete The Configuration
                    
                    I recommended You, If You Dont Have Any Errors In The Configuration,
                    Save Your Configuration File In Other Folder, Because If You
                    Download Another Actualization In The Github, You Can Throw The 
                    Files, To Not Have Configure Again.
                '''

                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 LoadedJson:
                    data = json.load(LoadedJson)

                time.sleep(.5)
                time.sleep(.5)

                try:
                    HealthLocation = GetHealthPosition()
                    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 = GetManaPosition()
                    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()
                    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()
                    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()
                    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()
                    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'] = False
                    with open('Scripts/' + ScriptToLoad + '.json',
                              'w') as wJson:
                        json.dump(data, wJson, indent=4)
                    pass

                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()
                    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)

                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()
                '''
                    If Dont Have Any Error, He Throw You For The Root Window, In The 'Modules'
                    In the 'Root.py' File.
                '''

                root(CharName, ScriptToLoad)

        # region Valiables

        NameCreateJson = tk.StringVar()
        NameCreateJson.set('NewConfig')
        CheckAuto = tk.BooleanVar()
        CheckAuto.set(True)
        MouseMode = tk.IntVar()
        MouseMode.set(1)
        HookMode = tk.IntVar()
        HookMode.set(1)

        # endregion

        # region Buttons

        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])

        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)))

        # endregion

        self.ChooseConfig.loop()
Пример #7
0
class root:
    def __init__(self, CharName, LoadedJson):
        self.root = GUI('root', 'TibiaAuto V12')
        self.root.MainWindow('Main', [357, 530], [2, 2.36])

        self.root.addMinimalLabel(f'Logged as: {CharName}', [14, 14])

        # regions Buttons

        self.root.addButton('Healer Friend', OpenHealerFriend, [92, 23],
                            [23, 56])
        self.root.addButton('Color Change', OpenColorChange, [92, 23],
                            [23, 108])
        self.root.addButton('Ammo Restack', OpenAmmoRestack, [92, 23],
                            [23, 135])
        self.root.addButton('Auto Looter', OpenAutoLooter, [92, 23], [23, 160])

        self.root.addButton('Food Eater', OpenFoodEater, [92, 23], [23, 210])
        self.root.addButton('Auto Grouping', OpenAutoGrouping, [92, 23],
                            [23, 236])
        self.root.addButton('Sort Loot', OpenSortLoot, [92, 23], [23, 262])
        self.root.addButton('Auto Banker', OpenAutoBanker, [92, 23], [23, 288])
        self.root.addButton('Auto Seller', OpenAutoSeller, [92, 23], [23, 340])
        self.root.addButton('FPS Changer', OpenFPSChanger, [92, 23], [23, 366])

        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])
        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])

        self.root.addButton('Creature Info', OpenCreatureInfo, [92, 23],
                            [147, 188])
        self.root.addButton('Monsters', OpenMonsters, [92, 23], [245, 188])

        self.root.addButton('Show Map', OpenShowMap, [92, 23], [147, 290])
        self.root.addButton('Cave Bot', OpenCaveBot, [92, 23], [245, 290])

        self.root.addButton('Load Config', OpenLoadConfig, [92, 23],
                            [147, 340])
        self.root.addButton('Save Config', OpenSaveConfig, [92, 23],
                            [245, 340])
        self.root.addButton('Adjust Config', OpenAdjustConfig, [92, 23],
                            [147, 366])
        self.root.addButton('Modules', OpenModules, [92, 23], [245, 366])
        self.root.addButton('Python Scripts', OpenPythonScripts, [92, 23],
                            [245, 392])

        self.root.addButton('General Options', OpenGeneralOptions, [213, 23],
                            [134, 426])

        def Exit():
            print("Exiting...")
            self.root.destroyWindow()

        self.root.addButton('Exit', Exit, [92, 23], [10, 498])

        # endregion
        '''
            This Functions Is Called From Line 186, As Soon As Window Is Loaded.
            
            It Sets For Program, The Variables Loaded From The Script You Chose,
            So That It Can Pass To The Modules That Are Opened.
        '''

        def SetVariablesFromLoadedJson():
            global SETTED_VARIABLES
            if not SETTED_VARIABLES:
                with open('Scripts/' + LoadedJson + '.json', 'r') as LoadsJson:
                    data = json.load(LoadsJson)

                global MOUSE_OPTION
                MOUSE_OPTION = data['MouseOption']
                if MOUSE_OPTION == 0:
                    print("Your Mouse Option Is: Send Events To Client")
                else:
                    print("Your Mouse Option Is: Movement Mouse")

                if data['Positions']['LifePosition'][0]['Stats']:
                    HealthLocation[0] = data['Positions']['LifePosition'][0][
                        'x']
                    HealthLocation[1] = data['Positions']['LifePosition'][0][
                        'y']
                if data['Positions']['ManaPosition'][0]['Stats']:
                    ManaLocation[0] = data['Positions']['ManaPosition'][0]['x']
                    ManaLocation[1] = data['Positions']['ManaPosition'][0]['y']
                if data['Boxes']['BattleBox'][0]['Stats']:
                    BattlePositions[0] = data['Boxes']['BattleBox'][0]['x'] - 3
                    BattlePositions[1] = data['Boxes']['BattleBox'][0]['y'] - 3
                    BattlePositions[2] = data['Boxes']['BattleBox'][0]['w'] + 3
                    BattlePositions[3] = data['Boxes']['BattleBox'][0]['h'] + 3
                if data['Boxes']['StatusBarBox'][0]['Stats']:
                    StatsPositions[
                        0] = data['Boxes']['StatusBarBox'][0]['x'] - 1
                    StatsPositions[
                        1] = data['Boxes']['StatusBarBox'][0]['y'] - 1
                    StatsPositions[2] = data['Boxes']['StatusBarBox'][0]['w']
                    StatsPositions[3] = data['Boxes']['StatusBarBox'][0]['h']
                if data['Boxes']['RingBox'][0]['Stats']:
                    RingPositions[0] = data['Boxes']['RingBox'][0]['x']
                    RingPositions[1] = data['Boxes']['RingBox'][0]['y']
                    RingPositions[2] = data['Boxes']['RingBox'][0]['w']
                    RingPositions[3] = data['Boxes']['RingBox'][0]['h']
                if data['Boxes']['AmuletBox'][0]['Stats']:
                    AmuletPositions[0] = data['Boxes']['AmuletBox'][0]['x']
                    AmuletPositions[1] = data['Boxes']['AmuletBox'][0]['y']
                    AmuletPositions[2] = data['Boxes']['AmuletBox'][0]['w']
                    AmuletPositions[3] = data['Boxes']['AmuletBox'][0]['h']
                if data['Boxes']['MapBox'][0]['Stats']:
                    MapPositions[0] = data['Boxes']['MapBox'][0]['x'] + 1
                    MapPositions[1] = data['Boxes']['MapBox'][0]['y'] + 1
                    MapPositions[2] = data['Boxes']['MapBox'][0]['w']
                    MapPositions[3] = data['Boxes']['MapBox'][0]['h'] + 1
                if data['Positions']['PlayerPosition'][0]['Stats'] and data[
                        'Boxes']['GameWindowBox'][0]['Stats']:
                    gameWindow[0] = data['Boxes']['GameWindowBox'][0]['x']
                    gameWindow[1] = data['Boxes']['GameWindowBox'][0]['y']
                    gameWindow[2] = data['Boxes']['GameWindowBox'][0]['w']
                    gameWindow[3] = data['Boxes']['GameWindowBox'][0]['h']
                    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']:
                    SQMs[0] = data['SQM']['SQM1'][0]['x']
                    SQMs[1] = data['SQM']['SQM1'][0]['y']
                    SQMs[2] = data['SQM']['SQM2'][0]['x']
                    SQMs[3] = data['SQM']['SQM2'][0]['y']
                    SQMs[4] = data['SQM']['SQM3'][0]['x']
                    SQMs[5] = data['SQM']['SQM3'][0]['y']
                    SQMs[6] = data['SQM']['SQM4'][0]['x']
                    SQMs[7] = data['SQM']['SQM4'][0]['y']
                    SQMs[8] = data['SQM']['SQM5'][0]['x']
                    SQMs[9] = data['SQM']['SQM5'][0]['y']
                    SQMs[10] = data['SQM']['SQM6'][0]['x']
                    SQMs[11] = data['SQM']['SQM6'][0]['y']
                    SQMs[12] = data['SQM']['SQM7'][0]['x']
                    SQMs[13] = data['SQM']['SQM7'][0]['y']
                    SQMs[14] = data['SQM']['SQM8'][0]['x']
                    SQMs[15] = data['SQM']['SQM8'][0]['y']
                    SQMs[16] = data['SQM']['SQM9'][0]['x']
                    SQMs[17] = data['SQM']['SQM9'][0]['y']

                SETTED_VARIABLES = True

        SetVariablesFromLoadedJson()

        self.root.loop()
Пример #8
0
class ColorChange:
    def __init__(self, root, Player):
        self.ColorChange = GUI('ColorChange', 'Module: Color Change')
        self.ColorChange.DefaultWindow('AutoHeal', [306, 472], [1.2, 2.29])

        def SetColorChange():
            global EnabledColorChange
            if not EnabledColorChange:
                EnabledColorChange = True
                ButtonEnabled.configure(text='ColorChange: ON')
                ScanColorChange()
            else:
                EnabledColorChange = False
                ButtonEnabled.configure(text='ColorChange: OFF')

        def ScanColorChange():
            while EnabledColorChange:
                if keyboard.is_pressed("c"):
                    pyautogui.PAUSE = 0.04
                    print("Pressed C")
                    ChangeColor2()
                    pyautogui.PAUSE = 0.005

        def Rotate():
            pyautogui.keyDown("ctrl")
            pyautogui.press('right')
            pyautogui.press('up')
            pyautogui.press('left')
            pyautogui.press('down')
            pyautogui.keyUp('ctrl')

        def ChangeColor():
            pyautogui.click(Player[0], Player[1])
            pyautogui.keyDown("ctrl")
            pyautogui.click(x=Player[0], y=Player[1], button='right')
            pyautogui.keyUp('ctrl')
            time.sleep(0.1)
            SetOutfit = pyautogui.locateOnScreen(
                'images/PlayerSettings/SetOutfit.png', confidence=0.9)
            if SetOutfit:
                pyautogui.click(x=SetOutfit[0], y=SetOutfit[1], button='left')

        def ChangeColor2():
            MousePosition = pyautogui.position()
            pyautogui.keyDown('shift')
            Move1(MousePosition)
            Move2(MousePosition)
            Move1(MousePosition)
            Move2(MousePosition)
            Move1(MousePosition)
            Move2(MousePosition)
            Move1(MousePosition)
            pyautogui.keyUp('shift')

        def Move1(MousePosition):
            pyautogui.moveTo(1220, 440)
            pyautogui.mouseDown(button='left')
            pyautogui.moveTo(MousePosition[0], MousePosition[1])
            pyautogui.mouseUp(button='left')

        def Move2(MousePosition):
            pyautogui.moveTo(1215, 540)
            pyautogui.mouseDown(button='left')
            pyautogui.moveTo(MousePosition[0], MousePosition[1])
            pyautogui.mouseUp(button='left')

        CheckPrint = tk.BooleanVar()
        LowMana = tk.BooleanVar()

        self.ColorChange.addButton('Ok', self.ColorChange.destroyWindow,
                                   [73, 21], [115, 440])

        global EnabledColorChange
        if not EnabledColorChange:
            ButtonEnabled = self.ColorChange.addButton('ColorChange: OFF',
                                                       SetColorChange,
                                                       [328, 29], [12, 469])
        else:
            ButtonEnabled = self.ColorChange.addButton('ColorChange: ON',
                                                       SetColorChange,
                                                       [328, 29], [12, 469])

        ButtonPrint = self.ColorChange.addCheck(CheckPrint, [10, 408],
                                                [120, 98, 51], 0,
                                                "Print on Tibia's screen")

        ButtonLowMana = self.ColorChange.addCheck(LowMana, [10, 440],
                                                  [120, 98, 51], 0,
                                                  "Low Mana Warnings")

        self.ColorChange.loop()
Пример #9
0
class AutoRing:
    def __init__(self, root, RingPositions, HealthLocation, MOUSE_OPTION):
        self.AutoRing = GUI('AutoRing', 'Module: Auto Ring')
        self.AutoRing.DefaultWindow('AutoRing', [306, 397], [1.2, 2.29])
        self.Setter = GUISetter("RingLoader")
        self.SendToClient = Hotkey(MOUSE_OPTION)
        self.ThreadManager = ThreadManager("ThreadAutoRing")

        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)
                if not ThreadStarted:
                    self.ThreadManager.NewThread(ScanAutoRing)
                else:
                    self.ThreadManager.UnPauseThread()
            else:
                EnabledAutoRing = False
                print('AutoRing: OFF')
                ButtonEnabled.configure(text='AutoRing: OFF',
                                        relief=RAISED,
                                        bg=rgb((127, 17, 8)))
                Checking()
                CheckingButtons()
                self.ThreadManager.PauseThread()

        def ScanAutoRing():
            if CheckLifeBellowThan.get():
                BellowThan = LifeBellowThan.get()
                from Modules.AutoHeal import EnabledAutoHeal
                if EnabledAutoHeal:
                    while EnabledAutoRing and EnabledAutoHeal:
                        try:
                            NoHasRing = ScanRing(RingPositions)
                        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').ScanStages(
                                HealthLocation, LifeColor, LifeColorFull)
                        except Exception:
                            Life = 100
                            pass

                        if Life is None:
                            Life = 0
                        try:
                            NoHasRing = ScanRing(RingPositions)
                        except Exception:
                            NoHasRing = False
                            pass

                        if NoHasRing and Life < BellowThan:
                            Execute()
            else:
                while EnabledAutoRing:
                    try:
                        NoHasRing = ScanRing(RingPositions)
                    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()

        VarCheckPrint, InitiatedCheckPrint = self.Setter.Variables.Bool(
            'CheckPrint')
        VarCheckBuff, InitiatedCheckBuff = self.Setter.Variables.Bool(
            'CheckBuff')

        RadioButton, InitiatedRadioButton = self.Setter.Variables.Int(
            'RadioButton')

        NameRing, InitiatedNameRing = self.Setter.Variables.Str('NameRing')
        HotkeyRing, InitiatedHotkeyRing = self.Setter.Variables.Str(
            'HotkeyRing')

        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')

        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(InitiatedRadioButton, RadioButton.get(), 'RadioButton')
            CheckingGUI(InitiatedNameRing, NameRing.get(), 'NameRing')
            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')

            if len(GUIChanges) != 0:
                for EachChange in range(len(GUIChanges)):
                    self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0],
                                                    GUIChanges[EachChange][1])

            self.AutoRing.destroyWindow()

        self.AutoRing.addButton('Ok', Destroy, [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(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])

        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], InitiatedLifeBellowThan,
            '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:
                    Disable(HotkeyOption)
                else:
                    Enable(HotkeyOption)
            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:
                    Disable(ButtonGetPosition)

                    Disable(LabelX)
                    Disable(EntryX)
                    Disable(LabelY)
                    Disable(EntryY)
                else:
                    Enable(ButtonGetPosition)

                    Enable(LabelX)
                    Enable(EntryX)
                    Enable(LabelY)
                    Enable(EntryY)
            if not CheckLifeBellowThan.get():
                Disable(LabelLifeBellowThan)
                Disable(PercentageLifeBellowThan)
            elif CheckLifeBellowThan.get():
                Enable(LabelLifeBellowThan)
                Enable(PercentageLifeBellowThan)
            ExecGUITrigger()

        def CheckingButtons():
            if EnabledAutoRing:
                Disable(CheckPrint)
                Disable(CheckBuff)

                Disable(DescLabel)
                Disable(ImgLabel)
                Disable(ButtonRecapture)
                Disable(ButtonAddNewRing)

                Disable(RButton1)
                Disable(RButton2)
                Disable(RingLabel)
                Disable(OptionNameRing)

                Disable(CheckBoxLifeBellowThan)
                Disable(LabelLifeBellowThan)
                Disable(PercentageLifeBellowThan)
            else:
                Enable(CheckPrint)
                Enable(CheckBuff)

                Enable(DescLabel)
                Enable(ImgLabel)
                Enable(ButtonRecapture)
                Enable(ButtonAddNewRing)

                Enable(RButton1)
                Enable(RButton2)
                Enable(RingLabel)
                Enable(OptionNameRing)

                Enable(CheckBoxLifeBellowThan)

                if not CheckLifeBellowThan.get():
                    Disable(LabelLifeBellowThan)
                    Disable(PercentageLifeBellowThan)
                elif CheckLifeBellowThan.get():
                    Enable(LabelLifeBellowThan)
                    Enable(PercentageLifeBellowThan)
            ExecGUITrigger()

        def ConstantVerify():
            if not EnabledAutoRing:
                if not CheckLifeBellowThan.get():
                    Disable(LabelLifeBellowThan)
                    Disable(PercentageLifeBellowThan)
                elif CheckLifeBellowThan.get():
                    Enable(LabelLifeBellowThan)
                    Enable(PercentageLifeBellowThan)
                ExecGUITrigger()

            self.AutoRing.After(1, ConstantVerify)

        Checking()
        CheckingButtons()

        ConstantVerify()

        self.AutoRing.Protocol(Destroy)
        self.AutoRing.loop()
Пример #10
0
class ShowMap:
    def __init__(self, root, SQMs, BattlePosition):
        self.ShowMap = GUI('AutoAttack', 'Module: Auto Attack')
        self.ShowMap.DefaultWindow('DefaultWindow')

        def SetAutoAttack():
            global EnabledAutoAttack
            if not EnabledAutoAttack:
                EnabledAutoAttack = True
                ButtonEnabled.configure(text='AutoAttack: ON')
                combine_funcs(ScanAutoAttack(), ScanFollowMode())
            else:
                EnabledAutoAttack = False
                ButtonEnabled.configure(text='AutoAttack: OFF')

        def ScanAutoAttack():
            if EnabledAutoAttack:
                global TargetNumber
                monster = monster2.get()
                TargetNumber = AttackTarget(monster, BattlePosition, SQMs,
                                            TargetNumber)

            if EnabledAutoAttack:
                root.after(300, ScanAutoAttack)

        def ScanFollowMode():
            if EnabledAutoAttack:
                follow_x_pos, follow_y_pos = SetFollow()

                if follow_x_pos != 0 and follow_y_pos != 0:
                    past_mouse_position = pyautogui.position()
                    pyautogui.leftClick(follow_x_pos, follow_y_pos)
                    pyautogui.moveTo(past_mouse_position)

            if EnabledAutoAttack:
                root.after(3000, ScanFollowMode)

        CheckPrint = tk.BooleanVar()
        LowMana = tk.BooleanVar()
        AttackOne = tk.BooleanVar()
        monster2 = tk.StringVar()
        monster2.set(monster)
        PriorityOne = tk.IntVar()
        PriorityOne.set(1)

        self.ShowMap.addButton('Ok', self.ShowMap.destroyWindow,
                               [84, 29, 130, 504], [127, 17, 8], [123, 13, 5])

        global EnabledAutoAttack
        if not EnabledAutoAttack:
            ButtonEnabled = self.ShowMap.addButton('AutoAttack: OFF',
                                                   SetAutoAttack,
                                                   [328, 29, 12, 469],
                                                   [127, 17, 8], [123, 13, 5])
        else:
            ButtonEnabled = self.ShowMap.addButton('AutoAttack: ON',
                                                   SetAutoAttack,
                                                   [328, 29, 12, 469],
                                                   [127, 17, 8], [123, 13, 5])

        ButtonPrint = self.ShowMap.addCheck(CheckPrint, [10, 408],
                                            [120, 98, 51], 0,
                                            "Print on Tibia's screen")

        ButtonLowMana = self.ShowMap.addCheck(LowMana, [10, 440],
                                              [120, 98, 51], 0,
                                              "Low Mana Warnings")

        CheckAttackOne = self.ShowMap.addCheck(AttackOne, [32, 74],
                                               [130, 16, 6], 1, 'Monster One')

        OptionMonstersOne = self.ShowMap.addOption(monster2, monsters,
                                                   [155, 70])

        PriorityMonstersOne = self.ShowMap.addOption(PriorityOne, priority,
                                                     [240, 70])

        self.ShowMap.loop()
Пример #11
0
class AutoHeal:
    def __init__(self, HealthLocation, MOUSE_OPTION):
        self.AutoHeal = GUI('AutoHeal', 'Module: Auto Heal')
        self.AutoHeal.DefaultWindow('AutoHeal2', [306, 372], [1.2, 2.29])
        self.Setter = GUISetter("HealthLoader")
        self.SendToClient = Hotkey(MOUSE_OPTION)
        self.Scan = ScanStages('Life')
        self.ThreadManager = ThreadManager("ThreadAutoHeal")

        def SetAutoHeal():
            global EnabledAutoHeal
            if not EnabledAutoHeal:
                EnabledAutoHeal = True
                ButtonEnabled.configure(text='AutoHealing: ON', relief=SUNKEN, bg=rgb((158, 46, 34)))
                print("AutoHealing: ON")
                CheckingButtons()
                if not ThreadStarted:
                    self.ThreadManager.NewThread(scanning_auto_life)
                else:
                    self.ThreadManager.UnPauseThread()
            else:
                EnabledAutoHeal = False
                print("AutoHealing: OFF")
                CheckingButtons()
                ButtonEnabled.configure(text='AutoHealing: OFF', relief=RAISED, bg=rgb((114, 0, 0)))
                self.ThreadManager.PauseThread()

        def scanning_auto_life():
            while EnabledAutoHeal:
                global Life
                Life = self.Scan.ScanStages(HealthLocation, LifeColor, LifeColorFull)

                if Life is None:
                    Life = 0

                if 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 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')

        for i in range(len(Stats)):
            ImageStatus = Image.open('images/Stats/' + Stats[i] + '.webp')
            ImageStatus = ImageStatus.resize((13, 13), Image.ANTIALIAS)
            ImageStatus = ImageTk.PhotoImage(ImageStatus)
            ImageStats.append(ImageStatus)

        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(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(InitiatedCheckFire, VarCheckFire.get(), 'CheckFire')
            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')

            if len(GUIChanges) != 0:
                for EachChange in range(len(GUIChanges)):
                    self.Setter.SetVariables.SetVar(GUIChanges[EachChange][0], GUIChanges[EachChange][1])

            self.AutoHeal.destroyWindow()

        self.AutoHeal.addButton('Ok', Destroy, [73, 21], [115, 340])

        ''' button enable healing '''

        global EnabledAutoHeal
        if not EnabledAutoHeal:
            ButtonEnabled = self.AutoHeal.addButton('AutoHealing: OFF', SetAutoHeal, [287, 23], [11, 311])
        else:
            ButtonEnabled = self.AutoHeal.addButton('AutoHealing: ON', SetAutoHeal, [287, 23], [11, 311])
            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])

        def CheckingButtons():
            if EnabledAutoHeal:
                Disable(CheckStats)
                Disable(StageThree)
                Disable(StageTwo)
                Disable(StageOne)
                Disable(LabelHotkey)
                Disable(LabelPercentage)
                Disable(PercentageStageOne)
                Disable(HotkeyStageOne)
                Disable(PercentageStageTwo)
                Disable(HotkeyStageTwo)
                Disable(PercentageStageThree)
                Disable(HotkeyStageThree)
                Disable(Paralyze)
                Disable(Poison)
                Disable(Fire)
                Disable(Electrify)
                Disable(Mort)
                Disable(Blood)
                Disable(CheckPrint)
                Disable(CheckBuff)
            else:
                Enable(CheckStats)
                Enable(StageThree)
                Enable(StageTwo)
                Enable(StageOne)
                Enable(LabelHotkey)
                Enable(LabelPercentage)
                Enable(PercentageStageOne)
                Enable(HotkeyStageOne)
                Enable(PercentageStageTwo)
                Enable(HotkeyStageTwo)
                Enable(PercentageStageThree)
                Enable(HotkeyStageThree)
                Enable(CheckPrint)
                Enable(CheckBuff)
                if not VarCheckCureStats.get():
                    Disable(Paralyze)
                    Disable(Poison)
                    Disable(Fire)
                    Disable(Electrify)
                    Disable(Mort)
                    Disable(Blood)
                elif VarCheckCureStats.get():
                    Enable(Paralyze)
                    Enable(Poison)
                    Enable(Fire)
                    Enable(Electrify)
                    Enable(Mort)
                    Enable(Blood)
            ExecGUITrigger()

        def ConstantVerify():
            if not EnabledAutoHeal:
                if not VarCheckCureStats.get():
                    Disable(Paralyze)
                    Disable(Poison)
                    Disable(Fire)
                    Disable(Electrify)
                    Disable(Mort)
                    Disable(Blood)
                elif VarCheckCureStats.get():
                    Enable(Paralyze)
                    Enable(Poison)
                    Enable(Fire)
                    Enable(Electrify)
                    Enable(Mort)
                    Enable(Blood)
                ExecGUITrigger()

            self.AutoHeal.After(30, ConstantVerify)

        CheckingButtons()

        ConstantVerify()

        self.AutoHeal.Protocol(Destroy)
        self.AutoHeal.loop()
Пример #12
0
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()