Example #1
0
def ScanAmulet(AmuletPositions, Amulet, Precision):
    HasAmulet = [0, 0]

    HasAmulet[0], HasAmulet[1] = LocateImage('images/Items/None/Amulets/' + Amulet + '.png', Precision=Precision, Region=(
        AmuletPositions[0] - 1, AmuletPositions[1] - 1, AmuletPositions[2] + 1, AmuletPositions[3] + 1))
    if HasAmulet[0] != 0 and HasAmulet[1] != 0:
        return False
    else:
        return True
Example #2
0
def ScanAmulet(AmuletPositions, Amulet):
    HasAmulet = [0, 0]

    HasAmulet[0], HasAmulet[1] = LocateImage('images/Amulets/' + Amulet + '.png', Precision=0.9, Region=(
        AmuletPositions[0], AmuletPositions[1], AmuletPositions[2], AmuletPositions[3]))
    if HasAmulet[0] != 0 and HasAmulet[1] != 0:
        return False
    else:
        return True
Example #3
0
def GetStatsPosition():
    StatsPositions[0], StatsPositions[1] = LocateImage('images/TibiaSettings/Stop.png', Precision=0.8)
    if StatsPositions[0] != 0 and StatsPositions[1] != 0:
        StatsPositions[0] = StatsPositions[0] - 117
        StatsPositions[1] = StatsPositions[1] + 1
        StatsPositions[2] = StatsPositions[0] + 105
        StatsPositions[3] = StatsPositions[1] + 10
        return StatsPositions[0], StatsPositions[1], StatsPositions[2], StatsPositions[3]
    else:
        return 0, 0, 0, 0
Example #4
0
def ScanHur(StatsPositions):
    HasHur = [0, 0]

    HasHur[0], HasHur[1] = LocateImage(
        'images/PlayerStats/Hur.png',
        Precision=0.9,
        Region=(StatsPositions[0], StatsPositions[1], StatsPositions[2],
                StatsPositions[3]))
    if HasHur[0] != 0 and HasHur[1] != 0:
        return False
    else:
        return True
Example #5
0
def ScanRing(RingPositions):
    NoHasRing = [0, 0]

    NoHasRing[0], NoHasRing[1] = LocateImage(
        'images/PlayerStats/NoRing.png',
        Precision=0.9,
        Region=(RingPositions[0], RingPositions[1], RingPositions[2],
                RingPositions[3]))
    if NoHasRing[0] != 0 and NoHasRing[1] != 0:
        return True
    else:
        return False
Example #6
0
def CheckWaypoint(image, map_positions):
    wpt = [0, 0]
    middle_start = (map_positions[0] + 48, map_positions[1] + 48)
    middle_end = (map_positions[2] - 48, map_positions[3] - 48)

    wpt[0], wpt[1] = LocateImage('images/MapSettings/' + image + '.png', Precision=0.7, Region=(middle_start[0], middle_start[1], middle_end[0], middle_end[1]))

    if wpt[0] != 0 and wpt[1] != 0:
        print("Arrived At Mark:", image)
        return True
    else:
        print("Didn't Arrived At Mark:", image)
        return False
Example #7
0
def GetBattlePosition():
    BattlePositions[0], BattlePositions[1] = LocateCenterImage(
        'images/TibiaSettings/BattleList.png', Precision=0.85)
    if BattlePositions[0] == 0 and BattlePositions[1] == 0:
        return 0, 0, 0, 0
    else:
        BattlePositions[0], BattlePositions[1] = LocateImage(
            'images/TibiaSettings/BattleList.png', Precision=0.85)
        BattlePositions[2] = BattlePositions[0] + 155
        BattlePositions[3] = BattlePositions[1] + 415

        return int(BattlePositions[0] + 8), int(BattlePositions[1]), int(
            BattlePositions[2]), int(BattlePositions[3])
