Esempio n. 1
0

basic_info_window = None


def on_tick() -> None:
    """
	OnTick callback.
	"""
    global basic_info_window
    if basic_info_window:
        basic_info_window.update(client.get_hp(), client.get_max_hp(),
                                 client.get_sp(), client.get_max_sp())


def on_mode_switch(mode_type: Mode, _map_name: str) -> None:
    """
	OnModeSwitch callback.
	"""
    global basic_info_window
    if mode_type == Mode.Game:
        basic_info_window = BasicInfoWindow(client.get_char_name())
        basic_info_window.open()
    elif mode_type == Mode.Login:
        if basic_info_window:
            basic_info_window.close()


bourgeon.register_callback("OnTick", on_tick)
bourgeon.register_callback("OnModeSwitch", on_mode_switch)
Esempio n. 2
0
# Called whenever a public irc message is received
def on_irc_message(server, event):
    username = event.source.nick
    message = event.arguments[0]
    channel = event.target
    ingame_notification = "(%s) %s: %s" % (channel, username, message)

    ro_client.print_in_chat(ingame_notification, 0xFFFFFF, 0)


# Called whenever an in-game chat message is received
def on_chat_message(message):
    global in_game

    if not in_game:
        in_game = True
        on_enter_ingame()


# Called when exiting
def on_exit():
    server.disconnect()


# Setup the connection, register the callbacks
server.connect(SERVER, 6667, NICKNAME)
server.add_global_handler("pubmsg", on_irc_message)
bourgeon.register_callback("OnChatMessage", on_chat_message)
bourgeon.register_callback("Tick", on_tick)
atexit.register(on_exit)
Esempio n. 3
0
            msg_id, values = message
            if msg_id == self.UiMessage.WindowClosed:
                self.close()
            elif msg_id == self.UiMessage.ComboItemSelected:
                log(f"Combo item selected: {values[0]}")
            elif msg_id == self.UiMessage.CheckBoxChecked:
                self.check_box_state = values[0]
                log(f"CheckBox state: {self.check_box_state}")
            elif msg_id == self.UiMessage.TextInputEdited:
                log(f"TextInput has been edited: {values[0]}")
            elif msg_id == self.UiMessage.ListBoxItemSelected:
                log(f"ListBox item selected: {values[0]}")

            message = self.window.read()


demo_window = DemoWindow()
demo_window.open()
log("Demo UI loaded!")


def on_tick() -> None:
    """
    OnTick callback.
    """
    global demo_window
    demo_window.handle_messages()


register_callback("OnTick", on_tick)
Esempio n. 4
0
def on_tick() -> None:
    """
    OnTick callback.
    """
    global ap_window

    ap_window.handle_messages()
    if current_mode == Mode.Game and ap_window.activated:
        hp_percent = (client.get_hp() / client.get_max_hp()) * 100.0
        sp_percent = (client.get_sp() / client.get_max_sp()) * 100.0

        if hp_percent < config.hp_min_percent:
            client.use_item(config.selected_hp_item)
        elif sp_percent < config.sp_min_percent:
            client.use_item(config.selected_sp_item)


def on_command(chat_buffer: str) -> None:
    """
    OnTalkType callback.
    """
    if chat_buffer.find("/autopot") == 0:
        ap_window.open()


bourgeon.register_callback("OnTick", on_tick)
bourgeon.register_callback("OnModeSwitch", on_mode_switch)
bourgeon.register_callback("OnTalkType", on_command)
bourgeon.log("Autopot plugin loaded!")
Esempio n. 5
0
            dir_name = parts[1]
            printf("%s $ %s %s" % (g_pwd, CMD_CD, dir_name))

            if dir_name == "..":
                pass

            if not os.path.isdir(g_pwd + "\\" + dir_name):
                printf("%s: No such file or directory" % CMD_CD)
                return
            g_pwd += "\\" + dir_name
    #cat
    elif chat_buffer.find("/%s" % CMD_CAT) == 0:
                parts = chat_buffer.split(" ")
                printf("%s $ %s" % (g_pwd, CMD_CAT))
                if len(parts) < 2:
                    return
                for i in range(1, len(parts)):
                    try:
                        f = open(g_pwd + "\\" + parts[i], "r")
                    except FileNotFoundError:
                        printf("%s: %s: No such file or directory" % (CMD_CAT, parts[i]))
                        continue
                    if f:
                        for line in f:
                            printf(line)
                        f.close()


bourgeon.log("> bash.py - The shitty bash plugin")
bourgeon.register_callback("OnTalkType", on_command)