diff --git a/qmutants.py b/qmutants.py index 1af2bb3..91d993d 100644 --- a/qmutants.py +++ b/qmutants.py @@ -12,7 +12,9 @@ import random import sys import paho.mqtt.client as mqtt -HOST = "telnet.goldenunicorn.net" +#HOST = "telnet.goldenunicorn.net" +#HOST = "192.168.254.238" +#MQTT_ENABLED = False player_list = [] MAX_SELL_ITEMS = 1 @@ -62,6 +64,13 @@ def player_add(usr,pwd,char_sel,weapon,spell,ac,ai,me,af,hu,ba,start_year,end_ye def load_player_file(login): file = "./"+login with open(file, 'r') as login_file: + system_line = login_file.readline().strip() + system_conf = system_line.split(",") + global HOST + HOST = system_conf[0] + global MQTT_ENABLED + MQTT_ENABLED = system_conf[1] == 'True' + #quit(0) while True: in_str = login_file.readline().strip() if in_str != "": @@ -1557,12 +1566,12 @@ class mutant(QWidget): if result == "(N)onstop, (Q)uit, or (C)ontinue?": self.command_str.emit("Q") - if result == "Make your selection (G,T,F,M,S,? for help, or X to exit): ": + if "(TOP)" in result: self.command_str.emit("G\r\n") self.mqtt_str.emit(self.user+" is online") self.mqtt_str_quiet.emit(self.user,"is online") - if result == "help, or X to exit): ": + if "(DOORS)" in result: self.command_str.emit("C\r\n") if result == "Select (P,I,H,S,W,X,?): ": @@ -1812,23 +1821,26 @@ class MainWindow(QMainWindow): self.layout.addLayout(hbox1) def setup_mqtt(self): - broker_address="192.168.86.27" - #print("creating new instance") - self.client = mqtt.Client("P1") #create new instance - self.client.username_pw_set("homeassistant", "oes5gohng9gau1Quei2ohpixashi4Thidoon1shohGai2mae0ru2zaph2vooshai") - self.client.connect(broker_address) + if MQTT_ENABLED: + broker_address="192.168.86.27" + #print("creating new instance") + self.client = mqtt.Client("P1") #create new instance + self.client.username_pw_set("homeassistant", "oes5gohng9gau1Quei2ohpixashi4Thidoon1shohGai2mae0ru2zaph2vooshai") + self.client.connect(broker_address) #Send mqtt with talking def send_mqtt(self,out_str): - self.setup_mqtt() - if self.mq_check.isChecked(): - self.client.publish("mutants/talk", out_str) + if MQTT_ENABLED: + 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 MQTT_ENABLED: + self.setup_mqtt() + if self.mq_check.isChecked(): + self.client.publish("mutants/stat/"+user, out_str) if __name__ == "__main__": App = QApplication(sys.argv) diff --git a/tkls-Warrior/banks.txt b/tkls-Warrior/banks.txt new file mode 100644 index 0000000..98735ae --- /dev/null +++ b/tkls-Warrior/banks.txt @@ -0,0 +1 @@ +done,done diff --git a/tkls-login.txt b/tkls-login.txt new file mode 100644 index 0000000..0ead4c7 --- /dev/null +++ b/tkls-login.txt @@ -0,0 +1,2 @@ +192.168.254.238,False +tkls-Warrior,mypass,4,Nuclear-Decay,dispell,True,True,False,False,False,False,2000,2500,50 \ No newline at end of file