Example #8
0
def GetMapPosition():
    top_right = LocateImage("images/MapSettings/MapSettings.png", Precision=0.8)
    map_size = 110  # 110px square
    MapPositions[0], MapPositions[1] = top_right[0] - map_size + 4, top_right[1] + 1
    MapPositions[2], MapPositions[3] = top_right[0] - 1, top_right[1] + map_size - 1
    if top_right[0] != -1:
        print(f"MiniMap Start [X: {MapPositions[0]}, Y: {MapPositions[1]}]")
        print(f"MiniMap End [X: {MapPositions[2]}, Y: {MapPositions[3]}]")
        print("")
        print(f"Size of MiniMap [X: {MapPositions[2] - MapPositions[0]}, Y: {MapPositions[3] - MapPositions[1]}]")
        return MapPositions[0], MapPositions[1], MapPositions[2], MapPositions[3]
    else:
        print("Error To Get Map Positions")
        return -1, -1, -1, -1
Example #9
0
def NeedIdle():
    X, Y = LocateImage('images/TibiaSettings/Following.png', Precision=0.7)
    if X != 0 and Y != 0:
        return True
    else:
        return False
Example #10
0
def GetPlayerPosition():
    LeftGameWindow = LocateImage("images/PlayerSettings/LeftOption1.png", Precision=0.75)
    if LeftGameWindow[0] == 0 and LeftGameWindow[1] == 0:
        LeftGameWindow = LocateImage("images/PlayerSettings/LeftOption2.png", Precision=0.75)

    if LeftGameWindow[0] == 0 and LeftGameWindow[1] == 0:
        LeftGameWindow = LocateImage("images/PlayerSettings/LeftOption3.png", Precision=0.75)

    try:
        GameWindow[0] = int(LeftGameWindow[0])
        GameWindow[1] = int(LeftGameWindow[1])
    except Exception as errno:
        print("?Error On ", errno)

    RightGameWindow = LocateImage("images/PlayerSettings/RightOption1.png", Precision=0.75)
    if RightGameWindow[0] == 0 and RightGameWindow[1] == 0:
        RightGameWindow = LocateImage("images/PlayerSettings/RightOption2.png", Precision=0.75)

    if RightGameWindow[0] == 0 and RightGameWindow[1] == 0:
        RightGameWindow = LocateImage("images/PlayerSettings/RightOption3.png", Precision=0.75)

    if RightGameWindow[0] == 0 and RightGameWindow[1] == 0:
        RightGameWindow = LocateImage("images/PlayerSettings/RightOption4.png", Precision=0.75)
    try:
        GameWindow[2] = int(RightGameWindow[0])
    except Exception as errno:
        print("?Error On ", errno)

    ButtomGameWindow = LocateImage("images/PlayerSettings/EndLocation.png", Precision=0.7)
    if ButtomGameWindow[0] == 0 and ButtomGameWindow[1] == 0:
        print("BUTTON GAME WINDOWS IS NONE")
    else:
        GameWindow[3] = int(ButtomGameWindow[1])

    if GameWindow[0] != 0 and GameWindow[2] != 0:
        Player[0] = int(((GameWindow[2] - GameWindow[0]) / 2) + GameWindow[0])
    else:
        try:
            raise Exception('ex')
        except Exception as Ex:
            print('X Game Window Error... Please Press "c" With Your Mouse On Player Position')
            import keyboard
            from Conf.Hotkeys import Hotkey
            MoveMouse = Hotkey(1)
            Waiting = True
            while Waiting:
                if keyboard.is_pressed("c"):
                    x, y = MoveMouse.Position()
                    Player[0] = x
                    Player[1] = y
                    if GameWindow[0] == 0:
                        GameWindow[0] = 1
                    if GameWindow[1] == 0:
                        GameWindow[1] = 1
                    if GameWindow[2] == 0:
                        GameWindow[2] = 1
                    if GameWindow[3] == 0:
                        GameWindow[3] = 1
                    return x, y, GameWindow[0], GameWindow[1], GameWindow[2], GameWindow[3]

    if GameWindow[1] != 0 and GameWindow[3] != 0:
        Player[1] = int(((GameWindow[3] - GameWindow[1]) / 2) + GameWindow[1])
    else:
        try:
            raise Exception('Y Game Window Error')
        except Exception as Ex:
            print(Ex)
            pass

    if Player[1] != 0:
        return Player[0], Player[1], GameWindow[0], GameWindow[1], GameWindow[2], GameWindow[3]
    else:
        print("Error To Get Player Position !!!")
        return 0, 0, 0, 0, 0, 0