improve getting areas on handshake

This commit is contained in:
cidoku 2025-03-12 14:18:18 -03:00
parent 0975d9c209
commit bf7248943e
2 changed files with 38 additions and 10 deletions

View File

@ -1581,6 +1581,7 @@ class GUI(QtGui.QWidget):
self.specialstream = 0
self.download_thread = None
self.tcp = None
self.demo_player = None
# Finally, load the theme
self.width = 820
@ -2776,6 +2777,7 @@ class GUI(QtGui.QWidget):
self.inboxqueue = []
self.inboxqueue.append(m_chatmessage)
self.inbox_timer.stop()
self.chat_tick_timer.stop()
self.m_chatmessage = m_chatmessage
objections = ["holdit", "objection", "takethat", "custom_objections/"+custom_objection if custom_objection != "custom" else "custom"]
@ -3846,6 +3848,7 @@ class GUI(QtGui.QWidget):
areaitem = QtGui.QListWidgetItem()
self.areaitems.addItem(areaitem)
self.allMusic()
self.update_area_list()
else:
self.no_arup = True
@ -3952,4 +3955,21 @@ class GUI(QtGui.QWidget):
if demo:
self.changechar.setText('Disconnect')
else:
self.changechar.setText('Switch &character')
self.changechar.setText('Switch &character')
def update_area_list(self):
for i in range(self.areas_len):
area_players = self.areas[0][i]
area_status = self.areas[1][i].title()
area_cm = self.areas[2][i].decode('utf-8')
area_locked = self.areas[3][i].title()
area_name = self.areas[4][i].decode('utf-8')
if area_status == "Casing":
self.areaitems.item(i).setText("%s\n%s | %s\n%s users | %s" % (area_name, area_status, area_cm, area_players, area_locked))
else:
self.areaitems.item(i).setText("%s\n%s\n%s users | %s" % (area_name, area_status, area_players, area_locked))
if area_locked == "Locked":
self.areaitems.item(i).setIcon(QtGui.QIcon(AO2XPpath + "icons/" + "lock.png"))
else:
self.areaitems.item(i).setIcon(QtGui.QIcon(AO2XPpath + "icons/" + "house.png"))

View File

@ -448,8 +448,11 @@ class AOServerInfo(QtCore.QThread):
features = []
evidence = []
playerlist = {}
musiclist = []
pingtimer = 150
readytick = -1
got_arup = False
while True:
if self.disconnect:
@ -594,16 +597,21 @@ class AOServerInfo(QtCore.QThread):
elif header == "ARUP":
del network[0]
kind = int(network[0])
areas[kind] = [network[i] for i in range(1, len(network))]
areas_len = len(areas[kind])
print '[client]', 'The server has %d areas' % areas_len
for i in areas_len:
for j in range(len(network)):
if j != kind:
caller.parent.areas[j].append("")
if musiclist:
del network[0]
areas[kind] = [network[i] for i in range(len(network))]
areas_len = len(areas[kind])
for i in range(areas_len):
for j in range(4):
if j != kind and not len(areas[j]):
areas[j] = ["" for i in range(len(network))]
if not got_arup:
print '[client]', 'The server has %d areas' % areas_len
got_arup = True
if musiclist and not len(areas[4]):
for i in range(areas_len):
areas[4].append(musiclist[0])
del musiclist[0]