guard against empty OTHER_OFFSET

This commit is contained in:
cidoku 2026-04-15 22:31:35 -04:00
parent 679a8688ce
commit 6bcf9eda0c

View File

@ -1,7 +1,3 @@
# This is the main file where everything happens. Honestly, it sucks and the
# thing is so complex and unsafe that I'm surprised it even works. I wish for
# a simpler client. ~ cidoku
import thread, time, os, urllib, random, platform, subprocess import thread, time, os, urllib, random, platform, subprocess
from os.path import exists, basename from os.path import exists, basename
from collections import OrderedDict from collections import OrderedDict
@ -985,6 +981,13 @@ class GUI(QtGui.QWidget):
self.slideBgAnimation.valueChanged.connect(self.slideChanged) self.slideBgAnimation.valueChanged.connect(self.slideChanged)
self.slideBg.hide() self.slideBg.hide()
self.onscreenTimerLabels = []
self.onscreenTimerTimes = [0, 0, 0, 0, 0]
self.onscreenTimerPaused = [True, True, True, True, True]
self.onscreenTimer = QtCore.QTimer(self)
self.onscreenTimer.timeout.connect(self.updateOnscreenTimers)
self.onscreenTimerTick = 1000
self.zoom = ZoomLines(self.viewport) self.zoom = ZoomLines(self.viewport)
self.char = AOCharMovie(self.viewport, self) self.char = AOCharMovie(self.viewport, self)
@ -1052,13 +1055,6 @@ class GUI(QtGui.QWidget):
self.screenshake.timeout.connect(self.screenShakeTick) self.screenshake.timeout.connect(self.screenShakeTick)
self.shakesRemaining = 0 self.shakesRemaining = 0
self.onscreenTimerLabels = []
self.onscreenTimerTimes = [0, 0, 0, 0, 0]
self.onscreenTimerPaused = [True, True, True, True, True]
self.onscreenTimer = QtCore.QTimer(self)
self.onscreenTimer.timeout.connect(self.updateOnscreenTimers)
self.onscreenTimerTick = 1000
for i in range(len(self.onscreenTimerTimes)): for i in range(len(self.onscreenTimerTimes)):
label = QtGui.QLabel(self.viewport) label = QtGui.QLabel(self.viewport)
label.hide() label.hide()
@ -3710,12 +3706,13 @@ class GUI(QtGui.QWidget):
boxPairOrder = -1 boxPairOrder = -1
hor2_offset = vert2_offset = 0 hor2_offset = vert2_offset = 0
if "y_offset" in self.features: # AO 2.9 if self.mChatMessage[OTHER_OFFSET]:
keyword = "<and>" if "<and>" in self.mChatMessage[OTHER_OFFSET] else "&" # i don't think it's hdf's fault but this is still ridiculous if "y_offset" in self.features: # AO 2.9
hor2_offset = int(self.mChatMessage[OTHER_OFFSET].split(keyword)[0]) keyword = "<and>" if "<and>" in self.mChatMessage[OTHER_OFFSET] else "&" # i don't think it's hdf's fault but this is still ridiculous
vert2_offset = int(self.mChatMessage[OTHER_OFFSET].split(keyword)[1]) if len(self.mChatMessage[OTHER_OFFSET].split(keyword)) > 1 else 0 hor2_offset = int(self.mChatMessage[OTHER_OFFSET].split(keyword)[0])
else: vert2_offset = int(self.mChatMessage[OTHER_OFFSET].split(keyword)[1]) if len(self.mChatMessage[OTHER_OFFSET].split(keyword)) > 1 else 0
hor2_offset = int(self.mChatMessage[OTHER_OFFSET]) else:
hor2_offset = int(self.mChatMessage[OTHER_OFFSET]) if self.mChatMessage[OTHER_OFFSET] else 0
if side == "def": if side == "def":
if hor2_offset > 0: if hor2_offset > 0: