latest commit since 12 months

This commit is contained in:
Mauricio 2020-08-01 22:15:07 -04:00
parent 246ca08e69
commit 31f7a2ee79
7 changed files with 317 additions and 255 deletions

View File

@ -1,10 +1,15 @@
import sys, thread, time, ctypes
from os.path import exists
debugmode = len(sys.argv) > 1 and sys.argv[1] == "debug"
if not debugmode:
if not exists("bass.dll"):
ctypes.windll.user32.MessageBoxA(0, "couldn't find the file 'bass.dll' on the client folder.\nthis program needs this file in order to play sounds and music.\nthe file is included in this client's zip file, make sure it's in the same folder as the AO2XP.exe", "unable to launch game", 0)
sys.exit(1)
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from pybass import * from pybass import *
import sys, thread, time import gameview, mainmenu, options, ini
from os.path import exists
import ctypes
import gameview, mainmenu, options
class gamewindow(QtGui.QMainWindow): class gamewindow(QtGui.QMainWindow):
def __init__(self): def __init__(self):
@ -32,7 +37,6 @@ class gamewindow(QtGui.QMainWindow):
def showGame(self, tcp, charlist, musiclist, background, evidence, areas, features=[], oocjoin=[], hplist=[]): def showGame(self, tcp, charlist, musiclist, background, evidence, areas, features=[], oocjoin=[], hplist=[]):
self.gamewidget.disconnectnow = False self.gamewidget.disconnectnow = False
self.gamewidget.startGame(tcp, charlist, musiclist, background, evidence, areas, features, oocjoin, hplist) self.gamewidget.startGame(tcp, charlist, musiclist, background, evidence, areas, features, oocjoin, hplist)
self.setFixedSize(714, 668)
self.stackwidget.setCurrentWidget(self.gamewidget) self.stackwidget.setCurrentWidget(self.gamewidget)
def returnToMenu(self): def returnToMenu(self):
@ -45,21 +49,14 @@ class gamewindow(QtGui.QMainWindow):
def showSettings(self): def showSettings(self):
self.settingsgui.showSettings() self.settingsgui.showSettings()
debugmode = False
if len(sys.argv) > 1:
if sys.argv[1] == "debug":
debugmode = True
if not debugmode: if not debugmode:
if not exists("base"): if not exists("base"):
ctypes.windll.user32.MessageBoxA(0, "i couldn't find the holy mother of all important folders that goes by the name of 'base'.\nto fix this, you can try:\n1. downloading a full vanilla copy of Attorney Online 2, and copy the 'base' folder over to this client's location\n2. making sure you extracted the client in the right location", "unable to launch game", 0) ctypes.windll.user32.MessageBoxA(0, "The 'base' folder appears to be missing.\nDownload the original Attorney Online client below,\nthen extract the 'base' folder from the zip to the AO2XP folder.\n\nhttp://aceattorneyonline.com", "unable to launch game", 0)
sys.exit(1)
elif not exists("bass.dll"):
ctypes.windll.user32.MessageBoxA(0, "i couldn't find the file 'bass.dll'\nthis program needs this file in order to play sounds and music\nthe file is included in this client's zip file, make sure it's in the same folder as this EXE", "unable to launch game", 0)
sys.exit(1) sys.exit(1)
BASS_Init(-1, 44100, 0, 0, 0) BASS_Init(ini.read_ini_int("base/AO2XP.ini", "Audio", "device", -1), 44100, 0, 0, 0)
BASS_PluginLoad("bassopus", 0)
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
shit = gamewindow() shit = gamewindow()
shit.show() shit.show()
sys.exit(app.exec_()) sys.exit(app.exec_())

View File

@ -1,8 +1,8 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import os import os
#AOpath = "base\\" AOpath = "base\\"
AOpath = "I:\\aovanilla1.7.5\\client\\base\\" #AOpath = "I:\\aovanilla1.7.5\\client\\base\\"
class RealizationButton(QtGui.QLabel): class RealizationButton(QtGui.QLabel):
pressed = False pressed = False
@ -155,6 +155,7 @@ class PenaltyBars(QtGui.QLabel):
plusClicked = QtCore.pyqtSignal(int) plusClicked = QtCore.pyqtSignal(int)
def __init__(self, parent, type): def __init__(self, parent, type):
super(PenaltyBars, self).__init__(parent) super(PenaltyBars, self).__init__(parent)
self.parent = parent
self.penaltybars = [] self.penaltybars = []
self.type = type self.type = type
self.health = 10 self.health = 10
@ -167,6 +168,7 @@ class PenaltyBars(QtGui.QLabel):
for i in range(11): for i in range(11):
self.penaltybars.append(QtGui.QPixmap(AOpath+"themes\\default\\prosecutionbar"+str(i)+".png")) self.penaltybars.append(QtGui.QPixmap(AOpath+"themes\\default\\prosecutionbar"+str(i)+".png"))
side = "pro" side = "pro"
self.side = side
self.minusbtn = PixmapButton(parent, QtGui.QPixmap(AOpath+"themes\\default\\"+side+"minus.png")) self.minusbtn = PixmapButton(parent, QtGui.QPixmap(AOpath+"themes\\default\\"+side+"minus.png"))
self.plusbtn = PixmapButton(parent, QtGui.QPixmap(AOpath+"themes\\default\\"+side+"plus.png")) self.plusbtn = PixmapButton(parent, QtGui.QPixmap(AOpath+"themes\\default\\"+side+"plus.png"))
self.minusbtn.clicked.connect(self.minusClick) self.minusbtn.clicked.connect(self.minusClick)
@ -188,8 +190,10 @@ class PenaltyBars(QtGui.QLabel):
self.minusClicked.emit(self.type) self.minusClicked.emit(self.type)
def setHealth(self, health): def setHealth(self, health):
self.minusbtn.setPixmap(QtGui.QPixmap(AOpath+"themes\\default\\"+self.side+"minus.png"))
self.plusbtn.setPixmap(QtGui.QPixmap(AOpath+"themes\\default\\"+self.side+"plus.png"))
self.setPixmap(self.penaltybars[health]) self.setPixmap(self.penaltybars[health])
self.health = health self.health = health
def getHealth(self): def getHealth(self):
return self.health return self.health

View File

@ -4,8 +4,13 @@ from os.path import exists
from functools import partial from functools import partial
from buttons import PixmapButton from buttons import PixmapButton
#AOpath = "base\\" AOpath = "base/"
AOpath = "I:\\aovanilla1.7.5\\client\\base\\" #AOpath = "I:/aovanilla1.7.5/client/base/"
def get_option(section, value, default=""):
tempini = ConfigParser()
tempini.read("base/ao2xp.ini")
return ini.read_ini(tempini, section, value, default)
class CharIcon(QtGui.QLabel): class CharIcon(QtGui.QLabel):
def __init__(self, parent, ind): def __init__(self, parent, ind):
@ -23,7 +28,7 @@ class charselect(QtGui.QWidget):
self.parent = parent self.parent = parent
self.page = 0 self.page = 0
self.image = QtGui.QLabel(self) self.image = QtGui.QLabel(self)
self.image.setPixmap(QtGui.QPixmap(AOpath+"themes\\default\\charselect_background.png")) self.image.setPixmap(QtGui.QPixmap(AOpath+"themes/default/charselect_background.png"))
self.image.show() self.image.show()
self.quittolobby = QtGui.QPushButton(self) self.quittolobby = QtGui.QPushButton(self)
@ -46,7 +51,7 @@ class charselect(QtGui.QWidget):
for i in range(self.max_chars_on_page): for i in range(self.max_chars_on_page):
self.buttons.append(CharIcon(self, i)) self.buttons.append(CharIcon(self, i))
self.chartaken.append(QtGui.QLabel(self)) self.chartaken.append(QtGui.QLabel(self))
self.chartaken[i].setPixmap(QtGui.QPixmap(AOpath+"themes\\default\\char_taken.png")) self.chartaken[i].setPixmap(QtGui.QPixmap(AOpath+"themes/default/char_taken.png"))
self.chartaken[i].hide() self.chartaken[i].hide()
x_pos = (btn_width + x_spacing) * x_mod_count x_pos = (btn_width + x_spacing) * x_mod_count
@ -60,11 +65,11 @@ class charselect(QtGui.QWidget):
y_mod_count += 1 y_mod_count += 1
x_mod_count = 0 x_mod_count = 0
self.prevpage = PixmapButton(self, QtGui.QPixmap(AOpath+"themes\\default\\arrow_left.png")) self.prevpage = PixmapButton(self, QtGui.QPixmap(AOpath+"themes/default/arrow_left.png"))
self.prevpage.move(left - self.prevpage.pixmap.size().width(), top + height) self.prevpage.move(left - self.prevpage.pixmap.size().width(), top + height)
self.prevpage.clicked.connect(self.prevPageButton) self.prevpage.clicked.connect(self.prevPageButton)
self.prevpage.show() self.prevpage.show()
self.nextpage = PixmapButton(self, QtGui.QPixmap(AOpath+"themes\\default\\arrow_right.png")) self.nextpage = PixmapButton(self, QtGui.QPixmap(AOpath+"themes/default/arrow_right.png"))
self.nextpage.move(left + width, top + height) self.nextpage.move(left + width, top + height)
self.nextpage.clicked.connect(self.nextPageButton) self.nextpage.clicked.connect(self.nextPageButton)
self.nextpage.show() self.nextpage.show()
@ -106,10 +111,10 @@ class charselect(QtGui.QWidget):
else: else:
self.prevpage.hide() self.prevpage.hide()
if exists(AOpath+"characters\\"+self.charlist[ind][0]+"\\char_icon.png"): # AO2 if exists(AOpath+"characters/"+self.charlist[ind][0]+"/char_icon.png"): # AO2
self.setBtnImage.emit(AOpath+"characters\\"+self.charlist[ind][0]+"\\char_icon.png", i) self.setBtnImage.emit(AOpath+"characters/"+self.charlist[ind][0]+"/char_icon.png", i)
elif exists(AOpath+"misc\\demothings\\"+self.charlist[ind][0]+"_char_icon.png"): # AO 1.7.5/1.8 elif exists(AOpath+"misc/demothings/"+self.charlist[ind][0]+"_char_icon.png"): # AO 1.7.5/1.8
self.setBtnImage.emit(AOpath+"misc\\demothings\\"+self.charlist[ind][0]+"_char_icon.png", i) self.setBtnImage.emit(AOpath+"misc/demothings/"+self.charlist[ind][0]+"_char_icon.png", i)
else: else:
self.setBtnImage.emit("placeholder.png", i) self.setBtnImage.emit("placeholder.png", i)
@ -124,4 +129,8 @@ class charselect(QtGui.QWidget):
self.buttons[ind].setPixmap(QtGui.QPixmap(filename)) self.buttons[ind].setPixmap(QtGui.QPixmap(filename))
def onCharClicked(self, ind): def onCharClicked(self, ind):
self.parent.tcp.send("CC#0#"+str(ind+(self.page*self.max_chars_on_page))+"#ur mom gay#%") self.parent.tcp.send("CC#0#"+str(ind+(self.page*self.max_chars_on_page))+"#ur mom gay#%")
def show(self):
super(charselect, self).show()
self.parent.gamewindow.setFixedSize(714, 668)

View File

