示例#1
0
async def chat_mouse_click():
    log_process("Left Clicking")
    mouse_x, mouse_y = get_mouse_position()[0], get_mouse_position()[1]
    print("Got mouse position")
    had_to_move, area, _, __ = await test_chat_mouse_pos(mouse_x, mouse_y)
    if had_to_move:
        log(f"Mouse is in unsafe spot (near {area}), relocating...")
        await move_mouse_chat_cmd(mouse_x, mouse_y)
        sleep(2)
    ACFG.left_click()
示例#2
0
async def send_chat(message: str, ocr=False):
    await check_active()
    for word in CFG.censored_words:  # TODO: More effective censoring
        if word in message:
            message = message.replace(word, "*" * len(word))
    for word in CFG.chat_overrides:
        if word in message:
            message = message.replace(word, CFG.chat_overrides[word])
    if ocr:
        ACFG.send_message(message, ocr=True)
    else:
        ACFG.send_message(message)
示例#3
0
async def do_anti_afk():
    await check_active()
    ACFG.look(direction="left", amount=45)
    await async_sleep(1)
    ACFG.look(direction="right", amount=90)
    await async_sleep(1)
    ACFG.look(direction="left", amount=45)
示例#4
0
def treehouse_to_main():
    log_process("AutoNav")
    log("Treehouse -> Main")
    ACFG.move("w", 3.3, raw=True)
    ACFG.move("d", 0.2, raw=True)
    ACFG.look("left", 1.10, raw=True)
    log_process("")
    log("")
示例#5
0
async def respawn_character(notify_chat: bool = True):
    await check_active()
    log_process("Respawning")
    if notify_chat:
        await send_chat("[Respawning!]")
    await async_sleep(0.75)
    ACFG.jump()
    await async_sleep(0.75)
    ACFG.keyPress("KEY_ESC")
    await async_sleep(0.5)
    ACFG.keyPress("r")
    await async_sleep(0.5)
    ACFG.keyPress("KEY_RETURN")
    await async_sleep(0.5)
    log_process("")
示例#6
0
async def move_mouse_chat_cmd(x: int, y: int):
    desired_x = CFG.screen_res["center_x"] + x
    desired_y = CFG.screen_res["center_y"] + y

    # Clamp
    target_x = min(CFG.screen_res["width"] - 1, desired_x)
    target_y = min(CFG.screen_res["height"] - 1, desired_y)
    target_x = max(1, target_x)
    target_y = max(1, target_y)

    had_to_move, area, target_x, target_y = await test_chat_mouse_pos(
        target_x, target_y)

    # Re-clamp
    target_x = min(CFG.screen_res["width"] - 1, target_x)
    target_y = min(CFG.screen_res["height"] - 1, target_y)
    target_x = max(1, target_x)
    target_y = max(1, target_y)

    print(target_x, target_y)
    ACFG.moveMouseAbsolute(x=target_x, y=target_y)
    ACFG.middle_click_software()
    return had_to_move, area
示例#7
0
def comedy_to_main():
    log_process("AutoNav")
    log("Comedy Machine -> Main")
    ACFG.move("w", 3.75, raw=True)
    ACFG.move("a", 0.5)
    ACFG.look("right", 0.3875, raw=True)

    log_process("")
    log("")
示例#8
0
 async def do_test(direction, amount):
     await check_active()
     await async_sleep(1)
     ACFG.move(direction, amount)
示例#9
0
def main_to_classic():
    log_process("AutoNav")
    log("Main -> BecomeFumo Classic Portal")
    ACFG.move("a", 0.25, raw=True)
    ACFG.move("s", 4.5, raw=True)
    ACFG.move("d", 1.75, raw=True)
    ACFG.move("s", 2.6, raw=True)
    ACFG.move("a", 1, raw=True)
    ACFG.move("s", 2.55, raw=True)
    ACFG.move("d", 1, raw=True)
    ACFG.move("s", 2.5, raw=True)
    ACFG.leap(forward_time=0.3, jump_time=0.25, direction_key="s")

    ACFG.move("d", 0.5, raw=True)
    ACFG.move("s", 0.3, raw=True)

    ACFG.leap(forward_time=0.3, jump_time=0.3, direction_key="s")
    ACFG.move("d", 0.2, raw=True)
    ACFG.move("s", 0.275, raw=True)
    ACFG.leap(forward_time=0.625, jump_time=0.5, direction_key="s")
    ACFG.leap(forward_time=1,
              jump_time=0.2,
              direction_key="d",
              jump_delay=0.35)
    ACFG.move("s", 0.225, raw=True)
    ACFG.leap(forward_time=0.8,
              jump_time=0.4,
              direction_key="d",
              jump_delay=0.3)
    ACFG.use()
    sleep(5)
    ACFG.move("w", 1.8, raw=True)
    ACFG.move("d", 0.125, raw=True)
    ACFG.move("w", 2.275, raw=True)
    ACFG.look("right", 0.375, raw=True)
    ACFG.move("s", 0.075, raw=True)
    ACFG.move("d", 0.06, raw=True)

    log_process("")
    log("")
示例#10
0
def main_to_train():
    log_process("AutoNav")
    log("Main -> Train Station")
    ACFG.move("a", 0.25, raw=True)
    ACFG.move("s", 4.5, raw=True)
    ACFG.move("d", 1.525, raw=True)
    ACFG.move("s", 2.9, raw=True)
    ACFG.move("d", 1, raw=True)
    ACFG.move("s", 2, raw=True)
    ACFG.move("d", 0.6, raw=True)
    ACFG.look("left", 1.5, raw=True)
    ACFG.leap(0.75, 0.75)
    ACFG.move("w", 0.75, raw=True)
    ACFG.leap(1, 1)
    ACFG.look("left", 0.75, raw=True)
    ACFG.move("s", 0.05, raw=True)
    ACFG.move("a", 0.075, raw=True)
    ACFG.move("s", 0.1, raw=True)
    log_process("")
    log("")
示例#11
0
def main_to_ratcade():
    log_process("AutoNav")
    log("Main -> Ratcade")
    ACFG.move("a", 1.5, raw=True)
    ACFG.move("w", 5, raw=True)
    ACFG.move("d", 0.5, raw=True)
    ACFG.move("w", 0.9, raw=True)
    ACFG.move("d", 2, raw=True)
    ACFG.move("w", 0.075, raw=True)
    ACFG.move("a", 0.075, raw=True)
    ACFG.move("s", 0.075, raw=True)
    ACFG.look("right", 0.75, raw=True)
    log_process("")
    log("")
示例#12
0
def main_to_shrimp_tree():
    log_process("AutoNav")
    log("Main -> Shrimp Tree")
    # If main spawn is facing North,
    # Turn to face West
    ACFG.look("left", 0.75, raw=True)
    ACFG.move("a", 1.3, raw=True)  # 0.3576
    ACFG.move("w", 0.75, raw=True)
    # Right in front of first step
    ACFG.leap(0.54, 0.475)
    # Right before first tree
    ACFG.leap(0.4, 0.4)
    # Move towards edge of tree
    ACFG.move("a", 0.1, raw=True)
    # Turn towards shrimp tree
    ACFG.look("left", 1.135, raw=True)
    # Leap to Shrimp Tree
    ACFG.leap(0.6, 0.4)
    # Face South, character looking North
    ACFG.look("right", 0.385, raw=True)
    ACFG.move("a", 0.07, raw=True)
    ACFG.move("s", 0.07, raw=True)
    ACFG.move("d", 0.07, raw=True)
    log_process("")
    log("")
示例#13
0
def main_to_treehouse():
    log_process("AutoNav")
    log("Main -> Funky Treehouse")
    ACFG.move("a", 1.5, raw=True)
    ACFG.move("w", 3, raw=True)
    ACFG.move("a", 1, raw=True)
    ACFG.move("w", 1.5, raw=True)
    ACFG.move("a", 1.1, raw=True)
    ACFG.move("s", 1, raw=True)
    ACFG.leap(forward_time=1, jump_time=1, direction_key="s")
    ACFG.move("s", 0.5, raw=True)
    ACFG.move("d", 0.5, raw=True)
    ACFG.move("w", 0.3, raw=True)
    ACFG.move("d", 0.2, raw=True)
    ACFG.leap(forward_time=0.305, jump_time=0.3, direction_key="w")
    ACFG.move("d", 0.2, raw=True)
    ACFG.leap(forward_time=0.6,
              jump_time=0.3,
              direction_key="s",
              jump_delay=0.15)

    ACFG.move("w", 0.125, raw=True)
    ACFG.leap(forward_time=0.2,
              jump_time=0.3,
              direction_key="d",
              jump_delay=0.1)
    ACFG.move("d", 0.125, raw=True)
    ACFG.leap(forward_time=0.2, jump_time=0.3, direction_key="d")
    ACFG.move("s", 0.5, raw=True)
    ACFG.leap(forward_time=0.2, jump_time=0.2, direction_key="s")
    ACFG.move("a", 0.1, raw=True)
    ACFG.move("s", 0.15, raw=True)
    ACFG.move("a", 0.8, raw=True)
    ACFG.move("w", 0.125, raw=True)
    ACFG.leap(forward_time=0.3, jump_time=0.15, direction_key="d")
    ACFG.move("d", 1.7, raw=True)
    ACFG.move("w", 0.5, raw=True)
    ACFG.move("a", 0.5, raw=True)

    ACFG.move("s", 0.41, raw=True)
    ACFG.move("d", 0.55, raw=True)
    ACFG.leap(forward_time=0.4, jump_time=0.75, direction_key="a")
    ACFG.leap(forward_time=0.2,
              jump_time=0.3,
              direction_key="d",
              jump_delay=0.1)

    ACFG.move("s", 0.075, raw=True)
    ACFG.move("a", 0.05, raw=True)
示例#14
0
from arduino_integration import ACFG

ACFG.initalize_serial_interface(do_log=True)
print("Initialized Serial")
示例#15
0
from typing import Tuple, Union

from pyautogui import position as get_mouse_position

from arduino_integration import ACFG, CFG
from config import OBS
from utilities import (
    check_active,
    kill_process,
    log,
    log_process,
    notify_admin,
    output_log,
)

ACFG.initalize_serial_interface(do_log=False)


async def send_chat(message: str, ocr=False):
    await check_active()
    for word in CFG.censored_words:  # TODO: More effective censoring
        if word in message:
            message = message.replace(word, "*" * len(word))
    for word in CFG.chat_overrides:
        if word in message:
            message = message.replace(word, CFG.chat_overrides[word])
    if ocr:
        ACFG.send_message(message, ocr=True)
    else:
        ACFG.send_message(message)