From e3521ffe24b050e2be45617cb10f7775f1f83eba Mon Sep 17 00:00:00 2001 From: Nicolas Sanchez <98576999+nicolassanchez02@users.noreply.github.com> Date: Fri, 29 May 2026 19:55:09 -0500 Subject: [PATCH] Fix format-string arg errors in battle notifies Two notify calls would raise TypeError instead of logging when their (already exceptional) branch runs. DistributedLevelBattle: '...%s...%s...' % self.levelDoId, self.doId binds the % tighter than the comma, so it formats two specifiers against the single int self.levelDoId (crash) and passes self.doId as a stray second arg to warning(). Wrapped both operands in a tuple. TownBattleAttackPanel: the operand was a list [track, level]; % only unpacks a tuple, so two %s against one list crashed before the error message could be built. Changed to a tuple. --- toontown/coghq/DistributedLevelBattle.py | 2 +- toontown/town/TownBattleAttackPanel.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toontown/coghq/DistributedLevelBattle.py b/toontown/coghq/DistributedLevelBattle.py index e9e99b2..e54fa1d 100644 --- a/toontown/coghq/DistributedLevelBattle.py +++ b/toontown/coghq/DistributedLevelBattle.py @@ -41,7 +41,7 @@ class DistributedLevelBattle(DistributedBattle.DistributedBattle): level = base.cr.doId2do.get(self.levelDoId) if level is None: - self.notify.warning('level %s not in doId2do yet, battle %s will be mispositioned.' % self.levelDoId, self.doId) + self.notify.warning('level %s not in doId2do yet, battle %s will be mispositioned.' % (self.levelDoId, self.doId)) self.levelRequest = self.cr.relatedObjectMgr.requestObjects([self.levelDoId], doPlacement) else: doPlacement([level]) diff --git a/toontown/town/TownBattleAttackPanel.py b/toontown/town/TownBattleAttackPanel.py index 62bf84b..011d2e5 100644 --- a/toontown/town/TownBattleAttackPanel.py +++ b/toontown/town/TownBattleAttackPanel.py @@ -77,7 +77,7 @@ class TownBattleAttackPanel(StateData.StateData): doneStatus['level'] = level messenger.send(self.doneEvent, [doneStatus]) else: - self.notify.error("An item we don't have: track %s level %s was selected." % [track, level]) + self.notify.error("An item we don't have: track %s level %s was selected." % (track, level)) def __handleHide(self): if AttackPanelHidden: