|
|
|
@ -14,118 +14,56 @@ import paho.mqtt.client as mqtt |
|
|
|
|
|
|
|
HOST = "telnet.goldenunicorn.net" |
|
|
|
|
|
|
|
player_list = [] |
|
|
|
|
|
|
|
class player(): |
|
|
|
def __init__(self): |
|
|
|
self.usr = "" |
|
|
|
self.pwrd = "" |
|
|
|
self.char_sel = 4 |
|
|
|
self.weapon = "" |
|
|
|
self.spell = "" |
|
|
|
self.auto_combat = True |
|
|
|
self.auto_ion = True |
|
|
|
self.meander = False |
|
|
|
self.auto_farm = False |
|
|
|
self.hunt = False |
|
|
|
self.bait = False |
|
|
|
|
|
|
|
choice = int(sys.argv[1]) |
|
|
|
print("choice:"+sys.argv[1]) |
|
|
|
|
|
|
|
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" |
|
|
|
def player_add(usr,pwd,char_sel,weapon,spell,ac,ai,me,af,hu,ba): |
|
|
|
plyr = player() |
|
|
|
plyr.usr = usr |
|
|
|
plyr.pwrd = pwd |
|
|
|
plyr.char_sel = char_sel |
|
|
|
plyr.weapon = weapon |
|
|
|
plyr.spell = spell |
|
|
|
|
|
|
|
plyr.auto_combat = ac |
|
|
|
plyr.auto_ion = ai |
|
|
|
plyr.meander = me |
|
|
|
plyr.auto_farm = af |
|
|
|
plyr.hunt = hu |
|
|
|
plyr.bait = ba |
|
|
|
|
|
|
|
usr_3 = "doctor" |
|
|
|
pwrd_3 = "gupass" |
|
|
|
char_sel_3 = 2 |
|
|
|
weapon_3 = "Nuclear-Decay" |
|
|
|
spell_3 = "cure poison" |
|
|
|
player_list.append(plyr) |
|
|
|
|
|
|
|
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 = "mutant-warrior-1" |
|
|
|
pwrd_7 = "gupass" |
|
|
|
char_sel_7 = 4 |
|
|
|
weapon_7 = "nuclear-decay" |
|
|
|
spell_7 = "dispell" |
|
|
|
|
|
|
|
usr_8 = "mutant-warrior-2" |
|
|
|
pwrd_8 = "gupass" |
|
|
|
char_sel_8 = 4 |
|
|
|
weapon_8 = "nuclear-decay" |
|
|
|
spell_8 = "dispell" |
|
|
|
if choice == 1: |
|
|
|
player_add("epilectrik","gupass",4,"Nuclear-Decay","dispell",True,True,True,True,True,False) |
|
|
|
player_add("im bait","gupass",4,"Nuclear-Decay","dispell",True,True,True,True,True,False) |
|
|
|
player_add("doctor","gupass",2,"Nuclear-Decay","cure poison",True,True,False,False,False,False) |
|
|
|
player_add("robin-hood","gupass",1,"Nuclear-Decay","invisibility",True,True,False,False,False,False) |
|
|
|
player_add("assassin","gupass",4,"Nuclear-Decay","dispell",True,True,True,True,True,False) |
|
|
|
player_add("mercenary","gupass",4,"Nuclear-Decay","dispell",True,True,True,True,True,False) |
|
|
|
player_add("mutant-warrior-1","gupass",4,"Nuclear-Decay","dispell",True,True,False,False,False,False) |
|
|
|
player_add("mutant-warrior-2","gupass",4,"Nuclear-Decay","dispell",True,True,False,False,False,False) |
|
|
|
|
|
|
|
if choice == 2: |
|
|
|
usr_1 = "Mtron" |
|
|
|
pwrd_1 = "gupass" |
|
|
|
char_sel_1 = 4 |
|
|
|
weapon_1 = "Nuclear-Decay" |
|
|
|
|
|
|
|
usr_2 = "IonJunkies-Merc" |
|
|
|
pwrd_2 = "gupass" |
|
|
|
char_sel_2 = 4 |
|
|
|
weapon_2 = "Nuclear-Decay" |
|
|
|
player_add("Mtron","gupass",4,"Nuclear-Decay","dispell",True,True,False,False,False,False) |
|
|
|
player_add("IonJunkies-Merc","gupass",4,"Nuclear-Decay","dispell",True,True,False,False,False,False) |
|
|
|
|
|
|
|
#this is a thing that i wrote |
|
|
|
#static lists |
|
|
|
convert_list = ["Ion-Pack","Ion-Decay","Cheese","Nuclear-thong","Skull","Bottle-Cap","Cigarette-Butt","Knife","Gas-Grenade","Leather-Vest","Buckler","Bola","Bug-Plate", |
|
|
|
"Light-Spear","Silver-Potion","Bastard-Sword","Invisible-Knife","Great-Club","Spear","Blizzard-Staff","Devil_Key","Grey-Dagger","Bone","Axe","BlackJack", |
|
|
|
@ -170,10 +108,11 @@ 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,spell): |
|
|
|
def __init__(self,player): |
|
|
|
QWidget.__init__(self) |
|
|
|
self.player=player |
|
|
|
#file related |
|
|
|
self.path=user |
|
|
|
self.path=player.usr |
|
|
|
|
|
|
|
#dynamic lists |
|
|
|
self.local_items = [] |
|
|
|
@ -206,7 +145,7 @@ class mutant(QWidget): |
|
|
|
self.path_step = 0 |
|
|
|
self.location = [0,0] |
|
|
|
self.weapon = "Nuclear-Decay" |
|
|
|
self.spell = spell |
|
|
|
self.spell = player.spell |
|
|
|
self.watchdog = 0 |
|
|
|
|
|
|
|
#value tracking |
|
|
|
@ -226,9 +165,9 @@ class mutant(QWidget): |
|
|
|
self.console_lines = 0 |
|
|
|
|
|
|
|
#account |
|
|
|
self.user = user |
|
|
|
self.password = password |
|
|
|
self.char_sel = char_sel |
|
|
|
self.user = player.usr |
|
|
|
self.password = player.pwrd |
|
|
|
self.char_sel = player.char_sel |
|
|
|
|
|
|
|
self.logged_in = False |
|
|
|
|
|
|
|
@ -274,6 +213,7 @@ class mutant(QWidget): |
|
|
|
self.console.setStyleSheet("QTextEdit { color: white; background-color: rgb(0, 0, 0); font-size: 18px; }") |
|
|
|
self.console.clear() |
|
|
|
self.console.append("test") |
|
|
|
self.console.setMinimumHeight(300) |
|
|
|
self.layout.addWidget(self.console) |
|
|
|
|
|
|
|
#Add buttons |
|
|
|
@ -298,7 +238,7 @@ class mutant(QWidget): |
|
|
|
#settings group |
|
|
|
self.createSettingsGroup() |
|
|
|
self.layout.addLayout(self.settingsGroupBox) |
|
|
|
self.weapon_input.setText(weapon) |
|
|
|
self.weapon_input.setText(player.weapon) |
|
|
|
self.setLayout(self.layout) |
|
|
|
self.load_bank_paths() |
|
|
|
self.init_telnet() |
|
|
|
@ -319,7 +259,7 @@ class mutant(QWidget): |
|
|
|
self.tn_thread.start() |
|
|
|
|
|
|
|
def reconnect(self): |
|
|
|
self.player_init() |
|
|
|
self.player_exit() |
|
|
|
print("obj restarting") |
|
|
|
|
|
|
|
#create buttons |
|
|
|
@ -1002,25 +942,46 @@ class mutant(QWidget): |
|
|
|
def player_init(self): |
|
|
|
self.in_combat=False |
|
|
|
self.heal = False |
|
|
|
self.in_play = True |
|
|
|
self.logged_in = True |
|
|
|
self.wander = self.player.meander |
|
|
|
self.auto_farm = self.player.auto_farm |
|
|
|
self.auto_combat = self.player.auto_combat |
|
|
|
self.auto_ion = self.player.auto_ion |
|
|
|
self.hunt = self.player.hunt |
|
|
|
self.bait = self.player.bait |
|
|
|
|
|
|
|
self.ac_check.setChecked(self.auto_combat) |
|
|
|
self.af_check.setChecked(self.auto_farm) |
|
|
|
self.ai_check.setChecked(self.auto_ion) |
|
|
|
self.me_check.setChecked(self.wander) |
|
|
|
self.ba_check.setChecked(self.bait) |
|
|
|
self.hu_check.setChecked(self.hunt) |
|
|
|
|
|
|
|
#Player starting condition |
|
|
|
def player_exit(self): |
|
|
|
self.in_combat=False |
|
|
|
self.heal = False |
|
|
|
self.in_play = False |
|
|
|
self.logged_in = False |
|
|
|
self.wander = False |
|
|
|
self.auto_farm = False |
|
|
|
self.auto_combat = True |
|
|
|
self.auto_ion = True |
|
|
|
self.in_play = False |
|
|
|
self.auto_combat = False |
|
|
|
self.auto_ion = 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) |
|
|
|
self.bait = False |
|
|
|
|
|
|
|
self.ac_check.setChecked(self.auto_combat) |
|
|
|
self.af_check.setChecked(self.auto_farm) |
|
|
|
self.ai_check.setChecked(self.auto_ion) |
|
|
|
self.me_check.setChecked(self.wander) |
|
|
|
self.ba_check.setChecked(self.bait) |
|
|
|
self.hu_check.setChecked(self.hunt) |
|
|
|
|
|
|
|
#Resets connection with no activity |
|
|
|
def watchdog_t(self): |
|
|
|
if self.watchdog > 4: |
|
|
|
self.player_init() |
|
|
|
self.player_exit() |
|
|
|
self.tn_obj.close_telnet() |
|
|
|
self.watchdog = 0 |
|
|
|
else: |
|
|
|
@ -1056,6 +1017,7 @@ class mutant(QWidget): |
|
|
|
#Detect in play |
|
|
|
if result.find("Prepare to walk a thousand years!") != -1: |
|
|
|
self.in_play = True |
|
|
|
self.player_init() |
|
|
|
self.command_str.emit("blurb\r\n") |
|
|
|
self.command_str.emit("deaf\r\n") |
|
|
|
self.command_str.emit("memorize "+self.spell+"\r\n") |
|
|
|
@ -1562,67 +1524,24 @@ class MainWindow(QMainWindow): |
|
|
|
self.tab3 = QWidget() |
|
|
|
self.tab4 = QWidget() |
|
|
|
|
|
|
|
|
|
|
|
#self.tabs.addTab(self.tab2,"Group 2") |
|
|
|
#self.tabs.addTab(self.tab3,"Group 3") |
|
|
|
#self.tabs.addTab(self.tab4,"Group 4") |
|
|
|
|
|
|
|
#Create mutant objects |
|
|
|
if usr_1 != "" and usr_2 != "": |
|
|
|
mutbox1 = QHBoxLayout() |
|
|
|
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) |
|
|
|
self.m2.mqtt_str.connect(self.send_mqtt) |
|
|
|
self.m1.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.m2.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.tabs.addTab(self.tab1,"Group 1") |
|
|
|
self.tab1.setLayout(mutbox1) |
|
|
|
|
|
|
|
#Create mutant objects |
|
|
|
if usr_3 != "" and usr_4 != "": |
|
|
|
mutbox2 = QHBoxLayout() |
|
|
|
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) |
|
|
|
self.m4.mqtt_str.connect(self.send_mqtt) |
|
|
|
self.m3.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.m4.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.tabs.addTab(self.tab2,"Group 2") |
|
|
|
self.tab2.setLayout(mutbox2) |
|
|
|
|
|
|
|
#Create mutant objects |
|
|
|
if usr_5 != "" and usr_6 != "": |
|
|
|
mutbox3 = QHBoxLayout() |
|
|
|
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) |
|
|
|
self.m6.mqtt_str.connect(self.send_mqtt) |
|
|
|
self.m5.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.m6.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.tabs.addTab(self.tab3,"Group 3") |
|
|
|
self.tab3.setLayout(mutbox3) |
|
|
|
|
|
|
|
#Create mutant objects |
|
|
|
if usr_7 != "" and usr_8 != "": |
|
|
|
mutbox4 = QHBoxLayout() |
|
|
|
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) |
|
|
|
self.m8.mqtt_str.connect(self.send_mqtt) |
|
|
|
self.m7.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.m8.mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.tabs.addTab(self.tab4,"Group 4") |
|
|
|
self.tab4.setLayout(mutbox4) |
|
|
|
|
|
|
|
self.mutant_list = [] |
|
|
|
print(player_list) |
|
|
|
for player in player_list: |
|
|
|
mutbox = QHBoxLayout() |
|
|
|
print(player.usr) |
|
|
|
mut = mutant(player) |
|
|
|
self.mutant_list.append(mut) |
|
|
|
mutbox.addWidget(self.mutant_list[-1]) |
|
|
|
self.mutant_list[-1].mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.mutant_list[-1].mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
tab = QWidget() |
|
|
|
tab.setLayout(mutbox) |
|
|
|
self.tabs.addTab(tab,player.usr) |
|
|
|
|
|
|
|
#self.tab2.setLayout(self.h_2.layout) |
|
|
|
#self.tab3.setLayout(self.h_1.layout) |
|
|
|
#self.tab4.setLayout(self.h_2.layout) |
|
|
|
@ -1704,74 +1623,20 @@ class MainWindow(QMainWindow): |
|
|
|
self.send_all("west\r\n") |
|
|
|
|
|
|
|
def h_btn(self): |
|
|
|
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 |
|
|
|
for mut in mutant_list: |
|
|
|
mut.heal=True |
|
|
|
|
|
|
|
def c_btn(self): |
|
|
|
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 |
|
|
|
for mut in mutant_list: |
|
|
|
mut.combat_start() |
|
|
|
|
|
|
|
#Button send text |
|
|
|
def send_str(self): |
|
|
|
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 |
|
|
|
for mut in mutant_list: |
|
|
|
mut.command_str.emit(out_str+"\r\n") |
|
|
|
|
|
|
|
#Creates the form groupbox |
|
|
|
def createModeGroup(self): |
|
|
|
|