Beispiel #1
0
def cmd_save(ch, cmd, arg):
    '''Attempt to save your character and all recent changes made to it, to
       disk. This automatically happens when logging out.'''
    if mudsys.do_save(ch):
        ch.send("Saved.")
    else:
        ch.send("Your character was not saved.")


def cmd_quit(ch, cmd, arg):
    '''Attempts to save and log out of the game.'''
    mud.log_string(ch.name + " has left the game.")
    mudsys.do_save(ch)
    mudsys.do_quit(ch)


################################################################################
# add our commands
################################################################################
mudsys.add_cmd("stop", None, cmd_stop, "player", False)
mudsys.add_cmd("clear", None, cmd_clear, "player", False)
mudsys.add_cmd("delay", None, cmd_delay, "player", False)
mudsys.add_cmd("motd", None, cmd_motd, "player", False)
mudsys.add_cmd("save", None, cmd_save, "player", False)
mudsys.add_cmd("quit", None, cmd_quit, "player", True)

chk_can_save = lambda ch, cmd: not ch.is_npc
mudsys.add_cmd_check("save", chk_can_save)
mudsys.add_cmd_check("quit", chk_can_save)
Beispiel #2
0
################################################################################
# add our commands
################################################################################
mudsys.add_cmd("ask",     None, cmd_ask,   "player", False)
mudsys.add_cmd("say",     None, cmd_say,   "player", False)
mudsys.add_cmd("'",       None, cmd_say,   "player", False)
mudsys.add_cmd("tell",    None, cmd_tell,  "player", False)
mudsys.add_cmd("chat",    None, cmd_chat,  "player", False)
mudsys.add_cmd("wizchat", "wiz",cmd_wiz,   "wizard", False)
mudsys.add_cmd("gossip",  None, cmd_chat,  "player", False)
mudsys.add_cmd("\"",      None, cmd_chat,  "player", False)
mudsys.add_cmd("page",    None, cmd_page,  "player", False)
mudsys.add_cmd("greet",   None, cmd_greet, "player", False)
mudsys.add_cmd("approach",None, cmd_greet, "player", False)
mudsys.add_cmd("emote",   None, cmd_emote, "player", False)
mudsys.add_cmd("gemote",  None, cmd_gemote,"player", False)
mudsys.add_cmd(":",       None, cmd_emote, "player", False)

def chk_room_communication(ch, cmd):
    if ch.pos in ("sleeping", "unconscious"):
        ch.send("You cannot do that while " + ch.pos + ".")
        return False

for cmd in ["ask", "say", "'", "greet", "approach", "emote", ":"]:
    mudsys.add_cmd_check(cmd, chk_room_communication)

# register our history handling
history.register_comm_history("chat", lambda ch: "chat")
# history.register_comm_history("say",  lambda ch: ch.name)
history.register_comm_history("tell", lambda ch: ch.name)
def cmd_save(ch, cmd, arg):
    """Attempt to save your character and all recent changes made to it, to
       disk. This automatically happens when logging out."""
    if mudsys.do_save(ch):
        ch.send("Saved.")
    else:
        ch.send("Your character was not saved.")


def cmd_quit(ch, cmd, arg):
    """Attempts to save and log out of the game."""
    mud.log_string(ch.name + " has left the game.")
    mudsys.do_save(ch)
    mudsys.do_quit(ch)


################################################################################
# add our commands
################################################################################
mudsys.add_cmd("stop", None, cmd_stop, "player", False)
mudsys.add_cmd("clear", None, cmd_clear, "player", False)
mudsys.add_cmd("delay", None, cmd_delay, "player", False)
mudsys.add_cmd("motd", None, cmd_motd, "player", False)
mudsys.add_cmd("save", None, cmd_save, "player", False)
mudsys.add_cmd("quit", None, cmd_quit, "player", True)

chk_can_save = lambda ch, cmd: not ch.is_npc
mudsys.add_cmd_check("save", chk_can_save)
mudsys.add_cmd_check("quit", chk_can_save)
Beispiel #4
0
################################################################################
# add our commands
################################################################################
mudsys.add_cmd("ask",     None, cmd_ask,   "player", False)
mudsys.add_cmd("say",     None, cmd_say,   "player", False)
mudsys.add_cmd("'",       None, cmd_say,   "player", False)
mudsys.add_cmd("tell",    None, cmd_tell,  "player", False)
mudsys.add_cmd("chat",    None, cmd_chat,  "player", False)
mudsys.add_cmd("wizchat", "wiz",cmd_wiz,   "wizard", False)
mudsys.add_cmd("gossip",  None, cmd_chat,  "player", False)
mudsys.add_cmd("\"",      None, cmd_chat,  "player", False)
mudsys.add_cmd("page",    None, cmd_page,  "player", False)
mudsys.add_cmd("greet",   None, cmd_greet, "player", False)
mudsys.add_cmd("approach",None, cmd_greet, "player", False)
mudsys.add_cmd("emote",   None, cmd_emote, "player", False)
mudsys.add_cmd("gemote",  None, cmd_gemote,"player", False)
mudsys.add_cmd(":",       None, cmd_emote, "player", False)

