USAGE_CMDPRAY = "Usage: pray <diety>"
DEITIES = {
"deity1": {
"caliphate": "whererever",
"empire": "wherever",
"kingdom": "wherever"
},
"deity2": {
"caliphate": "whererever",
"empire": "wherever",
"kingdom": "wherever"
},
"deity3": {
"caliphate": "whererever",
"empire": "wherever",
"kingdom": "wherever"
},
"atheist": {
"caliphate": "whererever",
"empire": "wherever",
"kingdom": "wherever"
}
}
ERROR_MESSAGE = "You reach towards the light, but something pulls you back.\n|rAn error occured - the administrator has been notified ({})|n"
class CmdPray(MuxCommand):
"""
Pray to the diety of your choice to be resurrected.
Usage: pray <diety>
"""
key = 'pray'
lock = 'cmd:all(),attr(permadeath, False)'
def func(self):
args = self.args
caller = self.caller
if not args:
caller.msg(USAGE_CMDPRAY)
result = DEITIES.get(args, None)
if not result:
caller.msg("You can't pray to {}.\nThe gods of this realm are:{}"\
.format(args,
"\n".join(DEITIES.keys())
)
)
if result:
loc_name = result.get(caller.db.Nation.lower(), None)
if loc_name:
loc = caller.search(loc_name, global_search=True, quiet=True).first()
if not loc_name:
print("Caller is not assigned to a nation")
caller.msg(ERROR_MESSAGE.format("NONATION"))
return
if not loc:
print("Could not find location based on caller's nation")
caller.msg(ERROR_MESSAGE.format("INVALIDLOCATION"))
return
caller.move_to(loc)
Comments