Improvement on fishbot + config + idling bot
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class Config:
|
||||
def __init__(self) -> None:
|
||||
## PASS JSON CONFIG HERE AND DECLARE IT TO THE MAIN AGENT
|
||||
pass
|
||||
+10
-2
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user