more demo playing stuff
This commit is contained in:
parent
237524c1d4
commit
23c66eea44
43
gameview.py
43
gameview.py
@ -1385,6 +1385,7 @@ class gui(QtGui.QWidget):
|
|||||||
self.selectedplayer = -1
|
self.selectedplayer = -1
|
||||||
self.myflip = 0
|
self.myflip = 0
|
||||||
self.playsfx = 1
|
self.playsfx = 1
|
||||||
|
self.demo_playing = False
|
||||||
|
|
||||||
self.slide_enabled = bool(get_option("General", "slide", False))
|
self.slide_enabled = bool(get_option("General", "slide", False))
|
||||||
self.slide_available = False
|
self.slide_available = False
|
||||||
@ -1491,7 +1492,11 @@ class gui(QtGui.QWidget):
|
|||||||
self.setJudgeButtons()
|
self.setJudgeButtons()
|
||||||
self.icchat_focus()
|
self.icchat_focus()
|
||||||
|
|
||||||
|
if self.demo_playing:
|
||||||
|
return
|
||||||
|
|
||||||
server_is_2_8 = "additive" in self.features and "looping_sfx" in self.features and "effects" in self.features
|
server_is_2_8 = "additive" in self.features and "looping_sfx" in self.features and "effects" in self.features
|
||||||
|
|
||||||
if server_is_2_8:
|
if server_is_2_8:
|
||||||
self.tcp.send("SP#"+self.charside+"#%") # all hail new AO 2.8 packet
|
self.tcp.send("SP#"+self.charside+"#%") # all hail new AO 2.8 packet
|
||||||
else:
|
else:
|
||||||
@ -2131,12 +2136,6 @@ class gui(QtGui.QWidget):
|
|||||||
area = item.text().split('\n')[0]
|
area = item.text().split('\n')[0]
|
||||||
self.sendMC(area)
|
self.sendMC(area)
|
||||||
|
|
||||||
def onDemoClick(self, item):
|
|
||||||
self.tcpthread.stop()
|
|
||||||
self.demoplayer.start(item.text())
|
|
||||||
self.demoslider.setVisible(True)
|
|
||||||
self.icchatinput.setVisible(False)
|
|
||||||
|
|
||||||
def sendMC(self, content):
|
def sendMC(self, content):
|
||||||
if "cccc_ic_support" in self.features and self.showname:
|
if "cccc_ic_support" in self.features and self.showname:
|
||||||
self.tcp.send('MC#' + content + '#' + str(self.mychar) + '#' + self.showname + '#%')
|
self.tcp.send('MC#' + content + '#' + str(self.mychar) + '#' + self.showname + '#%')
|
||||||
@ -2562,6 +2561,8 @@ class gui(QtGui.QWidget):
|
|||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
logcharname = f_char
|
logcharname = f_char
|
||||||
|
|
||||||
|
timestamp = "[%d:%.2d " % (t[3], t[4]) if not self.demo_playing else ""
|
||||||
|
|
||||||
if f_char.lower() != self.charlist[f_char_id][0].lower():
|
if f_char.lower() != self.charlist[f_char_id][0].lower():
|
||||||
logcharname = self.charlist[f_char_id][0] + ' (' + f_char.decode("utf-8") + ')'
|
logcharname = self.charlist[f_char_id][0] + ' (' + f_char.decode("utf-8") + ')'
|
||||||
|
|
||||||
@ -2574,7 +2575,7 @@ class gui(QtGui.QWidget):
|
|||||||
logcharname += " (???)"
|
logcharname += " (???)"
|
||||||
|
|
||||||
if evidence == -1:
|
if evidence == -1:
|
||||||
self.icLog.append('[%d:%.2d] %s: %s' % (t[3], t[4], logcharname, chatmsg))
|
self.icLog.append(timestamp + '%s: %s' % (logcharname, chatmsg))
|
||||||
else:
|
else:
|
||||||
eviname = '(NULL) %d' % evidence
|
eviname = '(NULL) %d' % evidence
|
||||||
try:
|
try:
|
||||||
@ -2582,7 +2583,7 @@ class gui(QtGui.QWidget):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.icLog.append('[%d:%.2d] %s: %s\n%s presented an evidence: %s' % (t[3], t[4], logcharname, chatmsg, f_char, eviname.strip()))
|
self.icLog.append(timestamp + '%s: %s\n%s presented an evidence: %s' % (logcharname, chatmsg, f_char, eviname.strip()))
|
||||||
|
|
||||||
self.is_additive = (m_chatmessage[ADDITIVE] == "1")
|
self.is_additive = (m_chatmessage[ADDITIVE] == "1")
|
||||||
|
|
||||||
@ -3516,6 +3517,21 @@ class gui(QtGui.QWidget):
|
|||||||
if self.onscreen_timer_times == [0, 0, 0, 0, 0]:
|
if self.onscreen_timer_times == [0, 0, 0, 0, 0]:
|
||||||
self.onscreen_timer.stop()
|
self.onscreen_timer.stop()
|
||||||
|
|
||||||
|
def onDemoClick(self, item):
|
||||||
|
self.playerList.clear()
|
||||||
|
self.stopMusic()
|
||||||
|
self.icLog.clear()
|
||||||
|
self.ooclog.clear()
|
||||||
|
if not self.demo_playing:
|
||||||
|
for widget in [self.oocinput, self.callmodbtn, self.changechar, self.oocnameinput, self.ooclogin, self.gametab_evidence, self.gametab_msgqueue, self.gametab_iniswap, self.gametab_mute, self.gametab_pair, self.gametab_misc, self.gametab_players, self.gametab_music, self.emotedropdown, self.posdropdown, self.flipbutton, self.sfxbutton, self.nointerruptbtn, self.effectdropdown, self.slidebutton, self.deskbtn, self.additivebtn, self.areaitems, self.shownameedit, self.colordropdown]:
|
||||||
|
widget.setEnabled(False)
|
||||||
|
self.demoslider.setVisible(True)
|
||||||
|
self.icchatinput.setVisible(False)
|
||||||
|
self.tcpthread.stop()
|
||||||
|
self.demo_playing = True
|
||||||
|
|
||||||
|
self.demoplayer.start(item.text())
|
||||||
|
|
||||||
def demoSeek(self, time):
|
def demoSeek(self, time):
|
||||||
self.demoplayer.seek(time)
|
self.demoplayer.seek(time)
|
||||||
|
|
||||||
@ -3709,6 +3725,7 @@ class TCP_Thread(QtCore.QThread):
|
|||||||
color.setHsv(rainbow, 255, 255)
|
color.setHsv(rainbow, 255, 255)
|
||||||
while True:
|
while True:
|
||||||
if self.stop_now:
|
if self.stop_now:
|
||||||
|
self.parent.tcp.close()
|
||||||
self.quit()
|
self.quit()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -3890,6 +3907,7 @@ def handle_packets(caller, total):
|
|||||||
music = decode_ao_str(network[1])
|
music = decode_ao_str(network[1])
|
||||||
charid = int(network[2])
|
charid = int(network[2])
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
|
timestamp = "[%d:%.2d " % (t[3], t[4]) if not caller.parent.demo_playing else ""
|
||||||
if charid != -1:
|
if charid != -1:
|
||||||
try:
|
try:
|
||||||
name = caller.parent.charlist[charid][0]
|
name = caller.parent.charlist[charid][0]
|
||||||
@ -3898,9 +3916,9 @@ def handle_packets(caller, total):
|
|||||||
|
|
||||||
if len(network) > 3 and network[3]:
|
if len(network) > 3 and network[3]:
|
||||||
name += " ("+network[3].decode("utf-8")+")"
|
name += " ("+network[3].decode("utf-8")+")"
|
||||||
caller.IC_Log.emit('[%d:%.2d] %s changed the music to %s' % (t[3], t[4], name, music))
|
caller.IC_Log.emit(timestamp + '%s changed the music to %s' % (name, music))
|
||||||
else:
|
else:
|
||||||
caller.IC_Log.emit('[%d:%.2d] The music was changed to %s' % (t[3], t[4], music))
|
caller.IC_Log.emit(timestamp + 'The music was changed to %s' % music)
|
||||||
caller.parent.playMusic(music)
|
caller.parent.playMusic(music)
|
||||||
|
|
||||||
elif header == 'BN':
|
elif header == 'BN':
|
||||||
@ -4058,6 +4076,11 @@ def handle_packets(caller, total):
|
|||||||
|
|
||||||
caller.timerUpdate.emit(command, timer_id, time_ms)
|
caller.timerUpdate.emit(command, timer_id, time_ms)
|
||||||
|
|
||||||
|
# For demos
|
||||||
|
elif header == 'SC':
|
||||||
|
del network[0]
|
||||||
|
caller.parent.charlist = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ]
|
||||||
|
|
||||||
class PresentButton(QtGui.QLabel):
|
class PresentButton(QtGui.QLabel):
|
||||||
|
|
||||||
def __init__(self, gamegui, parent):
|
def __init__(self, gamegui, parent):
|
||||||
|
Loading…
Reference in New Issue
Block a user