def do_at(ch, argument): argument, arg = game_utils.read_word(argument) if not arg or not argument: ch.send("At where what?\n") return location = game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if not ch.is_room_owner(location) and location.is_private() \ and ch.trust < merc.MAX_LEVEL: ch.send("That room is private right now.\n") return original = ch.in_room on = ch.on original.get(ch) location.put(ch) ch.interpret(argument) # See if 'ch' still exists before continuing! # Handles 'at XXXX quit' case. for wch in instance.characters.values(): if wch == ch: location.get(ch) original.put(ch) ch.on = on break
def cmd_rset(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) arg3 = argument if not arg1 or not arg2 or not arg3: ch.send("Syntax: rset <location> <field> value\n\n" "Field being one of:\n" " flags sector\n") return location = game_utils.find_location(ch, arg1) if not location: ch.send("No such location.\n") return # Snarf the value. value = int(arg3) if arg3.isdigit() else -1 # Set something. if game_utils.str_cmp(arg2, "flags"): location.room_flags.bits = value return if game_utils.str_cmp(arg2, "sector"): location.sector_type = value return # Generate usage message. ch.cmd_rset("")
def do_goto(ch, argument): if not argument: ch.send("Goto where?\n") return location = game_utils.find_location(ch, argument) if not location: ch.send("No such location.\n") return count = len(location.people) if not ch.is_room_owner(location) and location.is_private() \ and (count > 1 or ch.trust < merc.MAX_LEVEL): ch.send("That room is private right now.\n") return if ch.fighting: fight.stop_fighting(ch, True) for rch_id in ch.in_room.people[:]: rch = instance.characters[rch_id] if rch.trust >= ch.invis_level: if ch.is_npc() and ch.bamfout: handler_game.act("$t", ch, ch.bamfout, rch, merc.TO_VICT) else: handler_game.act("$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT) location.put(ch.in_room.get(ch)) for rch_id in ch.in_room.people[:]: rch = instance.characters[rch_id] if rch.trust >= ch.invis_level: if ch.is_npc() and ch.bamfin: handler_game.act("$t", ch, ch.bamfin, rch, merc.TO_VICT) else: handler_game.act("$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT) ch.do_look("auto") return
def do_stat(ch, argument): string, arg = game_utils.read_word(argument) if not arg: ch.send("Syntax:\n") ch.send(" stat <name>\n") ch.send(" stat obj <name>\n") ch.send(" stat mob <name>\n") ch.send(" stat room <number>\n") return if arg == "room": ch.do_rstat(string) return if arg == "obj": ch.do_ostat(string) return if arg == "char" or arg == "mob": ch.do_mstat(string) return # do it the old way obj = ch.get_item_world(argument) if obj: ch.do_ostat(argument) return victim = ch.get_char_world(argument) if victim: ch.do_mstat(argument) return location = game_utils.find_location(ch, argument) if location: ch.do_rstat(argument) return ch.send("Nothing by that name found anywhere.\n")
def do_violate(ch, argument): if not argument: ch.send("Goto where?\n") return location = game_utils.find_location(ch, argument) if not location: ch.send("No such location.\n") return if not location.is_private(): ch.send("That room isn't private, use goto.\n") return if ch.fighting: fight.stop_fighting(ch, True) for rch_id in ch.in_room.people: rch = instance.characters[rch_id] if rch.trust >= ch.invis_level: if ch.pcdata and ch.bamfout: handler_game.act("$t", ch, ch.bamfout, rch, merc.TO_VICT) else: handler_game.act("$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT) ch.get() ch.put(location) for rch_id in ch.in_room.people: rch = instance.characters[rch_id] if rch.trust >= ch.invis_level: if ch.pcdata and ch.bamfin: handler_game.act("$t", ch, ch.bamfin, rch, merc.TO_VICT) else: handler_game.act("$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT) ch.do_look("auto") return
def cmd_rstat(ch, argument): argument, arg = game_utils.read_word(argument) location = ch.in_room if not arg else game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if ch.in_room != location and location.is_private(): ch.send("That room is private right now.\n") return buf = [ "Name: '{}.'\nArea: '{}'.\n".format(location.name, location.area.name) ] buf += "Vnum: {}. Sector: {}. Light: {}.\n".format( location.vnum, location.sector_type, location.available_light) buf += "Room flags: {}.\nDescription:\n{}".format( repr(location.room_flags), location.description) if location.extra_descr: buf += "Extra description keywords: '" buf += [edd.keyword + " " for edd in location.extra_descr] buf += "'.\n" buf += "Characters:" for rch_id in location.people: rch = instance.characters[rch_id] buf += "'{}' ".format( rch.name if not rch.is_npc() else rch.short_descr) buf += ".\nObjects: " for obj_id in location.inventory[:]: obj = instance.global_instances[obj_id] buf += "'{}' ".format(obj.name) buf += ".\n" for door, pexit in enumerate(location.exit): if pexit: ch.send( "Door: {}. To: {}. Key: {}. Exit flags: {}.\nKeyword: '{}'. Description: {}" .format( door, # TODO: come back and fix this -1 if pexit.to_room is None else instance.rooms[pexit.to_room].vnum, -1 if pexit.key is None else pexit.key, pexit.exit_info, pexit.keyword, pexit.description if pexit.description else "(none).\n"))
def do_rstat(ch, argument): argument, arg = game_utils.read_word(argument) location = ch.in_room if not arg else game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if not ch.is_room_owner(location) and ch.in_room != location \ and location.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): ch.send("That room is private right now.\n") return ch.send("Name: '%s'\nArea: '%s'\n" % (location.name, location.area)) ch.send("Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n" % (location.vnum, location.sector_type, location.available_light, location.heal_rate, location.mana_rate)) ch.send("Room flags: %d.\nDescription:\n%s" % (location.room_flags, location.description)) if location.extra_descr: ch.send("Extra description keywords: '") [ch.send(ed.keyword + " ") for ed in location.extra_descr] ch.send("'.\n") ch.send("Characters:") for rch_id in location.people: rch = instance.characters[rch_id] if ch.can_see(rch): ch.send("%s " % rch.name if not rch.is_npc() else rch.short_descr) ch.send(".\nObjects: ") for obj_id in location.inventory[:]: obj = instance.global_instances[obj_id] ch.send("'%s' " % obj.name) ch.send(".\n") for door, pexit in enumerate(location.exit): if pexit: ch.send( "Door: %d. To: %d. Key: %d. Exit flags: %d.\nKeyword: '%s'. Description: %s" % ( door, # TODO: come back and fix this -1 if pexit.to_room is None else instance.rooms[pexit.to_room].vnum, -1 if pexit.key is None else pexit.key, pexit.exit_info, pexit.keyword, pexit.description if pexit.description else "(none).\n")) return
def do_transfer(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1: ch.send("Transfer whom (and where)?\n") return if arg1 == "all": for d in merc.descriptor_list: if d.is_connected(nanny.con_playing) \ and d.character != ch \ and d.character.in_room \ and ch.can_see(d.character): ch.do_transfer("%s %s" % d.character.name, arg2) return # Thanks to Grodyn for the optional location parameter. if not arg2: location = ch.in_room else: location = game_utils.find_location(ch, arg2) if not location: ch.send("No such location.\n") return if not ch.is_room_owner(location) and location.is_private() \ and ch.trust < merc.MAX_LEVEL: ch.send("That room is private right now.\n") return victim = ch.get_char_world(arg1) if not victim: ch.send("They aren't here.\n") return if victim.in_room is None: ch.send("They are in limbo.\n") return if victim.fighting: fight.stop_fighting(victim, True) handler_game.act("$n disappears in a mushroom cloud.", victim, None, None, merc.TO_ROOM) victim.in_room.get(victim) location.put(victim) handler_game.act("$n arrives from a puff of smoke.", victim, None, None, merc.TO_ROOM) if ch != victim: handler_game.act("$n has transferred you.", ch, None, victim, merc.TO_VICT) victim.do_look("auto") ch.send("Ok.\n")
def do_rstat(ch, argument): argument, arg = game_utils.read_word(argument) location = ch.in_room if not arg else game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if not ch.is_room_owner(location) and ch.in_room != location \ and location.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): ch.send("That room is private right now.\n") return ch.send("Name: '%s'\nArea: '%s'\n" % (location.name, location.area)) ch.send("Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n" % ( location.vnum, location.sector_type, location.available_light, location.heal_rate, location.mana_rate)) ch.send("Room flags: %d.\nDescription:\n%s" % (location.room_flags, location.description)) if location.extra_descr: ch.send("Extra description keywords: '") [ch.send(ed.keyword + " ") for ed in location.extra_descr] ch.send("'.\n") ch.send("Characters:") for rch_id in location.people: rch = instance.characters[rch_id] if ch.can_see(rch): ch.send("%s " % rch.name if not rch.is_npc() else rch.short_descr) ch.send(".\nObjects: ") for obj_id in location.inventory[:]: obj = instance.global_instances[obj_id] ch.send("'%s' " % obj.name) ch.send(".\n") for door, pexit in enumerate(location.exit): if pexit: ch.send("Door: %d. To: %d. Key: %d. Exit flags: %d.\nKeyword: '%s'. Description: %s" % ( door, # TODO: come back and fix this -1 if pexit.to_room is None else instance.rooms[pexit.to_room].vnum, -1 if pexit.key is None else pexit.key, pexit.exit_info, pexit.keyword, pexit.description if pexit.description else "(none).\n" )) return
def cmd_goto(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Goto where?\n") return location = game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if location.is_private(): ch.send("That room is private right now.\n") return if ch.fighting: fight.stop_fighting(ch, True) for rch_id in ch.in_room.people[:]: rch = instance.characters[rch_id] if rch.trust >= ch.invis_level: if ch.is_npc() and ch.bamfout: handler_game.act("$t", ch, ch.bamfout, rch, merc.TO_VICT) else: handler_game.act("$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT) location.put(ch.in_room.get(ch)) for rch_id in ch.in_room.people[:]: rch = instance.characters[rch_id] if rch.trust >= ch.invis_level: if ch.is_npc() and ch.bamfin: handler_game.act("$t", ch, ch.bamfin, rch, merc.TO_VICT) else: handler_game.act("$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT) ch.cmd_look("auto") mount = ch.mount if mount: ch.in_room.put(mount.in_room.get(mount)) mount.cmd_look("")
def cmd_transfer(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1: ch.send("Transfer whom (and where)?\n") return if game_utils.str_cmp(arg1, "all"): for wch in list(instance.players.values()): if wch != ch and wch.in_room and ch.can_see(wch): if wch.act.is_set( merc.PLR_GODLESS ) and ch.trust < merc.NO_GODLESS and not ch.extra.is_set( merc.EXTRA_ANTI_GODLESS): continue ch.cmd_transfer("{} {}".format(wch.name, arg2)) return # Thanks to Grodyn for the optional location parameter. if not arg2: location = ch.in_room else: location = game_utils.find_location(ch, arg2) if not location: ch.send("No such location.\n") return if location.is_private(): ch.send("That room is private right now.\n") return victim = ch.get_char_world(arg1) if not victim: ch.not_here(arg1) return if not victim.in_room: ch.send("They are in limbo.\n") return if victim.act.is_set( merc.PLR_GODLESS ) and ch.trust < merc.NO_GODLESS and not ch.extra.is_set( merc.EXTRA_ANTI_GODLESS): ch.send("You failed.\n") return if victim.fighting: fight.stop_fighting(victim, True) handler_game.act("$n disappears in a mushroom cloud.", victim, None, None, merc.TO_ROOM) victim.in_room.get(victim) location.put(victim) handler_game.act("$n arrives from a puff of smoke.", victim, None, None, merc.TO_ROOM) if ch != victim: handler_game.act("$n has transferred you.", ch, None, victim, merc.TO_VICT) victim.cmd_look("auto") ch.send("Ok.\n") mount = victim.mount if mount: mount.in_room.get(mount) location.put(mount) if ch != mount: handler_game.act("$n has transferred you.", ch, None, mount, merc.TO_VICT) mount.cmd_look("auto")