refactoring + improving the visuals of the joining process

This commit is contained in:
cidoku 2026-02-07 19:20:00 -03:00
parent 967809a404
commit 968ea04abe
8 changed files with 305 additions and 317 deletions

View File

@ -43,7 +43,7 @@ class AOtcpSocket(object):
if tempdata:
contents = tempdata + contents
tempdata = ""
totals = contents.split('%')
del totals[-1]
for i in range(len(totals)):

View File

@ -53,13 +53,14 @@ class charselect(QtGui.QWidget):
self.btns = []
self.chartaken = []
self.max_chars_on_page = 0
self.prevpage = PixmapButton(self, QtGui.QPixmap(AO2XPpath + "themes/default/arrow_left.png"))
self.nextpage = PixmapButton(self, QtGui.QPixmap(AO2XPpath + "themes/default/arrow_right.png"))
self.setButtons()
self.setBtnImage.connect(self.setButtonImage)
self.hide()
def setButtons(self):
#directly stolen from ao2 source code and default theme because i was stuck (i'm so sorry)
@ -120,10 +121,10 @@ class charselect(QtGui.QWidget):
char = charList[ind][0].lower()
charid = charList[ind][2] if filtered else ind
if exists(AOpath + "characters/"+ char +"/char_icon.png"): # AO2
self.setBtnImage.emit(AOpath + "characters/"+ char +"/char_icon.png", i, charid)
elif exists(AOpath + "misc/demothings/"+ char +"_char_icon.png"): # AO 1.7.5/1.8
self.setBtnImage.emit(AOpath + "misc/demothings/"+ char +"_char_icon.png", i, charid)
if exists(BASE_PATH + "characters/"+ char +"/char_icon.png"): # AO2
self.setBtnImage.emit(BASE_PATH + "characters/"+ char +"/char_icon.png", i, charid)
elif exists(BASE_PATH + "misc/demothings/"+ char +"_char_icon.png"): # AO 1.7.5/1.8
self.setBtnImage.emit(BASE_PATH + "misc/demothings/"+ char +"_char_icon.png", i, charid)
else:
self.setBtnImage.emit("placeholder.png", i, charid)
@ -144,7 +145,7 @@ class charselect(QtGui.QWidget):
self.showCharPage(charList)
def quitToLobby(self):
self.parent.gamewindow.returnToMenu()
self.parent.mainWindow.returnToMenu()
def setCharList(self, charList):
self.charList = charList
@ -183,14 +184,20 @@ class charselect(QtGui.QWidget):
self.showCharPage()
def selectChar(self, charIndex):
self.hide()
self.parent.tcp.send("CC#0#"+str(charIndex)+"##%")
if not self.parent.gotPV:
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
self.parent.setDisabled(True)
self.parent.mainWindow.setFixedSize(self.parent.width, self.parent.height)
self.parent.mainWindow.center()
def onCancel(self):
self.hide()
self.parent.gamewindow.setFixedSize(self.parent.width, self.parent.height)
self.parent.gamewindow.center()
self.parent.mainWindow.setFixedSize(self.parent.width, self.parent.height)
self.parent.mainWindow.center()
def show(self):
super(charselect, self).show()
self.parent.gamewindow.setFixedSize(714, 668)
self.parent.gamewindow.center()
self.parent.mainWindow.setFixedSize(714, 668)
self.parent.mainWindow.center()

View File

@ -1,5 +1,7 @@
GAME_VERSION = "2.9.4"
AOpath = "base/"
GAME_VERSION = "2.9.5"
YEAR = "2026"
BASE_PATH = "base/"
AO2XPpath = "AO2XPbase/"
DESK_MOD = 1

View File

@ -172,7 +172,7 @@ class DemoPicker(QtGui.QDialog):
def __init__(self, parent):
super(DemoPicker, self).__init__()
self.setModal(True)
self.gamewindow = parent
self.mainWindow = parent
self.parent = parent
self.setWindowTitle("Select a demo file...")
@ -204,8 +204,8 @@ class DemoPicker(QtGui.QDialog):
if not fname:
return
self.gamewindow.gamewidget.startDemo(fname)
self.gamewindow.stackwidget.setCurrentWidget(self.gamewindow.gamewidget)
self.mainWindow.gameWidget.startDemo(fname)
self.mainWindow.widgetStack.setCurrentWidget(self.mainWindow.gameWidget)
self.hide()
def get_demo_treeview():

View File

