maybe fixed the weird crashes from bad text idk
This commit is contained in:
parent
8c47509c6c
commit
806a2e2700
|
@ -51,6 +51,7 @@ class game_strings_base(object):
|
||||||
no_formats = strikeoutlooking + strikeoutswinging + doubleplay + walk + single + double + triple + homerun + grandslam
|
no_formats = strikeoutlooking + strikeoutswinging + doubleplay + walk + single + double + triple + homerun + grandslam
|
||||||
|
|
||||||
def activate(self, lastupdate, currentupdate, game):
|
def activate(self, lastupdate, currentupdate, game):
|
||||||
|
try:
|
||||||
if "twopart" in lastupdate:
|
if "twopart" in lastupdate:
|
||||||
for key, value in lastupdate.items():
|
for key, value in lastupdate.items():
|
||||||
if key != "twopart":
|
if key != "twopart":
|
||||||
|
@ -65,6 +66,8 @@ class game_strings_base(object):
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
currentupdate["displaytext"] = f"{currentupdate['batter']} {self.format_gamestring(getattr(self, currentupdate['outcome'].name)[currentupdate['voiceindex']], currentupdate)}"
|
currentupdate["displaytext"] = f"{currentupdate['batter']} {self.format_gamestring(getattr(self, currentupdate['outcome'].name)[currentupdate['voiceindex']], currentupdate)}"
|
||||||
|
except:
|
||||||
|
game_strings_base().activate(lastupdate, currentupdate, game)
|
||||||
|
|
||||||
def check_for_twopart(self, gamestring):
|
def check_for_twopart(self, gamestring):
|
||||||
return gamestring in self.twoparts
|
return gamestring in self.twoparts
|
||||||
|
@ -105,6 +108,7 @@ class game_strings_base(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def stealing(self, currentupdate, runner, base_string, defender, is_successful):
|
def stealing(self, currentupdate, runner, base_string, defender, is_successful):
|
||||||
|
try:
|
||||||
if is_successful:
|
if is_successful:
|
||||||
index = randrange(0, len(self.steal_success))
|
index = randrange(0, len(self.steal_success))
|
||||||
text = self.steal_success[index]
|
text = self.steal_success[index]
|
||||||
|
@ -124,6 +128,9 @@ class game_strings_base(object):
|
||||||
currentupdate["steals"] = [text.format(*format_list)]
|
currentupdate["steals"] = [text.format(*format_list)]
|
||||||
else:
|
else:
|
||||||
currentupdate["steals"] = [text]
|
currentupdate["steals"] = [text]
|
||||||
|
except:
|
||||||
|
game_strings_base().stealing(currentupdate, runner, base_string, defender, is_successful)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TheGoddesses(game_strings_base):
|
class TheGoddesses(game_strings_base):
|
||||||
|
|
Loading…
Reference in a new issue