Пример #1
0
 def click(x: int, y: int, button: str = "left") -> None:
     """Click at pixel xy."""
     # No need for checking if special keys are pressed down.
     # When game is out of focus they are not sent :)
     button = Inputs.btns[button]
     Com.set_cur_pos(x + Window.x, y + Window.y)
     win32gui.SendMessage(Window.id, button.down, button.btn, 0)
     win32gui.SendMessage(Window.id, button.up, button.btn, 0)
     time.sleep(userset.SHORT_SLEEP)
     Com.restore_cur()
Пример #2
0
    def send_string(s):
        """Send string to game"""
        for c in str(s):
            # UnityEngine.UI.InputField
            vkc = win32api.VkKeyScan(c)
            win32gui.PostMessage(Window.id, wcon.WM_KEYDOWN, vkc, 0)

            # UnityEngine.Input.GetKeyDownInt
            # https://github.com/jamesjlinden/unity-decompiled/blob/master/UnityEngine/UnityEngine/KeyCode.cs
            # Unity"s keycodes matches with ascii
            Com.shortcut(ord(c))
            time.sleep(userset.SHORT_SLEEP)
Пример #3
0
 def click_drag(x: int, y: int, x2: int, y2: int, button: str = "left") -> None:
     """Simulate drag event from x, y to x2, y2"""
     button = Inputs.btns[button]
     Com.set_cur_pos(x + Window.cx, y + Window.cy)
     win32gui.SendMessage(Window.id, button.down, button.btn, 0)
     time.sleep(userset.SHORT_SLEEP)
     Com.set_cur_pos(x2 + Window.cx, y2 + Window.cy)
     win32gui.SendMessage(Window.id, wcon.WM_MOUSEMOVE, 0, 0)
     win32gui.SendMessage(Window.id, button.up, button.btn, 0)
     time.sleep(userset.SHORT_SLEEP)
     Com.restore_cur()
Пример #4
0
 def restore_special() -> None:
     """Restore special button state"""
     Com.restore_special()
Пример #5
0
 def special(special: str = "leftShift") -> None:
     """Simulate special button to be down"""
     # UnityEngine.Input.GetKeyString
     key = Inputs.specialKeys[special]
     Com.special(key)
Пример #6
0
 def send_arrow_press(a: str = "left") -> None:
     """Sends either a left, right, up or down arrow key press"""
     key = Inputs.Arrow[a]
     Com.shortcut(key)
     time.sleep(userset.SHORT_SLEEP)
Пример #7
0
 def restore_cursor() -> None:
     """Restore cursor position"""
     Com.restore_cur()
Пример #8
0
 def cursor_position(x: int, y: int) -> None:
     """Set cursor position to (x, y)"""
     Com.set_cur_pos(x + Window.cx, y + Window.cy)
Пример #9
0
 def init() -> None:
     Window.init()
     Com.init()
     Com.hook()
Пример #10
0
 def init(printCoords: bool = False) -> None:
     Window.init()
     Com.init()
     Com.hook()
Пример #11
0
from classes.match import Match
from classes.user import User
from classes.com import Com
from classes.interface import Interface
from classes.api_client import ApiClient

interface = Interface()
match = Match()
user = User()
com = Com()
api_client = ApiClient()


def reset():
    """Resets wins and rounds"""
    match.reset_rounds()
    user.reset_wins()
    com.reset_wins()


def print_default():
    """Prints the default play area"""
    interface.clear_screen()
    interface.print_banner()


def start_new_round():
    """Starts a new round and sets input"""
    match.new_round()
    interface.print_input_prompt()
    user.set_play()