From c1bdce49a832db9b3c31c71f13cdcb553dbb3950 Mon Sep 17 00:00:00 2001 From: srose Date: Sun, 22 Sep 2024 20:07:09 -0400 Subject: [PATCH] Added new cli parser --- bots/fighting/FightingAgent.py | 6 ++++ bots/fighting/hunter/marksmanship/Routine.py | 4 +++ config_Aelyss.json | 8 +++++ core/Config.py | 4 +-- core/MainAgent.py | 4 +-- core/cli/CliAgent.py | 3 +- main.py | 37 +++++++++++++++++++- 7 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 bots/fighting/hunter/marksmanship/Routine.py create mode 100644 config_Aelyss.json diff --git a/bots/fighting/FightingAgent.py b/bots/fighting/FightingAgent.py index a26be22..934af26 100644 --- a/bots/fighting/FightingAgent.py +++ b/bots/fighting/FightingAgent.py @@ -9,11 +9,17 @@ class FightingAgent: self.player = player self.logger = Logger("Combat Agent", player.debug) self.hasTarget = False + self.combatClass = self.loadCombatClass() + + def loadCombatClass(self): + return 42 def startFighting(self): self.player.checkConnection() self.isCombatModeEnabled = True + while self.isCombatModeEnabled is True: + time.sleep(0.1) self.logger.log("Combat mode is now disabled...") diff --git a/bots/fighting/hunter/marksmanship/Routine.py b/bots/fighting/hunter/marksmanship/Routine.py new file mode 100644 index 0000000..5cda055 --- /dev/null +++ b/bots/fighting/hunter/marksmanship/Routine.py @@ -0,0 +1,4 @@ +class Routine: + def __init__(self, monitor, player) -> None: + self.player = player + self.monitor = monitor \ No newline at end of file diff --git a/config_Aelyss.json b/config_Aelyss.json new file mode 100644 index 0000000..efd543e --- /dev/null +++ b/config_Aelyss.json @@ -0,0 +1,8 @@ +{ + "antiAfk": true, + "class": "HUNTER", + "spe": "MARKSMANSHIP", + "debug": false, + "lang": "en", + "name": "Aelyss" +} \ No newline at end of file diff --git a/core/Config.py b/core/Config.py index 98fb793..84e834d 100644 --- a/core/Config.py +++ b/core/Config.py @@ -1,5 +1,5 @@ import json class Config: - def __init__(self) -> None: - with open("config.json", encoding="utf-8") as jsonFile: + def __init__(self, configName = "config") -> None: + with open(configName + ".json", encoding="utf-8") as jsonFile: self.file = json.load(jsonFile) \ No newline at end of file diff --git a/core/MainAgent.py b/core/MainAgent.py index 84181d8..c2db917 100644 --- a/core/MainAgent.py +++ b/core/MainAgent.py @@ -7,8 +7,8 @@ from bots.idling.IdlingAgent import IdlingAgent from core.Player import Player, PLAYER_STATE class MainAgent: - def __init__(self) -> None: - self.config = Config() + def __init__(self, configName = "config ") -> None: + self.config = Config(configName) self.monitor = Monitor(self.config) self.playerAgent = Player(self.monitor, self.config) self.idlingBot = IdlingAgent(self.monitor, self.playerAgent) diff --git a/core/cli/CliAgent.py b/core/cli/CliAgent.py index 30a04a3..8615352 100644 --- a/core/cli/CliAgent.py +++ b/core/cli/CliAgent.py @@ -5,7 +5,8 @@ class CLIAgent: def __init__(self, mainAgent) -> None: self.isRunning = False self.logger = Logger("CliAgent") - if (not mainAgent): + + if (not mainAgent): raise Exception("Main agent not found...") self.mainAgent = mainAgent diff --git a/main.py b/main.py index 540dca3..93034ad 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,44 @@ +import sys from core.cli.CliAgent import CLIAgent from core.MainAgent import MainAgent +def printLogo(): + print(""" + ,--, + ,--.'| + .---. ,---. | | : + /. ./| ' ,'\\ ,--, ,--, : : ' + .-'-. ' | / / ||'. \\/ .`| ,---. | ' | + /___/ \\: |. ; ,. :' \\/ / ; / \\ ' | | + .-'.. ' ' .' | |: : \\ \\.' / / / || | : +/___/ \\: '' | .; : \\ ; ; . ' / |' : |__ +. \\ ' .\\ | : | / \\ \\ \\ ' ; /|| | '.'| + \\ \\ ' \\ | \\ \\ /./__; ; \' | / |; : ; + \\ \\ |--" `----' | :/\\ \\ ;| : || , / + \\ \\ | `---' `--` \\ \\ / ---`-' + '---" `----' +""") + ###### MAIN ######## if __name__ == "__main__": - mainAgent = MainAgent() + configName = "config" + length = len(sys.argv) + for i in range(1, length): + arg = sys.argv[i] + if (arg == "-c" or arg == "--config"): + configName = sys.argv[i + 1] + elif (arg == "-h" or arg == "--help"): + printLogo() + print("usage: wowxel [-h] -c CONFIG_FILE_NAME") + print("wowxel: A pixel bot for World of Warcraft") + print("optional arguments:") + print("-h, --help show this help message and exit") + print("-c CONFIG_FILE_NAME, --config CONFIG_FILE_NAME Specify the path to the configuration file (config by default)") + print("\n") + quit() + + + mainAgent = MainAgent(configName) cliAgent = CLIAgent(mainAgent) cliAgent.run() \ No newline at end of file