@ -25,7 +25,7 @@ def delay(msec):
def getCharIni(char, section, value, default=""):
tempini = ConfigParser()
return ini.read_ini(AOpath + 'characters/' + char.lower() + '/char.ini', section, value, default)
return ini.read_ini(BASE_PATH + 'characters/' + char.lower() + '/char.ini', section, value, default)
def getOption(section, value, default=""):
tempini = ConfigParser()
@ -320,13 +320,13 @@ class AOCharMovie(QtGui.QLabel):
pEmote = pEmote.lower()
apngPath = testPath(
AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".apng",
AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".apng",
AOpath + "characters/" + pChar + "/" + pEmote + ".apng",
AOpath + "characters/" + pChar + "/(a)" + pEmote + ".apng",
AOpath + "characters/" + pChar + "/(b)" + pEmote + ".apng",
AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".apng",
AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".apng"
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + pEmote + ".apng",
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".apng",
BASE_PATH + "characters/" + pChar + "/" + pEmote + ".apng",
BASE_PATH + "characters/" + pChar + "/(a)" + pEmote + ".apng",
BASE_PATH + "characters/" + pChar + "/(b)" + pEmote + ".apng",
BASE_PATH + "characters/" + pChar + "/(a)/" + pEmote + ".apng",
BASE_PATH + "characters/" + pChar + "/(b)/" + pEmote + ".apng"
)
placeholderPath = AO2XPpath + "themes/default/oldplaceholder.gif"
@ -337,13 +337,13 @@ class AOCharMovie(QtGui.QLabel):
self.usePillow = 1
else:
pngPath = testPath(
AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".png",
AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".png",
AOpath + "characters/" + pChar + "/" + pEmote + ".png",
AOpath + "characters/" + pChar + "/(a)" + pEmote + ".png",
AOpath + "characters/" + pChar + "/(b)" + pEmote + ".png",
AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".png",
AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".png"
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + pEmote + ".png",
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".png",
BASE_PATH + "characters/" + pChar + "/" + pEmote + ".png",
BASE_PATH + "characters/" + pChar + "/(a)" + pEmote + ".png",
BASE_PATH + "characters/" + pChar + "/(b)" + pEmote + ".png",
BASE_PATH + "characters/" + pChar + "/(a)/" + pEmote + ".png",
BASE_PATH + "characters/" + pChar + "/(b)/" + pEmote + ".png"
)
if pngPath:
@ -351,13 +351,13 @@ class AOCharMovie(QtGui.QLabel):
self.usePillow = 0
else:
webpPath = testPath(
AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".webp",
AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".webp",
AOpath + "characters/" + pChar + "/" + pEmote + ".webp",
AOpath + "characters/" + pChar + "/(a)" + pEmote + ".webp",
AOpath + "characters/" + pChar + "/(b)" + pEmote + ".webp",
AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".webp",
AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".webp"
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + pEmote + ".webp",
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".webp",
BASE_PATH + "characters/" + pChar + "/" + pEmote + ".webp",
BASE_PATH + "characters/" + pChar + "/(a)" + pEmote + ".webp",
BASE_PATH + "characters/" + pChar + "/(b)" + pEmote + ".webp",
BASE_PATH + "characters/" + pChar + "/(a)/" + pEmote + ".webp",
BASE_PATH + "characters/" + pChar + "/(b)/" + pEmote + ".webp"
)
if webpPath:
@ -365,13 +365,13 @@ class AOCharMovie(QtGui.QLabel):
self.usePillow = 2
else:
gifPath = testPath(
AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".gif",
AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".gif",
AOpath + "characters/" + pChar + "/" + pEmote + ".gif",
AOpath + "characters/" + pChar + "/(a)" + pEmote + ".gif",
AOpath + "characters/" + pChar + "/(b)" + pEmote + ".gif",
AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".gif",
AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".gif"
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + pEmote + ".gif",
BASE_PATH + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".gif",
BASE_PATH + "characters/" + pChar + "/" + pEmote + ".gif",
BASE_PATH + "characters/" + pChar + "/(a)" + pEmote + ".gif",
BASE_PATH + "characters/" + pChar + "/(b)" + pEmote + ".gif",
BASE_PATH + "characters/" + pChar + "/(a)/" + pEmote + ".gif",
BASE_PATH + "characters/" + pChar + "/(b)/" + pEmote + ".gif"
)
if gifPath:
@ -440,9 +440,9 @@ class AOCharMovie(QtGui.QLabel):
def playPre(self, pChar, pEmote, duration, scaling = SCALING_AUTO):
pChar = pChar.lower()
gifPath = AOpath + "characters/" + pChar + "/" + pEmote + ".gif"
apngPath = AOpath + "characters/" + pChar + "/" + pEmote + ".apng"
webpPath = AOpath + "characters/" + pChar + "/" + pEmote + ".webp"
gifPath = BASE_PATH + "characters/" + pChar + "/" + pEmote + ".gif"
apngPath = BASE_PATH + "characters/" + pChar + "/" + pEmote + ".apng"
webpPath = BASE_PATH + "characters/" + pChar + "/" + pEmote + ".webp"
fullDuration = duration * self.timeMod
realDuration = 0
@ -489,7 +489,7 @@ class AOCharMovie(QtGui.QLabel):
def playTalking(self, pChar, pEmote, scaling = SCALING_AUTO):
pChar = pChar.lower()
gifPath = AOpath + 'characters/' + pChar + '/(b)' + pEmote + '.gif'
gifPath = BASE_PATH + 'characters/' + pChar + '/(b)' + pEmote + '.gif'
self.mMovie.stop()
self.clear()
@ -503,7 +503,7 @@ class AOCharMovie(QtGui.QLabel):
def playIdle(self, pChar, pEmote, scaling = SCALING_AUTO):
pChar = pChar.lower()
gifPath = AOpath + 'characters/' + pChar + '/(a)' + pEmote + '.gif'
gifPath = BASE_PATH + 'characters/' + pChar + '/(a)' + pEmote + '.gif'
self.mMovie.stop()
self.clear()
@ -625,8 +625,8 @@ class AOMovie(QtGui.QLabel):
if not exists(gifPath):
pathlist = [
getImageSuffix(AO2XPpath + "themes/default/" + pImage + "_bubble"),
getImageSuffix(AOpath + "characters/" + pChar + "/" + pImage),
getImageSuffix(AOpath + "misc/default/" + pImage),
getImageSuffix(BASE_PATH + "characters/" + pChar + "/" + pImage),
getImageSuffix(BASE_PATH + "misc/default/" + pImage),
getImageSuffix(AO2XPpath + "themes/default/" + pImage)
]
@ -792,7 +792,7 @@ class EditEvidenceDialog(QtGui.QDialog):
self.evidesc.setAcceptRichText(False)
self.evipicture = QtGui.QLabel(self)
self.filename = 'empty.png'
evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png')
evipic = QtGui.QPixmap(BASE_PATH + 'evidence/empty.png')
self.evipicture.setPixmap(evipic)
self.evipicture.move(434, 8)
self.evipicture.show()
@ -814,7 +814,7 @@ class EditEvidenceDialog(QtGui.QDialog):
self.browse.clicked.connect(self.onBrowseClicked)
self.browse.move(self.choosepic.x() + self.choosepic.width() + 8, self.choosepic.y())
files = os.listdir(AOpath + 'evidence')
files = os.listdir(BASE_PATH + 'evidence')
fileslength = len(files)
i = 0
while i < fileslength:
@ -837,8 +837,8 @@ class EditEvidenceDialog(QtGui.QDialog):
def choosePicChange(self, ind):
self.filename = self.filenames[ind]
if exists(AOpath + 'evidence/' + self.filename):
self.evipicture.setPixmap(QtGui.QPixmap(AOpath + 'evidence/' + self.filename))
if exists(BASE_PATH + 'evidence/' + self.filename):
self.evipicture.setPixmap(QtGui.QPixmap(BASE_PATH + 'evidence/' + self.filename))
else:
self.evipicture.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png'))
@ -866,7 +866,7 @@ class EditEvidenceDialog(QtGui.QDialog):
self.eviname.setText('')
self.evidesc.setText('')
evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png')
evipic = QtGui.QPixmap(BASE_PATH + 'evidence/empty.png')
self.evipicture.setPixmap(evipic)
self.filename = 'empty.png'
self.editing = False
@ -877,7 +877,7 @@ class EditEvidenceDialog(QtGui.QDialog):
def onCancelClicked(self):
self.eviname.setText('')
self.evidesc.setText('')
evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png')
evipic = QtGui.QPixmap(BASE_PATH + 'evidence/empty.png')
self.evipicture.setPixmap(evipic)
self.filename = 'empty.png'
self.editing = False
@ -886,7 +886,7 @@ class EditEvidenceDialog(QtGui.QDialog):
self.hide()
def onBrowseClicked(self):
path = str(QtGui.QFileDialog.getOpenFileName(self, "Select an image", AOpath + 'evidence', "Images (*.png)"))
path = str(QtGui.QFileDialog.getOpenFileName(self, "Select an image", BASE_PATH + 'evidence', "Images (*.png)"))
if path:
if not "/evidence/" in path.lower():
QtGui.QMessageBox.warning(self, 'Wrong directory', 'Please select a file from the "evidence" directory.')
@ -895,7 +895,7 @@ class EditEvidenceDialog(QtGui.QDialog):
file = basename(path)
if file.lower().endswith('.png'):
ind = os.listdir(AOpath + 'evidence').index(file)
ind = os.listdir(BASE_PATH + 'evidence').index(file)
self.choosepic.setCurrentIndex(ind)
else:
QtGui.QMessageBox.warning(self, 'Not a valid file', 'Please select a PNG image.')
@ -1026,7 +1026,7 @@ class Chatbox(QtGui.QLabel):
self.geometrySet = False
class GUI(QtGui.QWidget):
gamewindow = None
mainWindow = None
# In theory 3 sounds may play at the same time: character, evidence sweep,
# effect
soundChannels = 3
@ -1078,7 +1078,7 @@ class GUI(QtGui.QWidget):
def __init__(self, parent=None):
super(GUI, self).__init__(parent)
self.gamewindow = parent
self.mainWindow = parent
self.gotPing.connect(self.setPing)
@ -1244,7 +1244,7 @@ class GUI(QtGui.QWidget):
self.evidenceDescription = QtGui.QTextEdit(self.tabEvidence)
self.evidenceDescription.setReadOnly(True)
self.evidenceImage = QtGui.QLabel(self.tabEvidence)
self.evidenceImage.setPixmap(QtGui.QPixmap(AOpath + 'evidence/empty.png'))
self.evidenceImage.setPixmap(QtGui.QPixmap(BASE_PATH + 'evidence/empty.png'))
self.evidenceImage.show()
self.btnEvidenceAdd = QtGui.QPushButton(QtGui.QIcon(AO2XPpath + "icons/" + "add.png"), "", self.tabEvidence)
self.btnEvidenceAdd.setToolTip('Add new evidence')
@ -1507,7 +1507,7 @@ class GUI(QtGui.QWidget):
self.btnReloadTheme.setObjectName("ui_reload_theme")
self.btnSettings = QtGui.QPushButton("&Settings", self)
self.btnSettings.clicked.connect(self.gamewindow.showSettings)
self.btnSettings.clicked.connect(self.mainWindow.showSettings)
self.btnSettings.setObjectName("ui_settings")
self.boxEmotes = QtGui.QComboBox(self)
@ -1601,8 +1601,8 @@ class GUI(QtGui.QWidget):
self.btnShake.setToolTip('Show the next message with a shaking effect')
self.btnShake.setObjectName("ui_screenshake")
self.sndRealization = audio.loadHandle(False, AOpath + 'sounds/general/sfx-realization.wav', 0, 0, 0)
#self.sndShake = audio.loadHandle(False, AOpath + 'sounds/general/sfx-damage.wav', 0, 0, 0)
self.sndRealization = audio.loadHandle(False, BASE_PATH + 'sounds/general/sfx-realization.wav', 0, 0, 0)
#self.sndShake = audio.loadHandle(False, BASE_PATH + 'sounds/general/sfx-damage.wav', 0, 0, 0)
# Objections
self.btnCustomObjection = buttons.CustomObjection(self)
@ -1766,6 +1766,7 @@ class GUI(QtGui.QWidget):
self.XPDownloadThread = None
self.tcp = None
self.demoPlayer = None
self.gotPV = False
# TTS fun
self.speaker = None
@ -1786,7 +1787,7 @@ class GUI(QtGui.QWidget):
stylesheet = ""
self.emotePageGeometry = []
self.viewportScale = 0
self.gamewindow.setStyleSheet("")
self.mainWindow.setStyleSheet("")
self.chatbox.resetGeometry()
self.btnReloadTheme.setVisible(False)
self.cbBench.setVisible(True)
@ -1896,6 +1897,10 @@ class GUI(QtGui.QWidget):
move[e].move(*d[0:2])
else:
move[e].move(-500, -500)
if "courtroom" in design:
self.width = int(design["courtroom"][2])
self.height = int(design["courtroom"][3])
if "emotes" in design:
self.emotePageGeometry = [int(x) for x in design["emotes"]]
@ -1910,14 +1915,12 @@ class GUI(QtGui.QWidget):
if "found_song_color" in design:
self.foundSongItemColor = QtGui.QColor(*[int(x) for x in design["found_song_color"]])
self.cbSlide.setVisible("slide_enable" in design)
self.cbBench.setVisible("ao2xp_desk" in design)
self.OOCLogin.setVisible("ao2xp_login" in design)
self.btnReloadTheme.setVisible(True)
QtGui.QApplication.setStyle('plastique')
QtGui.QApplication.setStyle('plastique') # This avoids issues with widget colors
for w in [self.gameTabs, self.serverTabs]:
stack = w.findChild(QtGui.QStackedWidget)
if stack:
@ -1987,8 +1990,8 @@ class GUI(QtGui.QWidget):
if exists(courtroomBackground):
stylesheet += "QTabWidget {background-color: transparent;} QMainWindow { background-image: url(./" + courtroomBackground + ");}"
courtroomBackground = QtGui.QPixmap(courtroomBackground)
self.width = courtroomBackground.size().width()
self.height = courtroomBackground.size().height()
# self.width = courtroomBackground.size().width()
# self.height = courtroomBackground.size().height()
# Stylesheet
courtroomStylesheets = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_stylesheets.css'
@ -1996,7 +1999,7 @@ class GUI(QtGui.QWidget):
with open(courtroomStylesheets) as f:
stylesheet += f.read()
self.gamewindow.setStyleSheet(stylesheet)
self.mainWindow.setStyleSheet(stylesheet)
self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale)
@ -2113,8 +2116,8 @@ class GUI(QtGui.QWidget):
self.setScene()
self.boxEmotes.setCurrentIndex(0)
self.setEmotePage()
self.gamewindow.setFixedSize(self.width, self.height)
self.gamewindow.center()
self.mainWindow.setFixedSize(self.width, self.height)
self.mainWindow.center()
# except Exception as e:
# QtGui.QMessageBox.critical(None, "Unable to load theme", "There was a problem loading the current theme \"%s\":\n\n%s." % (theme, e))
# os._exit(-2)
@ -2346,7 +2349,7 @@ class GUI(QtGui.QWidget):
if QtCore.QString(fname).contains(text, QtCore.Qt.CaseInsensitive):
songitem = QtGui.QListWidgetItem()
songitem.setText(song)
if not self.privateMusicSelected and exists(unicode(AOpath + 'sounds/music/' + decodeAOString(fname).lower())):
if not self.privateMusicSelected and exists(unicode(BASE_PATH + 'sounds/music/' + decodeAOString(fname).lower())):
songitem.setBackgroundColor(QtGui.QColor(self.foundSongItemColor))
self.musicItems.addItem(songitem)
else:
@ -2438,7 +2441,7 @@ class GUI(QtGui.QWidget):
self.backgroundItems.clear()
self.backgroundSearch.clear()
self.backgrounds = []
for folder in os.listdir(unicode(AOpath + 'background')):
for folder in os.listdir(unicode(BASE_PATH + 'background')):
self.backgrounds.append(folder)
self.backgroundItems.addItem(folder)
@ -2454,8 +2457,8 @@ class GUI(QtGui.QWidget):
self.backgroundItems.addItem(bg)
def setEvidenceImage(self, guiobj, image, scale=False):
if exists(AOpath + 'evidence/' + image):
img = QtGui.QPixmap(AOpath + "evidence/%s" % image)
if exists(BASE_PATH + 'evidence/' + image):
img = QtGui.QPixmap(BASE_PATH + "evidence/%s" % image)
if not img.isNull() and scale:
guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
else:
@ -2470,7 +2473,7 @@ class GUI(QtGui.QWidget):
if ini.read_ini_bool("AO2XP.ini", "General", "download evidence", True):
url = "base/evidence/"+image.lower()
url = url.replace("evidence/../", "")
path = AOpath + "evidence/"+image
path = BASE_PATH + "evidence/"+image
path = path.replace("evidence/../", "")
thread.start_new_thread(downloadThread, (url, path))
@ -2570,8 +2573,9 @@ class GUI(QtGui.QWidget):
self.ICChatFocus()
def onPVPacket(self, charName=""):
self.gamewindow.setFixedSize(self.width, self.height)
self.gamewindow.center()
QtGui.QApplication.restoreOverrideCursor()
self.setDisabled(False)
self.gotPV = True
if not self.swapping and charName:
self.loadCharacter(charName)
@ -2598,27 +2602,27 @@ class GUI(QtGui.QWidget):
elif isinstance(charName, QtCore.QString):
charName = unicode(charName.toLower())
#self.charName = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "options", "name", charName.decode('utf-8').lower()
#self.charName = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "options", "name", charName.decode('utf-8').lower()
self.charName = charName # Just use the folder name
self.charShowname = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "options", "showname")
self.charShowname = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "options", "showname")
if not self.charShowname == "":
self.charShowname = self.charShowname.decode('utf-8')
self.charSide = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "options", "side", "def")
self.charSide = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "options", "side", "def")
self.boxPositions.setCurrentIndex(self.boxPositions.findText(self.charSide))
self.setJudgeButtons()
for emoteind in range(1, ini.read_ini_int(AOpath + "characters/"+self.charName+"/char.ini", "emotions", "number") + 1):
for emoteind in range(1, ini.read_ini_int(BASE_PATH + "characters/"+self.charName+"/char.ini", "emotions", "number") + 1):
if emoteind == 1:
suffix = 'on'
else:
suffix = 'off'
emote = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "emotions", str(emoteind), 'normal#(a)normal#normal#0#')
sound = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "soundn", str(emoteind), '1')
soundt = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "soundt", str(emoteind), '0')
soundl = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "soundl", str(emoteind), '0') # AO 2.8
emote = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "emotions", str(emoteind), 'normal#(a)normal#normal#0#')
sound = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "soundn", str(emoteind), '1')
soundt = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "soundt", str(emoteind), '0')
soundl = ini.read_ini(BASE_PATH + 'characters/' + charName + '/char.ini', "soundl", str(emoteind), '0') # AO 2.8
emoteList = emote.split('#')
deskmod = emoteList.pop(len(emoteList) - 1)
@ -2668,9 +2672,9 @@ class GUI(QtGui.QWidget):
for nEmote in range(emotesOnPage):
nRealEmote = nEmote + self.currentEmotePage * self.maxEmotesOnPage
if nRealEmote == self.selectedEmote:
image = QtGui.QPixmap(AOpath + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_on.png')
image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_on.png')
else:
image = QtGui.QPixmap(AOpath + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_off.png')
image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_off.png')
if not image.isNull() and not image.width() == 40:
self.emoteButtons[nEmote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation))
@ -2686,8 +2690,8 @@ class GUI(QtGui.QWidget):
def loadSwapCharacters(self):
self.charsFolder = []
self.iniSwapList.clear()
for folder in os.listdir(unicode(AOpath + 'characters')):
if exists(AOpath + 'characters/' + folder + '/char.ini'):
for folder in os.listdir(unicode(BASE_PATH + 'characters')):
if exists(BASE_PATH + 'characters/' + folder + '/char.ini'):
self.charsFolder.append(folder)
self.iniSwapList.addItem(folder)
@ -2901,7 +2905,7 @@ class GUI(QtGui.QWidget):
self.inboxTimer.stop()
self.chatTickTimer.stop()
self.disconnectCommon()
self.gamewindow.returnToMenu()
self.mainWindow.returnToMenu()
else:
self.charSelect.showCharSelect()
@ -3007,10 +3011,10 @@ class GUI(QtGui.QWidget):
self.selectedEmote = ind
for button in self.emoteButtons:
if button.emoteid == ind:
button.path = AOpath + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1)
button.path = BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1)
image = QtGui.QPixmap(button.path + '_on.png')
else:
image = QtGui.QPixmap(AOpath + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1) + '_off.png')
image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1) + '_off.png')
if not image.isNull() and not image.width() == 40:
button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation))
@ -3032,7 +3036,7 @@ class GUI(QtGui.QWidget):
reply = QtGui.QMessageBox.warning(self, *args, **kwargs)
if self.willDisconnect:
self.disconnectCommon()
self.gamewindow.returnToMenu()
self.mainWindow.returnToMenu()
def exitCommon(self):
self.disconnectCommon()
@ -3041,6 +3045,8 @@ class GUI(QtGui.QWidget):
self.speaker.wait()
def disconnectCommon(self):
self.gotPV = False
self.charName = ""
self.onSwitchInventory(True)
self.selectedPlayer = -1
self.playerItems.clear()
@ -3256,7 +3262,7 @@ class GUI(QtGui.QWidget):
for fEmote in emotes_to_check:
packet += fEmote
if ini.read_ini_bool("AO2XP.ini", "General", "network frame effects", True):
sfx_frames = "|".join(ini.read_ini_tags(AOpath + "characters/"+self.charName+"/char.ini", fEmote + f_effect))
sfx_frames = "|".join(ini.read_ini_tags(BASE_PATH + "characters/"+self.charName+"/char.ini", fEmote + f_effect))
if sfx_frames:
packet += "|" + sfx_frames
packet += "^"
@ -3268,7 +3274,7 @@ class GUI(QtGui.QWidget):
if "effects" in self.features:
fx = self.boxEffects.currentText() if self.boxEffects.currentIndex() > 0 else ""
fxSound = ini.get_effect_sound(fx, self.charName)
p_effect = ini.read_ini(AOpath + "characters/"+self.charName+"/char.ini", "options", "effects")
p_effect = ini.read_ini(BASE_PATH + "characters/"+self.charName+"/char.ini", "options", "effects")
msg += str(fx + "|" + p_effect + "|" + fxSound + "#").encode('utf-8')
self.boxEffects.setCurrentIndex(0)
@ -3276,9 +3282,9 @@ class GUI(QtGui.QWidget):
# AO 2.10.2+
if "custom_blips" in self.features:
blip = ini.read_ini(AOpath + "characters/"+self.charName+"/char.ini", "options", "blips")
blip = ini.read_ini(BASE_PATH + "characters/"+self.charName+"/char.ini", "options", "blips")
if not blip:
blip = ini.read_ini(AOpath + "characters/"+self.charName+"/char.ini", "options", "gender")
blip = ini.read_ini(BASE_PATH + "characters/"+self.charName+"/char.ini", "options", "gender")
if blip:
msg += str(blip) + "#"
@ -3301,7 +3307,7 @@ class GUI(QtGui.QWidget):
else:
self.background = bg
if not exists(AOpath + 'background/' + bg):
if not exists(BASE_PATH + 'background/' + bg):
bg = 'default'
for bgfile in [["sideDef", "defenseempty"],
@ -3321,7 +3327,7 @@ class GUI(QtGui.QWidget):
["sideSea", "seancestand"],
["benchSea", "seancedesk"]]:
bgimg = QtGui.QImage(AOpath + 'background/' + bg + '/' + bgfile[1] + '.png')
bgimg = QtGui.QImage(BASE_PATH + 'background/' + bg + '/' + bgfile[1] + '.png')
if not bgimg.isNull():
if bgimg.size().width() != self.viewport.width() or bgimg.size().height() != self.viewport.height():
if "bench" in bgfile[0]:
@ -3334,7 +3340,7 @@ class GUI(QtGui.QWidget):
else:
setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg))
court = AOpath + 'background/' + bg + '/court.png'
court = BASE_PATH + 'background/' + bg + '/court.png'
self.slideAvailable = exists(court)
if self.slideAvailable:
@ -3344,7 +3350,7 @@ class GUI(QtGui.QWidget):
self.slideBg.resize(slide_width, self.viewport.height())
self.slideBg.setPixmap(slide.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
courtOverlay = AOpath + 'background/' + bg + '/courtOverlay.png'
courtOverlay = BASE_PATH + 'background/' + bg + '/courtOverlay.png'
if exists(courtOverlay):
slideOverlay = QtGui.QPixmap(courtOverlay)
self.slideOverlay.resize(slide_width, self.viewport.height())
@ -3376,7 +3382,7 @@ class GUI(QtGui.QWidget):
self.slideDirection = value[1]
# TODO: play only first frame of preanim, figure out zooms
scaling = getScaling(ini.read_ini(AOpath + 'characters/' + self.mChatMessage[CHARNAME].lower() + '/char.ini', "options", "scaling").lower())
scaling = getScaling(ini.read_ini(BASE_PATH + 'characters/' + self.mChatMessage[CHARNAME].lower() + '/char.ini', "options", "scaling").lower())
if self.mChatMessage[FLIP] == "1":
self.slideSpeaker.setFlipped(True)
else:
@ -3878,7 +3884,7 @@ class GUI(QtGui.QWidget):
self.objectionView.raise_()
self.whiteFlashLabel.raise_()
self.scaling[1] = getScaling(ini.read_ini(AOpath + 'characters/' + self.mChatMessage[OTHER_NAME].lower() + '/char.ini', "options", "scaling").lower())
self.scaling[1] = getScaling(ini.read_ini(BASE_PATH + 'characters/' + self.mChatMessage[OTHER_NAME].lower() + '/char.ini', "options", "scaling").lower())
self.sideChar.setFlipped(self.mChatMessage[OTHER_FLIP] == "1")
if not self.animIsEmpty:
@ -3888,7 +3894,7 @@ class GUI(QtGui.QWidget):
self.sideChar.hide()
self.sideChar.move(0, 0)
self.scaling[0] = getScaling(ini.read_ini(AOpath + 'characters/' + self.mChatMessage[CHARNAME].lower() + '/char.ini', "options", "scaling").lower())
self.scaling[0] = getScaling(ini.read_ini(BASE_PATH + 'characters/' + self.mChatMessage[CHARNAME].lower() + '/char.ini', "options", "scaling").lower())
if self.slideEnabled and self.slideAvailable:
if side == "wit":
@ -3919,8 +3925,8 @@ class GUI(QtGui.QWidget):
fChar = self.mChatMessage[CHARNAME].lower()
fPreanim = self.mChatMessage[PREANIM].strip()
ao2Duration = ini.read_ini_int(AOpath + "characters/" + fChar + "/char.ini", "time", fPreanim, -1)
textDelay = ini.read_ini_int(AOpath + "characters/" + fChar + "/char.ini", "textdelay", fPreanim, -1)
ao2Duration = ini.read_ini_int(BASE_PATH + "characters/" + fChar + "/char.ini", "time", fPreanim, -1)
textDelay = ini.read_ini_int(BASE_PATH + "characters/" + fChar + "/char.ini", "textdelay", fPreanim, -1)
sfxDelay = int(self.mChatMessage[SFX_DELAY]) * 60
if sfxDelay > 0:
@ -3930,9 +3936,9 @@ class GUI(QtGui.QWidget):
preanimDuration = ao2Duration
animToFind = AOpath + "characters/" + fChar + "/" + fPreanim + ".gif"
apngToFind = AOpath + "characters/" + fChar + "/" + fPreanim + ".apng"
webpToFind = AOpath + "characters/" + fChar + "/" + fPreanim + ".webp"
animToFind = BASE_PATH + "characters/" + fChar + "/" + fPreanim + ".gif"
apngToFind = BASE_PATH + "characters/" + fChar + "/" + fPreanim + ".apng"
webpToFind = BASE_PATH + "characters/" + fChar + "/" + fPreanim + ".webp"
if (not animToFind and not apngToFind and not webpToFind) or preanimDuration < 0:
if nonInterrupting:
@ -4089,10 +4095,10 @@ class GUI(QtGui.QWidget):
self.blip = "male"
path = testPath(
AOpath + "sounds/blips/"+ self.blip +".wav",
AOpath + "sounds/blips/"+ self.blip +".opus",
AOpath + "sounds/general/sfx-blip"+ self.blip +".wav",
AOpath + "sounds/general/sfx-blip"+ self.blip +".opus"
BASE_PATH + "sounds/blips/"+ self.blip +".wav",
BASE_PATH + "sounds/blips/"+ self.blip +".opus",
BASE_PATH + "sounds/general/sfx-blip"+ self.blip +".wav",
BASE_PATH + "sounds/general/sfx-blip"+ self.blip +".opus"
)
if path:
@ -4326,20 +4332,20 @@ class GUI(QtGui.QWidget):
objecting = ["holdit", "objection", "takethat", "custom"][objection - 1]
if objecting:
if exists(AOpath + 'characters/' + charName + '/' + objecting + '.wav'):
self.sndObjection = audio.loadHandle(False, AOpath + 'characters/' + charName + '/' + objecting + '.wav', 0, 0, 0)
elif exists(AOpath + 'characters/' + charName + '/' + objecting + '.opus'):
self.sndObjection = audio.loadHandle(False, AOpath + 'characters/' + charName + '/' + objecting + '.opus', 0, 0, 0)
if exists(BASE_PATH + 'characters/' + charName + '/' + objecting + '.wav'):
self.sndObjection = audio.loadHandle(False, BASE_PATH + 'characters/' + charName + '/' + objecting + '.wav', 0, 0, 0)
elif exists(BASE_PATH + 'characters/' + charName + '/' + objecting + '.opus'):
self.sndObjection = audio.loadHandle(False, BASE_PATH + 'characters/' + charName + '/' + objecting + '.opus', 0, 0, 0)
else:
self.sndObjection = None
if ini.read_ini_bool("AO2XP.ini", "General", "download sounds", True):
thread.start_new_thread(downloadThread, ("base/characters/"+charName+"/"+objecting+".wav", AOpath + "characters/"+charName+"/"+objecting.lower() + ".wav"))
thread.start_new_thread(downloadThread, ("base/characters/"+charName+"/"+objecting+".opus", AOpath + "characters/"+charName+"/"+objecting.lower() + ".wav"))
thread.start_new_thread(downloadThread, ("base/characters/"+charName+"/"+objecting+".wav", BASE_PATH + "characters/"+charName+"/"+objecting.lower() + ".wav"))
thread.start_new_thread(downloadThread, ("base/characters/"+charName+"/"+objecting+".opus", BASE_PATH + "characters/"+charName+"/"+objecting.lower() + ".wav"))
if exists(AOpath + 'sounds/general/sfx-objection.opus'):
self.sndObjection = audio.loadHandle(False, AOpath + 'sounds/general/sfx-objection.opus', 0, 0, 0)
if exists(BASE_PATH + 'sounds/general/sfx-objection.opus'):
self.sndObjection = audio.loadHandle(False, BASE_PATH + 'sounds/general/sfx-objection.opus', 0, 0, 0)
else:
self.sndObjection = audio.loadHandle(False, AOpath + 'sounds/general/sfx-objection.wav', 0, 0, 0)
self.sndObjection = audio.loadHandle(False, BASE_PATH + 'sounds/general/sfx-objection.wav', 0, 0, 0)
audio.setHandleAttr(self.sndObjection, BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0)
audio.playHandle(self.sndObjection, True)
@ -4369,9 +4375,9 @@ class GUI(QtGui.QWidget):
audio.freeHandle(self.sound[self.soundChannel])
path = testPath(
AOpath + 'sounds/general/' + sfx,
AOpath + 'sounds/general/' + sfx + '.wav',
AOpath + 'sounds/general/' + sfx + '.opus'
BASE_PATH + 'sounds/general/' + sfx,
BASE_PATH + 'sounds/general/' + sfx + '.wav',
BASE_PATH + 'sounds/general/' + sfx + '.opus'
)
if path:
@ -4394,16 +4400,16 @@ class GUI(QtGui.QWidget):
playLocal = False
if exists(AOpath + 'sounds/music/' + musl):
if exists(BASE_PATH + 'sounds/music/' + musl):
playLocal = True
elif self.pickedMusicItem:
_musl = _musicList[self.musicItems.currentItem().text()]
if exists(AOpath + 'sounds/music/' + _musl):
if exists(BASE_PATH + 'sounds/music/' + _musl):
musl = _musl
playLocal = True
elif musl.startswith("http"):
_musl = urllib.unquote(basename(mus))
if exists(AOpath + 'sounds/music/' + _musl):
if exists(BASE_PATH + 'sounds/music/' + _musl):
musl = _musl
playLocal = True
@ -4415,7 +4421,7 @@ class GUI(QtGui.QWidget):
musl = musl.encode('mbcs')
else:
musl = musl.encode('utf-8')
self.music = audio.loadHandle(False, AOpath + 'sounds/music/' + musl, 0, 0, BASS_SAMPLE_LOOP)
self.music = audio.loadHandle(False, BASE_PATH + 'sounds/music/' + musl, 0, 0, BASS_SAMPLE_LOOP)
if self.music:
audio.setHandleAttr(self.music, BASS_ATTRIB_VOL, self.sliMusicVolume.value() / 100.0)
audio.playHandle(self.music, True)
@ -4501,7 +4507,7 @@ class GUI(QtGui.QWidget):
for song, fname in _musicList.items():
songitem = QtGui.QListWidgetItem()
songitem.setText(song)
if not self.privateMusicSelected and exists(unicode(AOpath + 'sounds/music/' + decodeAOString(fname).lower())):
if not self.privateMusicSelected and exists(unicode(BASE_PATH + 'sounds/music/' + decodeAOString(fname).lower())):
songitem.setBackgroundColor(QtGui.QColor(self.foundSongItemColor))
self.musicItems.addItem(songitem)
@ -4547,7 +4553,7 @@ class GUI(QtGui.QWidget):
_data = self.charList[int(data)][0] if data.isdigit() else decodeAOString(data)
else:
_dataInt, ok = data.toInt()
_data = self.charList[int(_dataInt)][0] if ok else data
_data = self.charList[int(_dataInt)][0] if ok else decodeAOString(data)
self.playerList[pid][utype] = _data
item = self.playerItems.findItems("[%s]" % pid, QtCore.Qt.MatchStartsWith)
@ -4658,7 +4664,6 @@ class GUI(QtGui.QWidget):
global bucket
bucket = webAO_bucket
self.charSelect.setCharList(charList)
autopick = getOption("General", "auto pick").decode('utf-8').lower()
coincidence = -1
for i, char in enumerate(self.charList):
@ -4667,8 +4672,10 @@ class GUI(QtGui.QWidget):
break
if coincidence > -1:
self.setDisabled(True)
self.charSelect.selectChar(coincidence)
else:
self.charSelect.setCharList(charList)
self.charSelect.showCharSelect(False)
# Putting it down here because some servers won't allow you to switch areas without picking a character first
@ -4712,7 +4719,7 @@ class GUI(QtGui.QWidget):
self.healthbars.emit(hp[0], hp[1])
for char in self.charList:
if not exists(AOpath + 'characters/' + char[0].lower() + '/char.ini'):
if not exists(BASE_PATH + 'characters/' + char[0].lower() + '/char.ini'):
continue
char[2] = getCharIni(char[0], "Options", "gender").lower()
if not char[2]:
@ -4732,6 +4739,9 @@ class GUI(QtGui.QWidget):
self.boxEvidence.clear()
for evi in evidence:
self.boxEvidence.addItem(evi[0].strip())
if tcp.isWS and tcp.isSecure:
self.OOCLog.append("<b>--- Using a secure connection ---</b>")
logstart = '<b>--- Log started on ' + time.ctime() + ' ---</b>'
if self.OOCLog.toPlainText():

View File

@ -24,22 +24,22 @@ class PicButton(QtGui.QAbstractButton):
def setPixmap(self, pixmap):
self.pixmap = pixmap
class lobby(QtGui.QWidget):
gamewindow = None
class Lobby(QtGui.QWidget):
mainWindow = None
tab = 0
def __init__(self, parent=None, demo=None):
super(lobby, self).__init__(parent)
self.can_connect = False
super(Lobby, self).__init__(parent)
self.canConnect = False
self.svclicked = None
self.gamewindow = parent
self.pix_lobby = QtGui.QPixmap(AO2XPpath+'themes/default/lobbybackground.png')
self.pix_btn_public = QtGui.QPixmap(AO2XPpath+'themes/default/publicservers.png')
self.pix_btn_favs = QtGui.QPixmap(AO2XPpath+'themes/default/favorites.png')
self.pix_btn_refresh = QtGui.QPixmap(AO2XPpath+'themes/default/refresh.png')
self.pix_btn_addfav = QtGui.QPixmap(AO2XPpath+'themes/default/addtofav.png')
self.pix_btn_connect = QtGui.QPixmap(AO2XPpath+'themes/default/connect.png')
self.pix_connecting = QtGui.QPixmap(AO2XPpath+'themes/default/loadingbackground.png')
self.mainWindow = parent
self.pixLobby = QtGui.QPixmap(AO2XPpath+'themes/default/lobbybackground.png')
self.pixBtnPublic = QtGui.QPixmap(AO2XPpath+'themes/default/publicservers.png')
self.pixBtnFavs = QtGui.QPixmap(AO2XPpath+'themes/default/favorites.png')
self.pixBtnRefresh = QtGui.QPixmap(AO2XPpath+'themes/default/refresh.png')
self.pixBtnAddfav = QtGui.QPixmap(AO2XPpath+'themes/default/addtofav.png')
self.pixBtnConnect = QtGui.QPixmap(AO2XPpath+'themes/default/connect.png')
self.pixConnecting = QtGui.QPixmap(AO2XPpath+'themes/default/loadingbackground.png')
self.autoconnect = None
@ -47,10 +47,10 @@ class lobby(QtGui.QWidget):
with open('serverlist.txt') as file:
self.favoriteslist = [line.rstrip().split(':') for line in file]
autoconnect_id = ini.read_ini_int("AO2XP.ini", "General", "auto connect", -1)
if autoconnect_id >= 0:
autoconnectId = ini.read_ini_int("AO2XP.ini", "General", "auto connect", -1)
if autoconnectId >= 0:
try:
self.autoconnect = self.favoriteslist[autoconnect_id]
self.autoconnect = self.favoriteslist[autoconnectId]
except:
print "[debug] Can't autoconnect to server."
else:
@ -58,49 +58,49 @@ class lobby(QtGui.QWidget):
#self.favoriteslist = ['127.0.0.1:27017:your server (port 27017)'.split(':'), '127.0.0.1:27016:your server (port 27016)'.split(':'),]
self.lobbyimg = QtGui.QLabel(self)
self.lobbyimg.setPixmap(self.pix_lobby)
self.lobbyimg.setPixmap(self.pixLobby)
self.lobbyimg.show()
self.connectingimg = QtGui.QLabel(self)
self.connectingimg.setPixmap(self.pix_connecting)
self.connectingimg.setPixmap(self.pixConnecting)
self.connectingimg.hide()
self.btnSettings = QtGui.QPushButton(self)
self.btnSettings.setText("Settings")
self.btnSettings.resize(self.btnSettings.sizeHint())
self.btnSettings.move(self.pix_lobby.size().width() - self.btnSettings.size().width(), 0)
self.btnSettings.move(self.pixLobby.size().width() - self.btnSettings.size().width(), 0)
self.btnSettings.clicked.connect(self.onSettingsClicked)
self.demobtn = QtGui.QPushButton(self)
self.demobtn.setText("Play a demo")
self.demobtn.resize(self.demobtn.sizeHint())
self.demobtn.move(self.btnSettings.x() - self.demobtn.size().width(), 0)
self.demobtn.clicked.connect(self.on_demo_clicked)
self.btnDemo = QtGui.QPushButton(self)
self.btnDemo.setText("Play a demo")
self.btnDemo.resize(self.btnDemo.sizeHint())
self.btnDemo.move(self.btnSettings.x() - self.btnDemo.size().width(), 0)
self.btnDemo.clicked.connect(self.onDemoClicked)
self.btn_public = PicButton(self.pix_btn_public, self)
self.btn_public.resize(self.btn_public.sizeHint())
self.btn_public.move(46, 88)
self.btn_public.clicked.connect(self.onClicked_public)
self.btnPublic = PicButton(self.pixBtnPublic, self)
self.btnPublic.resize(self.btnPublic.sizeHint())
self.btnPublic.move(46, 88)
self.btnPublic.clicked.connect(self.onClickedPublic)
self.btn_favs = PicButton(self.pix_btn_favs, self)
self.btn_favs.resize(self.btn_favs.sizeHint())
self.btn_favs.move(164, 88)
self.btn_favs.clicked.connect(self.onClicked_favs)
self.btnFavs = PicButton(self.pixBtnFavs, self)
self.btnFavs.resize(self.btnFavs.sizeHint())
self.btnFavs.move(164, 88)
self.btnFavs.clicked.connect(self.onClickedFavs)
self.btn_refresh = PicButton(self.pix_btn_refresh, self)
self.btn_refresh.resize(self.btn_refresh.sizeHint())
self.btn_refresh.move(56, 381)
self.btn_refresh.clicked.connect(self.onClicked_refresh)
self.btnRefresh = PicButton(self.pixBtnRefresh, self)
self.btnRefresh.resize(self.btnRefresh.sizeHint())
self.btnRefresh.move(56, 381)
self.btnRefresh.clicked.connect(self.onClickedRefresh)
self.btn_addfav = PicButton(self.pix_btn_addfav, self)
self.btn_addfav.resize(self.btn_addfav.sizeHint())
self.btn_addfav.move(194, 381)
self.btn_addfav.clicked.connect(self.onClicked_addfav)
self.btnAddfav = PicButton(self.pixBtnAddfav, self)
self.btnAddfav.resize(self.btnAddfav.sizeHint())
self.btnAddfav.move(194, 381)
self.btnAddfav.clicked.connect(self.onClickedAddfav)
self.btn_connect = PicButton(self.pix_btn_connect, self)
self.btn_connect.resize(self.btn_connect.sizeHint())
self.btn_connect.move(332, 381)
self.btn_connect.clicked.connect(self.onClicked_connect)
self.btnConnect = PicButton(self.pixBtnConnect, self)
self.btnConnect.resize(self.btnConnect.sizeHint())
self.btnConnect.move(332, 381)
self.btnConnect.clicked.connect(self.onClickedConnect)
self.serverlist = QtGui.QListWidget(self)
self.serverlist.resize(286, 240)
@ -108,7 +108,7 @@ class lobby(QtGui.QWidget):
p = self.serverlist.viewport().palette()
p.setColor(self.serverlist.viewport().backgroundRole(), QtGui.QColor(114,114,114))
self.serverlist.viewport().setPalette(p)
self.serverlist.itemClicked.connect(self.onClicked_serverlist)
self.serverlist.itemClicked.connect(self.onClickedServerlist)
self.onlineplayers = QtGui.QLabel(self)
self.onlineplayers.setStyleSheet('color: white')
@ -130,10 +130,10 @@ class lobby(QtGui.QWidget):
self.connectcancel.setText('Cancel')
self.connectcancel.resize(80, 20)
self.connectcancel.move(220, 220)
self.connectcancel.clicked.connect(self.onClicked_cancelconnect)
self.connectcancel.clicked.connect(self.onClickedCancelconnect)
self.connectcancel.hide()
self.actual_serverlist = []
self.actualServerlist = []
self.lobbychatlog = QtGui.QTextEdit(self)
self.lobbychatlog.setReadOnly(True)
@ -141,7 +141,7 @@ class lobby(QtGui.QWidget):
p = self.lobbychatlog.viewport().palette()
p.setColor(self.lobbychatlog.viewport().backgroundRole(), QtGui.QColor(139,139,139))
self.lobbychatlog.viewport().setPalette(p)
self.lobbychatlog.textChanged.connect(self.lobbychatlog_update)
self.lobbychatlog.textChanged.connect(self.lobbychatlogUpdate)
self.whitecolor = QtGui.QColor(255, 255, 255)
@ -158,36 +158,21 @@ class lobby(QtGui.QWidget):
self.connectprogress.resize(300, 95)
self.connectprogress.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignTop)
self.connectprogress.move(135-20, 92)
self.oocname = 'Name'
self.OOCNameInput = QtGui.QLineEdit(self)
self.OOCNameInput.setText(self.oocname)
self.OOCNameInput.move(0, 646)
self.OOCNameInput.resize(91, 19)
self.OOCNameInput.setStyleSheet('background-color: rgb(87, 87, 87);')
self.OOCNameInput.textChanged.connect(self.setoocname)
self.lobbychatinput = QtGui.QLineEdit(self)
self.lobbychatinput.setPlaceholderText("Say something...")
self.lobbychatinput.move(90, 646)
self.lobbychatinput.resize(427, 19)
self.lobbychatinput.setStyleSheet('background-color: rgb(87, 87, 87);')
self.lobbychatinput.returnPressed.connect(self.lobby_sendchat)
self.aoserverinfo = AOServerInfo()
self.aoserverinfo.moveToGameSignal.connect(self.moveToGame)
self.aoserverinfo.msgbox_signal.connect(self.showMessageBox)
self.aoserverinfo.moveToGameSignal.connect(self.mainWindow.showGame)
self.aoserverinfo.msgboxSignal.connect(self.showMessageBox)
self.aoserverinfo.setOnlinePlayers.connect(self.onlineplayers.setText)
self.aoserverinfo.returnToLobby.connect(self.onClicked_cancelconnect)
self.aoserverinfo.returnToLobby.connect(self.onClickedCancelconnect)
self.aoserverinfo.setConnectProgress.connect(self.connectprogress.setText)
self.aoserverinfo.readySoon.connect(self.connectcancel.hide)
self.aoserverinfo.setWindowTitle.connect(self.gamewindow.setWindowTitle)
self.aoserverinfo.canConnect.connect(self.canConnect)
self.aoserverinfo.setWindowTitle.connect(self.mainWindow.setWindowTitle)
self.aoserverinfo.canConnect.connect(self.setCanConnect)
self.masterserver = MasterServer()
self.masterserver.gotServers.connect(self.onGetServers)
self.masterserver.gotOOCMsg.connect(self.newOOCMessage)
self.masterserver.msgbox_signal.connect(self.showMessageBox)
self.masterserver.msgboxSignal.connect(self.showMessageBox)
self.masterserver.start()
if not demo and self.autoconnect:
@ -196,15 +181,15 @@ class lobby(QtGui.QWidget):
self.aoserverinfo.stop()
self.aoserverinfo.start()
def canConnect(self):
self.can_connect = True
def setCanConnect(self):
self.canConnect = True
if self.autoconnect:
self.autoconnect = None # We only want to autoconnect on first login after all
self.onClicked_connect()
self.onClickedConnect()
def onGetServers(self, servers):
if self.tab == 0: self.serverlist.clear()
self.actual_serverlist = []
self.actualServerlist = []
del servers[0]
del servers[-1]
for server in servers:
@ -212,47 +197,33 @@ class lobby(QtGui.QWidget):
desc = server["description"]
ip = server["ip"]
port = server["port"]
ws_port = server["ws_port"] if "ws_port" in server else 0
wss_port = server["wss_port"] if "wss_port" in server else 0
wsPort = server["ws_port"] if "ws_port" in server else 0
wssPort = server["wss_port"] if "wss_port" in server else 0
serveritem = QtGui.QListWidgetItem(name)
if self.tab == 0: self.serverlist.addItem(serveritem)
self.actual_serverlist.append((ip, port, name, desc, ws_port, wss_port))
def moveToGame(self, stuff):
tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket = stuff
self.move_to_game(tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket)
self.actualServerlist.append((ip, port, name, desc, wsPort, wssPort))
def onSettingsClicked(self):
self.gamewindow.showSettings()
self.mainWindow.showSettings()
def on_demo_clicked(self):
self.gamewindow.show_demo_picker()
def showMessageBox(self, type, title, message):
if type == 0: #critical
return QtGui.QMessageBox.critical(self, title, message)
elif type == 1: #information
return QtGui.QMessageBox.information(self, title, message)
elif type == 2: #question
return QtGui.QMessageBox.question(self, title, message)
elif type == 3: #warning
return QtGui.QMessageBox.warning(self, title, message)
def onDemoClicked(self):
self.mainWindow.showDemoPicker()
def onClicked_public(self):
def onClickedPublic(self):
self.tab = 0
self.serverlist.clear()
for sv in self.actual_serverlist:
for sv in self.actualServerlist:
self.serverlist.addItem(QtGui.QListWidgetItem(sv[2]))
def onClicked_favs(self):
def onClickedFavs(self):
self.tab = 1
self.serverlist.clear()
self.serverinfo.setText("")
for sv in self.favoriteslist:
self.serverlist.addItem(QtGui.QListWidgetItem(sv[-1]))
def onClicked_refresh(self):
def onClickedRefresh(self):
self.serverlist.clear()
if self.tab == 0:
try:
@ -268,7 +239,7 @@ class lobby(QtGui.QWidget):
else:
self.favoriteslist = ['127.0.0.1:27017:your server (port 27017)'.split(':'), '0.0.0.0:27017:serverlist.txt not found on base folder'.split(':')]
def onClicked_addfav(self):
def onClickedAddfav(self):
if self.tab == 1 or not self.svclicked:
if self.tab == 1:
QtGui.QMessageBox.information(self, "???", "Wait. That's illegal.")
@ -276,35 +247,37 @@ class lobby(QtGui.QWidget):
for i in range(self.serverlist.count()):
if self.serverlist.item(i) == self.svclicked:
ip = self.actual_serverlist[i][0]
port = str(self.actual_serverlist[i][1])
name = self.actual_serverlist[i][2]
ws = self.actual_serverlist[i][4]
wss = self.actual_serverlist[i][5]
ip = self.actualServerlist[i][0]
port = str(self.actualServerlist[i][1])
name = self.actualServerlist[i][2]
ws = self.actualServerlist[i][4]
wss = self.actualServerlist[i][5]
for sv in self.favoriteslist:
if sv[0] == ip and sv[1] == port:
return QtGui.QMessageBox.information(self, "Error", "This server already exists in your favorites list, named '%s'" % sv[2])
return QtGui.QMessageBox.information(self, "AO2XP", "This server already exists in your favorites list, named '%s'" % sv[4])
self.favoriteslist.append([ip, port, ws, wss, name])
with open('serverlist.txt', "a") as file:
file.write("%s:%s:%s:%s:%s\n" % (ip, port, ws, wss, name))
file.close()
QtGui.QMessageBox.information(self, "AO2XP", "The server '%s' was added to your favorites." % name)
def onClicked_connect(self):
if not self.can_connect:
def onClickedConnect(self):
if not self.canConnect:
return
self.btn_public.hide()
self.btn_favs.hide()
self.btn_refresh.hide()
self.btn_addfav.hide()
self.btn_connect.hide()
self.btnPublic.hide()
self.btnFavs.hide()
self.btnRefresh.hide()
self.btnAddfav.hide()
self.btnConnect.hide()
self.serverlist.hide()
self.onlineplayers.hide()
self.serverinfo.hide()
self.btnSettings.hide()
self.demobtn.hide()
self.btnDemo.hide()
self.connectprogress.setText('Connecting...')
self.connectingimg.show()
@ -312,63 +285,60 @@ class lobby(QtGui.QWidget):
self.connectprogress.show()
self.aoserverinfo.tcp.send('askchaa#%')
def onClicked_cancelconnect(self):
def onClickedCancelconnect(self):
self.connectingimg.hide()
self.connectcancel.hide()
self.connectprogress.hide()
self.btn_public.show()
self.btn_favs.show()
self.btn_refresh.show()
self.btn_addfav.show()
self.btn_connect.show()
self.btnPublic.show()
self.btnFavs.show()
self.btnRefresh.show()
self.btnAddfav.show()
self.btnConnect.show()
self.serverlist.show()
self.onlineplayers.show()
self.serverinfo.show()
self.btnSettings.show()
self.demobtn.show()
self.btnDemo.show()
def onClicked_serverlist(self, item):
def onClickedServerlist(self, item):
self.svclicked = item
self.can_connect = False
self.canConnect = False
self.onlineplayers.setText('Retrieving...')
text = item.text()
print '[debug]', 'you clicked %s' % text
print '[debug]', 'Selected %s' % text
for i in range(self.serverlist.count()):
if self.serverlist.item(i) == item:
if self.tab == 0:
self.serverinfo.setText(self.actual_serverlist[i][3])
self.aoserverinfo.setIP(text, self.actual_serverlist[i][0], self.actual_serverlist[i][1], self.actual_serverlist[i][4], self.actual_serverlist[i][5])
print '[debug]', 'ind: ' + str(i) + ', ip: ' + self.actual_serverlist[i][0] + ', port: ' + str(self.actual_serverlist[i][1]) + ", websocket port: " + str(self.actual_serverlist[i][4]) + ", secure websocket port: " + str(self.actual_serverlist[i][5])
self.serverinfo.setText(self.actualServerlist[i][3])
self.aoserverinfo.setIP(text, self.actualServerlist[i][0], self.actualServerlist[i][1], self.actualServerlist[i][4], self.actualServerlist[i][5])
print '[debug]', 'ind: ' + str(i) + ', ip: ' + self.actualServerlist[i][0] + ', port: ' + str(self.actualServerlist[i][1]) + ", websocket port: " + str(self.actualServerlist[i][4]) + ", secure websocket port: " + str(self.actualServerlist[i][5])
elif self.tab == 1:
self.aoserverinfo.setIP(text, self.favoriteslist[i][0], self.favoriteslist[i][1], self.favoriteslist[i][2], self.favoriteslist[i][3])
print '[debug]', 'ind: ' + str(i) + ', ip: ' + self.favoriteslist[i][0] + ', port: ' + str(self.favoriteslist[i][1]) + ", websocket port: " + str(self.favoriteslist[i][2]) + ", secure websocket port: " + str(self.favoriteslist[i][3])
self.aoserverinfo.stop()
self.aoserverinfo.start()
def move_to_game(self, tcp, playerList, charList, musicList, background, evidence, areas, features=[], joinOOC=[], hpList=[], webAO_bucket=""):
self.gamewindow.showGame(tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket)
def lobby_sendchat(self):
#text = self.lobbychatinput.text().toUtf8()
#self.masterserver.ms_tcp.send('CT#' +self.oocname+ '#' + text + '#%')
self.lobbychatlog.append("Lobby chat is not supported on the new HTTP-based masterserver.")
self.lobbychatinput.clear()
def setoocname(self):
self.oocname = self.OOCNameInput.text().toUtf8()
def lobbychatlog_update(self):
def lobbychatlogUpdate(self):
if self.lobbychatlog.verticalScrollBar().value() == self.lobbychatlog.verticalScrollBar().maximum(): self.lobbychatlog.verticalScrollBar().setValue(self.lobbychatlog.verticalScrollBar().maximum())
def newOOCMessage(self, text):
self.lobbychatlog.append(text)
def showMessageBox(self, type, title, message):
if type == 0: #critical
return QtGui.QMessageBox.critical(self, title, message)
elif type == 1: #information
return QtGui.QMessageBox.information(self, title, message)
elif type == 2: #question
return QtGui.QMessageBox.question(self, title, message)
elif type == 3: #warning
return QtGui.QMessageBox.warning(self, title, message)
class MasterServer(QtCore.QThread):
gotServers = QtCore.pyqtSignal(list)
gotOOCMsg = QtCore.pyqtSignal(str)
msgbox_signal = QtCore.pyqtSignal(int, str, str)
msgboxSignal = QtCore.pyqtSignal(int, str, str)
def __init__(self):
super(MasterServer, self).__init__()
@ -376,18 +346,18 @@ class MasterServer(QtCore.QThread):
def run(self):
try:
tempdata = ""
self.ms_http = requests.get("http://servers.aceattorneyonline.com/servers")
self.ms_motd = requests.get("http://servers.aceattorneyonline.com/motd")
self.msHttp = requests.get("http://servers.aceattorneyonline.com/servers")
self.msMotd = requests.get("http://servers.aceattorneyonline.com/motd")
if self.ms_http.ok: self.gotServers.emit(json.loads(self.ms_http.content))
if self.ms_motd.ok: self.gotOOCMsg.emit(self.ms_motd.content)
if self.msHttp.ok: self.gotServers.emit(json.loads(self.msHttp.content))
if self.msMotd.ok: self.gotOOCMsg.emit(self.msMotd.content)
except Exception as e:
print "[debug] Failed to load server list:", e
QtGui.QMessageBox.critical(None, "Error", "Failed to load the master server list. Please check your internet connection and try again.")
class AOServerInfo(QtCore.QThread):
moveToGameSignal = QtCore.pyqtSignal(list)
msgbox_signal = QtCore.pyqtSignal(int, str, str)
msgboxSignal = QtCore.pyqtSignal(int, str, str)
setOnlinePlayers = QtCore.pyqtSignal(str)
setConnectProgress = QtCore.pyqtSignal(str)
returnToLobby = QtCore.pyqtSignal()
@ -399,20 +369,20 @@ class AOServerInfo(QtCore.QThread):
super(AOServerInfo, self).__init__()
self.ip = ""
self.port = 0
self.ws_port = 0
self.wss_port = 0
self.wsPort = 0
self.wssPort = 0
self.name = "jm"
self.webAO_bucket = ""
self.webAOBucket = ""
self.useWS = False
self.connected = False
self.disconnect = False
self.musicHack = False
def setIP(self, name, ip, port, ws_port=0, wss_port=0):
def setIP(self, name, ip, port, wsPort=0, wssPort=0):
self.ip = ip
self.port = int(port)
self.ws_port = int(ws_port)
self.wss_port = int(wss_port)
self.wsPort = int(wsPort)
self.wssPort = int(wssPort)
self.name = name
def stop(self):
@ -425,9 +395,9 @@ class AOServerInfo(QtCore.QThread):
self.disconnect = False
try:
if self.ws_port == 0 and self.wss_port == 0: raise Exception # make it jump to except: and use TCP
if self.wsPort == 0 and self.wssPort == 0: raise Exception # make it jump to except: and use TCP
self.tcp = AOsocket.AOwebSocket()
self.connected = self.tcp.connect(self.ip, self.ws_port, self.wss_port)
self.connected = self.tcp.connect(self.ip, self.wsPort, self.wssPort)
except:
self.tcp = AOsocket.AOtcpSocket()
try:
@ -440,7 +410,7 @@ class AOServerInfo(QtCore.QThread):
print "[debug]", "Connected! websocket: %s" % self.tcp.isWS + " (secure)" if (self.tcp.isWS and self.tcp.isSecure) else ""
self.tcp.sock.settimeout(0.1)
got_stuff = False
gotStuff = False
gotChars = False
hpList = []
joinOOC = []
@ -469,9 +439,9 @@ class AOServerInfo(QtCore.QThread):
if readytick == 0:
readytick = -1
try:
self.moveToGameSignal.emit([self.tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, self.webAO_bucket])
self.moveToGameSignal.emit([self.tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, self.webAOBucket])
except Exception as err:
self.msgbox_signal.emit(0, "Error caught while loading", traceback.format_exc(err))
self.msgboxSignal.emit(0, "Error caught while loading", traceback.format_exc(err))
self.returnToLobby.emit()
return
@ -482,7 +452,7 @@ class AOServerInfo(QtCore.QThread):
if error == -2: # timeout
continue
elif error == -1: # disconnected
self.setOnlinePlayers.emit("Something wrong happened" if not got_stuff else "Connection lost")
self.setOnlinePlayers.emit("Something wrong happened" if not gotStuff else "Connection lost")
return
for network in totals:
@ -497,14 +467,14 @@ class AOServerInfo(QtCore.QThread):
maxplayers = int(network[2])
self.canConnect.emit()
self.setOnlinePlayers.emit('%d/%d players online' % (players, maxplayers))
got_stuff = True
gotStuff = True
elif header == "decryptor":
self.tcp.send("HI#%s#%%" % hardware.get_hdid())
elif header == "ASS": # ha ha ha...
self.webAO_bucket = network[1]
print "[debug] URL:", self.webAO_bucket
self.webAOBucket = network[1]
print "[debug] URL:", self.webAOBucket
elif header == "ID":
self.tcp.send("ID#AO2XP#%s#%%" % "2.11.0") # need to send this to tsuserver3 servers in order to get feature list (FL)
@ -516,7 +486,7 @@ class AOServerInfo(QtCore.QThread):
elif header == 'BD':
reason = network[1].decode("utf-8") if len(network) > 1 else "Failed to receive ban reason (old server version?)" # new in AO2 2.6
self.setOnlinePlayers.emit('Banned')
self.msgbox_signal.emit(0, "Banned", "Reason:\n"+reason)
self.msgboxSignal.emit(0, "Banned", "Reason:\n"+reason)
self.tcp.close()
return
@ -540,7 +510,7 @@ class AOServerInfo(QtCore.QThread):
# Disable characters not found in filesystem
for char in charList:
if not exists(AOpath + "characters/" + char[0].lower()):
if not exists(BASE_PATH + "characters/" + char[0].lower()):
char[3] = False
self.setConnectProgress.emit('Requesting music list (%d)...' % maxmusic)

