Added new cli parser

This commit is contained in:
srose 2024-09-22 20:07:09 -04:00
parent 9b0fe2183b
commit c1bdce49a8
7 changed files with 60 additions and 6 deletions

View File

@ -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...")

View File

@ -0,0 +1,4 @@
class Routine:
def __init__(self, monitor, player) -> None:
self.player = player
self.monitor = monitor

8
config_Aelyss.json Normal file
View File

@ -0,0 +1,8 @@
{
"antiAfk": true,
"class": "HUNTER",
"spe": "MARKSMANSHIP",
"debug": false,
"lang": "en",
"name": "Aelyss"
}

View File

@ -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)

View File

@ -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)

View File

@ -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

37
main.py
View File

@ -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()