From ee766e48b38250fde9097d6e80b02f0118d67afd Mon Sep 17 00:00:00 2001 From: Joe DiPrima Date: Mon, 26 Dec 2022 13:18:37 -0600 Subject: [PATCH] 12/26/2022 --- .gitignore | 4 +- qmutants.py | 135 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 94 insertions(+), 45 deletions(-) diff --git a/.gitignore b/.gitignore index 32294a8..4ab9ada 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ epilectrik/ assassin/ mercenary/ robin-hood/ -doctor/ \ No newline at end of file +doctor/ +mutant-warrior-1/ +mutant-warrior-2/ \ No newline at end of file diff --git a/qmutants.py b/qmutants.py index 07a651a..8dfcc54 100644 --- a/qmutants.py +++ b/qmutants.py @@ -102,17 +102,17 @@ if choice == 1: weapon_6 = "Nuclear-Decay" spell_6 = "dispell" - usr_7 = "" - pwrd_7 = "" + usr_7 = "mutant-warrior-1" + pwrd_7 = "gupass" char_sel_7 = 4 - weapon_7 = "" - spell_7 = "" + weapon_7 = "nuclear-decay" + spell_7 = "dispell" - usr_8 = "" - pwrd_8 = "" + usr_8 = "mutant-warrior-2" + pwrd_8 = "gupass" char_sel_8 = 4 - weapon_8 = "" - spell_8 = "" + weapon_8 = "nuclear-decay" + spell_8 = "dispell" if choice == 2: usr_1 = "Mtron" @@ -124,9 +124,6 @@ if choice == 2: pwrd_2 = "gupass" char_sel_2 = 4 weapon_2 = "Nuclear-Decay" - - - #this is a thing that i wrote #static lists @@ -141,7 +138,7 @@ farm_sell_list = ["Gold-Chunck","Nuclear-Rock","Nuclear-Waste"] farm_stock_list = ["Nuclear-Decay","Eazy-Armor","Hell-Blade"] -friend_list = ["Epilectrik","ImBait","Mtron","Im","IonJunkies-Merc","Robin-Hood","Doctor","Assassin","Mercenary"] +friend_list = ["Epilectrik","ImBait","Mtron","Im","IonJunkies-Merc","Robin-Hood","Doctor","Assassin","Mercenary","Mutant-warrior-1","Mutant-warrior-2"] help_list = ["$ - Key listener on/off", "8 - North", @@ -489,6 +486,8 @@ class mutant(QWidget): if (os.path.exists(self.path) == False): os.makedirs(self.path) f = open(file, "x") + f.write("done,done\r\n") + f.seek(0) print("creating "+file) else: print("File Exists") @@ -539,7 +538,7 @@ class mutant(QWidget): def heal_trig(self): if self.heal and self.logged_in and self.in_play: 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 def wield_trig(self): @@ -1206,27 +1205,23 @@ class mutant(QWidget): #Monster took off, remove from list if result.find("has just left") != -1: - end_index = result.index(' has') - mon_str = result[:end_index] - mon_str = mon_str.replace(" ","") try: + end_index = result.index(' has') + mon_str = result[:end_index] + mon_str = mon_str.replace(" ","") self.local_monsters.remove(mon_str) except: pass - #print(mon_str) - #print(self.local_monsters) #Monster died, remove from list if result.find("is crumbling to dust") != -1: - end_index = result.index(' is') - mon_str = result[:end_index] - mon_str = mon_str.replace(" ","") try: + end_index = result.index(' is') + mon_str = result[:end_index] + mon_str = mon_str.replace(" ","") self.local_monsters.remove(mon_str) except: pass - #print(mon_str) - #print(self.local_monsters) #Someone picked something up, remove from item list if result.find("picked up the") != -1: @@ -1239,8 +1234,6 @@ class mutant(QWidget): self.local_items.remove(item_str) except: pass - #print(item_str) - #print(self.local_items) #Dead person dropping stuff, add to local list if result.find("is falling from") != -1: @@ -1697,29 +1690,84 @@ class MainWindow(QMainWindow): #buttons def n_btn(self): - self.m1.command_str.emit("north\r\n") - self.m2.command_str.emit("north\r\n") + self.send_all("north\r\n") def s_btn(self): - self.m1.command_str.emit("south\r\n") - self.m2.command_str.emit("south\r\n") + self.send_all("south\r\n") def e_btn(self): - self.m1.command_str.emit("east\r\n") - self.m2.command_str.emit("east\r\n") + self.send_all("east\r\n") def w_btn(self): - self.m1.command_str.emit("west\r\n") - self.m2.command_str.emit("west\r\n") + self.send_all("west\r\n") + def h_btn(self): - self.m1.heal = True - self.m2.heal = True + try: + self.m1.heal = True + self.m2.heal = True + except: + pass + try: + self.m3.heal = True + self.m4.heal = True + except: + pass + try: + self.m5.heal = True + self.m6.heal = True + except: + pass + try: + self.m7.heal = True + self.m8.heal = True + except: + pass + def c_btn(self): - self.m1.combat_start() - self.m2.combat_start() - + try: + self.m1.combat_start() + self.m2.combat_start() + except: + pass + try: + self.m3.combat_start() + self.m4.combat_start() + except: + pass + try: + self.m5.combat_start() + self.m6.combat_start() + except: + pass + try: + self.m7.combat_start() + self.m8.combat_start() + except: + pass + #Button send text def send_str(self): - self.m1.command_str.emit(self.text_input.text()+"\r\n") - self.m2.command_str.emit(self.text_input.text()+"\r\n") - + self.send_all(self.text_input.text()) + + def send_all(self,out_str): + try: + self.m1.command_str.emit(out_str+"\r\n") + self.m2.command_str.emit(out_str+"\r\n") + except: + pass + try: + self.m3.command_str.emit(out_str+"\r\n") + self.m4.command_str.emit(out_str+"\r\n") + except: + pass + try: + self.m5.command_str.emit(out_str+"\r\n") + self.m6.command_str.emit(out_str+"\r\n") + except: + pass + try: + self.m7.command_str.emit(out_str+"\r\n") + self.m8.command_str.emit(self.text_input.text()+"\r\n") + except: + pass + #Creates the form groupbox def createModeGroup(self): self.mode_layout = QVBoxLayout() @@ -1744,14 +1792,13 @@ class MainWindow(QMainWindow): self.setup_mqtt() if self.mq_check.isChecked(): self.client.publish("mutants/talk", out_str) + #Send mqtt with talking def send_mqtt_quiet(self,user,out_str): self.setup_mqtt() if self.mq_check.isChecked(): self.client.publish("mutants/stat/"+user, out_str) - - - + if __name__ == "__main__": App = QApplication(sys.argv) QApplication.setQuitOnLastWindowClosed(True)