def cmd_invis(ch, argument): # RT code for taking a level argument argument, arg = game_utils.read_word(argument) if not arg: if ch.invis_level: ch.invis_level = 0 handler_game.act("$n slowly fades into existence.", ch, None, None, merc.TO_ROOM) ch.send("You slowly fade back into existence.\n") else: ch.invis_level = ch.trust handler_game.act("$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM) ch.send("You slowly vanish into thin air.\n") else: # do the level thing level = int(arg) if arg.isdigit() else -1 if level not in merc.irange(2, ch.trust): ch.send("Invis level must be between 2 and your level.\n") return ch.reply = None ch.invis_level = level handler_game.act("$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM) ch.send("You slowly vanish into thin air.\n")
def cmd_read(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("What do you wish to read?\n") return item = ch.get_item_here(arg) if not item: ch.send("You don't have that book.\n") return if item.item_type == merc.ITEM_PAGE: buf = ["{}.\n".format("Untitled page" if not item.victpoweruse else item.victpoweruse.capitalize())] if not item.chpoweruse: if not item.are_runes(): buf += "This page is blank.\n" elif ch.is_affected(merc.AFF_DETECT_MAGIC) and not item.quest.is_set(merc.QUEST_MASTER_RUNE) and not item.spectype.is_set(merc.ADV_STARTED): buf += living.Living.show_runes(item, False) else: buf += "This page is blank.\n" ch.send("".join(buf)) return buf += "--------------------------------------------------------------------------------\n" buf += item.chpoweruse + "\n" buf += "--------------------------------------------------------------------------------\n" if ch.is_affected(merc.AFF_DETECT_MAGIC) and not item.quest.is_set(merc.QUEST_MASTER_RUNE) and not item.spectype.is_set(merc.ADV_STARTED): buf += living.Living.show_runes(item, False) ch.send("".join(buf)) return if item.item_type != merc.ITEM_BOOK: ch.send("That's not a book.\n") return if state_checks.is_set(item.value[1], merc.CONT_CLOSED): if not item.victpoweruse: ch.send("The book is untitled.\n") else: ch.send("The book is titled '{}'.\n".format(item.victpoweruse)) return if item.value[2] == 0: buf = ["Index page.\n"] if item.value[3] <= 0: buf += "<No pages>\n" ch.send("".join(buf)) return for page in merc.irange(1, item.value[3]): buf += "Page {}:".format(page) buf += ch.show_page(item, page, True) else: buf = ["Page {}:".format(item.value[2])] buf += ch.show_page(item, item.value[2], False) ch.send("".join(buf))
def cmd_token(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if ch.is_npc() or (ch.quest < 1 and not ch.is_judge()): ch.send("You are unable to make a quest token.\n") return if not arg1 or not arg1.isdigit(): ch.send("Please specify a value for the quest token.\n") return value = int(arg1) if value not in merc.irange(1, 100): ch.send("Quest token should have a value between 1 and 100.\n") return if ch.quest < value and not ch.is_judge(): ch.send("You only have {:,} quest points left to put into tokens.\n".format(ch.quest)) return if arg2: victim = ch.get_char_room(arg2) if not victim: ch.not_here(arg2) return else: victim = None obj_index = instance.item_templates[merc.OBJ_VNUM_PROTOPLASM] if not obj_index: ch.send("Error...missing object, please inform an Immortal.\n") return ch.quest -= value if ch.quest < 0: ch.quest = 0 item = object_creator.create_item(obj_index, 1) item.value[0] = value item.cost = value * 1000 item.item_type = merc.ITEM_QUEST item.questmaker = ch.name item.name = "quest token" item.short_descr = "a {:,} point quest token".format(value) item.description = "A {:,} point quest token lies on the floor.".format(value) ch.put(item) if victim and victim != ch: handler_game.act("You reach behind $N's ear and produce $p.", ch, item, victim, merc.TO_CHAR) handler_game.act("$n reaches behind $N's ear and produces $p.", ch, item, victim, merc.TO_NOTVICT) handler_game.act("$n reaches behind your ear and produces $p.", ch, item, victim, merc.TO_VICT) else: handler_game.act("You snap your fingers and reveal $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n snaps $s fingers and reveals $p.", ch, item, None, merc.TO_ROOM)
def cmd_create(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1: itemtype = merc.ITEM_TRASH else: type_list = [("light", merc.ITEM_LIGHT), ("scroll", merc.ITEM_SCROLL), ("wand", merc.ITEM_WAND), ("staff", merc.ITEM_STAFF), ("weapon", merc.ITEM_WEAPON), ("treasure", merc.ITEM_TREASURE), (["armor", "armour"], merc.ITEM_ARMOR), ("potion", merc.ITEM_POTION), ("furniture", merc.ITEM_FURNITURE), ("trash", merc.ITEM_TRASH), ("container", merc.ITEM_CONTAINER), ("drink", merc.ITEM_DRINK_CON), ("key", merc.ITEM_KEY), ("food", merc.ITEM_FOOD), ("money", merc.ITEM_MONEY), ("boat", merc.ITEM_BOAT), ("corpse", merc.ITEM_CORPSE_NPC), ("fountain", merc.ITEM_FOUNTAIN), ("pill", merc.ITEM_PILL), ("portal", merc.ITEM_PORTAL), ("egg", merc.ITEM_EGG), ("stake", merc.ITEM_STAKE), ("missile", merc.ITEM_MISSILE)] for (aa, bb) in type_list: if game_utils.str_cmp(arg1, aa): itemtype = bb break else: itemtype = merc.ITEM_TRASH if not arg2 or not arg2.isdigit(): level = 0 else: level = int(arg2) if level not in merc.irange(1, 50): ch.send("Level should be within range 1 to 50.\n") return obj_index = instance.item_templates[merc.OBJ_VNUM_PROTOPLASM] if not obj_index: ch.send("Error...missing object, please inform an Immortal.\n") return item = object_creator.create_item(obj_index, level) item.item_type = itemtype ch.put(item) item.questmaker = ch.name handler_game.act( "You reach up into the air and draw out a ball of protoplasm.", ch, item, None, merc.TO_CHAR) handler_game.act( "$n reaches up into the air and draws out a ball of protoplasm.", ch, item, None, merc.TO_ROOM)
def cmd_sset(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) argument, arg3 = game_utils.read_word(argument) if not arg1 or not arg2 or not arg3: ch.send("Syntax: sset <victim> <skill> <value>\n" "or: sset <victim> all <value>\n" "Skill being any skill or spell.\n") return victim = ch.get_char_world(arg1) if not victim: ch.not_here(arg1) return if victim.is_npc(): ch.not_npc() 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 fall = game_utils.str_cmp(arg2, "all") sn = state_checks.prefix_lookup(const.skill_table, arg2) if not fall and not sn: ch.send("No such skill or spell.\n") return # Snarf the value. if not arg3.isdigit(): ch.send("Value must be numeric.\n") return value = int(arg3) if value not in merc.irange(0, 100): ch.send("Value range is 0 to 100.\n") return if fall: for sn in const.skill_table.keys(): victim.learned[sn] = value else: victim.learned[sn.name] = value ch.send("Ok.\n")
def cmd_clanname(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_npc(): return if not ch.is_vampire() and not ch.is_werewolf(): ch.huh() return if ch.powers[merc.UNI_GEN] != 1: ch.huh() return if not arg: if ch.is_vampire(): ch.send("Who's clan do you wish to name?\n") else: ch.send("Who do you wish to give a tribe to?\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.powers[merc.UNI_GEN] != 2: if victim.is_werewolf(): ch.send("Only greater werewolves may own a tribe.\n") else: ch.send("Only the Antediluvians may have clans.\n") return if victim.clan: ch.send("But they already have a clan!\n") return length = len(argument) if length not in merc.irange(3, 13) or not argument.isalpha(): ch.send("Clan name should be between 3 and 13 letters long.\n") return victim.clan = argument ch.send( "{} name set.\n".format("Clan" if victim.is_vampire() else "Tribe"))
def r_reset(preset, last, level, npc): if preset.arg1 not in instance.room_templates.keys(): comm.notify("r_reset: 'R': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: room_instance_id = instance.instances_by_room[preset.arg1][0] room_instance = instance.global_instances[room_instance_id] for d0 in merc.irange(preset.arg2 - 1): d1 = game_utils.number_range(d0, preset.arg2 - 1) pexit = room_instance.exit[d0] room_instance.exit[d0] = room_instance.exit[d1] room_instance.exit[d1] = pexit return last, level, npc
def check_parse_name(name): bad_names = ["All", "Auto", "Immortal", "Self", "Someone", "Gaia"] if name.title() in bad_names: return False if len(name) not in merc.irange(3, 12): return False if not name.isalpha(): return False checked = [licheck(c) for c in name] if True not in checked: return False return True
def cmd_time(ch, argument): day = handler_game.time_info.day + 1 if day in merc.irange(5, 19): suf = "th" elif day % 10 == 1: suf = "st" elif day % 10 == 2: suf = "nd" elif day % 10 == 3: suf = "rd" else: suf = "th" ch.send("It is {} o'clock {}, Day of {}, {}{} the Month of {}.\n".format( 12 if (handler_game.time_info.hour % 12 == 0) else handler_game.time_info.hour % 12, "pm" if handler_game.time_info.hour >= 12 else "am", day_name[day % 7], day, suf, month_name[handler_game.time_info.month])) ch.send("God Wars started up at {}\n".format(sys_utils.systimestamp(merc.boot_time))) ch.send("The system time is {}\n".format(sys_utils.systimestamp(merc.current_time)))
def cmd_fightstyle(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 is: fightstyle <number> <style>.\n" "Style can be selected from the following (enter style in text form):\n" "[ 1]*Trip [ 2]*Kick [ 3] Bash [ 4] Elbow [ 5] Knee\n" "[ 6] Headbutt [ 7]*Disarm [ 8] Bite [ 9]*Dirt [10] Grapple\n" "[11] Punch [12]*Gouge [13] Rip [14]*Stamp [15] Backfist\n" "[16] Jumpkick [17] Spinkick [18] Hurl [19] Sweep [20] Charge\n" "Selected options: 1:[{}] 2:[{}] 3:[{}] 4:[{}] 5:[{}] 6:[{}] 7:[{}] 8:[{}]\n\n" "* This has been coded (others are not yet in).\n".format( ch.cmbt[0], ch.cmbt[1], ch.cmbt[2], ch.cmbt[3], ch.cmbt[4], ch.cmbt[5], ch.cmbt[6], ch.cmbt[7])) return value = int(arg1) if arg1.isdigit() else -1 if value not in merc.irange(1, 8): ch.send("Please enter a value between 1 and 8.\n") return arg_list = [("clear", 0), ("trip", 1), ("kick", 2), ("bash", 3), ("elbow", 4), ("knee", 5), ("headbutt", 6), ("disarm", 7), ("bite", 8), ("dirt", 9), ("grapple", 10), ("punch", 11), ("gouge", 12), ("rip", 13), ("stamp", 14), ("backfist", 15), ("jumpkick", 16), ("spinkick", 17), ("hurl", 18), ("sweep", 19), ("charge", 20)] for (aa, bb) in arg_list: if game_utils.str_cmp(arg2, bb): selection = bb break else: ch.cmd_fightstyle("") return ch.cmbt[value - 1] = selection ch.send("Combat option {} now set to {} ({})\n".format( value, arg2, ch.cmbt[0]))
def cmd_incognito(ch, argument): # RT code for taking a level argument argument, arg = game_utils.read_word(argument) if not arg: if ch.incog_level: ch.incog_level = 0 handler_game.act("$n is no longer cloaked.", ch, None, None, merc.TO_ROOM) ch.send("You are no longer cloaked.\n") else: ch.incog_level = ch.trust handler_game.act("$n cloaks $s presence.", ch, None, None, merc.TO_ROOM) ch.send("You cloak your presence.\n") else: level = int(arg) if arg.isdigit() else -1 if level not in merc.irange(2, ch.level): ch.send("Incog level must be between 2 and your level.\n") return ch.reply = None ch.incog_level = level handler_game.act("$n cloaks $s presence.", ch, None, None, merc.TO_ROOM) ch.send("You cloak your presence.\n")
def cmd_oload(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1 or not arg1.isdigit(): ch.send("Syntax: oload <vnum> <level>.\n") return if not arg2: level = ch.trust else: # New feature from Alander. if not arg2.isdigit(): ch.send("Syntax: oload <vnum> <level>.\n") return level = int(arg2) if level not in merc.irange(0, ch.trust): ch.send("Limited to your trust level.\n") return vnum = int(arg1) if vnum not in instance.item_templates: ch.send("No object has that vnum.\n") return item = object_creator.create_item(instance.item_templates[vnum], level) if item.flags.take: ch.put(item) handler_game.act("$p appears in $n's hands!", ch, item, None, merc.TO_ROOM) else: ch.in_room.put(item) handler_game.act("$n has created $p!", ch, item, None, merc.TO_ROOM) handler_game.act("You create $p.", ch, item, None, merc.TO_CHAR) item.questmaker = ch.name
def cmd_pset(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) argument, arg3 = game_utils.read_word(argument) if not arg1 or not arg2 or not arg3: ch.send("Syntax: pset <victim> <area> <field> <value>\n\n" "Area being one of:\n" " quest quest+ quest- weapon immune beast\n" " blue red yellow green purple\n" " mongoose crane crab viper bull mantis\n" " dragon tiger monkey swallow \n\n" "Field being one of:\n" "Weapon: slice stab slash whip claw blast\n" "Weapon: pound crush grep bite pierce suck\n" "Immune: slash stab smash animal misc charm\n" "Immune: heat cold acid summon voodoo\n" "Immune: hurl backstab shielded kick disarm\n" "Immune: steal sleep drain sunlight\n" " all\n") return victim = ch.get_char_world(arg1) if not victim: ch.not_here(arg1) return if victim.is_npc(): ch.not_npc() return if victim.act.is_set(merc.PLR_GODLESS) and ch.level < merc.NO_GODLESS: ch.send("You failed.\n") return # Snarf the value (which need not be numeric). value = int(arg3) if arg3.isdigit() else -1 # Set something. if game_utils.str_cmp(arg2, "beast"): if value not in merc.irange(0, 100): ch.send("Beast range is 0 to 100.\n") return if ch.is_judge(): victim.beast = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "quest"): if value not in merc.irange(1, 15000): ch.send("Quest range is 1 to 15000.\n") return if ch.is_judge(): victim.quest = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "quest+"): if value not in merc.irange(1, 15000): ch.send("Quest range is 1 to 15000.\n") return if ch.is_judge(): victim.quest += value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "quest-"): if value not in merc.irange(1, 15000): ch.send("Quest range is 1 to 15000.\n") return if ch.is_judge(): victim.quest -= value if victim.quest < 0: victim.quest = 0 ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "viper"): if value not in merc.irange(0, 200): ch.send("Stance Viper range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_VIPER] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "crane"): if value not in merc.irange(0, 200): ch.send("Stance Crane range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_CRANE] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "crab"): if value not in merc.irange(0, 200): ch.send("Stance Crab range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_CRAB] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "mongoose"): if value not in merc.irange(0, 200): ch.send("Stance Mongoose range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_MONGOOSE] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "bull"): if value not in merc.irange(0, 200): ch.send("Stance Bull range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_BULL] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "mantis"): if value not in merc.irange(0, 200): ch.send("Stance Mantis range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_MANTIS] = value victim.stance[merc.STANCE_CRANE] = 200 victim.stance[merc.STANCE_VIPER] = 200 ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "dragon"): if value not in merc.irange(0, 200): ch.send("Stance Dragon range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_DRAGON] = value victim.stance[merc.STANCE_CRAB] = 200 victim.stance[merc.STANCE_BULL] = 200 ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "tiger"): if value not in merc.irange(0, 200): ch.send("Stance Tiger range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_TIGER] = value victim.stance[merc.STANCE_BULL] = 200 victim.stance[merc.STANCE_VIPER] = 200 ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "monkey"): if value not in merc.irange(0, 200): ch.send("Stance Monkey range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_MONKEY] = value victim.stance[merc.STANCE_MONGOOSE] = 200 victim.stance[merc.STANCE_CRANE] = 200 ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "swallow"): if value not in merc.irange(0, 200): ch.send("Stance Swallow range is 0 to 200.\n") return if ch.is_judge(): victim.stance[merc.STANCE_SWALLOW] = value victim.stance[merc.STANCE_CRAB] = 200 victim.stance[merc.STANCE_MONGOOSE] = 200 ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "purple"): smax = 240 if victim.is_mage() else 200 if value not in merc.irange(4, smax): ch.send("Spell range is 4 to {}.\n".format(smax)) return if ch.is_judge(): victim.spl[merc.PURPLE_MAGIC] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "red"): smax = 240 if victim.is_mage() else 200 if value not in merc.irange(4, smax): ch.send("Spell range is 4 to {}.\n".format(smax)) return if ch.is_judge(): victim.spl[merc.RED_MAGIC] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "blue"): smax = 240 if victim.is_mage() else 200 if value not in merc.irange(4, smax): ch.send("Spell range is 4 to {}.\n".format(smax)) return if ch.is_judge(): victim.spl[merc.BLUE_MAGIC] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "blue"): smax = 240 if victim.is_mage() else 200 if value not in merc.irange(4, smax): ch.send("Spell range is 4 to {}.\n".format(smax)) return if ch.is_judge(): victim.spl[merc.BLUE_MAGIC] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "yellow"): smax = 240 if victim.is_mage() else 200 if value not in merc.irange(4, smax): ch.send("Spell range is 4 to {}.\n".format(smax)) return if ch.is_judge(): victim.spl[merc.YELLOW_MAGIC] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "immune"): if not arg3: ch.send("pset <victim> immune <type>\n") return if ch.is_judge(): if game_utils.str_cmp(arg3, "all"): victim.immune.set_bit(merc.IMM_DRAIN) victim.immune.set_bit(merc.IMM_VOODOO) victim.immune.set_bit(merc.IMM_SLASH) victim.immune.set_bit(merc.IMM_STAB) victim.immune.set_bit(merc.IMM_SMASH) victim.immune.set_bit(merc.IMM_ANIMAL) victim.immune.set_bit(merc.IMM_MISC) victim.immune.set_bit(merc.IMM_CHARM) victim.immune.set_bit(merc.IMM_HEAT) victim.immune.set_bit(merc.IMM_COLD) victim.immune.set_bit(merc.IMM_LIGHTNING) victim.immune.set_bit(merc.IMM_ACID) victim.immune.set_bit(merc.IMM_HURL) victim.immune.set_bit(merc.IMM_BACKSTAB) victim.immune.set_bit(merc.IMM_KICK) victim.immune.set_bit(merc.IMM_DISARM) victim.immune.set_bit(merc.IMM_STEAL) victim.immune.set_bit(merc.IMM_SLEEP) ch.send("All immunities added.\n") else: imm_list = [ ("voodoo", merc.IMM_VOODOO), ("slash", merc.IMM_SLASH), ("stab", merc.IMM_STAB), ("smash", merc.IMM_SMASH), ("animal", merc.IMM_ANIMAL), ("misc", merc.IMM_MISC), ("charm", merc.IMM_CHARM), ("heat", merc.IMM_HEAT), ("cold", merc.IMM_COLD), ("lightning", merc.IMM_LIGHTNING), ("acid", merc.IMM_ACID), ("shield", merc.IMM_SHIELDED), ("hurl", merc.IMM_HURL), ("backstab", merc.IMM_BACKSTAB), ("kick", merc.IMM_KICK), ("disarm", merc.IMM_DISARM), ("steal", merc.IMM_STEAL), ("sleep", merc.IMM_SLEEP), ("sunlight", merc.IMM_SUNLIGHT) ] for (aa, bb) in imm_list: if game_utils.str_cmp(arg3, aa): victim.immune.tog_bit(bb) if victim.immune.is_set(bb): ch.send("Immunity added.\n") else: ch.send("Immunity removed.\n") return else: ch.send("No such immunity exists.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "weapon"): argument, arg4 = game_utils.read_word(argument) # Snarf the value (which need not be numeric). value = int(arg4) if arg4.isdigit() else -1 if value not in merc.irange(0, 200): ch.send("Weapon skill range is 0 to 200.\n") return if ch.is_judge(): if game_utils.str_cmp(arg3, "all"): for i in merc.irange(merc.MAX_WPN): victim.wpn[i] = value ch.send("Ok.\n") else: wpn_list = [ ("unarmed", merc.WPN_UNARMED), ("slice", merc.WPN_SLICE), ("stab", merc.WPN_STAB), ("slash", merc.WPN_SLASH), ("whip", merc.WPN_WHIP), ("claw", merc.WPN_CLAW), ("blast", merc.WPN_BLAST), ("pound", merc.WPN_POUND), ("crush", merc.WPN_CRUSH), ("grep", merc.WPN_GREP), ("bite", merc.WPN_BITE), ("pierce", merc.WPN_PIERCE), ("suck", merc.WPN_SUCK) ] for (aa, bb) in wpn_list: if game_utils.str_cmp(arg3, aa): victim.wpn[bb] = value ch.send("Ok.\n") return else: ch.send("No such weapon skill exists.\n") else: ch.send("Sorry, no can do...\n") return # Generate usage message. ch.cmd_pset("")
def cmd_majesty(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if ch.is_npc(): return if not ch.is_vampire(): ch.huh() return if not ch.vampaff.is_set(merc.VAM_PRESENCE): ch.send("You are not trained in the Presence discipline.\n") return if game_utils.str_cmp(arg1, "on"): if ch.extra.is_set(merc.EXTRA_FAKE_CON): ch.send("You already have Majesty on.\n") return ch.extra.set_bit(merc.EXTRA_FAKE_CON) ch.send("Your Majesty is now ON.\n") return if game_utils.str_cmp(arg1, "off"): if not ch.extra.is_set(merc.EXTRA_FAKE_CON): ch.send("You already have Majesty off.\n") return ch.extra.rem_bit(merc.EXTRA_FAKE_CON) ch.send("Your Majesty is now OFF.\n") return if not arg1 or not arg2: buf = ["You have the following stats:\n"] buf += "Hitroll: {}, Actual: {}.\n".format(ch.fake_hit, ch.hitroll) buf += "Damroll: {}, Actual: {}.\n".format(ch.fake_dam, ch.damroll) buf += "Armour: {}, Actual: {}.\n".format(ch.fake_ac, ch.armor) buf += "Hp: {}, Actual: {}.\n".format(ch.fake_hp, ch.hit) buf += "Mana: {}, Actual: {}.\n".format(ch.fake_mana, ch.mana) buf += "Move: {}, Actual: {}.\n".format(ch.fake_move, ch.move) ch.send("".join(buf)) return value = int(arg2) if arg2.isdigit() else -10000 if game_utils.str_cmp(arg1, ["hit", "hitroll"]): if value not in merc.irange(0, 1000): ch.send("Please enter a value between 0 and 1000.\n") return ch.fake_hit = value ch.send("Ok.\n") return if game_utils.str_cmp(arg1, ["dam", "damroll"]): if value not in merc.irange(0, 1000): ch.send("Please enter a value between 0 and 1000.\n") return ch.fake_dam = value ch.send("Ok.\n") return if game_utils.str_cmp(arg1, ["ac", "armour", "armor"]): if value not in merc.irange(-1000, 100): ch.send("Please enter a value between -1000 and 100.\n") return ch.fake_ac = value ch.send("Ok.\n") return if game_utils.str_cmp(arg1, ["hp", "hitpoints"]): if value not in merc.irange(1, 30000): ch.send("Please enter a value between 1 and 30000.\n") return ch.fake_hp = value ch.send("Ok.\n") return if game_utils.str_cmp(arg1, "mana"): if value not in merc.irange(1, 30000): ch.send("Please enter a value between 1 and 30000.\n") return ch.fake_mana = value ch.send("Ok.\n") return if game_utils.str_cmp(arg1, "move"): if value not in merc.irange(1, 30000): ch.send("Please enter a value between 1 and 30000.\n") return ch.fake_move = value ch.send("Ok.\n") return ch.send("You can set: Hit, Dam, Ac, Hp, Mana, Move.\n")
def create_item(item_template, level, prev_instance_id: int = None): if not item_template: comm.notify("create_item: no item_template", merc.CONSOLE_INFO) sys.exit(1) item = handler_item.Items(item_template) if not prev_instance_id: pass # item.instancer() else: item.instance_id = prev_instance_id item.level = level if item.vnum in merc.irange(29500, 29599): item.flags.artifact = True item.condition = 100 item.toughness = 100 item.resistance = 1 item.level = 60 item.cost = 1000000 elif item.vnum in merc.irange(29600, 29699): item.flags.relic = True item.condition = 100 item.toughness = 100 item.resistance = 1 else: item.condition = 100 item.toughness = 5 item.resistance = 25 # Mess with object properties. if item.item_type == merc.ITEM_SCROLL: item.value[0] = game_utils.number_fuzzy(item.value[0]) elif item.item_type in [merc.ITEM_WAND, merc.ITEM_STAFF]: item.value[0] = game_utils.number_fuzzy(item.value[0]) item.value[1] = game_utils.number_fuzzy(item.value[1]) item.value[2] = item.value[1] elif item.item_type == merc.ITEM_WEAPON: if not item.flags.artifact and not item.flags.relic: item.value[1] = game_utils.number_range(1, 10) item.value[2] = game_utils.number_range(item.value[1] + 1, item.value[1] * 2) elif item.item_type == merc.ITEM_ARMOR: if not item.flags.artifact and not item.flags.relic: item.value[0] = game_utils.number_range(5, 15) elif item.item_type in [merc.ITEM_POTION, merc.ITEM_PILL]: item.value[0] = game_utils.number_fuzzy( game_utils.number_fuzzy(item.value[0])) elif item.item_type == merc.ITEM_MONEY: item.value[0] = item.cost elif item.item_type in [ merc.ITEM_LIGHT, merc.ITEM_TREASURE, merc.ITEM_FURNITURE, merc.ITEM_TRASH, merc.ITEM_CONTAINER, merc.ITEM_DRINK_CON, merc.ITEM_KEY, merc.ITEM_FOOD, merc.ITEM_BOAT, merc.ITEM_CORPSE_NPC, merc.ITEM_CORPSE_PC, merc.ITEM_FOUNTAIN, merc.ITEM_PORTAL, merc.ITEM_EGG, merc.ITEM_VOODOO, merc.ITEM_STAKE, merc.ITEM_MISSILE, merc.ITEM_AMMO, merc.ITEM_QUEST, merc.ITEM_QUESTCARD, merc.ITEM_QUESTMACHINE, merc.ITEM_SYMBOL, merc.ITEM_BOOK, merc.ITEM_PAGE, merc.ITEM_TOOL ]: pass else: comm.notify( "create_item: bad item_type {} ({})".format( item_template.vnum, item.item_type), merc.CONSOLE_WARNING) item_template.count += 1 return item
def cmd_mset(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: mset <victim> <field> <value>\n" "or: mset <victim> <string> <value>\n\n" "Field being one of:\n" " str int wis dex con sex level exp\n" " gold hp mana move primal align\n" " hit dam ac\n\n" "String being one of:\n" " name short long description title spec\n") return victim = ch.get_char_world(arg1) if not victim: ch.not_here(arg1) 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 # Snarf the value (which need not be numeric). value = int(arg3) if arg3.isdigit() else -1 # Set something. if game_utils.str_cmp(arg2, "str"): if victim.is_npc(): ch.not_npc() return if value not in merc.irange(3, 18): ch.send("Strength range is 3 to 18.\n") return if ch.is_judge(): victim.perm_stat[merc.STAT_STR] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "int"): if victim.is_npc(): ch.not_npc() return if value not in merc.irange(3, 18): ch.send("Intelligence range is 3 to 18.\n") return if ch.is_judge(): victim.perm_stat[merc.STAT_INT] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "wis"): if victim.is_npc(): ch.not_npc() return if value not in merc.irange(3, 18): ch.send("Wisdom range is 3 to 18.\n") return if ch.is_judge(): victim.perm_stat[merc.STAT_WIS] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "dex"): if victim.is_npc(): ch.not_npc() return if value not in merc.irange(3, 18): ch.send("Dexterity range is 3 to 18.\n") return if ch.is_judge(): victim.perm_stat[merc.STAT_DEX] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "con"): if victim.is_npc(): ch.not_npc() return if value not in merc.irange(3, 18): ch.send("Constitution range is 3 to 18.\n") return if ch.is_judge(): victim.perm_stat[merc.STAT_CON] = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "sex"): if value not in merc.irange(0, 2): ch.send("Sex range is 0 to 2.\n") return victim.sex = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "level"): if victim.is_npc() and value not in merc.irange(1, 250): ch.send("Level range is 1 to 250 for mobs.\n") return if not ch.is_judge(): ch.send("Sorry, no can do...\n") return level_list = [("mortal", 2), ("avatar", 3), ("apprentice", 4), ("mage", 5), ("archmage", 6), ("builder", 7), ("questmaker", 8), ("enforcer", 9), ("judge", 10), ("highjudge", 11)] for (aa, bb) in level_list: if game_utils.str_cmp(arg3, aa): value = bb break else: if not victim.is_npc(): ch.send( "Level should be one of the following:\n" "Mortal, Avatar, Apprentice, Mage, Archmage, Builder, Questmaker, Enforcer,\n" "Judge, or Highjudge.\n") return if value >= ch.level and not victim.is_npc(): ch.send("Sorry, no can do...\n") else: victim.level = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, ["hitroll", "hit"]): smax = 50 if not victim.is_npc() else 250 if value not in merc.irange(0, smax): ch.send("Hitroll range is 0 to {}.\n".format(smax)) return if not victim.is_npc() and not ch.is_judge() and ch != victim: ch.send("Sorry, no can do...\n") return victim.hitroll = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, ["damroll", "dam"]): smax = 50 if victim.is_npc() else 250 if value not in merc.irange(0, smax): ch.send("Damroll range is 0 to {}.\n".format(smax)) return if not victim.is_npc() and not ch.is_judge() and ch != victim: ch.send("Sorry, no can do...\n") return victim.damroll = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, ["armor", "ac"]): if not victim.is_npc() and value not in merc.irange(-200, 200): ch.send("Armor class range is -200 to 200.\n") return if not victim.is_npc() and not ch.is_judge() and ch != victim: ch.send("Sorry, no can do...\n") return victim.armor = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "exp"): if victim.is_npc(): ch.not_npc() return if value < 0: ch.send("Exp must be at least 0.\n") return if value > 500000: ch.send("No more than 500000 possible.\n") return if ch.is_judge() or ch == victim: victim.exp = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "gold"): if value > 100000 and not ch.is_judge(): ch.send("Don't be so damn greedy!\n") else: victim.gold = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "hp"): if value not in merc.irange(1, 30000): ch.send("Hp range is 1 to 30,000 hit points.\n") return if ch.is_judge() or ch == victim or victim.is_npc(): victim.max_hit = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "mana"): if value not in merc.irange(0, 30000): ch.send("Mana range is 0 to 30,000 mana points.\n") return if ch.is_judge() or ch == victim or victim.is_npc(): victim.max_mana = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "move"): if value not in merc.irange(0, 30000): ch.send("Move range is 0 to 30,000 move points.\n") return if ch.is_judge() or ch == victim or victim.is_npc(): victim.max_move = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "primal"): if value not in merc.irange(0, 100): ch.send("Primal range is 0 to 100.\n") return if ch.is_judge() or ch == victim: victim.practice = value ch.send("Ok.\n") else: ch.send("Sorry, no can do...\n") return if game_utils.str_cmp(arg2, "align"): if value not in merc.irange(-1000, 1000): ch.send("Alignment range is -1000 to 1000.\n") return victim.alignment = value ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "name"): if not victim.is_npc(): ch.not_pc() return victim.name = arg3 ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "short"): victim.short_descr = arg3 ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "long"): victim.long_descr = arg3 ch.send("Ok.\n") return if game_utils.str_cmp(arg2, "title"): if victim.is_npc(): ch.not_npc() return victim.title = arg3 ch.send("Ok.\n") return """ if game_utils.str_cmp(arg2, "spec"): if not victim.is_npc(): ch.not_pc() return spec = state_checks.prefix_lookup(tables.spec_table) victim.spe if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 ) ch.send("No such spec fun.\n") return ch.send("Ok.\n") return """ # Generate usage message. ch.cmd_mset("")
def npc_update(): # Examine all mobs. for npc in list(instance.characters.values()): if not npc.in_room: continue if not npc.is_npc(): if npc.is_vampire() and npc.is_hero(): if npc.position == merc.POS_FIGHTING and npc.powers[ merc.UNI_RAGE] in merc.irange( 1, 24) and not npc.itemaff.is_set(merc.ITEMA_RAGER): npc.power[merc.UNI_RAGE] += 1 elif npc.powers[merc.UNI_RAGE] > 0 and not npc.itemaff.is_set( merc.ITEMA_RAGER): npc.powers[merc.UNI_RAGE] -= 1 if npc.powers[merc.UNI_RAGE] < 1: continue if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if not npc.bleeding.empty(): sn = "clot" const.skill_table[sn].spell_fun(sn, npc.level, npc, npc) else: if not npc.head.empty() and not npc.body.empty() and not npc.arm_left.empty() and not npc.arm_right.empty() and \ not npc.leg_left.empty() and not npc.leg_right.empty(): npc.reg_mend() elif npc.is_werewolf() and npc.is_hero(): if npc.position == merc.POS_FIGHTING and not npc.itemaff.is_set( merc.ITEMA_RAGER): if npc.powers[merc.UNI_RAGE] < 300: npc.powers[merc.UNI_RAGE] += game_utils.number_range( 5, 10) if npc.powers[merc.UNI_RAGE] < 300 and npc.powers[ merc.WPOWER_WOLF] > 3: npc.powers[merc.UNI_RAGE] += game_utils.number_range( 5, 10) if not npc.special.is_set(merc.SPC_WOLFMAN) and npc.powers[ merc.UNI_RAGE] >= 100: npc.werewolf() elif npc.powers[merc.UNI_RAGE] > 0 and not npc.itemaff.is_set( merc.ITEMA_RAGER): npc.powers[merc.UNI_RAGE] -= 1 if npc.powers[merc.UNI_RAGE] < 100: npc.unwerewolf() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.is_werewolf( ) and npc.position == merc.POS_SLEEPING and npc.powers[ merc.WPOWER_BEAR] > 3 and npc.hit > 0: if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if not npc.bleeding.empty(): sn = "clot" const.skill_table[sn].spell_fun(sn, npc.level, npc, npc) else: if not npc.head.empty() and not npc.body.empty() and not npc.arm_left.empty() and not npc.arm_right.empty() and \ not npc.leg_left.empty() and not npc.leg_right.empty(): npc.reg_mend() elif npc.itemaff.is_set( merc.ITEMA_REGENERATE) or npc.is_highlander(): if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if not npc.bleeding.empty(): sn = "clot" const.skill_table[sn].spell_fun(sn, npc.level, npc, npc) else: if not npc.head.empty() and not npc.body.empty() and not npc.arm_left.empty() and not npc.arm_right.empty() and \ not npc.leg_left.empty() and not npc.leg_right.empty(): npc.reg_mend() elif (npc.is_demon( ) or npc.special.is_set(merc.SPC_CHAMPION)) and npc.is_hero( ) and npc.in_room and npc.in_room.vnum == merc.ROOM_VNUM_HELL: if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit > 0: if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if npc.hit < npc.max_hit or npc.mana < npc.max_mana or npc.move < npc.max_move: npc.werewolf_regen() if not npc.bleeding.empty(): sn = "clot" const.skill_table[sn].spell_fun(sn, npc.level, npc, npc) else: if not npc.head.empty() and not npc.body.empty() and not npc.arm_left.empty() and not npc.arm_right.empty() and \ not npc.leg_left.empty() and not npc.leg_right.empty(): npc.reg_mend() continue if npc.is_affected(merc.AFF_CHARM): continue # Examine call for special procedure if npc.spec_fun: if npc.spec_fun(npc): continue # That's all for sleeping / busy monster, and empty zones if npc.position != merc.POS_STANDING: continue # Scavenge """
def cmd_turn(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: Turn <book> <forward/back>\n") return item = ch.get_item_here(arg1) if not item: ch.send("You don't have that book.\n") return if item.item_type != merc.ITEM_BOOK: ch.send("That's not a book.\n") return if state_checks.is_set(item.value[1], merc.CONT_CLOSED): ch.send("First you should open it.\n") return value = int(arg2) if arg2.isdigit() else 0 if game_utils.str_cmp(arg2, ["f", "forward"]): if item.value[2] >= item.value[3]: ch.send("But you are already at the end of the book.\n") return item.value[2] += 1 handler_game.act("You flip forward a page in $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n flips forward a page in $p.", ch, item, None, merc.TO_ROOM) elif game_utils.str_cmp(arg2, ["b", "backward"]): if item.value[2] <= 0: ch.send("But you are already at the beginning of the book.\n") return item.value[2] -= 1 handler_game.act("You flip backward a page in $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n flips backward a page in $p.", ch, item, None, merc.TO_ROOM) elif arg2.isdigit() and value in merc.irange(0, item.value[3]): if value == item.value[2]: handler_game.act("$p is already open at that page.", ch, item, None, merc.TO_CHAR) return if value < item.value[2]: handler_game.act("You flip backwards through $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n flips backwards through $p.", ch, item, None, merc.TO_ROOM) else: handler_game.act("You flip forwards through $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n flips forwards through $p.", ch, item, None, merc.TO_ROOM) item.value[2] = value else: ch.send("Do you wish to turn forward or backward a page?\n")
def cmd_train(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if ch.is_npc(): return last = True is_ok = False if not arg1: ch.send("You have {:,} experience points.\n".format(ch.exp)) arg1 = "foo" isok_list = [ "str", "int", "wis", "dex", "con", "hp", "mana", "move", "primal" ] for stat in isok_list: if game_utils.str_cmp(arg1, stat): is_ok = True else: if game_utils.str_cmp(arg1, "silver") and ch.is_werewolf(): is_ok = True if arg2 and is_ok: if not arg2.isdigit(): ch.send("Please enter a numeric value.\n") return amount = int(arg2) if arg2 not in merc.irange(1, 50): ch.send("Please enter a value between 1 and 50.\n") return if amount > 1: ch.cmd_train("{} {}".format(arg1, amount - 1)) last = False cost = 200 immcost = count_imms(ch) primal = (1 + ch.practice) * 500 silver = (1 + ch.powers[merc.WPOWER_SILVER]) * 2500 max_stat = 25 if ch.is_highlander() else 18 if game_utils.str_cmp(arg1, "str"): pability = merc.STAT_STR poutput = "strength" elif game_utils.str_cmp(arg1, "int"): pability = merc.STAT_INT poutput = "intelligence" elif game_utils.str_cmp(arg1, "wis"): pability = merc.STAT_WIS poutput = "wisdom" elif game_utils.str_cmp(arg1, "dex"): pability = merc.STAT_DEX poutput = "dexterity" elif game_utils.str_cmp(arg1, "con"): pability = merc.STAT_CON poutput = "constitution" elif game_utils.str_cmp(arg1, "avatar") and ch.level == 2: cost = 1000 pability = ch.level poutput = "level" elif game_utils.str_cmp(arg1, "hp") and ch.max_hit < 30000: cost = ch.max_hit - ch.perm_stat[merc.STAT_CON] pability = ch.max_hit poutput = "hp" elif game_utils.str_cmp(arg1, "mana") and ch.max_mana < 30000: cost = ch.max_mana - ch.perm_stat[merc.STAT_WIS] pability = ch.max_mana poutput = "mana" elif game_utils.str_cmp(arg1, "move") and ch.max_move < 30000: cost = ch.max_move - ch.perm_stat[merc.STAT_CON] pability = ch.max_move poutput = "move" elif game_utils.str_cmp(arg1, "primal") and ch.practice < 100: cost = primal pability = ch.practice poutput = "primal" elif game_utils.str_cmp(arg1, "silver") and ch.is_werewolf( ) and ch.powers[merc.WPOWER_SILVER] < 100: cost = silver pability = ch.powers[merc.WPOWER_SILVER] poutput = "tolerance to silver" else: imm_list = [ ("slash", merc.IMM_SLASH, "resistant to slashing and slicing weapons"), ("stab", merc.IMM_STAB, "resistant to stabbing and piercing weapons"), ("smash", merc.IMM_SMASH, "resistant to blasting, pounding and crushing weapons"), ("beast", merc.IMM_ANIMAL, "resistant to claw and bite attacks"), ("grab", merc.IMM_MISC, "resistant to grepping, sucking and whipping weapons"), ("charm", merc.IMM_CHARM, "immune to charm spells"), ("heat", merc.IMM_HEAT, "immune to heat and fire spells"), ("cold", merc.IMM_COLD, "immune to cold spells"), ("lightning", merc.IMM_LIGHTNING, "immune to lightning and electrical spells"), ("acid", merc.IMM_ACID, "immune to acid spells"), ("sleep", merc.IMM_SLEEP, "immune to the sleep spell"), ("drain", merc.IMM_DRAIN, "immune to the energy drain spell"), ("voodoo", merc.IMM_VOODOO, "immune to voodoo magic"), ("hurl", merc.IMM_HURL, "immune to being hurled"), ("backstab", merc.IMM_BACKSTAB, "immune to being backstabbed"), ("kick", merc.IMM_KICK, "immune to being kicked"), ("disarm", merc.IMM_DISARM, "immune to being disarmed"), ("steal", merc.IMM_STEAL, "immune to being stolen from") ] for (aa, bb, cc) in imm_list: if game_utils.str_cmp(arg1, aa) and not ch.immune.is_set(bb): if ch.exp < immcost: ch.send("You don't have enough exp.\n") return ch.exp -= immcost ch.immune.set_bit(bb) ch.send("You are now {}.\n".format(cc)) return else: buf = ["You can train the following:\n"] buf += "Stats:" if ch.perm_stat[merc.STAT_STR] < max_stat: buf += " Str" if ch.perm_stat[merc.STAT_INT] < max_stat: buf += " Int" if ch.perm_stat[merc.STAT_WIS] < max_stat: buf += " Wis" if ch.perm_stat[merc.STAT_DEX] < max_stat: buf += " Dex" if ch.perm_stat[merc.STAT_CON] < max_stat: buf += " Con" if ch.perm_stat[merc.STAT_STR] >= max_stat and ch.perm_stat[merc.STAT_INT] >= max_stat and ch.perm_stat[merc.STAT_WIS] >= max_stat and \ ch.perm_stat[merc.STAT_DEX] >= max_stat and ch.perm_stat[merc.STAT_CON] >= max_stat: buf += " None left to train" buf += ".\n" if ch.level == 2: buf += "Become an avatar - 1000 exp.\n" if ch.max_hit < 30000: buf += "Hp - {} exp per point.\n".format( ch.max_hit - ch.perm_stat[merc.STAT_CON]) if ch.max_mana < 30000: buf += "Mana - {} exp per point.\n".format( ch.max_mana - ch.perm_stat[merc.STAT_WIS]) if ch.max_move < 30000: buf += "Move - {} exp per point.\n".format( ch.max_move - ch.perm_stat[merc.STAT_CON]) if ch.practice < 100: buf += "Primal - {} exp per point of primal energy.\n".format( primal) if ch.powers[merc.WPOWER_SILVER] < 100 and ch.is_werewolf(): buf += "Silver tolerance - {} exp per point of tolerance.\n".format( silver) buf += "Natural resistances and immunities - {} exp each.\n".format( immcost) # Weapon resistance affects buf += "Weapon resistances:" found = False imm_list = [(merc.IMM_SLASH, " Slash"), (merc.IMM_STAB, " Stab"), (merc.IMM_SMASH, " Smash"), (merc.IMM_ANIMAL, " Beast"), (merc.IMM_MISC, " Grab")] for (aa, bb) in imm_list: if not ch.immune.is_set(aa): found = True buf += bb else: if not found: buf += " None left to learn.\n" else: buf += ".\n" # Spell immunity affects buf += "Magical immunities:" found = False imm_list = [(merc.IMM_CHARM, " Charm"), (merc.IMM_HEAT, " Heat"), (merc.IMM_COLD, " Cold"), (merc.IMM_LIGHTNING, " Lightning"), (merc.IMM_ACID, " Acid"), (merc.IMM_SLEEP, " Sleep"), (merc.IMM_DRAIN, " Drain"), (merc.IMM_VOODOO, " Voodoo")] for (aa, bb) in imm_list: if not ch.immune.is_set(aa): found = True buf += bb else: if not found: buf += " None left to learn.\n" else: buf += ".\n" # Skill immunity affects buf += "Skill immunities:" imm_list = [(merc.IMM_HURL, " Hurl"), (merc.IMM_BACKSTAB, " Backstab"), (merc.IMM_KICK, " Kick"), (merc.IMM_DISARM, " Disarm"), (merc.IMM_STEAL, " Steal")] found = False for (aa, bb) in imm_list: if not ch.immune.is_set(aa): found = True buf += bb else: if not found: buf += " None left to learn.\n" else: buf += ".\n" ch.send("".join(buf)) return if pability >= max_stat and game_utils.str_cmp( arg1, ["str", "int", "wis", "dex", "con"]): if last: handler_game.act("Your $T is already at maximum.", ch, None, poutput, merc.TO_CHAR) return if pability >= 30000 and game_utils.str_cmp(arg1, ["hp", "mana", "move"]): if last: handler_game.act("Your $T is already at maximum.", ch, None, poutput, merc.TO_CHAR) return if pability >= 100 and game_utils.str_cmp(arg1, ["primal", "silver"]): if last: handler_game.act("Your $T is already at maximum.", ch, None, poutput, merc.TO_CHAR) return if cost < 1: cost = 1 if cost > ch.exp: if last: ch.send("You don't have enough exp.\n") return ch.exp -= cost if game_utils.str_cmp(arg1, "avatar"): ch.level = merc.LEVEL_AVATAR elif game_utils.str_cmp(arg1, "hp"): ch.max_hit += 1 elif game_utils.str_cmp(arg1, "mana"): ch.max_mana += 1 elif game_utils.str_cmp(arg1, "move"): ch.max_move += 1 elif game_utils.str_cmp(arg1, "silver"): ch.powers[merc.WPOWER_SILVER] += 1 elif game_utils.str_cmp(arg1, "primal"): ch.practice += 1 else: ch.perm_stat[pability] += 1 if game_utils.str_cmp(arg1, "avatar"): handler_game.act("You become an avatar!", ch, None, None, merc.TO_CHAR) comm.info("{} has become an avatar!".format(ch.name)) if ch.level < ch.trust: ch.level = ch.trust if not ch.is_npc() and ch.vampaff.is_set(merc.VAM_MORTAL): ch.mortalvamp("") elif last: handler_game.act("Your $T increases!", ch, None, poutput, merc.TO_CHAR)
def cmd_write(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) arg3 = argument if ch.is_npc(): return if not arg1 or not arg2 or not arg3: ch.send("Syntax: Write <page> <title/line> <text>.\n") return item = ch.get_eq("left_hand") if not item or (item.item_type != merc.ITEM_TOOL or not state_checks.is_set(item.value[0], merc.TOOL_PEN)): item = ch.get_eq("right_hand") if not item or (item.item_type != merc.ITEM_TOOL or not state_checks.is_set(item.value[0], merc.TOOL_PEN)): ch.send("You are not holding a pen.\n") return item = ch.get_item_carry(arg1) if not item: ch.send("You are not carrying that item.\n") return if item.item_type not in [merc.ITEM_PAGE, merc.ITEM_BOOK]: ch.send("You cannot write on that.\n") return if game_utils.str_cmp(arg2, "title"): item.victpoweruse = arg3 ch.send("Ok.\n") handler_game.act("$n writes something on $p.", ch, item, None, merc.TO_ROOM) return if not game_utils.str_cmp(arg2, "line"): ch.send("You can write a TITLE or a LINE.\n") return if item.item_type == merc.ITEM_BOOK: ch.send("You can only write a title on the book.\n") return if not item.chpoweruse: return buf = item.chpoweruse if not buf: item.chpoweruse = arg3.capitalize() ch.send("Ok.\n") handler_game.act("$n writes something on $p.", ch, item, None, merc.TO_ROOM) if not ch.is_mage() and not ch.is_immortal() and not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_FAILED) elif game_utils.str_cmp(arg3, "start.damage.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) item.spectype.set_bit(merc.ADV_DAMAGE) elif game_utils.str_cmp(arg3, "start.affect.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) item.spectype.set_bit(merc.ADV_AFFECT) elif game_utils.str_cmp(arg3, "start.action.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) item.spectype.set_bit(merc.ADV_ACTION) elif game_utils.str_cmp(arg3, "start.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) elif not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_FAILED) return if item.chpoweruse and buf: if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4: ch.send("Line too long.\n") return item.chpoweruse = buf + "\n" + arg3 argument, arg1 = game_utils.read_word(argument) arg2 = argument if not ch.is_mage() and not ch.is_immortal() and not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_FAILED) elif game_utils.str_cmp(arg1, "start.damage.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) item.spectype.set_bit(merc.ADV_DAMAGE) elif game_utils.str_cmp(arg1, "start.affect.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) item.spectype.set_bit(merc.ADV_AFFECT) elif game_utils.str_cmp(arg1, "start.action.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) item.spectype.set_bit(merc.ADV_ACTION) elif game_utils.str_cmp(arg1, "start.spell") and item.spectype.empty(): item.spectype.set_bit(merc.ADV_STARTED) elif game_utils.str_cmp(arg1, "end.spell") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_FINISHED) item.toughness = ch.powers[merc.MPOWER_RUNE0] item.points += 1 elif game_utils.str_cmp(arg1, "damage.spell") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_DAMAGE) and \ not item.spectype.is_set(merc.ADV_AFFECT) and not item.spectype.is_set(merc.ADV_ACTION) and not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_DAMAGE) elif game_utils.str_cmp(arg1, "affect.spell") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_DAMAGE) and \ not item.spectype.is_set(merc.ADV_AFFECT) and not item.spectype.is_set(merc.ADV_ACTION) and not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_AFFECT) elif game_utils.str_cmp(arg1, "action.spell") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_DAMAGE) and \ not item.spectype.is_set(merc.ADV_AFFECT) and not item.spectype.is_set(merc.ADV_ACTION) and not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_AFFECT) elif game_utils.str_cmp(arg1, "area.affect") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_AREA_AFFECT) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_AREA_AFFECT) item.points += 100 elif game_utils.str_cmp(arg1, "victim.target") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_VICTIM_TARGET) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_VICTIM_TARGET) item.points += 5 elif game_utils.str_cmp(arg1, "object.target") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_OBJECT_TARGET) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_OBJECT_TARGET) item.points += 5 elif game_utils.str_cmp(arg1, "global.target") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_GLOBAL_TARGET) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_GLOBAL_TARGET) item.points += 50 elif game_utils.str_cmp(arg1, "next.page") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_NEXT_PAGE) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_NEXT_PAGE) item.points += 5 elif game_utils.str_cmp(arg1, "parameter:") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_PARAMETER) and \ not item.spectype.is_set(merc.ADV_FINISHED): if not arg2: item.spectype.set_bit(merc.ADV_FAILED) else: item.spectype.set_bit(merc.ADV_PARAMETER) item.chpoweron = arg2 elif game_utils.str_cmp(arg1, "spell.first") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_SPELL_FIRST) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_SPELL_FIRST) elif game_utils.str_cmp(arg1, "not.caster") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_NOT_CASTER) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_NOT_CASTER) elif game_utils.str_cmp(arg1, "no.players") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_NO_PLAYERS) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_NO_PLAYERS) elif game_utils.str_cmp(arg1, "second.victim") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_SECOND_VICTIM) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_SECOND_VICTIM) item.points += 5 elif game_utils.str_cmp(arg1, "second.object") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_SECOND_OBJECT) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_SECOND_OBJECT) item.points += 5 elif game_utils.str_cmp(arg1, "reversed") and item.spectype.is_set(merc.ADV_STARTED) and not item.spectype.is_set(merc.ADV_REVERSED) and \ not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_REVERSED) elif game_utils.str_cmp(arg1, "min.damage:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_DAMAGE) and \ not item.spectype.is_set(merc.ADV_FINISHED): if not arg2 or not arg2.isdigit() or int(arg2) not in merc.irange(0, 500): item.spectype.set_bit(merc.ADV_FAILED) else: item.value[1] = int(arg2) item.points += int(arg2) * 0.5 elif game_utils.str_cmp(arg1, "max.damage:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_DAMAGE) and \ not item.spectype.is_set(merc.ADV_FINISHED): if not arg2 or not arg2.isdigit() or int(arg2) not in merc.irange(0, 1000): item.spectype.set_bit(merc.ADV_FAILED) else: item.value[2] = int(arg2) item.points += int(arg2) * 0.5 elif game_utils.str_cmp(arg1, "move") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_ACTION) and \ item.value[1] == merc.ACTION_NONE and not item.spectype.is_set(merc.ADV_FINISHED): item.value[1] = merc.ACTION_MOVE item.points += 500 elif game_utils.str_cmp(arg1, "mob:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_ACTION) and \ item.value[1] == merc.ACTION_NONE and not item.specytpe.is_set(merc.ADV_FINISHED): item.value[1] = merc.ACTION_MOB mobile = ch.get_char_world2(arg2) if not arg2 or not mobile: item.spectype.set_bit(merc.ADV_FAILED) else: item.value[2] = mobile.vnum item.points += 500 elif game_utils.str_cmp(arg1, "object:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_ACTION) and \ item.value[1] == merc.ACTION_NONE and not item.spectype.is_set(merc.ADV_FINISHED): item.value[1] = merc.ACTION_OBJECT obj = ch.get_char_world2(arg2) if not arg2 or not obj or obj.flags.artifact or obj.questowner: item.spectype.set_bit(merc.ADV_FAILED) else: item.value[2] = obj.vnum item.points += 500 elif game_utils.str_cmp(arg1, "apply:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_AFFECT) and \ not item.spectype.is_set(merc.ADV_FINISHED): if not arg2: item.spectype.set_bit(merc.ADV_FAILED) elif game_utils.str_cmp(arg2, ["strength", "str"]) and not state_checks.is_set(item.value[1], merc.ADV_STR): state_checks.set_bit(item.value[1], merc.ADV_STR) elif game_utils.str_cmp(arg2, ["dexterity", "dex"]) and not state_checks.is_set(item.value[1], merc.ADV_DEX): state_checks.set_bit(item.value[1], merc.ADV_DEX) elif game_utils.str_cmp(arg2, ["intelligence", "int"]) and not state_checks.is_set(item.value[1], merc.ADV_INT): state_checks.set_bit(item.value[1], merc.ADV_INT) elif game_utils.str_cmp(arg2, ["wisdom", "wis"]) and not state_checks.is_set(item.value[1], merc.ADV_WIS): state_checks.set_bit(item.value[1], merc.ADV_WIS) elif game_utils.str_cmp(arg2, ["constitution", "con"]) and not state_checks.is_set(item.value[1], merc.ADV_CON): state_checks.set_bit(item.value[1], merc.ADV_CON) elif game_utils.str_cmp(arg2, "mana") and not state_checks.is_set(item.value[1], merc.ADV_MANA): state_checks.set_bit(item.value[1], merc.ADV_MANA) elif game_utils.str_cmp(arg2, ["hp", "hits", "hitpoints"]) and not state_checks.is_set(item.value[1], merc.ADV_HIT): state_checks.set_bit(item.value[1], merc.ADV_HIT) elif game_utils.str_cmp(arg2, ["move", "movement"]) and not state_checks.is_set(item.value[1], merc.ADV_MOVE): state_checks.set_bit(item.value[1], merc.ADV_MOVE) elif game_utils.str_cmp(arg2, ["ac", "armour", "armor"]) and not state_checks.is_set(item.value[1], merc.ADV_AC): state_checks.set_bit(item.value[1], merc.ADV_AC) elif game_utils.str_cmp(arg2, ["hr", "hit", "hitroll"]) and not state_checks.is_set(item.value[1], merc.ADV_HITROLL): state_checks.set_bit(item.value[1], merc.ADV_HITROLL) elif game_utils.str_cmp(arg2, ["dr", "dam", "damroll"]) and not state_checks.is_set(item.value[1], merc.ADV_DAMROLL): state_checks.set_bit(item.value[1], merc.ADV_DAMROLL) elif game_utils.str_cmp(arg2, ["save", "save.spell", "save_spell"]) and not state_checks.is_set(item.value[1], merc.ADV_SAVING_SPELL): state_checks.set_bit(item.value[1], merc.ADV_SAVING_SPELL) else: item.spectype.set_bit(merc.ADV_FAILED) return item.points += 25 elif game_utils.str_cmp(arg1, "affect:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_AFFECT) and \ not item.spectype.is_set(merc.ADV_FINISHED): if not arg2: item.spectype.set_bit(merc.ADV_FAILED) elif game_utils.str_cmp(arg2, ["blind", "blindness"]) and not state_checks.is_set(item.value[3], merc.AFF_BLIND): state_checks.set_bit(item.value[3], merc.AFF_BLIND) elif game_utils.str_cmp(arg2, ["invis", "invisible", "invisibility"]) and not state_checks.is_set(item.value[3], merc.AFF_BLIND): state_checks.set_bit(item.value[3], merc.AFF_INVISIBLE) elif game_utils.str_cmp(arg2, "detect.evil") and not state_checks.is_set(item.value[3], merc.AFF_DETECT_EVIL): state_checks.set_bit(item.value[3], merc.AFF_DETECT_EVIL) elif game_utils.str_cmp(arg2, ["detect.invis", "detect.invisible", "detect.invisibility"]) and not state_checks.is_set(item.value[3], merc.AFF_DETECT_INVIS): state_checks.set_bit(item.value[3], merc.AFF_DETECT_INVIS) elif game_utils.str_cmp(arg2, "detect.magic") and not state_checks.is_set(item.value[3], merc.AFF_DETECT_MAGIC): state_checks.set_bit(item.value[3], merc.AFF_DETECT_MAGIC) elif game_utils.str_cmp(arg2, "detect.hidden") and not state_checks.is_set(item.value[3], merc.AFF_DETECT_HIDDEN): state_checks.set_bit(item.value[3], merc.AFF_DETECT_HIDDEN) elif game_utils.str_cmp(arg2, ["shadowplane", "shadow.plane"]) and not state_checks.is_set(item.value[3], merc.AFF_SHADOWPLANE): state_checks.set_bit(item.value[3], merc.AFF_SHADOWPLANE) elif game_utils.str_cmp(arg2, ["sanct", "sanctuary"]) and not state_checks.is_set(item.value[3], merc.AFF_SANCTUARY): state_checks.set_bit(item.value[3], merc.AFF_SANCTUARY) elif game_utils.str_cmp(arg2, "faerie.fire") and not state_checks.is_set(item.value[3], merc.AFF_FAERIE_FIRE): state_checks.set_bit(item.value[3], merc.AFF_FAERIE_FIRE) elif game_utils.str_cmp(arg2, ["infravision", "infrared", "infra"]) and not state_checks.is_set(item.value[3], merc.AFF_SANCTUARY): state_checks.set_bit(item.value[3], merc.AFF_SANCTUARY) elif game_utils.str_cmp(arg2, "curse") and not state_checks.is_set(item.value[3], merc.AFF_CURSE): state_checks.set_bit(item.value[3], merc.AFF_CURSE) elif game_utils.str_cmp(arg2, ["flaming", "burning"]) and not state_checks.is_set(item.value[3], merc.AFF_FLAMING): state_checks.set_bit(item.value[3], merc.AFF_FLAMING) elif game_utils.str_cmp(arg2, "poison") and not state_checks.is_set(item.value[3], merc.AFF_POISON): state_checks.set_bit(item.value[3], merc.AFF_POISON) elif game_utils.str_cmp(arg2, ["protect", "protection"]) and not state_checks.is_set(item.value[3], merc.AFF_PROTECT): state_checks.set_bit(item.value[3], merc.AFF_PROTECT) elif game_utils.str_cmp(arg2, "ethereal") and not state_checks.is_set(item.value[3], merc.AFF_ETHEREAL): state_checks.set_bit(item.value[3], merc.AFF_ETHEREAL) elif game_utils.str_cmp(arg2, "sneak") and not state_checks.is_set(item.value[3], merc.AFF_SNEAK): state_checks.set_bit(item.value[3], merc.AFF_SNEAK) elif game_utils.str_cmp(arg2, "hide") and not state_checks.is_set(item.value[3], merc.AFF_HIDE): state_checks.set_bit(item.value[3], merc.AFF_HIDE) elif game_utils.str_cmp(arg2, "sleep") and not state_checks.is_set(item.value[3], merc.AFF_SLEEP): state_checks.set_bit(item.value[3], merc.AFF_SLEEP) elif game_utils.str_cmp(arg2, "charm") and not state_checks.is_set(item.value[3], merc.AFF_CHARM): state_checks.set_bit(item.value[3], merc.AFF_CHARM) elif game_utils.str_cmp(arg2, ["fly", "flying"]) and not state_checks.is_set(item.value[3], merc.AFF_FLYING): state_checks.set_bit(item.value[3], merc.AFF_FLYING) elif game_utils.str_cmp(arg2, ["passdoor", "pass.door"]) and not state_checks.is_set(item.value[3], merc.AFF_PASS_DOOR): state_checks.set_bit(item.value[3], merc.AFF_PASS_DOOR) elif game_utils.str_cmp(arg2, ["shadowsight", "shadow.sight"]) and not state_checks.is_set(item.value[3], merc.AFF_SHADOWSIGHT): state_checks.set_bit(item.value[3], merc.AFF_SHADOWSIGHT) elif game_utils.str_cmp(arg2, ["web", "webbed"]) and not state_checks.is_set(item.value[3], merc.AFF_WEBBED): state_checks.set_bit(item.value[3], merc.AFF_WEBBED) else: item.spectype.set_bit(merc.ADV_FAILED) return item.points += 25 elif game_utils.str_cmp(arg1, "bonus:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_AFFECT) and \ not item.spectype.is_set(merc.ADV_FINISHED): if not arg2 or not arg2.isdigit() or int(arg2) not in merc.irange(0, 100): item.spectype.set_bit(merc.ADV_FAILED) else: item.value[2] = int(arg2) item.points += int(arg2) * 15 elif game_utils.str_cmp(arg1, "duration:") and item.spectype.is_set(merc.ADV_STARTED) and item.spectype.is_set(merc.ADV_AFFECT) and \ item.level == 0 and not item.spectype.is_set(merc.ADV_FINISHED): if not arg2 or not arg2.isdigit() or int(arg2) not in merc.irange(1, 60): item.spectype.set_bit(merc.ADV_FAILED) else: item.level = int(arg2) item.points += int(arg2) * 10 elif game_utils.str_cmp(arg1, ["message.one:", "message.1:"]) and item.spectype.is_set(merc.ADV_STARTED) and \ not item.spectype.is_set(merc.ADV_MESSAGE_1) and not item.spectype.is_set(merc.ADV_FINISHED): if not arg2: item.spectype.set_bit(merc.ADV_FAILED) else: item.spectype.set_bit(merc.ADV_MESSAGE_1) item.chpoweroff = arg2 elif game_utils.str_cmp(arg1, ["message.two:", "message.2:"]) and item.spectype.is_set(merc.ADV_STARTED) and \ not item.spectype.is_set(merc.ADV_MESSAGE_2) and not item.spectype.is_set(merc.ADV_FINISHED): if not arg2: item.spectype.set_bit(merc.ADV_FAILED) else: item.spectype.set_bit(merc.ADV_MESSAGE_2) item.victpoweron = arg2 elif game_utils.str_cmp(arg1, ["message.three:", "message.3:"]) and item.spectype.is_set(merc.ADV_STARTED) and \ not item.spectype.is_set(merc.ADV_MESSAGE_3) and not item.spectype.is_set(merc.ADV_FINISHED): if not arg2: item.spectype.set_bit(merc.ADV_FAILED) else: item.spectype.set_bit(merc.ADV_MESSAGE_3) item.victpoweroff = arg2 elif not item.spectype.is_set(merc.ADV_FINISHED): item.spectype.set_bit(merc.ADV_FAILED) else: return handler_game.act("$n writes something on $p.", ch, item, None, merc.TO_ROOM) ch.send("Ok.\n")