Browse Source

12/25/2022

BradDev
Joe DiPrima 3 years ago
parent
commit
06f2098438
  1. 125
      qmutants.py

125
qmutants.py

@ -21,82 +21,98 @@ usr_1 = ""
pwrd_1 = ""
char_sel_1 = 4
weapon_1 = ""
spell_1 = ""
usr_2 = ""
pwrd_2 = ""
char_sel_2 = 4
weapon_2 = ""
spell_2 = ""
usr_3 = ""
pwrd_3 = ""
char_sel_3 = 2
weapon_3 = ""
spell_3 = ""
usr_4 = ""
pwrd_4 = ""
char_sel_4 = 1
weapon_4 = ""
spell_4 = ""
usr_5 = ""
pwrd_5 = ""
char_sel_5 = 4
weapon_5 = ""
spell_5 = ""
usr_6 = ""
pwrd_6 = ""
char_sel_6 = 4
weapon_6 = ""
spell_6 = ""
usr_7 = ""
pwrd_7 = ""
char_sel_7 = 4
weapon_7 = ""
spell_7 = ""
usr_8 = ""
pwrd_8 = ""
char_sel_8 = 4
weapon_8 = ""
spell_8 = ""
if choice == 1:
usr_1 = "epilectrik"
pwrd_1 = "gupass"
char_sel_1 = 4
weapon_1 = "Nuclear-Decay"
spell_1 = "dispell"
usr_2 = "im bait"
pwrd_2 = "gupass"
char_sel_2 = 4
weapon_2 = "Nuclear-Decay"
spell_2 = "dispell"
usr_3 = "doctor"
pwrd_3 = "gupass"
char_sel_3 = 2
weapon_3 = "Nuclear-Decay"
spell_3 = "cure poison"
usr_4 = "robin-hood"
pwrd_4 = "gupass"
char_sel_4 = 1
weapon_4 = "Nuclear-Decay"
spell_4 = "invisibility"
usr_5 = "assassin"
pwrd_5 = "gupass"
char_sel_5 = 4
weapon_5 = "Nuclear-Decay"
spell_5 = "dispell"
usr_6 = "mercenary"
pwrd_6 = "gupass"
char_sel_6 = 4
weapon_6 = "Nuclear-Decay"
spell_6 = "dispell"
usr_7 = ""
pwrd_7 = ""
char_sel_7 = 4
weapon_7 = ""
spell_7 = ""
usr_8 = ""
pwrd_8 = ""
char_sel_8 = 4
weapon_8 = ""
spell_8 = ""
if choice == 2:
usr_1 = "Mtron"
@ -119,7 +135,7 @@ convert_list = ["Ion-Pack","Ion-Decay","Cheese","Nuclear-thong","Skull","Bottle-
"Golden-Key","Crystal-Key","Trident","Ice-Knife","Iron-Sickle","Gold-Spear","Fang-Dagger","Hound-Fang","Pink-Potion","Small-Dagger","Mage-Stick","Purple-Potion",
"Tree-Branch","Poker","Bronze Knife","Small-Club","Wonderous-Sword","Spell-Potion","Long-Sword","Ion-Gauntlet","Sling-Sword","Small-Spear","Iron-Mace","Iron-Boots",
"Tree-Stump","Saphire","Flame-Sword","Rock-Club","Lava-Dagger","Bloody-Arm","Golden-Needle","Ion-Booster","Devil-Key","Chain-Mail","Weak-Cloth","Splint-Mail","Rags",
"Bug-Skin","Troll-Sword","Axe","Plate-Mail","Common-Hide","Kelp-Mail","Green-Vial"]
"Bug-Skin","Troll-Sword","Axe","Plate-Mail","Common-Hide","Kelp-Mail","Green-Vial","Broken-Weapon"]
farm_sell_list = ["Gold-Chunck","Nuclear-Rock","Nuclear-Waste"]
@ -157,7 +173,7 @@ class mutant(QWidget):
command_str = pyqtSignal(str)
mqtt_str = pyqtSignal(str)
mqtt_str_quiet = pyqtSignal(str,str)
def __init__(self,user,password,char_sel,weapon):
def __init__(self,user,password,char_sel,weapon,spell):
QWidget.__init__(self)
#file related
self.path=user
@ -193,6 +209,8 @@ class mutant(QWidget):
self.path_step = 0
self.location = [0,0]
self.weapon = "Nuclear-Decay"
self.spell = spell
self.watchdog = 0
#value tracking
self.riblets = 0
@ -243,6 +261,11 @@ class mutant(QWidget):
self.path_timer.setInterval(100)
self.path_timer.timeout.connect(self.path_trig)
self.path_timer.start()
#watchdog
self.watchdog_timer = QTimer()
self.watchdog_timer.setInterval(30000)
self.watchdog_timer.timeout.connect(self.watchdog_t)
self.watchdog_timer.start()
#layout stuff
self.layout = QVBoxLayout()
@ -298,7 +321,7 @@ class mutant(QWidget):
self.tn_thread.start()
def reconnect(self):
self.logged_in = False
self.player_init()
print("obj restarting")
#create buttons
@ -618,7 +641,7 @@ class mutant(QWidget):
item_l=self.sell_list[0]
self.sell_list.pop(0)
self.command_str.emit("sell "+item_l+"\r\n")
time.sleep(.25)
time.sleep(.05)
#Stock
def stock_items(self):
@ -627,7 +650,7 @@ class mutant(QWidget):
item_l=self.stock_list[0]
self.stock_list.pop(0)
self.command_str.emit("stock "+item_l+"\r\n")
time.sleep(.25)
time.sleep(.05)
#Drop monster baits
def drop_baits(self):
@ -778,7 +801,8 @@ class mutant(QWidget):
if result.find(">") != -1:
self.stat_parsed = True
#Retally items, convert extras
if self.stat_parsed and self.status != "":
if self.stat_parsed and self.status != "":
self.watchdog = 0
for item_l in farm_sell_list:
x = self.status.count(item_l)
for i in range(x):
@ -965,7 +989,35 @@ class mutant(QWidget):
self.me_check.setChecked(False)
self.ba_check.setChecked(False)
self.hu_check.setChecked(False)
#Player starting condition
def player_init(self):
self.in_combat=False
self.heal = False
self.wander = False
self.auto_farm = False
self.auto_combat = True
self.auto_ion = True
self.in_play = False
self.hunt = False
self.logged_in = False
self.ac_check.setChecked(True)
self.af_check.setChecked(False)
self.ai_check.setChecked(True)
self.me_check.setChecked(False)
self.ba_check.setChecked(False)
self.hu_check.setChecked(False)
#Resets connection with no activity
def watchdog_t(self):
if self.watchdog > 4:
self.player_init()
self.tn_obj.close_telnet()
self.watchdog = 0
else:
self.watchdog = self.watchdog + 1
#Main game loop
def mutants(self,result):
#update farm year text box
@ -996,6 +1048,9 @@ class mutant(QWidget):
#Detect in play
if result.find("Prepare to walk a thousand years!") != -1:
self.in_play = True
self.command_str.emit("blurb\r\n")
self.command_str.emit("deaf\r\n")
self.command_str.emit("memorize "+self.spell+"\r\n")
print("Character in play..")
#New area, set index, get location
@ -1099,16 +1154,16 @@ class mutant(QWidget):
self.command_str.emit("kick\r\n")
#self.exit_game()
#GTFO
if self.wander and (((result.find("It's too dark to see anything!") != -1 and self.path_step == 0) or
result.find("You're blocked!") != -1) or
len(self.local_monsters) > 4):
self.heal = True
local_monsters = []
#Lighten
if self.wander and (result.find("It's too dark to see anything!") != -1 and self.path_step == 0):
self.command_str.emit("cast\r\n")
self.command_str.emit("tra "+str(self.farm_year)+"\r\n")
self.in_combat = False
#GTFO
#if result.find("You're blocked!") != -1 or len(self.local_monsters) > 4:
# self.heal = True
# local_monsters = []
# self.command_str.emit("tra "+str(self.farm_year)+"\r\n")
# self.in_combat = False
#Sell the loot
if (result.find("City Trading Centre") != -1 or result.find("Satan Inc. Trade Centre") != -1) and self.path_step == 0:
@ -1140,8 +1195,10 @@ class mutant(QWidget):
self.local_monsters.append(monster)
self.remove_friends()
#print(self.local_monsters)
if len(self.local_monsters) > 0 and self.auto_combat and not self.in_combat:
self.combat_start()
#Start Combat
if len(self.local_monsters) > 0 and self.auto_combat and not self.in_combat:
self.combat_start()
#Monster took off, remove from list
if result.find("has just left") != -1:
@ -1426,7 +1483,15 @@ class telnet_thread(QObject):
print("telnet connected..")
except:
print("Connection attempt failed..")
#Close telnet
def close_telnet(self):
try:
self.tn.close()
print("closing telnet...")
except:
print("Telnet close failed...")
#Decode incoming information
def decode_line(self,line):
result = ""
@ -1489,8 +1554,8 @@ class MainWindow(QMainWindow):
#Create mutant objects
if usr_1 != "" and usr_2 != "":
mutbox1 = QHBoxLayout()
self.m1 = mutant(usr_1,pwrd_2,char_sel_1,weapon_1)
self.m2 = mutant(usr_2,pwrd_2,char_sel_2,weapon_2)
self.m1 = mutant(usr_1,pwrd_2,char_sel_1,weapon_1,spell_1)
self.m2 = mutant(usr_2,pwrd_2,char_sel_2,weapon_2,spell_2)
mutbox1.addWidget(self.m1)
mutbox1.addWidget(self.m2)
self.m1.mqtt_str.connect(self.send_mqtt)
@ -1503,8 +1568,8 @@ class MainWindow(QMainWindow):
#Create mutant objects
if usr_3 != "" and usr_4 != "":
mutbox2 = QHBoxLayout()
self.m3 = mutant(usr_3,pwrd_3,char_sel_3,weapon_3)
self.m4 = mutant(usr_4,pwrd_4,char_sel_4,weapon_4)
self.m3 = mutant(usr_3,pwrd_3,char_sel_3,weapon_3,spell_3)
self.m4 = mutant(usr_4,pwrd_4,char_sel_4,weapon_4,spell_4)
mutbox2.addWidget(self.m3)
mutbox2.addWidget(self.m4)
self.m3.mqtt_str.connect(self.send_mqtt)
@ -1517,8 +1582,8 @@ class MainWindow(QMainWindow):
#Create mutant objects
if usr_5 != "" and usr_6 != "":
mutbox3 = QHBoxLayout()
self.m5 = mutant(usr_5,pwrd_5,char_sel_5,weapon_5)
self.m6 = mutant(usr_6,pwrd_6,char_sel_6,weapon_6)
self.m5 = mutant(usr_5,pwrd_5,char_sel_5,weapon_5,spell_5)
self.m6 = mutant(usr_6,pwrd_6,char_sel_6,weapon_6,spell_6)
mutbox3.addWidget(self.m5)
mutbox3.addWidget(self.m6)
self.m5.mqtt_str.connect(self.send_mqtt)
@ -1531,8 +1596,8 @@ class MainWindow(QMainWindow):
#Create mutant objects
if usr_7 != "" and usr_8 != "":
mutbox4 = QHBoxLayout()
self.m7 = mutant(usr_7,pwrd_7,char_sel_7,weapon_7)
self.m8 = mutant(usr_8,pwrd_8,char_sel_8,weapon_8)
self.m7 = mutant(usr_7,pwrd_7,char_sel_7,weapon_7,spell_7)
self.m8 = mutant(usr_8,pwrd_8,char_sel_8,weapon_8,spell_8)
mutbox4.addWidget(self.m7)
mutbox4.addWidget(self.m8)
self.m7.mqtt_str.connect(self.send_mqtt)

Loading…
Cancel
Save