@ -5,8 +5,8 @@ from os.path import exists
from functools import partial from functools import partial
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
#AOpath = "base/" AOpath = "base/"
AOpath = 'I:/aovanilla1.7.5/client/base/' #AOpath = 'I:/aovanilla1.7.5/client/base/'
PREANIM = 2 PREANIM = 2
CHARNAME = 3 CHARNAME = 3
@ -59,7 +59,12 @@ def decode_ao_str(text):
def get_char_ini(char, section, value, default=""): def get_char_ini(char, section, value, default=""):
tempini = ConfigParser() tempini = ConfigParser()
tempini.read(AOpath + 'characters\\' + char + '\\char.ini') tempini.read(AOpath + 'characters/' + char + '/char.ini')
return ini.read_ini(tempini, section, value, default)
def get_option(section, value, default=""):
tempini = ConfigParser()
tempini.read("base/ao2xp.ini")
return ini.read_ini(tempini, section, value, default) return ini.read_ini(tempini, section, value, default)
def get_text_color(textcolor): def get_text_color(textcolor):
@ -67,7 +72,7 @@ def get_text_color(textcolor):
return QtGui.QColor(255, 255, 255) return QtGui.QColor(255, 255, 255)
elif textcolor == 1: elif textcolor == 1:
return QtGui.QColor(0, 255, 0) return QtGui.QColor(0, 255, 0)
elif textcolor == 2: #OH FUCK MOD elif textcolor == 2: # OH FUCK MOD
return QtGui.QColor(255, 0, 0) return QtGui.QColor(255, 0, 0)
elif textcolor == 3: elif textcolor == 3:
return QtGui.QColor(255, 165, 0) return QtGui.QColor(255, 165, 0)
@ -130,6 +135,8 @@ class ChatLogs(QtGui.QTextEdit):
self.logfile = open("chatlogs/IC_%d%.2d%.2d_on_%.2d.%.2d.%.2d.txt" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]), "w") self.logfile = open("chatlogs/IC_%d%.2d%.2d_on_%.2d.%.2d.%.2d.txt" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]), "w")
else: else:
self.logfile = open("chatlogs/OOC_%d%.2d%.2d_on_%.2d.%.2d.%.2d.txt" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]), "w") self.logfile = open("chatlogs/OOC_%d%.2d%.2d_on_%.2d.%.2d.%.2d.txt" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]), "w")
else:
self.logfile = None
def __del__(self): def __del__(self):
if self.savelog: if self.savelog:
@ -178,7 +185,7 @@ class AOCharMovie(QtGui.QLabel):
self.m_flipped = flip self.m_flipped = flip
def play(self, p_char, p_emote, emote_prefix): def play(self, p_char, p_emote, emote_prefix):
if p_emote[0] == "/" or p_emote[0] == "\\": if p_emote[0] == "/" or p_emote[0] == "/":
p_emote = p_emote[1:] p_emote = p_emote[1:]
elif "../../characters" in p_emote: elif "../../characters" in p_emote:
print p_emote print p_emote
@ -188,9 +195,9 @@ class AOCharMovie(QtGui.QLabel):
emote_prefix = "" emote_prefix = ""
p_emote = emote p_emote = emote
original_path = AOpath+"characters\\"+p_char+"\\"+emote_prefix+p_emote+".gif" original_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif"
alt_path = AOpath+"characters\\"+p_char+"\\"+p_emote+".png" alt_path = AOpath+"characters/"+p_char+"/"+p_emote+".png"
placeholder_path = AOpath+"themes\\default\\placeholder.gif" placeholder_path = AOpath+"themes/default/placeholder.gif"
gif_path = "" gif_path = ""
if exists(original_path): if exists(original_path):
@ -199,8 +206,8 @@ class AOCharMovie(QtGui.QLabel):
if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download characters"): if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download characters"):
url = "http://s3.wasabisys.com/webao/base/characters/"+p_char.lower()+"/"+emote_prefix+p_emote.lower()+".gif" url = "http://s3.wasabisys.com/webao/base/characters/"+p_char.lower()+"/"+emote_prefix+p_emote.lower()+".gif"
url = url.replace(" ", "%20") url = url.replace(" ", "%20")
if not exists(AOpath+"characters\\"+p_char): # gotta make sure the character folder exists, better safe than sorry if not exists(AOpath+"characters/"+p_char): # gotta make sure the character folder exists, better safe than sorry
os.mkdir(AOpath+"characters\\"+p_char) os.mkdir(AOpath+"characters/"+p_char)
thread.start_new_thread(download_thread, (url, original_path)) thread.start_new_thread(download_thread, (url, original_path))
if exists(alt_path): if exists(alt_path):
@ -209,14 +216,14 @@ class AOCharMovie(QtGui.QLabel):
if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download characters"): if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download characters"):
url = "http://s3.wasabisys.com/webao/base/characters/"+p_char.lower()+"/"+p_emote.lower()+".png" url = "http://s3.wasabisys.com/webao/base/characters/"+p_char.lower()+"/"+p_emote.lower()+".png"
url = url.replace(" ", "%20") url = url.replace(" ", "%20")
if not exists(AOpath+"characters\\"+p_char): # gotta make sure the character folder exists, better safe than sorry if not exists(AOpath+"characters/"+p_char): # gotta make sure the character folder exists, better safe than sorry
os.mkdir(AOpath+"characters\\"+p_char) os.mkdir(AOpath+"characters/"+p_char)
thread.start_new_thread(download_thread, (url, alt_path)) thread.start_new_thread(download_thread, (url, alt_path))
if exists(placeholder_path): if exists(placeholder_path):
gif_path = placeholder_path gif_path = placeholder_path
else: else:
gif_path = "" gif_path = ""
self.m_movie.stop() self.m_movie.stop()
self.m_movie.setFileName(gif_path) self.m_movie.setFileName(gif_path)
@ -225,7 +232,7 @@ class AOCharMovie(QtGui.QLabel):
self.m_movie.start() self.m_movie.start()
def play_pre(self, p_char, p_emote, duration): def play_pre(self, p_char, p_emote, duration):
gif_path = AOpath+"characters\\"+p_char+"\\"+p_emote+".gif" gif_path = AOpath+"characters/"+p_char+"/"+p_emote+".gif"
self.m_movie.stop() self.m_movie.stop()
self.clear() self.clear()
@ -261,7 +268,7 @@ class AOCharMovie(QtGui.QLabel):
self.play(p_char, p_emote, "") self.play(p_char, p_emote, "")
def play_talking(self, p_char, p_emote): def play_talking(self, p_char, p_emote):
gif_path = AOpath + 'characters\\' + p_char + '\\(b)' + p_emote + '.gif' gif_path = AOpath + 'characters/' + p_char + '/(b)' + p_emote + '.gif'
self.m_movie.stop() self.m_movie.stop()
self.clear() self.clear()
@ -273,7 +280,7 @@ class AOCharMovie(QtGui.QLabel):
self.play(p_char, p_emote, '(b)') self.play(p_char, p_emote, '(b)')
def play_idle(self, p_char, p_emote): def play_idle(self, p_char, p_emote):
gif_path = AOpath + 'characters\\' + p_char + '\\(a)' + p_emote + '.gif' gif_path = AOpath + 'characters/' + p_char + '/(a)' + p_emote + '.gif'
self.m_movie.stop() self.m_movie.stop()
self.clear() self.clear()
@ -291,7 +298,11 @@ class AOCharMovie(QtGui.QLabel):
@QtCore.pyqtSlot(int) @QtCore.pyqtSlot(int)
def frame_change(self, n_frame): def frame_change(self, n_frame):
f_pixmap = QtGui.QPixmap.fromImage(self.m_movie.currentImage().mirrored(self.m_flipped, False)) f_img = self.m_movie.currentImage().mirrored(self.m_flipped, False)
if f_img.size().width() != 256 or f_img.size().height() != 192:
f_img = f_img.scaled(256, 192, transformMode=QtCore.Qt.SmoothTransformation)
f_pixmap = QtGui.QPixmap.fromImage(f_img)
self.setPixmap(f_pixmap) self.setPixmap(f_pixmap)
if self.m_movie.frameCount() - 1 == n_frame and self.play_once: if self.m_movie.frameCount() - 1 == n_frame and self.play_once:
@ -321,12 +332,12 @@ class AOMovie(QtGui.QLabel):
custom_path = "" custom_path = ""
if p_gif == "custom": if p_gif == "custom":
custom_path = AOpath+"characters\\"+p_char+"\\"+p_gif+".gif" custom_path = AOpath+"characters/"+p_char+"/"+p_gif+".gif"
else: else:
custom_path = AOpath+"characters\\"+p_char+"\\"+p_gif+"_bubble.gif" custom_path = AOpath+"characters/"+p_char+"/"+p_gif+"_bubble.gif"
theme_path = AOpath+"themes\\default\\"+p_gif+".gif" theme_path = AOpath+"themes/default/"+p_gif+".gif"
placeholder_path = AOpath+"themes\\default\\placeholder.gif" placeholder_path = AOpath+"themes/default/placeholder.gif"
if exists(custom_path): if exists(custom_path):
gif_path = custom_path gif_path = custom_path
@ -370,9 +381,9 @@ class ZoomLines(QtGui.QLabel):
return return
self.show() self.show()
if dir == 0: if dir == 0:
self.movie.setFileName(AOpath + 'themes\\default\\defense_speedlines.gif') self.movie.setFileName(AOpath + 'themes/default/defense_speedlines.gif')
else: else:
self.movie.setFileName(AOpath + 'themes\\default\\prosecution_speedlines.gif') self.movie.setFileName(AOpath + 'themes/default/prosecution_speedlines.gif')
self.movie.start() self.movie.start()
@ -403,14 +414,14 @@ class WTCE_View(QtGui.QLabel):
def showWTCE(self, wtce, variant=0): def showWTCE(self, wtce, variant=0):
self.finished() self.finished()
if wtce == 'testimony1': if wtce == 'testimony1':
self.movie.setFileName(AOpath + 'themes\\default\\witnesstestimony.gif') self.movie.setFileName(AOpath + 'themes/default/witnesstestimony.gif')
elif wtce == 'testimony2': elif wtce == 'testimony2':
self.movie.setFileName(AOpath + 'themes\\default\\crossexamination.gif') self.movie.setFileName(AOpath + 'themes/default/crossexamination.gif')
elif wtce == "judgeruling": elif wtce == "judgeruling":
if variant == 0: if variant == 0:
self.movie.setFileName(AOpath + 'themes\\default\\notguilty.gif') self.movie.setFileName(AOpath + 'themes/default/notguilty.gif')
elif variant == 1: elif variant == 1:
self.movie.setFileName(AOpath + 'themes\\default\\guilty.gif') self.movie.setFileName(AOpath + 'themes/default/guilty.gif')
else: else:
return return
self.show() self.show()
@ -496,11 +507,11 @@ class gui(QtGui.QWidget):
self.sidechar.hide() self.sidechar.hide()
self.bench = QtGui.QLabel(self.viewport) self.bench = QtGui.QLabel(self.viewport)
bench = QtGui.QPixmap(AOpath + 'background\\default\\defensedesk.png') bench = QtGui.QPixmap(AOpath + 'background/default/defensedesk.png')
self.court.setPixmap(QtGui.QPixmap(AOpath + 'background\\default\\defenseempty.png')) self.court.setPixmap(QtGui.QPixmap(AOpath + 'background/default/defenseempty.png'))
self.bench.setPixmap(bench) self.bench.setPixmap(bench)
self.chatbox = QtGui.QLabel(self) self.chatbox = QtGui.QLabel(self)
chatbox = QtGui.QPixmap(AOpath + 'themes\\default\\chatmed.png') chatbox = QtGui.QPixmap(AOpath + 'themes/default/chatmed.png')
chatboxheight = chatbox.size().height() chatboxheight = chatbox.size().height()
self.chatbox.setPixmap(chatbox) self.chatbox.setPixmap(chatbox)
self.chatbox.move(0, 192 - chatboxheight) self.chatbox.move(0, 192 - chatboxheight)
@ -533,7 +544,7 @@ class gui(QtGui.QWidget):
self.objectionview.done.connect(self.objection_done) self.objectionview.done.connect(self.objection_done)
self.whiteflashlab = QtGui.QLabel(self) self.whiteflashlab = QtGui.QLabel(self)
self.whiteflashlab.setPixmap(QtGui.QPixmap(AOpath + 'themes\\default\\realizationflash.png')) self.whiteflashlab.setPixmap(QtGui.QPixmap(AOpath + 'themes/default/realizationflash.png'))
self.whiteflashlab.setGeometry(0, 0, 256, 192) self.whiteflashlab.setGeometry(0, 0, 256, 192)
self.whiteflashlab.hide() self.whiteflashlab.hide()
self.whiteflash = QtCore.QTimer() self.whiteflash = QtCore.QTimer()
@ -542,30 +553,22 @@ class gui(QtGui.QWidget):
self.ooclog = ChatLogs(self, 1) self.ooclog = ChatLogs(self, 1)
self.ooclog.setReadOnly(True) self.ooclog.setReadOnly(True)
self.ooclog.setGeometry(714 - 288, 0, 288, 256)
self.ooclog.setStyleSheet('background-color: rgb(139, 139, 139);') self.ooclog.setStyleSheet('background-color: rgb(139, 139, 139);')
self.ooclog.textChanged.connect(self.ooclog_update) self.ooclog.textChanged.connect(self.ooclog_update)
self.oocnameinput = QtGui.QLineEdit(self) self.oocnameinput = QtGui.QLineEdit(self)
self.oocnameinput.setPlaceholderText('Enter a name...') self.oocnameinput.setPlaceholderText('Enter a name...')
self.oocnameinput.resize(self.oocnameinput.sizeHint().width() - 32, self.oocnameinput.sizeHint().height())
self.oocnameinput.setStyleSheet('background-color: rgb(139, 139, 139);') self.oocnameinput.setStyleSheet('background-color: rgb(139, 139, 139);')
self.oocnameinput.move(714 - 288, 256)
self.oocinput = QtGui.QLineEdit(self) self.oocinput = QtGui.QLineEdit(self)
self.oocinput.setPlaceholderText('Server chat/OOC chat...') self.oocinput.setPlaceholderText('Server chat/OOC chat...')
self.oocinput.setStyleSheet('background-color: rgb(139, 139, 139);') self.oocinput.setStyleSheet('background-color: rgb(139, 139, 139);')
self.oocinput.resize(187, self.oocinput.sizeHint().height())
self.oocinput.move(714 - 288 + self.oocnameinput.size().width(), 256)
self.oocinput.returnPressed.connect(self.onOOCreturn) self.oocinput.returnPressed.connect(self.onOOCreturn)
self.ooclogin = QtGui.QPushButton("Login", self) self.ooclogin = QtGui.QPushButton("Login", self)
self.ooclogin.resize(48, 20)
self.ooclogin.move(714 - (self.ooclogin.size().width()), self.oocinput.y() + self.ooclogin.size().height())
self.ooclogin.clicked.connect(self.onOOCLoginBtn) self.ooclogin.clicked.connect(self.onOOCLoginBtn)
self.musicitems = QtGui.QListWidget(self) self.musicitems = QtGui.QListWidget(self)
self.musicitems.setGeometry(714 - 288, 348, 288, 320)
self.musicitems.itemDoubleClicked.connect(self.onMusicClick) self.musicitems.itemDoubleClicked.connect(self.onMusicClick)
self.gametabs = QtGui.QTabWidget(self) self.gametabs = QtGui.QTabWidget(self)
@ -579,41 +582,30 @@ class gui(QtGui.QWidget):
self.icLog = ChatLogs(self.gametab_log, 0, self.ooclog.logfile) self.icLog = ChatLogs(self.gametab_log, 0, self.ooclog.logfile)
self.icLog.setReadOnly(True) self.icLog.setReadOnly(True)
self.icLog.setGeometry(8, 8, 714 - 304 - 22, 212)
self.icLog.textChanged.connect(self.icLogChanged) self.icLog.textChanged.connect(self.icLogChanged)
self.evidencedropdown = QtGui.QComboBox(self.gametab_evidence) self.evidencedropdown = QtGui.QComboBox(self.gametab_evidence)
self.evidencedropdown.setGeometry(8, 8, 192, 20)
self.evidencedropdown.currentIndexChanged.connect(self.changeEvidence) self.evidencedropdown.currentIndexChanged.connect(self.changeEvidence)
self.evidencedesc = QtGui.QTextEdit(self.gametab_evidence) self.evidencedesc = QtGui.QTextEdit(self.gametab_evidence)
self.evidencedesc.setReadOnly(True) self.evidencedesc.setReadOnly(True)
self.evidencedesc.setGeometry(8, 108, 714 - 304 - 22, 112)
self.evidenceimage = QtGui.QLabel(self.gametab_evidence) self.evidenceimage = QtGui.QLabel(self.gametab_evidence)
self.evidenceimage.setPixmap(QtGui.QPixmap(AOpath + 'evidence\\empty.png')) self.evidenceimage.setPixmap(QtGui.QPixmap(AOpath + 'evidence/empty.png'))
self.evidenceimage.setGeometry(326, 8, 70, 70)
self.evidenceimage.show() self.evidenceimage.show()
self.evidenceadd = QtGui.QPushButton(self.gametab_evidence) self.evidenceadd = QtGui.QPushButton(self.gametab_evidence)
self.evidenceadd.setText('Add') self.evidenceadd.setText('Add')
self.evidenceadd.move(8, 32)
self.evidenceadd.clicked.connect(self.onAddEvidence) self.evidenceadd.clicked.connect(self.onAddEvidence)
self.evidenceedit = QtGui.QPushButton(self.gametab_evidence) self.evidenceedit = QtGui.QPushButton(self.gametab_evidence)
self.evidenceedit.setText('Edit') self.evidenceedit.setText('Edit')
self.evidenceedit.move(8, 56)
self.evidenceedit.clicked.connect(self.onEditEvidence) self.evidenceedit.clicked.connect(self.onEditEvidence)
self.evidencedelete = QtGui.QPushButton(self.gametab_evidence) self.evidencedelete = QtGui.QPushButton(self.gametab_evidence)
self.evidencedelete.setText('Delete') self.evidencedelete.setText('Delete')
self.evidencedelete.move(8, 80)
self.evidencedelete.clicked.connect(self.onDeleteEvidence) self.evidencedelete.clicked.connect(self.onDeleteEvidence)
self.evidencepresent = PresentButton(self, self.gametab_evidence) self.evidencepresent = PresentButton(self, self.gametab_evidence)
self.evidencepresent.move((714 - 304 - 22) / 2 - self.evidencepresent.button_off.size().width() / 2, self.evidencedesc.y() - self.evidencepresent.button_off.size().height())
self.msgqueueList = QtGui.QListWidget(self.gametab_msgqueue) self.msgqueueList = QtGui.QListWidget(self.gametab_msgqueue)
self.msgqueueList.setGeometry(8, 8, 714 - 304 - 22, 180)
self.msgqueueList.itemClicked.connect(self.onClicked_msgqueue) self.msgqueueList.itemClicked.connect(self.onClicked_msgqueue)
self.removeQueue = QtGui.QPushButton(self.gametab_msgqueue) self.removeQueue = QtGui.QPushButton(self.gametab_msgqueue)
self.removeQueue.setText('Delete') self.removeQueue.setText('Delete')
self.removeQueue.resize(self.removeQueue.sizeHint())
self.removeQueue.move(8, self.msgqueueList.size().height() + 16)
self.removeQueue.clicked.connect(self.onClicked_removeQueue) self.removeQueue.clicked.connect(self.onClicked_removeQueue)
self.unmutedlist = QtGui.QListWidget(self.gametab_mute) self.unmutedlist = QtGui.QListWidget(self.gametab_mute)
@ -626,54 +618,35 @@ class gui(QtGui.QWidget):
self.mutedlabel.setText('Muted') self.mutedlabel.setText('Muted')
self.mutebtn.setText('>>') self.mutebtn.setText('>>')
self.unmutebtn.setText('<<') self.unmutebtn.setText('<<')
self.notmutedlabel.move(8, 8)
self.unmutedlist.setGeometry(8, 24, 160, 192)
self.mutedlist.setGeometry(238, 24, 160, 192)
self.mutedlabel.move(238 + self.mutedlist.size().width() - self.mutedlist.size().width() - 8, 8)
self.mutebtn.setGeometry((714 - 304) / 2 - 26, 64, 48, 32)
self.unmutebtn.setGeometry((714 - 304) / 2 - 26, 128, 48, 32)
self.mutebtn.clicked.connect(self.onMuteClick) self.mutebtn.clicked.connect(self.onMuteClick)
self.unmutebtn.clicked.connect(self.onUnmuteClick) self.unmutebtn.clicked.connect(self.onUnmuteClick)
self.mutedlist.itemClicked.connect(self.changeMuteIndex) self.mutedlist.itemClicked.connect(self.changeMuteIndex)
self.unmutedlist.itemClicked.connect(self.changeUnmuteIndex) self.unmutedlist.itemClicked.connect(self.changeUnmuteIndex)
self.iniswaplist = QtGui.QComboBox(self.gametab_iniswap) self.iniswaplist = QtGui.QComboBox(self.gametab_iniswap)
self.iniswaplist.setGeometry(8, 8, 192, self.iniswaplist.sizeHint().height())
self.iniswaplist.currentIndexChanged.connect(self.iniswap_index_change) self.iniswaplist.currentIndexChanged.connect(self.iniswap_index_change)
self.iniswapconfirm = QtGui.QPushButton(self.gametab_iniswap) self.iniswapconfirm = QtGui.QPushButton(self.gametab_iniswap)
self.iniswapconfirm.setText('Swap') self.iniswapconfirm.setText('Swap')
self.iniswapconfirm.resize(self.iniswapconfirm.sizeHint())
self.iniswapconfirm.move(714 - 304 - 22 - self.iniswapconfirm.size().width(), 8)
self.iniswapconfirm.clicked.connect(self.iniswap_confirm) self.iniswapconfirm.clicked.connect(self.iniswap_confirm)
self.iniswapreset = QtGui.QPushButton(self.gametab_iniswap) self.iniswapreset = QtGui.QPushButton(self.gametab_iniswap)
self.iniswapreset.setText('Reset') self.iniswapreset.setText('Reset')
self.iniswapreset.resize(self.iniswapconfirm.size())
self.iniswapreset.move(714 - 304 - 22 - self.iniswapconfirm.size().width(), 16 + self.iniswapconfirm.size().height())
self.iniswapreset.clicked.connect(self.resetIniSwap) self.iniswapreset.clicked.connect(self.resetIniSwap)
self.iniswapinfo = QtGui.QLabel(self.gametab_iniswap) self.iniswapinfo = QtGui.QLabel(self.gametab_iniswap)
self.iniswapinfo.setText('Not swapped') self.iniswapinfo.setText('Not swapped')
self.iniswapinfo.setGeometry(8, 32, 192, 24)
self.iniswaprefresh = QtGui.QPushButton(self.gametab_iniswap) self.iniswaprefresh = QtGui.QPushButton(self.gametab_iniswap)
self.iniswaprefresh.setText('Refresh characters') self.iniswaprefresh.setText('Refresh characters')
self.iniswaprefresh.resize(self.iniswaprefresh.sizeHint())
self.iniswaprefresh.move(8, 64)
self.iniswaprefresh.clicked.connect(self.loadSwapCharacters) self.iniswaprefresh.clicked.connect(self.loadSwapCharacters)
self.paircheckbox = QtGui.QCheckBox(self.gametab_pair) self.paircheckbox = QtGui.QCheckBox(self.gametab_pair)
self.paircheckbox.setChecked(False) self.paircheckbox.setChecked(False)
self.paircheckbox.setGeometry(16, 16, 128, 24)
self.pairdropdown = QtGui.QComboBox(self.gametab_pair) self.pairdropdown = QtGui.QComboBox(self.gametab_pair)
self.pairdropdown.setGeometry(112, 64, 192, 18)
self.pairdropdown_l = QtGui.QLabel("Pair with...", self.gametab_pair) self.pairdropdown_l = QtGui.QLabel("Pair with...", self.gametab_pair)
self.pairdropdown_l.move(self.pairdropdown.x() - 64, self.pairdropdown.y()+2) self.pairdropdown_l.move(self.pairdropdown.x() - 64, self.pairdropdown.y()+2)
self.pairoffset = QtGui.QSlider(QtCore.Qt.Horizontal, self.gametab_pair) self.pairoffset = QtGui.QSlider(QtCore.Qt.Horizontal, self.gametab_pair)
self.pairoffset.setRange(-100, 100) self.pairoffset.setRange(-100, 100)
self.pairoffset.setValue(0) self.pairoffset.setValue(0)
self.pairoffset.setGeometry(114, 128, 192, 24)
self.pairoffset_l = QtGui.QLabel("Position offset", self.gametab_pair) self.pairoffset_l = QtGui.QLabel("Position offset", self.gametab_pair)
self.pairoffset_l.move(self.pairoffset.x() - 88, self.pairoffset.y()+4)
self.pairoffsetreset = QtGui.QPushButton("Reset", self.gametab_pair) self.pairoffsetreset = QtGui.QPushButton("Reset", self.gametab_pair)
self.pairoffsetreset.move(self.pairoffset.x() + self.pairoffset.size().width() + 8, self.pairoffset.y())
self.pairoffsetreset.clicked.connect(partial(self.pairoffset.setValue, 0)) self.pairoffsetreset.clicked.connect(partial(self.pairoffset.setValue, 0))
self.misc_layout = QtGui.QVBoxLayout(self.gametab_misc) self.misc_layout = QtGui.QVBoxLayout(self.gametab_misc)
@ -684,17 +657,13 @@ class gui(QtGui.QWidget):
self.spacebartext = QtGui.QCheckBox() self.spacebartext = QtGui.QCheckBox()
self.spacebartext.setChecked(False) self.spacebartext.setChecked(False)
self.spacebartext.setText("S p a c i n g") self.spacebartext.setText("S p a c i n g")
self.spacebartext.move(self.mocktext.x(), self.mocktext.y()+24)
self.autocaps = QtGui.QCheckBox() self.autocaps = QtGui.QCheckBox()
self.autocaps.setChecked(False) self.autocaps.setChecked(False)
self.autocaps.setText("Automatic caps and period") self.autocaps.setText("Automatic caps and period")
self.autocaps.move(self.spacebartext.x(), self.spacebartext.y()+24)
self.misc_layout.addWidget(self.mocktext) self.misc_layout.addWidget(self.mocktext)
self.misc_layout.addWidget(self.spacebartext) self.misc_layout.addWidget(self.spacebartext)
self.misc_layout.addWidget(self.autocaps) self.misc_layout.addWidget(self.autocaps)
self.gametabs.move(8, 402)
self.gametabs.resize(714 - 304, 256)
self.gametabs.addTab(self.gametab_log, 'Game log') self.gametabs.addTab(self.gametab_log, 'Game log')
self.gametabs.addTab(self.gametab_evidence, 'Evidence') self.gametabs.addTab(self.gametab_evidence, 'Evidence')
self.gametabs.addTab(self.gametab_msgqueue, 'Message queue') self.gametabs.addTab(self.gametab_msgqueue, 'Message queue')
@ -777,7 +746,7 @@ class gui(QtGui.QWidget):
self.nextemotepage = NextEmoteButton(self, 236, 253) self.nextemotepage = NextEmoteButton(self, 236, 253)
self.nextemotepage.show() self.nextemotepage.show()
self.realizationbtn = buttons.RealizationButton(self, 265, 192) self.realizationbtn = buttons.RealizationButton(self, 265, 192)
self.realizationsnd = BASS_StreamCreateFile(False, AOpath + 'sounds\\general\\sfx-realization.wav', 0, 0, 0) self.realizationsnd = BASS_StreamCreateFile(False, AOpath + 'sounds/general/sfx-realization.wav', 0, 0, 0)
self.customobject = buttons.CustomObjection(self, 250, 312) self.customobject = buttons.CustomObjection(self, 250, 312)
self.holditbtn = buttons.Objections(self, 10, 312, 1) self.holditbtn = buttons.Objections(self, 10, 312, 1)
self.objectbtn = buttons.Objections(self, 90, 312, 2) self.objectbtn = buttons.Objections(self, 90, 312, 2)
@ -823,21 +792,14 @@ class gui(QtGui.QWidget):
self.musicslider.setValue(100) self.musicslider.setValue(100)
self.soundslider.setValue(100) self.soundslider.setValue(100)
self.blipslider.setValue(100) self.blipslider.setValue(100)
self.musicslider.setGeometry(self.oocnameinput.x(), self.oocnameinput.y()+24, 192, 16)
self.soundslider.setGeometry(self.oocnameinput.x(), self.oocnameinput.y()+48, 192, 16)
self.blipslider.setGeometry(self.oocnameinput.x(), self.oocnameinput.y()+72, 192, 16)
self.musicslider.sliderMoved.connect(self.changeMusicVolume) self.musicslider.sliderMoved.connect(self.changeMusicVolume)
self.soundslider.sliderMoved.connect(self.changeSoundVolume) self.soundslider.sliderMoved.connect(self.changeSoundVolume)
self.blipslider.valueChanged.connect(self.changeBlipVolume) self.blipslider.valueChanged.connect(self.changeBlipVolume)
self.sliderlabel1 = QtGui.QLabel("Music", self) self.sliderlabel1 = QtGui.QLabel("Music", self)
self.sliderlabel2 = QtGui.QLabel("SFX", self) self.sliderlabel2 = QtGui.QLabel("SFX", self)
self.sliderlabel3 = QtGui.QLabel("Blips", self) self.sliderlabel3 = QtGui.QLabel("Blips", self)
self.sliderlabel1.move(self.musicslider.x() + self.musicslider.size().width()+8, self.musicslider.y())
self.sliderlabel2.move(self.soundslider.x() + self.soundslider.size().width()+8, self.soundslider.y())
self.sliderlabel3.move(self.blipslider.x() + self.blipslider.size().width()+8, self.blipslider.y())
self.pinglabel = QtGui.QLabel(self) self.pinglabel = QtGui.QLabel(self)
self.pinglabel.setGeometry(self.sliderlabel3.x() + 32, self.sliderlabel3.y(), 96, 14)
self.name.show() self.name.show()
self.char.show() self.char.show()
@ -928,15 +890,12 @@ class gui(QtGui.QWidget):
self.showname = str(text.toUtf8()) self.showname = str(text.toUtf8())
def setEvidenceImg(self, guiobj, image): def setEvidenceImg(self, guiobj, image):
f_image = str(image) if exists(AOpath + 'evidence/' + image):
f_guiobj = str(guiobj) guiobj.setPixmap(QtGui.QPixmap(AOpath + "evidence/%s" % image))
if exists(AOpath + 'evidence\\' + f_image):
exec f_guiobj+'.setPixmap(QtGui.QPixmap(AOpath+"evidence/%s"))' % f_image
else: else:
exec f_guiobj+".setPixmap(QtGui.QPixmap(AOpath + 'themes\\default\\evidence_selected.png'))" guiobj.setPixmap(QtGui.QPixmap(AOpath + 'themes/default/evidence_selected.png'))
if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download evidence"): if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download evidence"):
url = "http://s3.wasabisys.com/webao/base/evidence/"+f_image.lower() url = "http://s3.wasabisys.com/webao/base/evidence/"+image.lower()
url = url.replace("evidence/../", "") url = url.replace("evidence/../", "")
path = AOpath+"evidence/"+image path = AOpath+"evidence/"+image
path = path.replace("evidence/../", "") path = path.replace("evidence/../", "")
@ -1031,6 +990,8 @@ class gui(QtGui.QWidget):
self.tcp.send("RT#judgeruling#" +str(variant)+ "#%") self.tcp.send("RT#judgeruling#" +str(variant)+ "#%")
def loadCharacter(self, charname): def loadCharacter(self, charname):
exec open("base/ao2xp_themes/"+get_option("General", "theme", "default")+"/theme.py")
self.emotedropdown.clear() self.emotedropdown.clear()
self.msgqueueList.clear() self.msgqueueList.clear()
self.msgqueue = [] self.msgqueue = []
@ -1091,9 +1052,9 @@ class gui(QtGui.QWidget):
for n_emote in range(emotes_on_page): for n_emote in range(emotes_on_page):
n_real_emote = n_emote + self.current_emote_page * self.max_emotes_on_page n_real_emote = n_emote + self.current_emote_page * self.max_emotes_on_page
if n_real_emote == self.selectedemote: if n_real_emote == self.selectedemote:
self.emotebuttons[n_emote].setPixmap(QtGui.QPixmap(AOpath + 'characters\\' + self.charname + '\\emotions\\button' + str(n_real_emote + 1) + '_on.png')) self.emotebuttons[n_emote].setPixmap(QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_on.png'))
else: else:
self.emotebuttons[n_emote].setPixmap(QtGui.QPixmap(AOpath + 'characters\\' + self.charname + '\\emotions\\button' + str(n_real_emote + 1) + '_off.png')) self.emotebuttons[n_emote].setPixmap(QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_off.png'))
self.emotebuttons[n_emote].show() self.emotebuttons[n_emote].show()
def iniswap_index_change(self, ind): def iniswap_index_change(self, ind):
@ -1103,7 +1064,7 @@ class gui(QtGui.QWidget):
self.charsfolder = [] self.charsfolder = []
self.iniswaplist.clear() self.iniswaplist.clear()
for folder in os.listdir(AOpath + 'characters'): for folder in os.listdir(AOpath + 'characters'):
if exists(AOpath + 'characters\\' + folder + '\\char.ini'): if exists(AOpath + 'characters/' + folder + '/char.ini'):
self.charsfolder.append(folder) self.charsfolder.append(folder)
self.iniswaplist.addItem(folder) self.iniswaplist.addItem(folder)
@ -1143,7 +1104,7 @@ class gui(QtGui.QWidget):
self.tcp.send("ZZ#%") self.tcp.send("ZZ#%")
def onClick_changeChar(self): def onClick_changeChar(self):
self.tcp.send('RD#%') #self.tcp.send('RD#%')
self.charselect.show() self.charselect.show()
def changeFlipCheck(self, on): def changeFlipCheck(self, on):
@ -1177,10 +1138,7 @@ class gui(QtGui.QWidget):
return return
self.selectedevi = ind self.selectedevi = ind
self.evidencedesc.setText(self.evidence[ind][1]) self.evidencedesc.setText(self.evidence[ind][1])
evithread = anythingThread('setEvidenceImg(QString, QString)', "self.evidenceimage", self.evidence[ind][2]) self.setEvidenceImg(self.evidenceimage, self.evidence[ind][2])
self.connect(evithread, QtCore.SIGNAL('setEvidenceImg(QString, QString)'), self.setEvidenceImg)
evithread.start()
del evithread
def buttonthread(self, ind, img): def buttonthread(self, ind, img):
if ind < self.max_emotes_on_page: if ind < self.max_emotes_on_page:
@ -1195,9 +1153,9 @@ class gui(QtGui.QWidget):
self.selectedemote = ind self.selectedemote = ind
for button in self.emotebuttons: for button in self.emotebuttons:
if button.emoteid == ind: if button.emoteid == ind:
button.setPixmap(QtGui.QPixmap(AOpath + 'characters\\' + self.charname + '\\emotions\\button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_on.png')) button.setPixmap(QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_on.png'))
else: else:
button.setPixmap(QtGui.QPixmap(AOpath + 'characters\\' + self.charname + '\\emotions\\button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_off.png')) button.setPixmap(QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_off.png'))
def setChatColor(self, ind): def setChatColor(self, ind):
self.mychatcolor = ind self.mychatcolor = ind
@ -1259,7 +1217,7 @@ class gui(QtGui.QWidget):
self.oocinput.clear() self.oocinput.clear()
def onICreturn(self): def onICreturn(self):
text = str(self.icchatinput.text().toUtf8()).replace('#', '<num>').replace('%', '<percent>').replace('&', '<and>').replace('$', '<dollar>').replace('\\n', '\n') text = str(self.icchatinput.text().toUtf8()).replace('#', '<num>').replace('%', '<percent>').replace('&', '<and>').replace('$', '<dollar>').replace('/n', '\n')
if not text: if not text:
return return
@ -1352,17 +1310,18 @@ class gui(QtGui.QWidget):
self.realizationbtn.setPressed(False) self.realizationbtn.setPressed(False)
def setBackground(self, bg): def setBackground(self, bg):
if not exists(AOpath + 'background\\' + bg): if not exists(AOpath + 'background/' + bg):
bg = 'default' bg = 'default'
self.side_def = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\defenseempty.png') self.side_def = QtGui.QPixmap(AOpath + 'background/' + bg + '/defenseempty.png')
self.bench_def = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\defensedesk.png') self.bench_def = QtGui.QPixmap(AOpath + 'background/' + bg + '/defensedesk.png')
self.side_pro = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\prosecutorempty.png') self.side_pro = QtGui.QPixmap(AOpath + 'background/' + bg + '/prosecutorempty.png')
self.bench_pro = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\prosecutiondesk.png') self.bench_pro = QtGui.QPixmap(AOpath + 'background/' + bg + '/prosecutiondesk.png')
self.side_wit = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\witnessempty.png') self.side_wit = QtGui.QPixmap(AOpath + 'background/' + bg + '/witnessempty.png')
self.bench_wit = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\stand.png') self.bench_wit = QtGui.QPixmap(AOpath + 'background/' + bg + '/stand.png')
self.side_hld = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\helperstand.png') self.side_hld = QtGui.QPixmap(AOpath + 'background/' + bg + '/helperstand.png')
self.side_hlp = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\prohelperstand.png') self.side_hlp = QtGui.QPixmap(AOpath + 'background/' + bg + '/prohelperstand.png')
self.side_jud = QtGui.QPixmap(AOpath + 'background\\' + bg + '\\judgestand.png') self.side_jud = QtGui.QPixmap(AOpath + 'background/' + bg + '/judgestand.png')
self.side_sea = QtGui.QPixmap(AOpath + 'background/' + bg + '/seance.png')
def netmsg_hp(self, type, health): def netmsg_hp(self, type, health):
if type == 1: if type == 1:
@ -1520,6 +1479,10 @@ class gui(QtGui.QWidget):
self.court.setPixmap(self.side_jud) self.court.setPixmap(self.side_jud)
self.bench.hide() self.bench.hide()
self.presentedevi.move(16, 16) self.presentedevi.move(16, 16)
elif side == 'sea':
self.bench.hide()
self.court.setPixmap(self.side_jud if self.side_sea.isNull() else self.side_sea)
self.presentedevi.move(16, 16)
def objection_done(self): def objection_done(self):
self.handle_chatmessage_2() self.handle_chatmessage_2()
@ -1560,7 +1523,11 @@ class gui(QtGui.QWidget):
self.sidechar.move(0,0) self.sidechar.move(0,0)
self.char.move(0,0) self.char.move(0,0)
else: else:
got_other_charid = int(self.m_chatmessage[OTHER_CHARID]) if "effects" in self.features:
got_other_charid = int(self.m_chatmessage[OTHER_CHARID].split("^")[0])
else:
got_other_charid = int(self.m_chatmessage[OTHER_CHARID])
if got_other_charid > -1: if got_other_charid > -1:
self.sidechar.show() self.sidechar.show()
@ -1632,7 +1599,7 @@ class gui(QtGui.QWidget):
self.sidechar.move(0, 0) self.sidechar.move(0, 0)
self.char.move(0, 0) self.char.move(0, 0)
if emote_mod == 1 or emote_mod == 2 or emote_mod == 6: if (emote_mod == 1 or emote_mod == 6 and self.m_chatmessage[PREANIM] != "-") or emote_mod == 2:
self.play_preanim(False) self.play_preanim(False)
elif emote_mod == 0 or emote_mod == 5: elif emote_mod == 0 or emote_mod == 5:
if self.m_chatmessage[NO_INTERRUPT] == "0": if self.m_chatmessage[NO_INTERRUPT] == "0":
@ -1654,7 +1621,7 @@ class gui(QtGui.QWidget):
else: else:
preanim_duration = ao2_duration preanim_duration = ao2_duration
anim_to_find = AOpath+"characters\\"+f_char+"\\"+f_preanim+".gif" anim_to_find = AOpath+"characters/"+f_char+"/"+f_preanim+".gif"
if not exists(anim_to_find) or preanim_duration < 0: if not exists(anim_to_find) or preanim_duration < 0:
if noninterrupting: if noninterrupting:
self.anim_state = 4 self.anim_state = 4
@ -1695,7 +1662,7 @@ class gui(QtGui.QWidget):
f_image = self.evidence[f_evi_id-1][2] f_image = self.evidence[f_evi_id-1][2]
is_left_side = not (f_side == "def" or f_side == "hlp" or f_side == "jud" or f_side == "jur") is_left_side = not (f_side == "def" or f_side == "hlp" or f_side == "jud" or f_side == "jur")
self.setEvidenceImg("self.presentedevi", f_image) self.setEvidenceImg(self.presentedevi, f_image)
if not is_left_side: if not is_left_side:
self.presentedevi.move(170, 16) self.presentedevi.move(170, 16)
@ -1777,7 +1744,7 @@ class gui(QtGui.QWidget):
charid = int(self.m_chatmessage[CHAR_ID]) charid = int(self.m_chatmessage[CHAR_ID])
self.blip = self.charlist[charid][2] self.blip = self.charlist[charid][2]
self.blipsnd = BASS_StreamCreateFile(False, AOpath+"sounds\\general\\sfx-blip"+self.blip+".wav", 0, 0, 0) self.blipsnd = BASS_StreamCreateFile(False, AOpath+"sounds/general/sfx-blip"+self.blip+".wav", 0, 0, 0)
BASS_ChannelSetAttribute(self.blipsnd, BASS_ATTRIB_VOL, self.blipslider.value() / 100.0) BASS_ChannelSetAttribute(self.blipsnd, BASS_ATTRIB_VOL, self.blipslider.value() / 100.0)
self.text_state = 1 self.text_state = 1
@ -1947,16 +1914,16 @@ class gui(QtGui.QWidget):
objecting = 'custom' objecting = 'custom'
if objecting: if objecting:
if exists(AOpath + 'characters\\' + charname + '\\' + objecting + '.wav'): if exists(AOpath + 'characters/' + charname + '/' + objecting + '.wav'):
self.objectsnd = BASS_StreamCreateFile(False, AOpath + 'characters\\' + charname + '\\' + objecting + '.wav', 0, 0, 0) self.objectsnd = BASS_StreamCreateFile(False, AOpath + 'characters/' + charname + '/' + objecting + '.wav', 0, 0, 0)
else: else:
self.objectsnd = None self.objectsnd = None
if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download sounds"): if ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download sounds"):
if not exists(AOpath+"characters\\"+charname.lower()): # gotta make sure the character folder exists, better safe than sorry if not exists(AOpath+"characters/"+charname.lower()): # gotta make sure the character folder exists, better safe than sorry
os.mkdir(AOpath+"characters\\"+charname.lower()) os.mkdir(AOpath+"characters/"+charname.lower())
thread.start_new_thread(download_thread, ("http://s3.wasabisys.com/webao/base/characters/"+charname.lower()+"/"+objecting.lower()+".wav", AOpath+"characters/"+charname.lower()+"/"+objecting.lower()+".wav")) thread.start_new_thread(download_thread, ("http://s3.wasabisys.com/webao/base/characters/"+charname.lower()+"/"+objecting.lower()+".wav", AOpath+"characters/"+charname.lower()+"/"+objecting.lower()+".wav"))
self.objectsnd = BASS_StreamCreateFile(False, AOpath + 'sounds\\general\\sfx-objection.wav', 0, 0, 0) self.objectsnd = BASS_StreamCreateFile(False, AOpath + 'sounds/general/sfx-objection.wav', 0, 0, 0)
BASS_ChannelSetAttribute(self.objectsnd, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0) BASS_ChannelSetAttribute(self.objectsnd, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
BASS_ChannelPlay(self.objectsnd, True) BASS_ChannelPlay(self.objectsnd, True)
@ -1972,8 +1939,8 @@ class gui(QtGui.QWidget):
if BASS_ChannelIsActive(self.sound): if BASS_ChannelIsActive(self.sound):
BASS_ChannelStop(self.sound) BASS_ChannelStop(self.sound)
BASS_StreamFree(self.sound) BASS_StreamFree(self.sound)
if exists(AOpath + 'sounds\\general\\' + sfx + '.wav'): if exists(AOpath + 'sounds/general/' + sfx + '.wav'):
self.sound = BASS_StreamCreateFile(False, AOpath + 'sounds\\general\\' + sfx + '.wav', 0, 0, 0) self.sound = BASS_StreamCreateFile(False, AOpath + 'sounds/general/' + sfx + '.wav', 0, 0, 0)
BASS_ChannelSetAttribute(self.sound, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0) BASS_ChannelSetAttribute(self.sound, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
BASS_ChannelPlay(self.sound, True) BASS_ChannelPlay(self.sound, True)
@ -1985,15 +1952,21 @@ class gui(QtGui.QWidget):
if BASS_ChannelIsActive(self.music): if BASS_ChannelIsActive(self.music):
BASS_ChannelStop(self.music) BASS_ChannelStop(self.music)
BASS_StreamFree(self.music) BASS_StreamFree(self.music)
if exists(AOpath + 'sounds\\music\\' + mus):
self.music = BASS_StreamCreateFile(False, AOpath + 'sounds\\music\\' + mus, 0, 0, 0) if exists(AOpath + 'sounds/music/' + mus):
self.music = BASS_StreamCreateFile(False, AOpath + 'sounds/music/' + mus, 0, 0, 0)
BASS_ChannelSetAttribute(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0) BASS_ChannelSetAttribute(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
BASS_ChannelPlay(self.music, True) BASS_ChannelPlay(self.music, True)
elif ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download music"): elif ini.read_ini_bool(AOpath+"AO2XP.ini", "General", "download music"):
self.music = BASS_StreamCreateURL('http://s3.wasabisys.com/webao/base/sounds/music/' + mus.lower(), 0, 0, DOWNLOADPROC(), 0) self.music = BASS_StreamCreateURL('http://s3.wasabisys.com/webao/base/sounds/music/' + mus.lower() if not mus.lower().startswith("http") else mus, 0, BASS_STREAM_BLOCK, DOWNLOADPROC(), 0)
if self.music: if self.music:
BASS_ChannelSetAttribute(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0) BASS_ChannelSetAttribute(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
BASS_ChannelPlay(self.music, True) BASS_ChannelPlay(self.music, True)
else:
self.music = BASS_StreamCreateURL('http://s3.wasabisys.com/aov-webao/base/sounds/music/' + mus.lower() if not mus.lower().startswith("http") else mus, 0, BASS_STREAM_BLOCK, DOWNLOADPROC(), 0)
BASS_ChannelSetAttribute(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
BASS_ChannelPlay(self.music, True)
def stopMusic(self): def stopMusic(self):
if self.music: if self.music:
@ -2052,7 +2025,7 @@ class gui(QtGui.QWidget):
self.healthbars.emit(hp[0], hp[1]) self.healthbars.emit(hp[0], hp[1])
for char in self.charlist: for char in self.charlist:
if not exists(AOpath + 'characters\\' + char[0] + '\\char.ini'): if not exists(AOpath + 'characters/' + char[0] + '/char.ini'):
continue continue
char[2] = get_char_ini(char[0], "options", "gender", "male") char[2] = get_char_ini(char[0], "options", "gender", "male")
@ -2078,17 +2051,14 @@ class gui(QtGui.QWidget):
else: else:
self.icLog.append(logstart) self.icLog.append(logstart)
bgthread = setBackgroundThread(background) self.setBackground(background)
self.connect(bgthread, QtCore.SIGNAL('setBackground(QString)'), self.setBackground)
bgthread.start()
del bgthread
for msg in oocjoin: for msg in oocjoin:
self.ooclog.append(msg) self.ooclog.append(msg)
for song in musiclist: for song in musiclist:
songitem = QtGui.QListWidgetItem() songitem = QtGui.QListWidgetItem()
songitem.setText(song) songitem.setText(song)
if exists(AOpath + 'sounds\\music\\' + song): if exists(AOpath + 'sounds/music/' + song):
songitem.setBackgroundColor(QtGui.QColor(128, 255, 128)) songitem.setBackgroundColor(QtGui.QColor(128, 255, 128))
else: else:
songitem.setBackgroundColor(QtGui.QColor(255, 128, 128)) songitem.setBackgroundColor(QtGui.QColor(255, 128, 128))
@ -2099,8 +2069,30 @@ class gui(QtGui.QWidget):
self.tcpthread = TCP_Thread(self) self.tcpthread = TCP_Thread(self)
self.tcpthread.MS_Chat.connect(self.netmsg_ms) self.tcpthread.MS_Chat.connect(self.netmsg_ms)
self.tcpthread.newChar.connect(self.loadCharacter) self.tcpthread.newChar.connect(self.loadCharacter)
self.tcpthread.newBackground.connect(self.setBackground)
self.tcpthread.OOC_Log.connect(self.ooclog.append)
self.tcpthread.IC_Log.connect(self.icLog.append)
self.tcpthread.charSlots.connect(partial(self.charselect.setCharList, self.charlist))
self.tcpthread.showCharSelect.connect(self.charselect.show)
self.tcpthread.allEvidence.connect(self.allEvidence)
self.tcpthread.rainbowColor.connect(self.text.setStyleSheet)
self.tcpthread.start() self.tcpthread.start()
def allEvidence(self, evi):
self.evidence = evi
if self.evidencedropdown.count() > 0:
self.evidencedropdown.clear()
for evi in self.evidence:
evi[0] = evi[0].decode('utf-8')
evi[1] = evi[1].decode('utf-8')
evi[2] = evi[2].decode('utf-8')
self.evidencedropdown.addItem(evi[0])
if not self.evidence:
self.evidencedropdown.setCurrentIndex(0)
self.evidencedesc.setText('.')
else:
self.evidencedropdown.setCurrentIndex(self.selectedevi)
class ButtonThread(QtCore.QThread): class ButtonThread(QtCore.QThread):
@ -2154,8 +2146,8 @@ class PresentButton(QtGui.QLabel):
def __init__(self, gamegui, parent): def __init__(self, gamegui, parent):
super(PresentButton, self).__init__(parent) super(PresentButton, self).__init__(parent)
self.gamegui = gamegui self.gamegui = gamegui
self.button_off = QtGui.QPixmap(AOpath + 'themes\\default\\present_disabled.png') self.button_off = QtGui.QPixmap(AOpath + 'themes/default/present_disabled.png')
self.button_on = QtGui.QPixmap(AOpath + 'themes\\default\\present.png') self.button_on = QtGui.QPixmap(AOpath + 'themes/default/present.png')
self.setPixmap(self.button_off) self.setPixmap(self.button_off)
self.show() self.show()
@ -2168,19 +2160,20 @@ class PresentButton(QtGui.QLabel):
class EditEvidenceDialog(QtGui.QDialog): class EditEvidenceDialog(QtGui.QDialog):
def __init__(self, gamegui): def __init__(self, gamegui):
super(EditEvidenceDialog, self).__init__() super(EditEvidenceDialog, self).__init__()
self.gamegui = gamegui self.gamegui = gamegui
self.setWindowTitle('Add evidence') self.setWindowTitle('Add evidence')
self.resize(512, 384) self.resize(512, 384)
self.setModal(True)
self.eviname = QtGui.QLineEdit(self) self.eviname = QtGui.QLineEdit(self)
self.eviname.setGeometry(8, 8, 384, 24) self.eviname.setGeometry(8, 8, 384, 24)
self.evidesc = QtGui.QTextEdit(self) self.evidesc = QtGui.QTextEdit(self)
self.evidesc.setGeometry(8, 192, 496, 160) self.evidesc.setGeometry(8, 192, 496, 160)
self.evipicture = QtGui.QLabel(self) self.evipicture = QtGui.QLabel(self)
self.filename = 'empty.png' self.filename = 'empty.png'
evipic = QtGui.QPixmap(AOpath + 'evidence\\empty.png') evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png')
self.evipicture.setPixmap(evipic) self.evipicture.setPixmap(evipic)
self.evipicture.move(434, 8) self.evipicture.move(434, 8)
self.evipicture.show() self.evipicture.show()
@ -2218,10 +2211,10 @@ class EditEvidenceDialog(QtGui.QDialog):
def choosePicChange(self, ind): def choosePicChange(self, ind):
self.filename = self.filenames[ind] self.filename = self.filenames[ind]
if exists(AOpath + 'evidence\\' + self.filename): if exists(AOpath + 'evidence/' + self.filename):
self.evipicture.setPixmap(QtGui.QPixmap(AOpath + 'evidence\\' + self.filename)) self.evipicture.setPixmap(QtGui.QPixmap(AOpath + 'evidence/' + self.filename))
else: else:
self.evipicture.setPixmap(QtGui.QPixmap(AOpath + 'themes\\default\\evidence_selected.png')) self.evipicture.setPixmap(QtGui.QPixmap(AOpath + 'themes/default/evidence_selected.png'))
def onSave(self): def onSave(self):
name = self.eviname.text().toUtf8() name = self.eviname.text().toUtf8()
@ -2232,7 +2225,7 @@ class EditEvidenceDialog(QtGui.QDialog):
self.gamegui.tcp.send('PE#' + name + '#' + desc + '#' + self.filename + '#%') self.gamegui.tcp.send('PE#' + name + '#' + desc + '#' + self.filename + '#%')
self.eviname.setText('') self.eviname.setText('')
self.evidesc.setText('') self.evidesc.setText('')
evipic = QtGui.QPixmap(AOpath + 'evidence\\empty.png') evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png')
self.evipicture.setPixmap(evipic) self.evipicture.setPixmap(evipic)
self.filename = 'empty.png' self.filename = 'empty.png'
self.editing = False self.editing = False
@ -2243,7 +2236,7 @@ class EditEvidenceDialog(QtGui.QDialog):
def onCancel(self): def onCancel(self):
self.eviname.setText('') self.eviname.setText('')
self.evidesc.setText('') self.evidesc.setText('')
evipic = QtGui.QPixmap(AOpath + 'evidence\\empty.png') evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png')
self.evipicture.setPixmap(evipic) self.evipicture.setPixmap(evipic)
self.filename = 'empty.png' self.filename = 'empty.png'
self.editing = False self.editing = False
@ -2305,7 +2298,7 @@ class BackEmoteButton(QtGui.QLabel):
super(BackEmoteButton, self).__init__(gamewindow) super(BackEmoteButton, self).__init__(gamewindow)
self.gamewindow = gamewindow self.gamewindow = gamewindow
self.move(x, y) self.move(x, y)
self.setPixmap(QtGui.QPixmap(AOpath + 'themes\\default\\arrow_left.png')) self.setPixmap(QtGui.QPixmap(AOpath + 'themes/default/arrow_left.png'))
self.show() self.show()
def mousePressEvent(self, event): def mousePressEvent(self, event):
@ -2319,7 +2312,7 @@ class NextEmoteButton(QtGui.QLabel):
super(NextEmoteButton, self).__init__(gamewindow) super(NextEmoteButton, self).__init__(gamewindow)
self.gamewindow = gamewindow self.gamewindow = gamewindow
self.move(x, y) self.move(x, y)
self.setPixmap(QtGui.QPixmap(AOpath + 'themes\\default\\arrow_right.png')) self.setPixmap(QtGui.QPixmap(AOpath + 'themes/default/arrow_right.png'))
self.show() self.show()
def mousePressEvent(self, event): def mousePressEvent(self, event):
@ -2328,8 +2321,17 @@ class NextEmoteButton(QtGui.QLabel):
class TCP_Thread(QtCore.QThread): class TCP_Thread(QtCore.QThread):
connectionError = QtCore.pyqtSignal(str, str, str)
MS_Chat = QtCore.pyqtSignal(list) MS_Chat = QtCore.pyqtSignal(list)
newChar = QtCore.pyqtSignal(str) newChar = QtCore.pyqtSignal(str)
newBackground = QtCore.pyqtSignal(str)
IC_Log = QtCore.pyqtSignal(str)
OOC_Log = QtCore.pyqtSignal(str)
charSlots = QtCore.pyqtSignal()
showCharSelect = QtCore.pyqtSignal()
allEvidence = QtCore.pyqtSignal(list)
rainbowColor = QtCore.pyqtSignal(str)
def __init__(self, parent): def __init__(self, parent):
super(TCP_Thread, self).__init__(parent) super(TCP_Thread, self).__init__(parent)
self.parent = parent self.parent = parent
@ -2358,7 +2360,8 @@ class TCP_Thread(QtCore.QThread):
rainbow += 5 rainbow += 5
if rainbow > 255: if rainbow > 255:
rainbow = 0 rainbow = 0
self.parent.text.setStyleSheet('color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')') #self.parent.text.setStyleSheet('color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')')
self.rainbowColor.emit('color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')')
if sendtick: if sendtick:
sendtick -= 1 sendtick -= 1
@ -2417,20 +2420,20 @@ class TCP_Thread(QtCore.QThread):
if len(network) > 3: if len(network) > 3:
name += " ("+network[3].decode("utf-8")+")" name += " ("+network[3].decode("utf-8")+")"
self.parent.icLog.append('[%d:%.2d] %s changed the music to %s' % (t[3], t[4], name, music)) #self.parent.icLog.append('[%d:%.2d] %s changed the music to %s' % (t[3], t[4], name, music))
self.IC_Log.emit('[%d:%.2d] %s changed the music to %s' % (t[3], t[4], name, music))
else: else:
self.parent.icLog.append('[%d:%.2d] the music was changed to %s' % (t[3], t[4], music)) self.IC_Log.emit('[%d:%.2d] the music was changed to %s' % (t[3], t[4], music))
self.parent.playMusic(music) self.parent.playMusic(music)
elif header == 'BN': elif header == 'BN':
imgthread = setBackgroundThread(network[1]) self.newBackground.emit(network[1])
self.parent.connect(imgthread, QtCore.SIGNAL('setBackground(QString)'), self.parent.setBackground)
imgthread.start()
del imgthread
elif header == 'CT': elif header == 'CT':
name = network[1].decode('utf-8').replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#') name = network[1].decode('utf-8').replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#')
chatmsg = network[2].decode('utf-8').replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#').replace("\n", "<br />") chatmsg = network[2].decode('utf-8').replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#').replace("\n", "<br />")
self.parent.ooclog.append('<b>%s:</b> %s' % (name, chatmsg)) #self.parent.ooclog.append('<b>%s:</b> %s' % (name, chatmsg))
self.OOC_Log.emit("<b>%s:</b> %s" % (name, chatmsg))
elif header == 'PV': elif header == 'PV':
self.parent.mychar = int(network[3]) self.parent.mychar = int(network[3])
@ -2441,34 +2444,22 @@ class TCP_Thread(QtCore.QThread):
elif header == 'LE': elif header == 'LE':
del network[0] del network[0]
self.parent.evidence = [ evi.split('&') for evi in network ] self.allEvidence.emit([evi.split('&') for evi in network])
if self.parent.evidencedropdown.count() > 0:
self.parent.evidencedropdown.clear()
for evi in self.parent.evidence:
evi[0] = evi[0].decode('utf-8')
evi[1] = evi[1].decode('utf-8')
evi[2] = evi[2].decode('utf-8')
self.parent.evidencedropdown.addItem(evi[0])
if not self.parent.evidence:
self.parent.evidencedropdown.setCurrentIndex(0)
self.parent.evidencedesc.setText('.')
else:
self.parent.evidencedropdown.setCurrentIndex(self.parent.selectedevi)
elif header == 'ZZ': elif header == 'ZZ':
if self.parent.modcall: if self.parent.modcall:
BASS_ChannelPlay(self.parent.modcall, False) BASS_ChannelPlay(self.parent.modcall, False)
if len(network) > 1: if len(network) > 1:
self.parent.ooclog.append('<b>[MOD CALL] ' + network[1].replace("\n", "<br />") + '</b>') self.OOC_Log.emit('<b>[MOD CALL] ' + network[1].replace("\n", "<br />") + '</b>')
else: else:
self.parent.ooclog.append('<b>[MOD CALL] But there was no extra information. (old server?)</b>') self.OOC_Log.emit('<b>[MOD CALL] But there was no extra information. (old server?)</b>')
elif header == 'CharsCheck': elif header == 'CharsCheck':
del network[0] del network[0]
for i in range(len(network)): for i in range(len(network)):
self.parent.charlist[i][1] = int(network[i]) self.parent.charlist[i][1] = int(network[i])
self.parent.charselect.setCharList(self.parent.charlist) self.charSlots.emit()
elif header == 'RT': elif header == 'RT':
testimony = network[1] testimony = network[1]
@ -2501,4 +2492,4 @@ class TCP_Thread(QtCore.QThread):
self.parent.gotPing.emit(int((pingafter - pingbefore)*1000)) self.parent.gotPing.emit(int((pingafter - pingbefore)*1000))
elif header == 'DONE': elif header == 'DONE':
self.parent.charselect.show() self.showCharSelect.emit()

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
import socket, thread, time, random import socket, thread, time, random, traceback, uuid
from os.path import exists from os.path import exists
#AOpath = "base\\" AOpath = "base/"
AOpath = "I:\\aovanilla1.7.5\\client\\base\\" #AOpath = "I:/aovanilla1.7.5/client/base/"
class PicButton(QtGui.QAbstractButton): class PicButton(QtGui.QAbstractButton):
def __init__(self, pixmap, parent=None): def __init__(self, pixmap, parent=None):
@ -26,6 +26,9 @@ class lobby(QtGui.QWidget):
tcp = None tcp = None
tab = 0 tab = 0
msgbox_signal = QtCore.pyqtSignal(int, str, str) msgbox_signal = QtCore.pyqtSignal(int, str, str)
moveToGameSignal = QtCore.pyqtSignal(list)
gotServers = QtCore.pyqtSignal(list)
gotOOCMsg = QtCore.pyqtSignal(str, str)
def __init__(self, parent=None): def __init__(self, parent=None):
super(lobby, self).__init__(parent) super(lobby, self).__init__(parent)
@ -33,14 +36,17 @@ class lobby(QtGui.QWidget):
self.connecting = False self.connecting = False
self.svclicked = None self.svclicked = None
self.gamewindow = parent self.gamewindow = parent
self.pix_lobby = QtGui.QPixmap(AOpath+'themes\\default\\lobbybackground.png') self.pix_lobby = QtGui.QPixmap(AOpath+'themes/default/lobbybackground.png')
self.pix_btn_public = QtGui.QPixmap(AOpath+'themes\\default\\publicservers.png') self.pix_btn_public = QtGui.QPixmap(AOpath+'themes/default/publicservers.png')
self.pix_btn_favs = QtGui.QPixmap(AOpath+'themes\\default\\favorites.png') self.pix_btn_favs = QtGui.QPixmap(AOpath+'themes/default/favorites.png')
self.pix_btn_refresh = QtGui.QPixmap(AOpath+'themes\\default\\refresh.png') self.pix_btn_refresh = QtGui.QPixmap(AOpath+'themes/default/refresh.png')
self.pix_btn_addfav = QtGui.QPixmap(AOpath+'themes\\default\\addtofav.png') self.pix_btn_addfav = QtGui.QPixmap(AOpath+'themes/default/addtofav.png')
self.pix_btn_connect = QtGui.QPixmap(AOpath+'themes\\default\\connect.png') self.pix_btn_connect = QtGui.QPixmap(AOpath+'themes/default/connect.png')
self.pix_connecting = QtGui.QPixmap(AOpath+'themes\\default\\loadingbackground.png') self.pix_connecting = QtGui.QPixmap(AOpath+'themes/default/loadingbackground.png')
self.msgbox_signal.connect(self.showMessageBox) self.msgbox_signal.connect(self.showMessageBox)
self.moveToGameSignal.connect(self.moveToGame)
self.gotServers.connect(self.onGetServers)
self.gotOOCMsg.connect(self.newOOCMessage)
if exists(AOpath+'serverlist.txt'): if exists(AOpath+'serverlist.txt'):
with open(AOpath+'serverlist.txt') as file: with open(AOpath+'serverlist.txt') as file:
@ -57,7 +63,7 @@ class lobby(QtGui.QWidget):
self.connectingimg.hide() self.connectingimg.hide()
self.clientver = QtGui.QLabel(self) self.clientver = QtGui.QLabel(self)
self.clientver.setText('AO2XP 1.2 by Headshot') self.clientver.setText('AO2XP 1.4 by Headshot')
self.clientver.resize(self.clientver.sizeHint()) self.clientver.resize(self.clientver.sizeHint())
self.clientver.move(self.pix_lobby.size().width() - self.clientver.size().width(), 0) self.clientver.move(self.pix_lobby.size().width() - self.clientver.size().width(), 0)
@ -158,7 +164,34 @@ class lobby(QtGui.QWidget):
self.joinooc = [] self.joinooc = []
thread.start_new_thread(self.connect_to_ms, ()) thread.start_new_thread(self.connect_to_ms, ())
def onGetServers(self, servers):
self.serverlist.clear()
self.actual_serverlist = []
del servers[0]
del servers[-1]
for svcontent in servers:
server = svcontent.split('&')
del server[-1]
name = server[0].decode('utf-8')
desc = server[1].decode('utf-8')
if len(server) <= 2:
ip = '0.0.0.0'
port = 0
elif len(server) == 3:
ip = server[2]
port = 27017
elif len(server) == 4:
ip = server[2]
port = int(server[3])
serveritem = QtGui.QListWidgetItem(name)
self.serverlist.addItem(serveritem)
self.actual_serverlist.append((ip, port, name, desc))
def moveToGame(self, stuff):
tcp, charlist, musiclist, background, evidence, areas, features, joinooc, hplist = stuff
self.move_to_game(tcp, charlist, musiclist, background, evidence, areas, features, joinooc, hplist)
def onSettingsClicked(self): def onSettingsClicked(self):
self.gamewindow.showSettings() self.gamewindow.showSettings()
@ -275,6 +308,7 @@ class lobby(QtGui.QWidget):
hplist = [] hplist = []
areas = [[], [], [], []] areas = [[], [], [], []]
features = [] features = []
charlist = None
pingtimer = 150 pingtimer = 150
readytick = -1 readytick = -1
text = item.text() text = item.text()
@ -307,9 +341,9 @@ class lobby(QtGui.QWidget):
if readytick == 0: if readytick == 0:
readytick = -1 readytick = -1
try: try:
self.move_to_game(self.tcp, charlist, musiclist, background, evidence, areas, features, self.joinooc, hplist) self.moveToGameSignal.emit([self.tcp, charlist, musiclist, background, evidence, areas, features, self.joinooc, hplist])
except Exception as err: except Exception as err:
self.msgbox_signal.emit(0, "Error caught while loading", str(err)) self.msgbox_signal.emit(0, "Error caught while loading", traceback.format_exc(err))
self.onClicked_cancelconnect() self.onClicked_cancelconnect()
return return
@ -348,17 +382,17 @@ class lobby(QtGui.QWidget):
got_stuff = True got_stuff = True
elif header == "decryptor": elif header == "decryptor":
self.tcp.send("HI#vidya is a fucking shitshow#%") self.tcp.send("HI#AO2XP %s#%%" % uuid.UUID(int=uuid.getnode()))
elif header == "ID": elif header == "ID":
self.tcp.send("ID#AO2#69.1337.420#%") #need to send this to tsuserver3 servers in order to get feature list (FL) self.tcp.send("ID#AO2#69.1337.420#%") # need to send this to tsuserver3 servers in order to get feature list (FL)
elif header == "FL": elif header == "FL":
features = network[1:] features = network[1:]
print features print features
elif header == 'BD': elif header == 'BD':
reason = network[1].decode("utf-8") #new in AO2 2.6 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.onlineplayers.setText('Banned') self.onlineplayers.setText('Banned')
self.msgbox_signal.emit(0, "Banned", "Reason:\n"+reason) self.msgbox_signal.emit(0, "Banned", "Reason:\n"+reason)
self.tcp.close() self.tcp.close()
@ -397,7 +431,7 @@ class lobby(QtGui.QWidget):
print '[client]', 'received songs (%d)' % len(musiclist) print '[client]', 'received songs (%d)' % len(musiclist)
elif header == 'CharsCheck': elif header == 'CharsCheck':
if not self.connecting: if not self.connecting or not charlist:
continue continue
network.pop(0) network.pop(0)
network.pop(len(network)-1) network.pop(len(network)-1)
@ -478,6 +512,9 @@ class lobby(QtGui.QWidget):
def lobbychatlog_update(self): def lobbychatlog_update(self):
self.lobbychatlog.verticalScrollBar().setValue(self.lobbychatlog.verticalScrollBar().maximum()) self.lobbychatlog.verticalScrollBar().setValue(self.lobbychatlog.verticalScrollBar().maximum())
def newOOCMessage(self, name, text):
self.lobbychatlog.append('%s: %s' % (name, text))
def connect_to_ms(self): def connect_to_ms(self):
tempdata = "" tempdata = ""
self.ms_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.ms_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@ -506,39 +543,19 @@ class lobby(QtGui.QWidget):
header = network[0] header = network[0]
if header == "servercheok": if header == "servercheok":
self.ms_tcp.send('HI#haha lol mods are gay#%ID#AO2XP by Headshot#1.2#%') self.ms_tcp.send('HI#ao 2.8 apng will kill me#%ID#AO2XP by Headshot#1.4#%')
self.ms_tcp.send("ALL#%") self.ms_tcp.send("ALL#%")
elif header == 'DOOM': elif header == 'DOOM':
print 'banned from masterserver' print 'banned from masterserver'
self.msgbox_signal.emit(0, "WHEEZE", "You've been exiled from AO.\nWow, great job, now everyone hates you lmao") self.msgbox_signal.emit(0, "WHEEZE", "You are exiled from AO")
self.ms_tcp.close() self.ms_tcp.close()
thread.exit() thread.exit()
elif header == 'ALL': elif header == 'ALL':
self.serverlist.clear() self.gotServers.emit(network)
self.actual_serverlist = []
network.pop(0)
network.pop(len(network) - 1)
for svcontent in network:
server = svcontent.split('&')
del server[len(server)-1]
name = server[0].decode('utf-8')
desc = server[1].decode('utf-8')
if len(server) <= 2:
ip = '0.0.0.0'
port = 0
elif len(server) == 3:
ip = server[2]
port = 27017
elif len(server) == 4:
ip = server[2]
port = int(server[3])
serveritem = QtGui.QListWidgetItem(name)
self.serverlist.addItem(serveritem)
self.actual_serverlist.append((ip, port, name, desc))
elif header == 'CT': elif header == 'CT':
name = network[1].decode("utf-8").replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#') name = network[1].decode("utf-8").replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#')
chatmsg = network[2].decode("utf-8").replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#') chatmsg = network[2].decode("utf-8").replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#').replace('<pound>', '#')
self.lobbychatlog.append('%s: %s' % (name, chatmsg)) self.gotOOCMsg.emit(name, chatmsg)

View File

@ -1,18 +1,21 @@
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from pybass import *
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
from os.path import exists from os.path import exists
from os import listdir
import ini import ini
#AOpath = "base\\" AOpath = "base/"
AOpath = "I:\\aovanilla1.7.5\\client\\base\\" #AOpath = "I:\\aovanilla1.7.5\\client\\base\\"
class Settings(QtGui.QWidget): class Settings(QtGui.QDialog):
def __init__(self): def __init__(self):
super(Settings, self).__init__() super(Settings, self).__init__()
self.setModal(True)
self.inifile = ConfigParser() self.inifile = ConfigParser()
self.setWindowTitle("Settings") self.setWindowTitle("Settings")
self.setFixedSize(320, 480) self.setFixedSize(400, 400)
self.hide() self.hide()
main_layout = QtGui.QVBoxLayout(self) main_layout = QtGui.QVBoxLayout(self)
@ -23,9 +26,13 @@ class Settings(QtGui.QWidget):
self.tabs.move(8, 8) self.tabs.move(8, 8)
general_tab = QtGui.QWidget() general_tab = QtGui.QWidget()
audio_tab = QtGui.QWidget()
callwords_tab = QtGui.QWidget() callwords_tab = QtGui.QWidget()
general_layout = QtGui.QVBoxLayout(general_tab) general_layout = QtGui.QVBoxLayout(general_tab)
general_layout.setAlignment(QtCore.Qt.AlignTop) general_layout.setAlignment(QtCore.Qt.AlignTop)
audio_layout = QtGui.QFormLayout(audio_tab)
audio_layout.setLabelAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
audio_layout.setFormAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
callwords_layout = QtGui.QVBoxLayout(callwords_tab) callwords_layout = QtGui.QVBoxLayout(callwords_tab)
callwords_layout.setAlignment(QtCore.Qt.AlignTop) callwords_layout.setAlignment(QtCore.Qt.AlignTop)
@ -37,7 +44,7 @@ class Settings(QtGui.QWidget):
cancelbtn.clicked.connect(self.onCancelClicked) cancelbtn.clicked.connect(self.onCancelClicked)
separators = [] separators = []
for i in range(2): for i in range(4):
separator = QtGui.QFrame() separator = QtGui.QFrame()
separator.setFixedSize(separator.size().width(), 16) separator.setFixedSize(separator.size().width(), 16)
separators.append(separator) separators.append(separator)
@ -67,6 +74,16 @@ class Settings(QtGui.QWidget):
allowdownload_layout.addWidget(self.allowdownload_sounds) allowdownload_layout.addWidget(self.allowdownload_sounds)
allowdownload_layout.addWidget(self.allowdownload_music) allowdownload_layout.addWidget(self.allowdownload_music)
allowdownload_layout.addWidget(self.allowdownload_evidence) allowdownload_layout.addWidget(self.allowdownload_evidence)
currtheme_layout = QtGui.QHBoxLayout()
currtheme_label = QtGui.QLabel("Current theme")
self.currtheme = QtGui.QComboBox()
self.themes = listdir(AOpath+"ao2xp_themes")
for theme in self.themes:
if exists(AOpath+"ao2xp_themes/"+theme+"/theme.py"):
self.currtheme.addItem(theme)
currtheme_layout.addWidget(currtheme_label)
currtheme_layout.addWidget(self.currtheme)
savechangeswarn = QtGui.QLabel() savechangeswarn = QtGui.QLabel()
savechangeswarn.setText("* Change takes effect upon restarting the client") savechangeswarn.setText("* Change takes effect upon restarting the client")
@ -78,8 +95,23 @@ class Settings(QtGui.QWidget):
general_layout.addWidget(separators[1]) general_layout.addWidget(separators[1])
general_layout.addWidget(allowdownload) general_layout.addWidget(allowdownload)
general_layout.addLayout(allowdownload_layout) general_layout.addLayout(allowdownload_layout)
general_layout.addWidget(separators[2])
general_layout.addLayout(currtheme_layout)
general_layout.addWidget(savechangeswarn, 50, QtCore.Qt.AlignBottom) general_layout.addWidget(savechangeswarn, 50, QtCore.Qt.AlignBottom)
###### Audio tab ######
device_label = QtGui.QLabel("Audio device")
self.device_list = QtGui.QComboBox()
audio_layout.setWidget(0, QtGui.QFormLayout.LabelRole, device_label)
audio_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.device_list)
audio_layout.setWidget(1, QtGui.QFormLayout.FieldRole, separators[3])
info = BASS_DEVICEINFO()
ind = 0
while BASS_GetDeviceInfo(ind, info):
self.device_list.addItem(info.name)
ind += 1
###### Callwords tab ###### ###### Callwords tab ######
self.callwords_edit = QtGui.QTextEdit() self.callwords_edit = QtGui.QTextEdit()
@ -95,6 +127,7 @@ class Settings(QtGui.QWidget):
callwords_layout.addWidget(callwords_instructions) callwords_layout.addWidget(callwords_instructions)
self.tabs.addTab(general_tab, "General") self.tabs.addTab(general_tab, "General")
self.tabs.addTab(audio_tab, "Audio")
self.tabs.addTab(callwords_tab, "Callwords") self.tabs.addTab(callwords_tab, "Callwords")
save_layout.addWidget(savebtn, 100, QtCore.Qt.AlignRight) save_layout.addWidget(savebtn, 100, QtCore.Qt.AlignRight)
@ -115,6 +148,8 @@ class Settings(QtGui.QWidget):
self.allowdownload_sounds.setChecked(ini.read_ini_bool(self.inifile, "General", "download sounds")) self.allowdownload_sounds.setChecked(ini.read_ini_bool(self.inifile, "General", "download sounds"))
self.allowdownload_music.setChecked(ini.read_ini_bool(self.inifile, "General", "download music")) self.allowdownload_music.setChecked(ini.read_ini_bool(self.inifile, "General", "download music"))
self.allowdownload_evidence.setChecked(ini.read_ini_bool(self.inifile, "General", "download evidence")) self.allowdownload_evidence.setChecked(ini.read_ini_bool(self.inifile, "General", "download evidence"))
self.currtheme.setCurrentIndex(self.themes.index(ini.read_ini(self.inifile, "General", "theme", "default")))
self.device_list.setCurrentIndex(ini.read_ini_int(self.inifile, "Audio", "device", BASS_GetDevice()))
else: else:
self.savetolog.setChecked(False) self.savetolog.setChecked(False)
self.savetolog_combine.setChecked(False) self.savetolog_combine.setChecked(False)
@ -122,6 +157,8 @@ class Settings(QtGui.QWidget):
self.allowdownload_sounds.setChecked(True) self.allowdownload_sounds.setChecked(True)
self.allowdownload_music.setChecked(True) self.allowdownload_music.setChecked(True)
self.allowdownload_evidence.setChecked(True) self.allowdownload_evidence.setChecked(True)
self.currtheme.setCurrentIndex(self.themes.index("default"))
self.device_list.setCurrentIndex(BASS_GetDevice())
self.callwords_edit.clear() self.callwords_edit.clear()
if exists(AOpath+"callwords.ini"): if exists(AOpath+"callwords.ini"):
@ -139,8 +176,8 @@ class Settings(QtGui.QWidget):
self.callwords_edit.setWordWrapMode(0) self.callwords_edit.setWordWrapMode(0)
def onSaveClicked(self): def onSaveClicked(self):
if not self.inifile.has_section("General"): if not self.inifile.has_section("General"): self.inifile.add_section("General")
self.inifile.add_section("General") if not self.inifile.has_section("Audio"): self.inifile.add_section("Audio")
self.inifile.set("General", "save logs", self.savetolog.isChecked()) self.inifile.set("General", "save logs", self.savetolog.isChecked())
self.inifile.set("General", "combined logs", self.savetolog_combine.isChecked()) self.inifile.set("General", "combined logs", self.savetolog_combine.isChecked())
self.inifile.set("General", "OOC name", self.defaultoocname.text().toUtf8()) self.inifile.set("General", "OOC name", self.defaultoocname.text().toUtf8())
@ -148,6 +185,8 @@ class Settings(QtGui.QWidget):
self.inifile.set("General", "download sounds", self.allowdownload_sounds.isChecked()) self.inifile.set("General", "download sounds", self.allowdownload_sounds.isChecked())
self.inifile.set("General", "download music", self.allowdownload_music.isChecked()) self.inifile.set("General", "download music", self.allowdownload_music.isChecked())
self.inifile.set("General", "download evidence", self.allowdownload_evidence.isChecked()) self.inifile.set("General", "download evidence", self.allowdownload_evidence.isChecked())
self.inifile.set("General", "theme", self.currtheme.currentText())
self.inifile.set("Audio", "device", self.device_list.currentIndex())
self.inifile.write(open(AOpath+"AO2XP.ini", "w")) self.inifile.write(open(AOpath+"AO2XP.ini", "w"))
with open(AOpath+"callwords.ini", "w") as f: with open(AOpath+"callwords.ini", "w") as f:
@ -156,4 +195,4 @@ class Settings(QtGui.QWidget):
self.hide() self.hide()
def onCancelClicked(self): def onCancelClicked(self):
self.hide() self.hide()

View File

@ -7,8 +7,12 @@ import os
def pip_install(package): def pip_install(package):
subprocess.call([sys.executable, "-m", "pip", "install", package]) subprocess.call([sys.executable, "-m", "pip", "install", package])
print "installing requests"
pip_install('requests')
import requests
print "downloading pybass" print "downloading pybass"
filedata = urllib2.urlopen('https://datapacket.dl.sourceforge.net/project/pybass/pybass_055.zip') filedata = urllib2.urlopen('http://master.dl.sourceforge.net/project/pybass/pybass_055.zip')
datatowrite = filedata.read() datatowrite = filedata.read()
with open('pybass_055.zip', 'wb') as f: with open('pybass_055.zip', 'wb') as f:
@ -39,13 +43,14 @@ zip_ref.extract('bass.dll')
zip_ref.close() zip_ref.close()
print "downloading pyqt4" print "downloading pyqt4"
filedata = urllib2.urlopen('https://download.lfd.uci.edu/pythonlibs/u2hcgva4/PyQt4-4.11.4-cp27-cp27m-win32.whl') filedata = requests.get('http://raw.githubusercontent.com/dhb52/python-lib/master/PyQt4-4.11.4-cp27-cp27m-win32.whl')
datatowrite = filedata.read() datatowrite = filedata.content
with open('PyQt4-4.11.4-cp27-cp27m-win32.whl', 'wb') as f: with open('PyQt4-4.11.4-cp27-cp27m-win32.whl', 'wb') as f:
f.write(datatowrite) f.write(datatowrite)
f.close() f.close()
print "installing pyqt4" print "installing pyqt4"
pip_install('PyQt4-4.11.4-cp27-cp27m-win32.whl') pip_install('PyQt4-4.11.4-cp27-cp27m-win32.whl')