From 8c1b29473cf56c84c0a9ab7bef83b06373c2a093 Mon Sep 17 00:00:00 2001 From: cidoku Date: Sun, 3 Aug 2025 04:31:52 -0400 Subject: [PATCH] better effects --- ini.py | 38 ++++++++++++++++++++++++++------------ mainmenu.py | 4 ++-- updater.py | 3 +-- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ini.py b/ini.py index fcb46dd..03cd522 100644 --- a/ini.py +++ b/ini.py @@ -108,32 +108,46 @@ def read_ini_tags(file, target_tag): return r_values def get_effect_sound(fx_name, char): - p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects") + p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects", "default/effects") p_path = "base/misc/"+p_effect+"/effects.ini" default_path = "AO2XPbase/themes/default/effects/effects.ini" if exists(p_path): - return read_sectionless_ini(p_path, fx_name) + inifile = ConfigParser() + inifile.read(p_path) + for section in inifile.sections(): + if fx_name == read_ini(inifile, section, "name", "").rstrip(): + return read_ini(inifile, section, "sound", "").rstrip() return read_sectionless_ini(default_path, fx_name) def get_effects(char): - p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects") + p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects", "default/effects") p_path = "base/misc/"+p_effect+"/effects.ini" - - effects = ["realization", "hearts", "reaction", "impact"] + default_path = "AO2XPbase/themes/default/effects/effects.ini" + + effects = [] + + if exists(default_path): + with open(default_path, 'r') as file: + for line in file: + effects.append(line.split("=")[0].strip()) + else: + effects = ["realization", "hearts", "reaction", "impact"] + if not exists(p_path): return effects - - with open(p_path).read().split("\n") as lines: - for line in lines: - effect = line.split("=")[0].rstrip() - if effect and effect not in effects: - effects.append(effect) + + inifile = ConfigParser() + inifile.read(p_path) + for section in inifile.sections(): + effect = read_ini(inifile, section, "name", "").rstrip() + if effect and effect not in effects: + effects.append(effect) return effects def get_effect(effect, char, folder): p_effect = folder - if not p_effect: p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects") + if not p_effect: p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects", "default/effects") p_path = get_img_suffix("base/misc/"+p_effect+"/"+effect) default_path = get_img_suffix("AO2XPbase/themes/default/effects/"+effect) diff --git a/mainmenu.py b/mainmenu.py index 2a2bc6f..e63ab81 100644 --- a/mainmenu.py +++ b/mainmenu.py @@ -197,7 +197,7 @@ class lobby(QtGui.QWidget): if not demo and self.autoconnect: self.aoserverinfo.setIP(self.autoconnect[-1], self.autoconnect[0], self.autoconnect[1], self.autoconnect[2], self.autoconnect[3]) - print '[debug]', 'Connecting automatically to ip: ' + self.autoconnect[0] + ', port: ' + str(self.autoconnect[1]) + ", websocket port: " + str(self.autoconnect[2]) + ", websocket port: " + str(self.autoconnect[3]) + print '[debug]', 'Connecting automatically to ip: ' + self.autoconnect[0] + ', port: ' + str(self.autoconnect[1]) + ", websocket port: " + str(self.autoconnect[2]) + ", secure websocket port: " + str(self.autoconnect[3]) self.aoserverinfo.stop() self.aoserverinfo.start() @@ -441,7 +441,7 @@ class AOServerInfo(QtCore.QThread): self.setOnlinePlayers.emit("Couldn't retrieve players") return - print "[debug]", "Connected! websocket: %s" % self.tcp.isWS + " (secure)" if self.tcp.isSecure else "" + 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 diff --git a/updater.py b/updater.py index 7051abc..81af296 100644 --- a/updater.py +++ b/updater.py @@ -118,8 +118,7 @@ class updateThread(QtCore.QThread): global returncode try: - manifest = json.load(BytesIO(requests.get("").content)) - #manifest = json.load(BytesIO(requests.get("http://api.github.com/repos/headshot2017/AO2XP/releases").content)) + manifest = json.load(BytesIO(requests.get("https://git.bunny.cafe/api/v1/repos/cidoku/AO2XP/releases/").content)) except: print traceback.format_exc() self.showMessageBox.emit("critical", "Error", "Failed to check for updates.\nPlease check your internet connection.")