Browse Source

12/23/2022

BradDev
Joe DiPrima 3 years ago
parent
commit
e5f910ab45
  1. 65
      qmutants.py

65
qmutants.py

@ -20,23 +20,29 @@ print("choice:"+sys.argv[1])
if choice == 1: if choice == 1:
usr_1 = "epilectrik" usr_1 = "epilectrik"
pwrd_1 = "gupass" pwrd_1 = "gupass"
char_sel_1 = 4
usr_2 = "im bait" usr_2 = "im bait"
pwrd_2 = "gupass" pwrd_2 = "gupass"
char_sel_2 = 4
if choice == 2: if choice == 2:
usr_1 = "Mtron" usr_1 = "Mtron"
pwrd_1 = "gupass" pwrd_1 = "gupass"
char_sel_1 = 4
usr_2 = "IonJunkies-Merc" usr_2 = "IonJunkies-Merc"
pwrd_2 = "gupass" pwrd_2 = "gupass"
char_sel_2 = 4
if choice == 3: if choice == 3:
usr_1 = "doctor" usr_1 = "doctor"
pwrd_1 = "gupass" pwrd_1 = "gupass"
char_sel_1 = 2
usr_2 = "robin-hood" usr_2 = "robin-hood"
pwrd_2 = "gupass" pwrd_2 = "gupass"
char_sel_2 = 1
#this is a thing that i wrote #this is a thing that i wrote
#static lists #static lists
@ -83,7 +89,7 @@ class mutant(QWidget):
command_str = pyqtSignal(str) command_str = pyqtSignal(str)
mqtt_str = pyqtSignal(str) mqtt_str = pyqtSignal(str)
mqtt_str_quiet = pyqtSignal(str,str) mqtt_str_quiet = pyqtSignal(str,str)
def __init__(self,user,password):
def __init__(self,user,password,char_sel):
QWidget.__init__(self) QWidget.__init__(self)
#file related #file related
self.path=user self.path=user
@ -101,12 +107,13 @@ class mutant(QWidget):
self.wander = False self.wander = False
self.bait = False self.bait = False
self.auto_combat = True self.auto_combat = True
self.auto_ion = False
self.auto_ion = True
self.auto_farm = False self.auto_farm = False
self.key_detect = False self.key_detect = False
#states #states
self.time_steps = 0 self.time_steps = 0
self.in_play = False
self.in_combat = False self.in_combat = False
self.hits = 0 self.hits = 0
self.lock_key="[" self.lock_key="["
@ -123,13 +130,14 @@ class mutant(QWidget):
self.farm_year=2000 self.farm_year=2000
self.year_limit=2500 self.year_limit=2500
self.no_action_cnt = 0 self.no_action_cnt = 0
self.na_thresh = 50
self.na_thresh = 150
self.status = "" self.status = ""
self.area = "" self.area = ""
#account #account
self.user = user self.user = user
self.password = password self.password = password
self.char_sel = char_sel
self.logged_in = False self.logged_in = False
#timers #timers
@ -212,6 +220,7 @@ class mutant(QWidget):
def reconnect(self): def reconnect(self):
self.logged_in = False self.logged_in = False
print("obj restarting") print("obj restarting")
#create buttons #create buttons
def button_group(self): def button_group(self):
hbox1 = QHBoxLayout() hbox1 = QHBoxLayout()
@ -262,6 +271,7 @@ class mutant(QWidget):
self.ac_check.setChecked(True) self.ac_check.setChecked(True)
self.af_check = QCheckBox("Auto Farm") self.af_check = QCheckBox("Auto Farm")
self.ai_check = QCheckBox("Auto Ion") self.ai_check = QCheckBox("Auto Ion")
self.ai_check.setChecked(True)
self.me_check = QCheckBox("Meander") self.me_check = QCheckBox("Meander")
self.ba_check = QCheckBox("Bait") self.ba_check = QCheckBox("Bait")
@ -284,8 +294,8 @@ class mutant(QWidget):
def createSettingsGroup(self): def createSettingsGroup(self):
self.settingsGroupBox = QFormLayout() self.settingsGroupBox = QFormLayout()
self.fy_input = QLineEdit("2000") self.fy_input = QLineEdit("2000")
self.na_input = QLineEdit("50")
self.yl_input = QLineEdit("2300")
self.na_input = QLineEdit("150")
self.yl_input = QLineEdit("2500")
self.path_input = QLineEdit("0") self.path_input = QLineEdit("0")
self.settingsGroupBox.addRow(QLabel("Farm Year:"),self.fy_input) self.settingsGroupBox.addRow(QLabel("Farm Year:"),self.fy_input)
@ -370,18 +380,18 @@ class mutant(QWidget):
#heal timer #heal timer
def heal_trig(self): def heal_trig(self):
if self.heal:
if self.heal and self.logged_in and self.in_play:
self.command_str.emit("heal\r\n") self.command_str.emit("heal\r\n")
# self.mqtt_str_quiet.emit(self.user," is healing." ) # self.mqtt_str_quiet.emit(self.user," is healing." )
#wield timer #wield timer
def wield_trig(self): def wield_trig(self):
if self.in_combat:
if self.in_combat and self.logged_in and self.in_play:
self.command_str.emit("wie nuclear-decay\r\n") self.command_str.emit("wie nuclear-decay\r\n")
#wander timer #wander timer
def wander_trig(self): def wander_trig(self):
if self.wander and not self.in_combat and self.path_step == 0:
if self.wander and self.logged_in and self.in_play and not self.in_combat and self.path_step == 0:
self.area_indexed = False self.area_indexed = False
self.local_monsters = [] self.local_monsters = []
self.local_items = [] self.local_items = []
@ -419,13 +429,13 @@ class mutant(QWidget):
#stat timer #stat timer
def stat_trig(self): def stat_trig(self):
if not self.in_combat and self.path_step ==0:
self.command_str.emit("stat\r\n")
self.command_str.emit("look\r\n")
if self.logged_in and self.in_play and not self.in_combat and self.path_step == 0:
self.command_str.emit("stat\r\n")
self.command_str.emit("look\r\n")
#path timer #path timer
def path_trig(self): def path_trig(self):
if not self.in_combat:
if self.logged_in and self.in_play and not self.in_combat:
self.path_process() self.path_process()
#search a list #search a list
@ -759,8 +769,13 @@ class mutant(QWidget):
if self.no_action_cnt > self.na_thresh: if self.no_action_cnt > self.na_thresh:
self.time_travel() self.time_travel()
self.no_action_cnt = 0 self.no_action_cnt = 0
#New area, take a look
#New area, take a look
#Detect in play
if result.find("Prepare to walk a thousand years!") != -1:
self.in_play = True
print("Character in play..")
#New area, set index, get location #New area, set index, get location
if result.find("Compass:") != -1: if result.find("Compass:") != -1:
res_filter = result.replace("Compass:","") res_filter = result.replace("Compass:","")
@ -931,12 +946,12 @@ class mutant(QWidget):
#Someone picked something up, remove from item list #Someone picked something up, remove from item list
if result.find("picked up the") != -1: if result.find("picked up the") != -1:
start_index = result.index('the') + 4
item_str = result[start_index:]
end_index = item_str.index('.')
item_str = item_str[:end_index]
item_str = item_str.replace(" ","")
try: try:
start_index = result.index('the') + 4
item_str = result[start_index:]
end_index = item_str.index('.')
item_str = item_str[:end_index]
item_str = item_str.replace(" ","")
self.local_items.remove(item_str) self.local_items.remove(item_str)
except: except:
pass pass
@ -970,6 +985,7 @@ class mutant(QWidget):
self.wander = False self.wander = False
self.auto_farm = False self.auto_farm = False
self.auto_combat = False self.auto_combat = False
self.in_play = False
self.ac_check.setChecked(False) self.ac_check.setChecked(False)
self.af_check.setChecked(False) self.af_check.setChecked(False)
self.ai_check.setChecked(False) self.ai_check.setChecked(False)
@ -1155,6 +1171,7 @@ class mutant(QWidget):
self.command_str.emit("G\r\n") self.command_str.emit("G\r\n")
self.mqtt_str.emit(self.user+" is online") self.mqtt_str.emit(self.user+" is online")
self.mqtt_str_quiet.emit(self.user,"is online") self.mqtt_str_quiet.emit(self.user,"is online")
if result == "help, or X to exit): ": if result == "help, or X to exit): ":
self.command_str.emit("C\r\n") self.command_str.emit("C\r\n")
@ -1162,7 +1179,7 @@ class mutant(QWidget):
self.command_str.emit("P\r\n") self.command_str.emit("P\r\n")
if result == "Select (Bury, 1-5, ?) ": if result == "Select (Bury, 1-5, ?) ":
self.command_str.emit("4\r\n")
self.command_str.emit(str(self.char_sel)+"\r\n")
#self.mutants() #self.mutants()
self.logged_in = True self.logged_in = True
@ -1243,8 +1260,8 @@ class MainWindow(QMainWindow):
self.setup_mqtt() self.setup_mqtt()
mutbox = QHBoxLayout() mutbox = QHBoxLayout()
self.m1 = mutant(usr_1,pwrd_2)
self.m2 = mutant(usr_2,pwrd_2)
self.m1 = mutant(usr_1,pwrd_2,char_sel_1)
self.m2 = mutant(usr_2,pwrd_2,char_sel_2)
mutbox.addWidget(self.m1) mutbox.addWidget(self.m1)
mutbox.addWidget(self.m2) mutbox.addWidget(self.m2)
self.m1.mqtt_str.connect(self.send_mqtt) self.m1.mqtt_str.connect(self.send_mqtt)

Loading…
Cancel
Save