def chk_room_communication(ch, cmd):
    if ch.pos in ("sleeping", "unconscious"):
        ch.send("You cannot do that while " + ch.pos + ".")
        return False

for cmd in ["ask", "say", "'", "greet", "approach", "emote", ":"]:
    mudsys.add_cmd_check(cmd, chk_room_communication)

# register our history handling
history.register_comm_history("chat", lambda ch: "chat")
# history.register_comm_history("say",  lambda ch: ch.name)
history.register_comm_history("tell", lambda ch: ch.name)
            obj.container_is_closed = True
            hooks.run("close_obj", hooks.build_info("ch obj", (ch, obj)))


################################################################################
# load all of our commands
################################################################################
mudsys.add_cmd("give", None, cmd_give, "player", True)
mudsys.add_cmd("get", None, cmd_get, "player", True)
mudsys.add_cmd("drop", None, cmd_drop, "player", True)
mudsys.add_cmd("remove", None, cmd_remove, "player", True)
mudsys.add_cmd("wear", None, cmd_wear, "player", True)
mudsys.add_cmd("put", None, cmd_put, "player", True)
mudsys.add_cmd("open", None, cmd_open, "player", True)
mudsys.add_cmd("close", None, cmd_close, "player", True)
mudsys.add_cmd("lock", None, cmd_lock, "player", True)
mudsys.add_cmd("unlock", None, cmd_unlock, "player", True)


def chk_can_manip(ch, cmd):
    if not ch.pos in ["sitting", "standing", "flying"]:
        ch.send("You cannot do that while " + ch.pos + ".")
        return False


for cmd in [
        "give", "get", "drop", "remove", "wear", "put", "open", "close",
        "lock", "unlock"
]:
    mudsys.add_cmd_check(cmd, chk_can_manip)
Beispiel #6
0
for cmd in [
        "north", "west", "east", "south", "up", "down", "northwest",
        "northeast", "southwest", "southeast", "nw", "ne", "sw", "se"
]:
    mudsys.register_dflt_move_cmd(cmd)
mudsys.register_move_check(chk_can_move)


def chk_wake(ch, cmd):
    if not ch.pos == "sleeping":
        ch.send("You must be asleep to wake up.")
        return False


mudsys.add_cmd_check("wake", chk_wake)


def chk_sleep(ch, cmd):
    if ch.pos == "sleeping":
        ch.send("You are already sleeping!")
        return False
    elif ch.pos == "unconscious":
        ch.send("You cannot sleep while you are unconscious.")
        return False


mudsys.add_cmd_check("sleep", chk_sleep)


def chk_stand(ch, cmd):
def chk_can_move(ch, cmd):
    if not ch.pos in ["standing", "flying"]:
        ch.send("You cannot do that while " + ch.pos + "!")
        return False

for cmd in ["north", "west", "east", "south", "up", "down", "northwest",
            "northeast", "southwest", "southeast", "nw", "ne", "sw", "se"]:
    mudsys.register_dflt_move_cmd(cmd)
mudsys.register_move_check(chk_can_move)

def chk_wake(ch, cmd):
    if not ch.pos == "sleeping":
        ch.send("You must be asleep to wake up.")
        return False
mudsys.add_cmd_check("wake", chk_wake)

def chk_sleep(ch, cmd):
    if ch.pos == "sleeping":
        ch.send("You are already sleeping!")
        return False
    elif ch.pos == "unconscious":
        ch.send("You cannot sleep while you are unconscious.")
        return False
mudsys.add_cmd_check("sleep", chk_sleep)

def chk_stand(ch, cmd):
    if ch.pos == "standing":
        ch.send("You are already standing!")
        return False
    elif ch.pos != "sitting":
Beispiel #8
0
        else:
            mud.message(ch, None, obj, None, True, "to_char", "You close $o.")
            mud.message(ch, None, obj, None, True, "to_room", "$n closes $o.")
            obj.container_is_closed = True
            hooks.run("close_obj", hooks.build_info("ch obj", (ch, obj)))



################################################################################
# load all of our commands
################################################################################
mudsys.add_cmd("give",   None, cmd_give,   "player", True)
mudsys.add_cmd("get",    None, cmd_get,    "player", True)
mudsys.add_cmd("drop",   None, cmd_drop,   "player", True)
mudsys.add_cmd("remove", None, cmd_remove, "player", True)
mudsys.add_cmd("wear",   None, cmd_wear,   "player", True)
mudsys.add_cmd("put",    None, cmd_put,    "player", True)
mudsys.add_cmd("open",   None, cmd_open,   "player", True)
mudsys.add_cmd("close",  None, cmd_close,  "player", True)
mudsys.add_cmd("lock",   None, cmd_lock,   "player", True)
mudsys.add_cmd("unlock", None, cmd_unlock, "player", True)

def chk_can_manip(ch, cmd):
    if not ch.pos in ["sitting", "standing", "flying"]:
        ch.send("You cannot do that while " + ch.pos + ".")
        return False

for cmd in ["give", "get", "drop", "remove", "wear", "put", "open", "close",
            "lock", "unlock"]:
    mudsys.add_cmd_check(cmd, chk_can_manip)