Browse Source

Changes to be committed:

modified:   qmutants.py
BradDev
Brad Winkelman 3 years ago
parent
commit
a644bdc0d9
  1. 40
      qmutants.py
  2. 1
      tkls-Warrior/banks.txt
  3. 2
      tkls-login.txt

40
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)

1
tkls-Warrior/banks.txt

@ -0,0 +1 @@
done,done

2
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
Loading…
Cancel
Save