Improvement on fishbot + config + idling bot

This commit is contained in:
2024-09-12 01:58:36 -04:00
parent 446e584b66
commit db5b3a521c
12 changed files with 133 additions and 12 deletions
+4
View File
@@ -0,0 +1,4 @@
class Config:
def __init__(self) -> None:
## PASS JSON CONFIG HERE AND DECLARE IT TO THE MAIN AGENT
pass
+10 -2
View File
@@ -1,13 +1,21 @@
from core.Monitor import Monitor
from bots.fishing.FishingAgent import FishingAgent
from bots.idling.IdlingAgent import IdlingAgent
from core.Player import Player, PLAYER_STATE
class MainAgent:
def __init__(self) -> None:
self.monitor = Monitor()
self.fishingBot = FishingAgent(self.monitor)
self.playerAgent = Player()
self.idlingBot = IdlingAgent(self.playerAgent)
self.fishingBot = FishingAgent(self.monitor, self.playerAgent)
self.monitor.startScreenCaptureThread()
# Start idling agent at the construction of the mainAgent for now
self.idlingBot.run()
def startFishBot(self):
self.monitor.startScreenCaptureThread()
self.playerAgent.changeState(PLAYER_STATE.FISHING)
self.fishingBot.run()
+22
View File
@@ -0,0 +1,22 @@
import json
from enum import Enum
from core.Logger import Logger
CONNECT_STATUS = Enum('CONNECT_STATUS', ["CONNECTED", "CONNECTING", "DISCONNECTED"])
CLASSES = Enum('CLASSES', ['DRUID', 'MAGE', 'HUNTER', 'PRIEST'])
PLAYER_STATE = Enum('STATE', ['IDLE', 'FISHING', 'FARMING'])
class Player:
def __init__(self) -> None:
with open("config.json", encoding="utf-8") as jsonFile:
self.config = json.load(jsonFile)
self.isConnected = CONNECT_STATUS.DISCONNECTED
self.idleThread = None
self.logger = Logger("Player Agent")
self.state = PLAYER_STATE.IDLE
self.playerClass = self.config["class"]
self.playerName = self.config["name"]
self.logger.log("Connected with " + self.playerName + " (" + self.playerClass + ")")
def changeState(self, newState):
self.state = newState