Expand the roles game mode to allow setting the default role and role reveal. Note that default role should always be either villager or cultist
This commit is contained in:
parent
2c47b5610c
commit
5cf86473e6
@ -251,9 +251,21 @@ class ChangedRolesMode(object):
|
|||||||
raise InvalidModeException("Invalid syntax for mode roles. arg={0}".format(arg))
|
raise InvalidModeException("Invalid syntax for mode roles. arg={0}".format(arg))
|
||||||
role, num = change
|
role, num = change
|
||||||
try:
|
try:
|
||||||
num = int(num)
|
|
||||||
if role.lower() in self.ROLE_GUIDE:
|
if role.lower() in self.ROLE_GUIDE:
|
||||||
self.ROLE_GUIDE[role.lower()] = tuple([num] * len(ROLE_INDEX))
|
self.ROLE_GUIDE[role.lower()] = tuple([int(num)] * len(ROLE_INDEX))
|
||||||
|
elif role.lower() == "default" and num.lower() in self.ROLE_GUIDE:
|
||||||
|
if num.lower() == "villager" or num.lower() == "cultist":
|
||||||
|
self.DEFAULT_ROLE = num.lower()
|
||||||
|
else:
|
||||||
|
raise InvalidModeException("The default role must be either \u0002villager\u0002 or \u0002cultist\u0002.")
|
||||||
|
elif role.lower() == "role reveal" or role.lower() == "reveal roles":
|
||||||
|
num = num.lower()
|
||||||
|
if num == "on" or num == "true" or num == "yes" or num == "1":
|
||||||
|
self.ROLE_REVEAL = True
|
||||||
|
elif num == "off" or num == "false" or num == "no" or num == "0":
|
||||||
|
self.ROLE_REVEAL = False
|
||||||
|
else:
|
||||||
|
raise InvalidModeException("Did not recognize value \u0002{0}\u0002 for role reveal.".format(num))
|
||||||
else:
|
else:
|
||||||
raise InvalidModeException(("The role \u0002{0}\u0002 "+
|
raise InvalidModeException(("The role \u0002{0}\u0002 "+
|
||||||
"is not valid.").format(role))
|
"is not valid.").format(role))
|
||||||
|
Loading…
Reference in New Issue
Block a user