View File

@ -15,8 +15,7 @@ class Settings(QtGui.QDialog):
def __init__(self, parent):
super(Settings, self).__init__()
self.setModal(True)
self.gamewindow = parent
self.parent = parent
self.mainWindow = parent
self.inifile = ConfigParser()
self.setWindowTitle("AO2XP Settings")
@ -126,8 +125,8 @@ class Settings(QtGui.QDialog):
layAutoPick = QtGui.QHBoxLayout()
lblAutoPick = QtGui.QLabel("Pick this character automatically on join")
self.cbCharacters = QtGui.QComboBox()
for folder in listdir(unicode(AOpath + 'characters')):
if exists(AOpath + 'characters/' + folder + '/char.ini'):
for folder in listdir(unicode(BASE_PATH + 'characters')):
if exists(BASE_PATH + 'characters/' + folder + '/char.ini'):
self.cbCharacters.addItem(folder)
self.cbCharacters.setEditable(1)
layAutoPick.addWidget(lblAutoPick)
@ -344,28 +343,28 @@ class Settings(QtGui.QDialog):
with open(AO2XPpath + "callwords.ini", "w") as f:
f.write(self.callwords.toPlainText().toUtf8())
self.gamewindow.gamewidget.textWaitTime = self.sbTextStayTime.value()
self.mainWindow.gameWidget.textWaitTime = self.sbTextStayTime.value()
slideEnabled = self.cbEnableSlide.isChecked()
self.gamewindow.gamewidget.slideEnabled = slideEnabled
self.gamewindow.gamewidget.cbSlide.setEnabled(slideEnabled)
self.mainWindow.gameWidget.slideEnabled = slideEnabled
self.mainWindow.gameWidget.cbSlide.setEnabled(slideEnabled)
if not slideEnabled:
self.gamewindow.gamewidget.cbSlide.setChecked(False)
self.mainWindow.gameWidget.cbSlide.setChecked(False)
if not self.themeState == self.cbThemes.currentText():
self.gamewindow.gamewidget.loadTheme(True)
self.mainWindow.gameWidget.loadTheme(True)
if not self.gamewindow.gamewidget.demoPlaying:
if not self.mainWindow.gameWidget.demoPlaying:
if not (self.saveLogsState == self.cbSaveToLog.isChecked() and self.combineLogsState == self.cbCombineLogs.isChecked()):
self.gamewindow.gamewidget.OOCLog.setLogFiles()
self.gamewindow.gamewidget.ICLog.setLogFiles(self.gamewindow.gamewidget.OOCLog.logfile)
self.mainWindow.gameWidget.OOCLog.setLogFiles()
self.mainWindow.gameWidget.ICLog.setLogFiles(self.mainWindow.gameWidget.OOCLog.logfile)
if not self.saveDemosState == self.cbSaveDemos.isChecked():
if self.cbSaveDemos.isChecked():
self.gamewindow.gamewidget.startDemoRecorder()
self.mainWindow.gameWidget.startDemoRecorder()
else:
self.gamewindow.gamewidget.demoRecorder = None
self.mainWindow.gameWidget.demoRecorder = None
self.hide()
@ -373,7 +372,7 @@ class Settings(QtGui.QDialog):
self.hide()
def onAboutClicked(self):
self.gamewindow.aboutgui.exec_()
self.mainWindow.showAboutBox()
def onUpdateClicked(self):
import updater

View File

@ -78,16 +78,16 @@ def handlePackets(caller, total, record=True):
elif header == 'RT':
testimony = network[1]
wtcefile = AOpath + "sounds/general/sfx-testimony2"
wtcefile = BASE_PATH + "sounds/general/sfx-testimony2"
if caller.parent.wtceSfx:
audio.freeHandle(caller.parent.wtceSfx)
if testimony == 'judgeruling':
variant = int(network[2])
if variant == 0:
wtcefile = AOpath + "sounds/general/sfx-notguilty"
wtcefile = BASE_PATH + "sounds/general/sfx-notguilty"
elif variant == 1:
wtcefile = AOpath + "sounds/general/sfx-guilty"
wtcefile = BASE_PATH + "sounds/general/sfx-guilty"
else:
variant = 0
caller.parent.wtceSfx = audio.loadHandle(False, wtcefile+".opus" if exists(wtcefile+".opus") else wtcefile+".wav", 0, 0, 0)