Pokémon R/B: Another quiz fix
This commit is contained in:
parent
4ff282a384
commit
3ef0a56ec2
|
@ -577,9 +577,6 @@ def write_quizzes(self, data, random):
|
||||||
for location in self.multiworld.get_filled_locations():
|
for location in self.multiworld.get_filled_locations():
|
||||||
if location.item.name == "Secret Key" and location.item.player == self.player:
|
if location.item.name == "Secret Key" and location.item.player == self.player:
|
||||||
break
|
break
|
||||||
if location.player == self.player:
|
|
||||||
player_name = "yourself"
|
|
||||||
else:
|
|
||||||
player_name = self.multiworld.player_name[location.player]
|
player_name = self.multiworld.player_name[location.player]
|
||||||
if not a:
|
if not a:
|
||||||
if len(self.multiworld.player_name) > 1:
|
if len(self.multiworld.player_name) > 1:
|
||||||
|
@ -588,7 +585,10 @@ def write_quizzes(self, data, random):
|
||||||
player_name = random.choice(list(self.multiworld.player_name.values()))
|
player_name = random.choice(list(self.multiworld.player_name.values()))
|
||||||
else:
|
else:
|
||||||
return encode_text("You're playing<LINE>in a multiworld<CONT>with other<CONT>players?<DONE>")
|
return encode_text("You're playing<LINE>in a multiworld<CONT>with other<CONT>players?<DONE>")
|
||||||
return encode_text(f"The Secret Key was<LINE>found by<CONT>{player_name[:17]}?<DONE>")
|
if player_name == self.multiworld.player_name[self.player]:
|
||||||
|
player_name = "yourself"
|
||||||
|
player_name = encode_text(player_name, force=True, safety=True)
|
||||||
|
return encode_text(f"The Secret Key was<LINE>found by<CONT>") + player_name + encode_text("<DONE>")
|
||||||
elif q == 2:
|
elif q == 2:
|
||||||
if a:
|
if a:
|
||||||
return encode_text(f"#mon is<LINE>pronounced<CONT>Po-kay-mon?<DONE>")
|
return encode_text(f"#mon is<LINE>pronounced<CONT>Po-kay-mon?<DONE>")
|
||||||
|
|
|
@ -118,9 +118,9 @@ def encode_text(text: str, length: int=0, whitespace=False, force=False, safety=
|
||||||
special = False
|
special = False
|
||||||
for char in text:
|
for char in text:
|
||||||
if char == ">":
|
if char == ">":
|
||||||
|
try:
|
||||||
if spec_char in unsafe_chars and safety:
|
if spec_char in unsafe_chars and safety:
|
||||||
raise KeyError(f"Disallowed Pokemon text special character '<{spec_char}>'")
|
raise KeyError(f"Disallowed Pokemon text special character '<{spec_char}>'")
|
||||||
try:
|
|
||||||
encoded_text.append(special_chars[spec_char])
|
encoded_text.append(special_chars[spec_char])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if force:
|
if force:
|
||||||
|
@ -135,10 +135,10 @@ def encode_text(text: str, length: int=0, whitespace=False, force=False, safety=
|
||||||
elif special is True:
|
elif special is True:
|
||||||
spec_char += char
|
spec_char += char
|
||||||
else:
|
else:
|
||||||
if char in unsafe_chars and safety:
|
|
||||||
raise KeyError(f"Disallowed Pokemon text character '{char}'")
|
|
||||||
try:
|
try:
|
||||||
encoded_text.append(char_map[char])
|
encoded_text.append(char_map[char])
|
||||||
|
if char in unsafe_chars and safety:
|
||||||
|
raise KeyError(f"Disallowed Pokemon text character '{char}'")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if force:
|
if force:
|
||||||
encoded_text.append(char_map[" "])
|
encoded_text.append(char_map[" "])
|
||||||
|
|
Loading…
Reference in New Issue