Repr instead of adding quotes

This commit is contained in:
Gouvernathor 2023-11-15 03:40:21 +01:00
parent 6ff3d39940
commit 1ee74a61ac

View File

@ -42,10 +42,10 @@ init python:
def use(self): def use(self):
if not self.usable: if not self.usable:
raise Exception("Item '{}' is not usable as it does not have any function or a label.".format(self.name)) raise Exception("Item {!r} is not usable as it does not have any function or a label.".format(self.name))
if self.owned == 0: if self.owned == 0:
raise Exception("Item '{}' owned count is equal to zero.".format(self.name)) raise Exception("Item {!r} owned count is equal to zero.".format(self.name))
if not self.type == "quest": if not self.type == "quest":
# Quest items require manual triggers, it's more convenient. # Quest items require manual triggers, it's more convenient.
@ -62,10 +62,10 @@ init python:
def give(self, who): def give(self, who):
if not self.givable: if not self.givable:
raise Exception("Item '{}' is not marked as givable.".format(self.name)) raise Exception("Item {!r} is not marked as givable.".format(self.name))
if self.owned == 0: if self.owned == 0:
raise Exception("Item '{}' owned count is equal to zero.".format(self.name)) raise Exception("Item {!r} owned count is equal to zero.".format(self.name))
if not self.type == "quest": if not self.type == "quest":
# Quest items require manual triggers, it's more convenient. # Quest items require manual triggers, it's more convenient.
@ -119,7 +119,7 @@ init python:
def use(self): def use(self):
if self.owned == 0: if self.owned == 0:
raise Exception("Decoration '{}' owned count is equal to zero.".format(self.name)) raise Exception("Decoration {!r} owned count is equal to zero.".format(self.name))
achievements.unlock("decorator") achievements.unlock("decorator")
@ -155,7 +155,7 @@ init python:
self.usable = bool( renpy.has_label("{}_use".format(self.label)) ) self.usable = bool( renpy.has_label("{}_use".format(self.label)) )
if self.recipe is None: if self.recipe is None:
raise Exception("Potion '{}' recipe is empty!".format(self.name)) raise Exception("Potion {!r} recipe is empty!".format(self.name))
def has_ingredients(self): def has_ingredients(self):
return all(x.owned > 0 for x in self.recipe) return all(x.owned > 0 for x in self.recipe)
@ -163,7 +163,7 @@ init python:
def set_active(self, who): def set_active(self, who):
"""Marks the event as 'in progress' and will trigger a return event in the morning/evening.""" """Marks the event as 'in progress' and will trigger a return event in the morning/evening."""
if not who in list(self.in_progress.keys()): if not who in list(self.in_progress.keys()):
raise Exception("Potion '{}' is not marked as usable on '{}'.".format(self.name, who)) raise Exception("Potion {!r} is not marked as usable on {!r}.".format(self.name, who))
self.in_progress[who] = True self.in_progress[who] = True
@ -195,13 +195,13 @@ init python:
check_label = "{}_potion_check".format(who[:3]) check_label = "{}_potion_check".format(who[:3])
if not renpy.has_label(give_label): if not renpy.has_label(give_label):
raise Exception("Potion '{}' give label doesn't exist.".format(self.name)) raise Exception("Potion {!r} give label doesn't exist.".format(self.name))
if not renpy.has_label(check_label): if not renpy.has_label(check_label):
raise Exception("Potion '{}' check label doesn't exist for '{}'.".format(self.name, who)) raise Exception("Potion {!r} check label doesn't exist for {!r}.".format(self.name, who))
if self.owned == 0: if self.owned == 0:
raise Exception("Potion '{}' owned count is equal to zero.".format(self.name)) raise Exception("Potion {!r} owned count is equal to zero.".format(self.name))
if not self.check_progression(who): if not self.check_progression(who):
self.jump(check_label) self.jump(check_label)
@ -215,10 +215,10 @@ init python:
label = "{}_use".format(self.label) label = "{}_use".format(self.label)
if not renpy.has_label(label): if not renpy.has_label(label):
raise Exception("Potion '{}' has no use label.".format(self.name)) raise Exception("Potion {!r} has no use label.".format(self.name))
if self.owned == 0: if self.owned == 0:
raise Exception("Potion '{}' owned count is equal to zero.".format(self.name)) raise Exception("Potion {!r} owned count is equal to zero.".format(self.name))
self.owned -= 1 self.owned -= 1
self.jump(label) self.jump(label)
@ -227,12 +227,12 @@ init python:
"""Play the return event for <girl>""" """Play the return event for <girl>"""
if not self.in_progress[who]: if not self.in_progress[who]:
raise Exception("Potion '{}' is not marked as in progress.".format(self.name)) raise Exception("Potion {!r} is not marked as in progress.".format(self.name))
label = "{}_{}_return".format(who[:3], self.label) label = "{}_{}_return".format(who[:3], self.label)
if not renpy.has_label(label): if not renpy.has_label(label):
raise Exception("Potion '{}' has no return label.".format(self.name)) raise Exception("Potion {!r} has no return label.".format(self.name))
self.in_progress[who] = False self.in_progress[who] = False
self.jump(label) self.jump(label)