Wowxel/core/cli/CliAgent.py

45 lines
1.2 KiB
Python

import cv2 as cv
from core.Logger import Logger
class CLIAgent:
def __init__(self, mainAgent) -> None:
self.isRunning = False
self.logger = Logger("CliAgent")
if (not mainAgent):
raise Exception("Main agent not found...")
self.mainAgent = mainAgent
def printMenu(self):
print("Enter a command:")
print("\tH\tHelp.")
print("\tBG\tStart the bg farming agent.")
print("\tC\tToggle fight mode ON/OFF.")
print("\tF\tStart the fishing agent.")
print("\tQ\tQuit.")
print("$>> ", end='')
def run(self):
self.isRunning = True
self.printMenu()
while self.isRunning is True:
userInput = input()
userInput = str.lower(userInput).strip()
if (userInput == "bg"):
self.mainAgent.startBgBot()
elif (userInput == "c"):
self.mainAgent.toggleFightingAgent()
elif (userInput == "f"):
self.mainAgent.startFishBot()
elif (userInput == "h"):
self.printMenu()
elif (userInput == "q"):
cv.destroyAllWindows()
self.logger.log("Exiting application...")
self.isRunning = False
else:
self.logger.log("Unknown Command.")
self.printMenu()