def cmd_champions(ch, argument): if ch.is_npc(): return if not ch.is_demon() and not ch.special.is_set(merc.SPC_CHAMPION): ch.huh() return if not ch.lord and not ch.is_demon(): ch.send("But you don't follow any demon!\n") return lord = ch.name if ch.is_demon() else ch.lord buf = ["The champions of {}:\n".format(lord)] buf += "[ Name ] [ Hits ] [ Mana ] [ Move ] [ Exp ] [ Power ]\n" for gch in list(instance.players.values()): if not gch.is_demon() and not gch.special.is_set(merc.SPC_CHAMPION): continue if game_utils.str_cmp(ch.lord, lord) or game_utils.str_cmp( ch.name, lord): buf += "[{:<16}] [{:<6}] [{:<6}] [{:<6}] [{:7}] [ {:<9}{:9} ]\n".format( gch.name, gch.hit, gch.mana, gch.move, gch.exp, gch.powers[merc.DEMON_CURRENT], gch.powers[merc.DEMON_TOTAL]) ch.send("".join(buf))
def cmd_qmake(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Do you wish to qmake a MACHINE or a CARD?\n") return if game_utils.str_cmp(arg, "card"): obj_index = instance.item_templates[merc.OBJ_VNUM_QUESTCARD] if not obj_index: ch.send("Missing object, please inform an Immortal.\n") return item = object_creator.create_item(obj_index, 0) item.quest_object() ch.put(item) elif game_utils.str_cmp(arg, "machine"): obj_index = instance.item_templates[merc.OBJ_VNUM_QUESTMACHINE] if not obj_index: ch.send("Missing object, please inform an Immortal.\n") return item = object_creator.create_item(obj_index, 0) ch.in_room.put(item) else: ch.cmd_qmake("") return ch.send("Ok.\n")
def cmd_prompt(ch, argument): if ch.is_npc(): return if not argument: ch.cmd_help("prompt") return if game_utils.str_cmp(argument, "on"): if ch.extra.is_set(merc.EXTRA_PROMPT): ch.send("But you already have customised prompt on!\n") else: ch.send("Ok.\n") ch.extra.set_bit(merc.EXTRA_PROMPT) elif game_utils.str_cmp(argument, "off"): if not ch.extra.is_set(merc.EXTRA_PROMPT): ch.send("But you already have customised prompt off!\n") else: ch.send("Ok.\n") ch.extra.rem_bit(merc.EXTRA_PROMPT) elif game_utils.str_cmp(argument, "clear"): ch.prompt = "" else: argument = argument[:50] if len(argument) > 50 else argument ch.prompt = argument ch.send("Ok.\n")
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 cmd_ntrust(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1: ch.send("Syntax: ntrust <char> <on/off>.\n") return if not arg2: ch.send("Do you wish to set ntrust ON or OFF?\n") return victim = ch.get_char_room(arg1) if not victim: ch.not_here(arg1) return if game_utils.str_cmp(arg2, "off"): if not victim.extra.is_set(merc.EXTRA_TRUSTED): ch.send("Their ntrust is already off.\n") return victim.extra.rem_bit(merc.EXTRA_NOTE_TRUST) ch.send("Note trust OFF.\n") victim.send("You are no longer note trusted.\n") elif game_utils.str_cmp(arg2, "on"): if victim.extra.is_set(merc.EXTRA_NOTE_TRUST): ch.send("Their ntrust is already on.\n") return victim.extra.set_bit(merc.EXTRA_NOTE_TRUST) ch.send("Note trust ON.\n") victim.send("You are now note trusted.\n") else: ch.send("Do you want to set their ntrust ON or OFF?\n")
def cmd_godless(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_npc(): return if not arg: ch.send("Do you wish to switch it ON or OFF?\n") return if ch.level != 3 and not ch.act.is_set(merc.PLR_GODLESS): ch.send("Sorry, you must be level 3.\n") return if ch.act.is_set(merc.PLR_GODLESS) and game_utils.str_cmp(arg, "off"): ch.act.rem_bit(merc.PLR_GODLESS) ch.send("You now obey the gods.\n") comm.info("{} now follows the whims of the gods.".format(ch.name)) elif not ch.act.is_set(merc.PLR_GODLESS) and game_utils.str_cmp( arg, "off"): ch.send("But you already obey the gods!\n") elif not ch.act.is_set(merc.PLR_GODLESS) and game_utils.str_cmp(arg, "on"): ch.act.set_bit(merc.PLR_GODLESS) ch.send("You no longer obey the gods.\n") comm.info("{} has rejected the gods.".format(ch.name)) elif ch.act.is_set(merc.PLR_GODLESS) and game_utils.str_cmp(arg, "on"): ch.send("But you have already rejected the gods!\n") else: ch.send("Do you wish to switch it ON or OFF?\n")
def cmd_transport(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_npc(): return if not arg: ch.send("Do you wish to switch transport ON or OFF?\n") return if ch.immune.is_set(merc.IMM_TRANSPORT) and game_utils.str_cmp(arg, "off"): ch.immune.rem_bit(merc.IMM_TRANSPORT) ch.send("You can no longer be the target of transport spells.\n") elif not ch.immune.is_set(merc.IMM_TRANSPORT) and game_utils.str_cmp( arg, "off"): ch.send("But it is already off!\n") elif not ch.immune.is_set(merc.IMM_TRANSPORT) and game_utils.str_cmp( arg, "on"): ch.immune.set_bit(merc.IMM_TRANSPORT) ch.send("You can now be the target of transport spells.\n") elif ch.immune.is_set(merc.IMM_TRANSPORT) and game_utils.str_cmp( arg, "on"): ch.send("But it is already on!\n") else: ch.send("Do you wish to switch it ON or OFF?\n")
def crack_head(ch, item, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not game_utils.str_cmp(arg2, "mob") and item.chobj and not item.chobj.is_npc() and item.chobj.is_affected(merc.AFF_POLYMORPH): victim = item.chobj object_creator.make_part(victim, "cracked_head") object_creator.make_part(victim, "brain") victim.morph = "the quivering brain of {}".format(victim.name) elif game_utils.str_cmp(arg2, "mob"): mob_index = instance.npc_templates[item.value[1]] if not mob_index: return victim = object_creator.create_mobile(mob_index) ch.in_room.put(victim) object_creator.make_part(victim, "cracked_head") object_creator.make_part(victim, "brain") victim.extract(True) else: mob_index = instance.npc_templates[30002] if not mob_index: return victim = object_creator.create_mobile(mob_index) victim.short_descr = arg2[0].upper() + arg2[1:] ch.in_room.put(victim) object_creator.make_part(victim, "cracked_head") object_creator.make_part(victim, "brain") victim.extract(True)
def cmd_order(ch, argument): argument, arg = game_utils.read_word(argument) if not arg or not argument: ch.send("Order whom to do what?\n") return if ch.is_affected(merc.AFF_CHARM): ch.send("You feel like taking, not giving, orders.\n") return if game_utils.str_cmp(arg, "all"): fall = True victim = None else: fall = False victim = ch.get_char_room(arg) if not victim: ch.not_here(arg) return if ch == victim: ch.not_self() return if (not victim.is_affected(merc.AFF_CHARM) or instance.characters[victim.master] != ch) and not (ch.is_vampire() and victim.is_vampire()): ch.send("Do it yourself!\n") return if ch.is_vampire() and victim.is_vampire() and (ch.powers[merc.UNI_GEN] != 2 or not game_utils.str_cmp(ch.clan, victim.clan)): handler_game.act("$N ignores your order.", ch, None, victim, merc.TO_CHAR) handler_game.act("You ignore $n's order.", ch, None, victim, merc.TO_VICT) return found = False for och_id in ch.in_room.people[:]: och = instance.characters[och_id] if och == ch: continue if (ch.is_affected(merc.AFF_CHARM) and instance.characters[och.master] == ch and (fall or och == victim)) or \ (ch.powers[merc.UNI_GEN] == 2 and (fall or och == victim) and game_utils.str_cmp(ch.clan, och.clan)): found = True handler_game.act("$n orders you to '$t'.", ch, argument, och, merc.TO_VICT) och.interpret(argument) elif not ch.is_npc() and not och.is_npc() and (fall or och == victim) and ch.is_vampire() and och.is_vampire() and \ ch.powers[merc.UNI_GEN] < och.powers[merc.UNI_GEN] and game_utils.str_cmp(ch.clan, och.clan): found = True handler_game.act("$n orders you to '$t'.", ch, argument, och, merc.TO_VICT) och.interpret(argument) if found: ch.send("Ok.\n") else: ch.send("You have no followers here.\n")
def cmd_wings(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_npc(): return if not ch.is_demon() and not ch.special.is_set(merc.SPC_CHAMPION): ch.huh() return if not ch.dempower.is_set(merc.DEM_WINGS): ch.send("You haven't been granted the gift of wings.\n") return if arg: if not ch.demaff.is_set(merc.DEM_WINGS): ch.send("First you better get your wings out!\n") return if game_utils.str_cmp(arg, ["unfold", "u"]): if ch.demaff.is_set(merc.DEM_UNFOLDED): ch.send("But your wings are already unfolded!\n") return ch.send("Your wings unfold from behind your back.\n") handler_game.act("$n's wings unfold from behind $s back.", ch, None, None, merc.TO_ROOM) ch.demaff.set_bit(merc.DEM_UNFOLDED) return if game_utils.str_cmp(arg, ["fold", "f"]): if not ch.demaff.is_set(merc.DEM_UNFOLDED): ch.send("But your wings are already folded!\n") return ch.send("Your wings fold up behind your back.\n") handler_game.act("$n's wings fold up behind $s back.", ch, None, None, merc.TO_ROOM) ch.demaff.rem_bit(merc.DEM_UNFOLDED) return ch.send("Do you want to FOLD or UNFOLD your wings?\n") return if ch.demaff.is_set(merc.DEM_WINGS): if ch.demaff.is_set(merc.DEM_UNFOLDED): ch.send("Your wings fold up behind your back.\n") handler_game.act("$n's wings fold up behind $s back.", ch, None, None, merc.TO_ROOM) ch.demaff.rem_bit(merc.DEM_UNFOLDED) ch.send("Your wings slide into your back.\n") handler_game.act("$n's wings slide into $s back.", ch, None, None, merc.TO_ROOM) ch.demaff.rem_bit(merc.DEM_WINGS) return ch.send("Your wings extend from your back.\n") handler_game.act("A pair of wings extend from $n's back.", ch, None, None, merc.TO_ROOM) ch.demaff.set_bit(merc.DEM_WINGS)
def cmd_relevel(ch, argument): if game_utils.str_cmp(ch.name, ["List", "of", "imps"]): ch.level = merc.MAX_LEVEL ch.trust = merc.MAX_LEVEL ch.send("Done.\n") elif game_utils.str_cmp(ch.name, ["List", "of", "HJs"]): ch.level = merc.MAX_LEVEL - 1 ch.trust = merc.MAX_LEVEL - 1 ch.send("Done.\n") else: ch.huh()
def cmd_divorce(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1 or not arg2: ch.send("Syntax: divorse <person> <person>\n") return victim1 = ch.get_char_room(arg1) if not victim1: ch.not_here(arg1) return victim2 = ch.get_char_room(arg2) if not victim2: ch.not_here(arg2) return if victim1.is_npc() or victim2.is_npc(): ch.not_npc() return if victim1.act.is_set(merc.PLR_GODLESS) and ch.level < merc.NO_GODLESS: ch.send("You failed.\n") return if victim2.act.is_set(merc.PLR_GODLESS) and ch.level < merc.NO_GODLESS: ch.send("You failed.\n") return if game_utils.str_cmp(victim1.name, victim2.marriage) and game_utils.str_cmp( victim2.name, victim1.marriage): if not victim1.extra.is_set( merc.EXTRA_MARRIED) or not victim2.extra.is_set( merc.EXTRA_MARRIED): ch.send("But they are not married!\n") return victim1.extra.rem_bit(merc.EXTRA_MARRIED) victim2.extra.rem_bit(merc.EXTRA_MARRIED) victim1.marriage = "" victim2.marriage = "" victim1.save(force=True) victim2.save(force=True) comm.info("{} and {} are now divorced!".format(victim1.name, victim2.name)) return ch.send("But they are not married!\n")
def cmd_sheath(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Which hand, left or right?\n") elif game_utils.str_cmp(arg, ["all", "both"]): sheath(ch, right_hand=True) sheath(ch, right_hand=False) elif game_utils.str_cmp(arg, ["l", "left"]): sheath(ch, right_hand=False) elif game_utils.str_cmp(arg, ["r", "right"]): sheath(ch, right_hand=True) else: ch.send("Which hand, left or right?\n")
def cmd_breakup(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_npc(): return if ch.marriage: if ch.extra.is_set(merc.EXTRA_MARRIED): ch.send("You'll have to get divorced.\n") return else: ch.send("But you are not even engaged!\n") return if not arg: ch.send("Who do you wish to break up with?\n") return victim = ch.get_char_room(arg) if not victim: ch.not_here(arg) return if victim.is_npc(): ch.not_npc() return if victim.marriage: if victim.extra.is_set(merc.EXTRA_MARRIED): ch.send("They'll have to get divorced.\n") return else: ch.send("But they are not even engaged!\n") return if game_utils.str_cmp(ch.name, victim.marriage) and game_utils.str_cmp( victim.name, ch.marriage): victim.marriage = "" ch.marriage = "" handler_game.act("You break off your engagement with $M.", ch, None, victim, merc.TO_CHAR) handler_game.act("$n breaks off $n engagement with $N.", ch, None, victim, merc.TO_NOTVICT) handler_game.act("$n breaks off $s engagement with you.", ch, None, victim, merc.TO_VICT) ch.save(force=True) victim.save(force=True) comm.info("{} and {} have broken up!".format(ch.name, victim.name)) ch.send("You are not engaged to them.\n")
def cmd_trust(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1 or not arg2: ch.send("Syntax: trust <char> <trust>\n" "Trust being one of: None, Builder, Questmaker, Enforcer, Judge, or Highjudge.\n") return victim = ch.get_char_room(arg1) if not victim: ch.not_here(arg1) return if victim.is_npc(): ch.not_npc() return arg_list = [("none", 0), ("builder", merc.LEVEL_BUILDER), ("questmaker", merc.LEVEL_QUESTMAKER), ("enforcer", merc.LEVEL_ENFORCER), ("judge", merc.LEVEL_JUDGE), ("highjudge", merc.LEVEL_HIGHJUDGE)] for (aa, bb) in arg_list: if game_utils.str_cmp(arg2, aa): level = bb break else: ch.cmd_trust("") return if level >= ch.trust: ch.send("Limited to below your trust.\n") return ch.send("Ok.\n") victim.trust = level
def cmd_locate(ch, argument): if ch.is_npc(): return buf = [] found = False for item in list(instance.items.values()): if not ch.can_see_item( item) or not item.questowner or not game_utils.str_cmp( ch.name, item.questowner): continue found = True in_item = item while in_item.in_item: in_item = in_item.in_item if in_item.in_living: buf += "{} created by {} and carried by {}.\n".format( item.short_descr, item.questmaker, in_item.in_living.pers(ch)) else: buf += "{} created by {} and in {}.\n".format( item.short_descr, item.questmaker, "somewhere" if not in_item.in_room else in_item.in_room.name) if not found: buf += "You cannot locate any items belonging to you.\n" ch.send("".join(buf))
def __init__(self, sock, addr_tup): self.active = True # Turns False when the connection is lost self.sock = sock # The connection's socket self.fileno = sock.fileno() # The socket's file descriptor self.address = addr_tup[0] # The client's remote TCP/IP address self.port = addr_tup[1] # The client's remote port hostname = socket.gethostbyaddr(addr_tup[0])[0] self.hostname = hostname if not game_utils.str_cmp( hostname, settings.LOCAL_NAME) else "localhost" self.terminal_type = "ANSI" # set via request_terminal_type() self.columns = 80 self.rows = 24 self.send_pending = False self.send_buffer = "" self.recv_buffer = "" self.bytes_sent = 0 self.bytes_received = 0 self.cmd_ready = False self.command_list = [] self.connect_time = time.time() self.last_input_time = time.time() self.snoop_by = None self.character = None self.original = None # State variables for interpreting incoming telnet commands self.telnet_got_iac = False # Are we inside an IAC sequence? self.telnet_got_cmd = None # Did we get a telnet command? self.telnet_got_sb = False # Are we inside a subnegotiation? self.telnet_opt_dict = {} # Mapping for up to 256 TelnetOptions self.telnet_echo = False # Echo input back to the client? self.telnet_echo_password = False # Echo back '*' for passwords? self.telnet_sb_buffer = "" # Buffer for sub-negotiations
def cmd_preturn(ch, argument): if ch.is_npc(): return arg = ch.pload.title() if not ch.pload or game_utils.str_cmp(ch.name, arg): ch.huh() return pload = handler_pc.Pc.load(player_name=arg, silent=True) if not pload: ch.send("That player doesn't exist.\n") return d = ch.desc ch.send("You transform back into {}.\n".format(arg)) handler_game.act("$n transforms back into $t.", ch, arg, None, merc.TO_ROOM) ch.save(force=True) if ch and ch.desc: ch.extract(True) elif ch: ch.extract(True) if ch.desc: ch.desc.character = pload if ch.in_room: ch.in_room.put(ch) else: room_id = instance.instances_by_room[merc.ROOM_VNUM_TEMPLE][0] instance.rooms[room_id].put(ch) ch.pload = ""
def spl_minor_creation(sn, level, ch, victim, target): handler_magic.target_name, arg = game_utils.read_word( handler_magic.target_name) arg_list = [("potion", merc.ITEM_POTION), ("scroll", merc.ITEM_SCROLL), ("wand", merc.ITEM_WAND), ("staff", merc.ITEM_STAFF), ("pill", merc.ITEM_PILL)] for (aa, bb) in arg_list: if game_utils.str_cmp(arg, aa): itemtype = bb itemkind = aa break else: ch.send("Item can be one of: Potion, Scroll, Wand, Staff or Pill.\n") return item = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_PROTOPLASM], 0) item.item_type = itemtype item.name = "{} {}".format(ch.name, itemkind) item.short_descr = "{}'s {}".format(ch.name, itemkind) item.description = "{}'s {} lies here.".format(ch.name, itemkind) item.weight = 10 item.questmaker = ch.name ch.put(item) handler_game.act("$p suddenly appears in your hands.", ch, item, None, merc.TO_CHAR) handler_game.act("$p suddenly appears in $n's hands.", ch, item, None, merc.TO_ROOM)
def cmd_exits(ch, argument): fauto = game_utils.str_cmp(argument, "auto") if ch.check_blind(): return buf = ["[Exits:" if fauto else "Obvious exits:\n"] found = False for door, pexit in enumerate(ch.in_room.exit): if pexit and pexit.to_room and not pexit.exit_info.is_set( merc.EX_CLOSED): found = True to_room = instance.rooms[pexit.to_room] if fauto: buf += " " + merc.dir_name[door] else: buf += "{:<5} - {}\n".format( merc.dir_name[door].capitalize(), "Too dark to tell" if to_room.is_dark() else to_room.name) if not found: buf += " none" if fauto else "None.\n" if fauto: buf += "]\n" ch.send("".join(buf))
def cmd_wear(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_affected( merc.AFF_POLYMORPH) and not ch.is_npc() and not ch.vampaff.is_set( merc.VAM_DISGUISED) and not ch.is_werewolf(): ch.send("You cannot wear anything in this form.\n") return if not arg: ch.send("Wear, wield, or hold what?\n") return if game_utils.str_cmp(arg, "all"): for item_id in ch.items: item = instance.items.get(item_id, None) if ch.can_see_item(item): ch.equip(item, False, verbose_all=True) return item = ch.get_item_carry(arg) if not item: ch.send("You do not have that item.\n") return ch.equip(item, True, verbose=True, verbose_all=True)
def cmd_vclan(ch, argument): if ch.is_npc(): return if not ch.is_vampire(): ch.huh() return if not ch.clan or ch.special.is_set(merc.SPC_ANARCH): ch.send("But you don't belong to any clan!\n") return buf = ["The {} clan:\n".format(ch.clan)] buf += "[ Name ] [ Gen ] [ Hits % ] [ Mana % ] [ Move % ] [ Exp ] [Blood]\n" for gch in list(instance.players.values()): if not gch.is_vampire() or not game_utils.str_cmp(ch.clan, gch.clan): continue buf += "[{:<16}] [ {} ] [{:<6}{:3}] [{:<6}{:3}] [{:<6}{:3}] [{:7}] [ {:3} ]\n".format( ch.name, ch.powers[merc.UNI_GEN], gch.hit, (gch.hit * 100 // gch.max_hit), gch.mana, (gch.mana * 100 // gch.max_mana), gch.move, (gch.move * 100 // gch.max_move), gch.exp, gch.blood) ch.send("".join(buf))
def cmd_force(ch, argument): argument, arg = game_utils.read_word(argument) if not arg or not argument: ch.send("Force whom to do what?\n") return if game_utils.str_cmp(arg, "all"): for vch in list(instance.characters.values()): if not vch.is_npc() and vch.trust < ch.trust and not vch.act.is_set(merc.PLR_GODLESS) and ch.trust < merc.NO_GODLESS and \ not ch.extra.is_set(merc.EXTRA_ANTI_GODLESS): handler_game.act("$n forces you to '$t'.", ch, argument, vch, merc.TO_VICT) vch.interpret(argument) else: victim = ch.get_char_world(arg) if not victim: ch.not_here(arg) return if victim == ch: ch.not_self() return if victim.trust >= ch.trust: ch.send("Do it yourself!\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 handler_game.act("$n forces you to '$t'.", ch, argument, victim, merc.TO_VICT) victim.interpret(argument) ch.send("Ok.\n")
def cmd_sacrifice(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Sacrifice what?\n") return item = ch.get_item_list(arg, ch.in_room.items) if not item: ch.send("You can't find it.\n") return if not item.flags.take or item.item_type in [merc.ITEM_QUEST, merc.ITEM_MONEY, merc.ITEM_TREASURE, merc.ITEM_QUESTCARD] or \ item.flags.artifact or item.questowner and not game_utils.str_cmp(ch.name, item.questowner): handler_game.act("You are unable to drain any energy from $p.", ch, item, None, merc.TO_CHAR) return elif item.chobj and not item.chobj.is_npc() and item.chobj.obj_vnum != 0: handler_game.act("You are unable to drain any energy from $p.", ch, item, None, merc.TO_CHAR) return expgain = item.cost // 100 expgain = state_checks.urange(1, expgain, 50) ch.exp += expgain handler_game.act("You drain {} exp of energy from $p.".format(expgain), ch, item, None, merc.TO_CHAR) handler_game.act("$p disintegrates into a fine powder.", ch, item, None, merc.TO_CHAR) handler_game.act("$n drains the energy from $p.", ch, item, None, merc.TO_ROOM) handler_game.act("$p disintegrates into a fine powder.", ch, item, None, merc.TO_ROOM) if item.points > 0 and not ch.is_npc() and item.item_type != merc.ITEM_PAGE: handler_game.act("You receive a refund of {} quest points from $p.".format(item.points), ch, item, None, merc.TO_CHAR) ch.quest += item.points item.extract()
def find_door(ch, arg): arg_list = [(["n", "north"], merc.DIR_NORTH), (["e", "east"], merc.DIR_EAST), (["s", "south"], merc.DIR_SOUTH), (["w", "west"], merc.DIR_WEST), (["u", "up"], merc.DIR_UP), (["d", "down"], merc.DIR_DOWN)] for (aa, bb) in arg_list: if game_utils.str_cmp(arg, aa): door = bb break else: for door in range(merc.MAX_DIR): pexit = ch.in_room.exit[door] if pexit and pexit.exit_info.is_set(merc.EX_ISDOOR) and pexit.keyword and game_utils.is_name(arg, pexit.keyword): return door handler_game.act("I see no $T here.", ch, None, arg, merc.TO_CHAR) return -1 pexit = ch.in_room.exit[door] if not pexit: handler_game.act("I see no door $T here.", ch, None, arg, merc.TO_CHAR) return -1 if not pexit.exit_info.is_set(merc.EX_ISDOOR): ch.send("You can't do that.\n") return -1 return door
def cmd_magetalk(ch, argument): if ch.is_npc() or (not ch.is_immortal() and not game_utils.str_cmp(ch.ch_class.name, "mage")): ch.huh() return ch.talk_channel(argument, merc.CHANNEL_MAGETALK, "magetalk")
def cmd_howl(ch, argument): if ch.is_npc() or (not ch.is_immortal() and not game_utils.str_cmp(ch.ch_class.name, "werewolf")): ch.huh() return ch.talk_channel(argument, merc.CHANNEL_HOWL, "howls")
def cmd_log(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Log whom?\n") return if game_utils.str_cmp(arg, "all"): if settings.LOGALL: settings.LOGALL = False ch.send("Log ALL off.\n") else: settings.LOGALL = True ch.send("Log ALL on.\n") return victim = ch.get_char_world(arg) if not victim: ch.not_here(arg) return if victim.is_npc(): ch.not_npc() return # No level check, gods can log anyone. victim.sentances.tog_bit(merc.SENT_LOG) if victim.sentances.is_set(merc.SENT_LOG): ch.send("LOG set.\n") else: ch.send("LOG removed.\n")
def cmd_draw(ch, argument): argument, arg = game_utils.read_word(argument) if not ch.is_npc() and ch.special.is_set(merc.SPC_WOLFMAN): ch.send("Not in this form.\n") return if not arg: ch.send("Which hand, left or right?\n") elif game_utils.str_cmp(arg, ["all", "both"]): draw(ch, right_hand=True) draw(ch, right_hand=False) elif game_utils.str_cmp(arg, ["l", "left"]): draw(ch, right_hand=False) elif game_utils.str_cmp(arg, ["r", "right"]): draw(ch, right_hand=True) else: ch.send("Which hand, left or right?\n")
def cmd_tabledump(ch, argument): argument, arg = game_utils.read_word(argument) if not arg or not game_utils.str_cmp(arg, "confirm"): ch.send("Usage: tableload confirm\n") return ch.send("Dumping all tables.\n") write.write_tables(ch)