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 spl_portal(sn, level, ch, victim, target): handler_magic.target_name, arg = game_utils.read_word(handler_magic.target_name) if not arg: ch.send("Who do you wish to create a portal to?\n") return victim = ch.get_char_world(arg) if not victim or victim == ch or not victim.in_room or ch.is_npc() or victim.is_npc() or \ (not victim.is_npc() and not victim.immune.is_set(merc.IMM_SUMMON)) or ch.in_room.room_flags.is_set(merc.ROOM_PRIVATE) or \ ch.in_room.room_flags.is_set(merc.ROOM_SOLITARY) or ch.in_room.room_flags.is_set(merc.ROOM_NO_RECALL) or \ victim.in_room.room_flags.is_set(merc.ROOM_PRIVATE) or victim.in_room.room_flags.is_set(merc.ROOM_SOLITARY) or \ victim.in_room.room_flags.is_set(merc.ROOM_NO_RECALL) or victim.in_room == ch.in_room: ch.send("You failed.\n") return duration = game_utils.number_range(2, 3) item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) item.value[0] = victim.in_room.vnum item.value[3] = ch.in_room.vnum item.timer = duration item.flags.shadowplane = ch.is_affected(merc.AFF_SHADOWPLANE) ch.in_room.put(item) item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) item.value[0] = ch.in_room.vnum item.value[3] = victim.in_room.vnum item.timer = duration item.flags.shadowplane = victim.is_affected(merc.AFF_SHADOWPLANE) victim.in_room.put(item) handler_game.act("$p appears in front of $n.", ch, item, None, merc.TO_ROOM) handler_game.act("$p appears in front of you.", ch, item, None, merc.TO_CHAR) handler_game.act("$p appears in front of $n.", victim, item, None, merc.TO_ROOM) handler_game.act("$p appears in front of you.", ch, item, victim, merc.TO_VICT)
def spell_nexus(sn, level, ch, victim, target): from_room = ch.in_room victim = ch.get_char_world(handler_magic.target_name) to_room = victim.in_room if not victim \ or victim == ch \ or not to_room \ or not ch.can_see_room(to_room.instance_id) or not ch.can_see_room(from_room.instance_id) \ or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SAFE) \ or state_checks.IS_SET(from_room.room_flags, merc.ROOM_SAFE) \ or state_checks.IS_SET(to_room.room_flags, merc.ROOM_PRIVATE) \ or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SOLITARY) \ or state_checks.IS_SET(to_room.room_flags, merc.ROOM_NO_RECALL) \ or state_checks.IS_SET(from_room.room_flags, merc.ROOM_NO_RECALL) \ or victim.level >= level + 3 \ or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) \ or (victim.is_npc() and state_checks.IS_SET(victim.imm_flags, merc.IMM_SUMMON)) \ or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_NONE) ) \ or (victim.is_clan() and not ch.is_same_clan(victim)): ch.send("You failed.\n") return stone = ch.slots.held if not ch.is_immortal() and (stone is None or stone.item_type != merc.ITEM_WARP_STONE): ch.send("You lack the proper component for this spell.\n") return if stone and stone.item_type == merc.ITEM_WARP_STONE: handler_game.act("You draw upon the power of $p.", ch, stone, None, merc.TO_CHAR) handler_game.act("It flares brightly and vanishes! ", ch, stone, None, merc.TO_CHAR) ch.unequip(stone.equipped_to) ch.get(stone) stone.extract() # portal one */ portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) portal.timer = 1 + level // 10 portal.value[3] = to_room.instance_id from_room.put(portal) handler_game.act("$p rises up from the ground.", ch, portal, None, merc.TO_ROOM) handler_game.act("$p rises up before you.", ch, portal, None, merc.TO_CHAR) # no second portal if rooms are the same */ if to_room == from_room: return # portal two */ portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) portal.timer = 1 + level // 10 portal.value[3] = from_room.instance_id to_room.put(portal) if to_room.people: vch = instance.characters[to_room.people[0]] handler_game.act("$p rises up from the ground.", vch, portal, None, merc.TO_ROOM) handler_game.act("$p rises up from the ground.", vch, portal, None, merc.TO_CHAR)
def spl_create_food(sn, level, ch, victim, target): mushroom = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_MUSHROOM], 0) mushroom.value[0] = 5 + level ch.in_room.put(mushroom) handler_game.act("$p suddenly appears.", ch, mushroom, None, merc.TO_ROOM) handler_game.act("$p suddenly appears.", ch, mushroom, None, merc.TO_CHAR)
def o_reset(pArea, pReset, last, level, npc): item = None if pReset.arg1 not in instance.item_templates.keys(): logger.error("Reset_area: 'O': bad vnum %d.", pReset.arg1) return last, level, npc else: itemTemplate = instance.item_templates[pReset.arg1] if pReset.arg3 not in instance.room_templates.keys(): logger.error("Reset_area: 'R': bad vnum %d.", pReset.arg3) return last, level, npc else: roomInstance_id = instance.instances_by_room[pReset.arg3][0] roomInstance = instance.global_instances[roomInstance_id] if pArea.player_count > 0 or handler_item.count_obj_list(itemTemplate, roomInstance.items) > 0: last = False return last, level, npc item = object_creator.create_item(itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) item.cost = 0 roomInstance.put(item) item = None last = True return last, level, npc
def p_reset(parea, preset, last, level, npc): if preset.arg1 not in instance.item_templates.keys(): comm.notify("p_reset: 'P': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: item_template = instance.item_templates[preset.arg1] if preset.arg3 not in instance.item_templates.keys(): comm.notify("p_reset: 'P': bad vnum {}".format(preset.arg3), merc.CONSOLE_WARNING) return last, level, npc else: item_to_template = instance.item_templates[preset.arg3] item_to = None item_to_list = instance.instances_by_item.get(item_to_template.vnum, None) if item_to_list: item_to = instance.global_instances[item_to_list[0]] if parea.player_count > 0 or not item_to or not item_to.in_room or handler_item.count_obj_list( item_template, item_to.inventory) > 0: last = False return last, level, npc item = object_creator.create_item(item_template, game_utils.number_range(1, 50)) item_to.put(item) last = True return last, level, npc
def o_reset(parea, preset, last, level, npc): if preset.arg1 not in instance.item_templates.keys(): comm.notify("o_reset: 'O': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: item_template = instance.item_templates[preset.arg1] if preset.arg3 not in instance.room_templates.keys(): comm.notify("o_reset: 'R': bad vnum {}".format(preset.arg3), merc.CONSOLE_WARNING) return last, level, npc else: room_instance_id = instance.instances_by_room[preset.arg3][0] room_instance = instance.global_instances[room_instance_id] if parea.player_count > 0 or handler_item.count_obj_list( item_template, room_instance.items) > 0: last = False return last, level, npc item = object_creator.create_item(item_template, game_utils.number_range(1, 50)) item.cost = 0 room_instance.put(item) last = True return last, level, npc
def o_reset(pArea, pReset, last, level, npc): item = None if pReset.arg1 not in instance.item_templates.keys(): logger.error("Reset_area: 'O': bad vnum %d.", pReset.arg1) return last, level, npc else: itemTemplate = instance.item_templates[pReset.arg1] if pReset.arg3 not in instance.room_templates.keys(): logger.error("Reset_area: 'R': bad vnum %d.", pReset.arg3) return last, level, npc else: roomInstance_id = instance.instances_by_room[pReset.arg3][0] roomInstance = instance.global_instances[roomInstance_id] if pArea.player_count > 0 or handler_item.count_obj_list( itemTemplate, roomInstance.items) > 0: last = False return last, level, npc item = object_creator.create_item( itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) item.cost = 0 roomInstance.put(item) item = None last = True return last, level, npc
def do_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: load obj <vnum> <level>.\n") return level = ch.trust # default if arg2: # load with a level if not arg2.isdigit(): ch.send("Syntax: oload <vnum> <level>.\n") return level = int(arg2) if level < 0 or level > ch.trust: ch.send("Level must be be between 0 and your 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) else: ch.in_room.put(item) handler_game.act("$n has created $p!", ch, item, None, merc.TO_ROOM) handler_game.wiznet("$N loads $p.", ch, item, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) ch.send("Ok.\n") return
def spl_quest(sn, level, ch, victim, target): if ch.practice < 1: ch.send( "It costs at least 1 point of primal energy to create a quest card.\n" ) return 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) if ch.practice >= 50: ch.practice -= 50 item.level = 50 else: item.level = ch.practice ch.practice = 0 handler_game.act("$p fades into existance in your hands.", ch, item, None, merc.TO_CHAR) handler_game.act("$p fades into existance in $n's hands.", ch, item, None, merc.TO_ROOM) item.questmaker = ch.name item.questowner = ch.name
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 fread_item(contents, odict): item = object_creator.create_item(item_templates[odict['Vnum']], odict['Lev'], odict['instance_id']) item.enchanted = odict['Enchanted'] item.name = odict['Name'] item.short_descr = odict['ShD'] item.description = odict['Desc'] item.equips_to = odict['EqpT'] item.item_attributes = odict['IatR'] item.item_restrictions = odict['IrsT'] item.weapon_attributes = odict['WeaT'] item.item_type = odict['Ityp'] item.weight = odict['Wt'] item.condition = odict['Cond'] item.level = odict['Lev'] item.timer = odict['timer'] item.cost = odict['cost'] item.value = odict['Val'] item.affected = odict['affected'] extra_descr = [] for k, v in odict['ExDe'].items(): newed = world_classes.ExtraDescrData() newed.keyword = k newed.description = v extra_descr.append(newed) item.extra_descr = extra_descr return item
def spl_continual_light(sn, level, ch, victim, target): light = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_LIGHT_BALL], 0) ch.in_room.put(light) handler_game.act("$n twiddles $s thumbs and $p appears.", ch, light, None, merc.TO_ROOM) handler_game.act("You twiddle your thumbs and $p appears.", ch, light, None, merc.TO_CHAR)
def do_outfit(ch, argument): if ch.level > 5 or ch.is_npc(): ch.send("Find it yourself!\n") return item = ch.slots.light if not item: item = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_SCHOOL_BANNER], 0) item.cost = 0 ch.put(item) ch.equip(item, True, False) item = None item = ch.slots.body if not item: item = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_SCHOOL_VEST], 0) item.cost = 0 ch.put(item) ch.equip(item, True, False) item = None # do the weapon thing item = ch.slots.main_hand if not item: vnum = merc.OBJ_VNUM_SCHOOL_SWORD # just in case! for k, weapon in const.weapon_table.items(): if argument in weapon.gsn: vnum = weapon.vnum item = object_creator.create_item(instance.item_templates[vnum], 0) ch.put(item) ch.equip(item, True, False) item = None item = ch.slots.main_hand shield = ch.slots.off_hand if (not item or not item.flags.two_handed) and not shield: item = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_SCHOOL_SHIELD], 0) item.cost = 0 ch.put(item) ch.equip(item, True, False) item = None ch.send("You have been equipped by Mota.\n")
def spell_create_food(sn, level, ch, victim, target): mushroom = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_MUSHROOM], 0) mushroom.value[0] = level // 2 mushroom.value[1] = level ch.in_room.put(mushroom) handler_game.act("$p suddenly appears.", ch, mushroom, None, merc.TO_ROOM) handler_game.act("$p suddenly appears.", ch, mushroom, None, merc.TO_CHAR) return
def recursive_clone(ch, item, clone): for c_item_id in item.inventory[:]: c_item = instance.items[c_item_id] if item_check(ch, c_item): t_obj = object_creator.create_item( instance.item_templates[c_item.vnum], 0) object_creator.clone_item(c_item, t_obj) clone.put(t_obj) recursive_clone(ch, c_item, t_obj)
def spell_create_spring(sn, level, ch, victim, target): spring = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_SPRING], 0) spring.timer = level ch.in_room.put(spring) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_ROOM) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_CHAR)
def g_e_reset(preset, last, level, npc): if preset.arg1 not in instance.item_templates.keys(): comm.notify("g_e_reset: 'E' or 'G': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: item_template = instance.item_templates[preset.arg1] if not last: return last, level, npc if not npc: comm.notify( "g_e_reset: 'E' or 'G': None mob for vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) last = False return last, level, npc if npc.pshop: if item_template.item_type in [merc.ITEM_PILL, merc.ITEM_POTION]: olevel = game_utils.number_range(0, 10) elif item_template.item_type == merc.ITEM_SCROLL: olevel = game_utils.number_range(5, 15) elif item_template.item_type == merc.ITEM_WAND: olevel = game_utils.number_range(10, 20) elif item_template.item_type == merc.ITEM_STAFF: olevel = game_utils.number_range(15, 25) elif item_template.item_type in [merc.ITEM_ARMOR, merc.ITEM_WEAPON]: olevel = game_utils.number_range(5, 15) else: olevel = 0 item = object_creator.create_item(item_template, olevel) item.flags.shop_inventory = True else: item = object_creator.create_item(item_template, game_utils.number_range(1, 50)) npc.put(item) if preset.command == "E": npc.equip(item, True) last = True return last, level, npc
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 spl_voodoo(sn, level, ch, victim, target): handler_magic.target_name, arg = game_utils.read_word(handler_magic.target_name) if ch.practice < 5: ch.send("It costs 5 points of primal energy to create a voodoo doll.\n") return victim = ch.get_char_world(arg) if not victim: ch.not_here(arg) return if victim.is_npc(): ch.not_npc() return item = ch.get_eq("right_hand") if not item: item = ch.get_eq("left_hand") if not item: ch.send("You are not holding any body parts.\n") return part_list = [(12, "head"), (13, "heart"), (14, "arm"), (15, "leg"), (30004, "entrails"), (30005, "brain"), (30006, "eye eyeball"), (30012, "face"), (30013, "windpipe"), (30014, "cracked head"), (30025, "ear"), (30026, "nose"), (30027, "tooth"), (30028, "tongue"), (30029, "hand"), (30030, "foot"), (30031, "thumb"), (30032, "index finger"), (30033, "middle finger"), (30034, "ring finger"), (30035, "little finger"), (30036, "toe")] for (aa, bb) in part_list: if item.value[2] == aa: part1 = aa + " " + victim.name break else: ch.send("{} isn't a part of {}!\n".format(item.name, victim.name)) return part2 = item.name if not game_utils.str_cmp(part1, part2): ch.send("But you are holding {}, not {}!\n".format(item.short_descr, victim.name)) return handler_game.act("$p vanishes from your hand in a puff of smoke.", ch, item, None, merc.TO_CHAR) handler_game.act("$p vanishes from $n's hand in a puff of smoke.", ch, item, None, merc.TO_ROOM) ch.get(item) item.extract() item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_VOODOO_DOLL], 0) item.name = "{} voodoo doll".format(victim.name) item.short_descr = "a voodoo doll of {}".format(victim.name) item.description = "A voodoo doll of {} lies here.".format(victim.name) ch.put(item) ch.equip(item, replace=False, verbose=False) handler_game.act("$p appears in your hand.", ch, item, None, merc.TO_CHAR) handler_game.act("$p appears in $n's hand.", ch, item, None, merc.TO_ROOM) ch.practice -= 5
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 spl_create_spring(sn, level, ch, victim, target): if not ch.is_npc() and ch.is_vampire(): obj_index = instance.item_templates[merc.OBJ_VNUM_BLOOD_SPRING] else: obj_index = instance.item_templates[merc.OBJ_VNUM_SPRING] spring = object_creator.create_item(obj_index, 0) spring.timer = level ch.in_room.put(spring) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_ROOM) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_CHAR)
def p_reset(pArea, pReset, last, level, npc): item = None if pReset.arg1 not in instance.item_templates.keys(): logger.error("Reset_area: 'P': bad vnum %d.", pReset.arg1) return last, level, npc else: itemTemplate = instance.item_templates[pReset.arg1] if pReset.arg3 not in instance.item_templates.keys(): logger.error("Reset_area: 'P': bad vnum %d.", pReset.arg3) return last, level, npc else: item_toTemplate = instance.item_templates[pReset.arg3] if pReset.arg2 > 50: # old format */ limit = 6 elif pReset.arg2 == -1: # no limit */ limit = 999 else: limit = pReset.arg2 item_to = None item_to_list = instance.instances_by_item.get(item_toTemplate.vnum, None) if item_to_list: item_to = instance.global_instances[item_to_list[0]] if pArea.player_count > 0 \ or not item_to \ or (not item_to.in_room and not last) \ or (itemTemplate.count >= limit and random.randint(0, 4) != 0) \ or handler_item.count_obj_list(itemTemplate, item_to.inventory) > pReset.arg4: last = False return last, level, npc count = handler_item.count_obj_list(itemTemplate, item_to.inventory) #Converted while to For Loop, testing indicated #While loop was ~.002-.004 #For loop ~.0009-.001 if item_to: for i in range(pReset.arg4): item = object_creator.create_item( itemTemplate, game_utils.number_fuzzy(item_to.level)) item_to.put(item) item = None count += 1 if count >= pReset.arg4: break if itemTemplate.count >= limit: break # fix object lock state! */ item_to.value[1] = item_toTemplate.value[1] last = True return last, level, npc
def p_reset(pArea, pReset, last, level, npc): item = None if pReset.arg1 not in instance.item_templates.keys(): logger.error("Reset_area: 'P': bad vnum %d.", pReset.arg1) return last, level, npc else: itemTemplate = instance.item_templates[pReset.arg1] if pReset.arg3 not in instance.item_templates.keys(): logger.error("Reset_area: 'P': bad vnum %d.", pReset.arg3) return last, level, npc else: item_toTemplate = instance.item_templates[pReset.arg3] if pReset.arg2 > 50: # old format */ limit = 6 elif pReset.arg2 == -1: # no limit */ limit = 999 else: limit = pReset.arg2 item_to = None item_to_list = instance.instances_by_item.get(item_toTemplate.vnum, None) if item_to_list: item_to = instance.global_instances[item_to_list[0]] if pArea.player_count > 0 \ or not item_to \ or (not item_to.in_room and not last) \ or (itemTemplate.count >= limit and random.randint(0, 4) != 0) \ or handler_item.count_obj_list(itemTemplate, item_to.inventory) > pReset.arg4: last = False return last, level, npc count = handler_item.count_obj_list(itemTemplate, item_to.inventory) #Converted while to For Loop, testing indicated #While loop was ~.002-.004 #For loop ~.0009-.001 if item_to: for i in range(pReset.arg4): item = object_creator.create_item(itemTemplate, game_utils.number_fuzzy(item_to.level)) item_to.put(item) item = None count += 1 if count >= pReset.arg4: break if itemTemplate.count >= limit: break # fix object lock state! */ item_to.value[1] = item_toTemplate.value[1] last = True return last, level, npc
def cmd_demonarmor(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 arg: ch.send( "Please specify which piece of demon armor you wish to make: Ring Collar\n" "Plate Helmet Leggings Boots Gauntlets Sleeves Cape Belt Bracer Visor.\n" ) return arg_list = [("ring", 29650), ("collar", 29651), ("plate", 29652), ("helmet", 29653), ("leggings", 29654), ("boots", 29655), ("gauntlets", 29656), ("sleeves", 29657), ("cape", 29658), ("belt", 29659), ("bracer", 29660), ("visor", 29661)] for (aa, bb) in arg_list: if game_utils.str_cmp(arg, aa): vnum = bb break else: ch.cmd_demonarmor("") return if ch.powers[merc.DEMON_TOTAL] < 5000 or ch.powers[ merc.DEMON_CURRENT] < 5000: ch.send( "It costs 5000 points of power to create a piece of demon armour.\n" ) return item_index = instance.item_templates[vnum] if not item_index: ch.send("Missing object, please inform an Immortal.\n") return ch.powers[merc.DEMON_TOTAL] -= 5000 ch.powers[merc.DEMON_CURRENT] -= 5000 item = object_creator.create_item(item_index, 50) ch.put(item) handler_game.act("$p appears in your hands in a blast of flames.", ch, item, None, merc.TO_CHAR) handler_game.act("$p appears in $n's hands in a blast of flames.", ch, item, None, merc.TO_ROOM)
def spell_floating_disc(sn, level, ch, victim, target): floating = ch.slots.float if floating and floating.flags.no_remove: handler_game.act("You can't remove $p.", ch, floating, None, merc.TO_CHAR) return disc = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_DISC], 0) disc.value[0] = ch.level * 10 # 10 pounds per level capacity */ disc.value[3] = ch.level * 5 # 5 pounds per level max per item */ disc.timer = ch.level * 2 - random.randint(0, level // 2) handler_game.act("$n has created a floating black disc.", ch, None, None, merc.TO_ROOM) ch.send("You create a floating disc.\n") ch.put(disc) ch.equip(disc, True, True)
def spell_floating_disc(sn, level, ch, victim, target): floating = ch.slots.float if floating and floating.flags.no_remove: handler_game.act("You can't remove $p.", ch, floating, None, merc.TO_CHAR) return disc = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_DISC], 0) disc.value[0] = ch.level * 10 # 10 pounds per level capacity */ disc.value[3] = ch.level * 5 # 5 pounds per level max per item */ disc.timer = ch.level * 2 - random.randint(0, level // 2) handler_game.act("$n has created a floating black disc.", ch, None, None, merc.TO_ROOM) ch.send("You create a floating disc.\n") ch.put(disc) ch.equip(disc, True, True)
def cmd_oclone(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Make a clone of what object?\n") return item = ch.get_item_world(arg) if not item: ch.send("Nothing like that in hell, earth, or heaven.\n") return if not ch.is_judge() and (not item.questmaker or not game_utils.str_cmp(ch.name, item.questmaker)): ch.send("You can only clone your own creations.\n") return clone_item = object_creator.create_item(instance.item_templates[item.vnum], 0) ch.put(clone_item) handler_game.act("You create a clone of $p.", ch, item, None, merc.TO_CHAR)
def spl_soulblade(sn, level, ch, victim, target): item = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_SOULBLADE], 0) wpn_list = [(merc.WPN_SLICE, "blade"), (merc.WPN_STAB, "blade"), (merc.WPN_WHIP, "whip"), (merc.WPN_CLAW, "claw"), (merc.WPN_BLAST, "blaster"), (merc.WPN_POUND, "mace"), (merc.WPN_CRUSH, "mace"), (merc.WPN_GREP, "grepper"), (merc.WPN_BITE, "biter"), (merc.WPN_PIERCE, "blade"), (merc.WPN_SUCK, "sucker")] for (aa, bb) in wpn_list: if ch.wpn[aa] > ch.wpn[merc.WPN_SLASH]: wpntype = aa wpnname = bb else: wpntype = merc.WPN_SLASH wpnname = "blade" # First we name the weapon item.name = "{} soul {}".format(ch.name, wpnname) short_descr = ch.short_descr if ch.is_npc() else ch.name item.short_descr = "{}'s soul {}".format( short_descr[0].upper() + short_descr[1:], wpnname) item.long_descr = "{}'s soul {} is lying here.".format( short_descr[0].upper() + short_descr[1:], wpnname) item.level = ch.level if ch.is_npc() else (ch.spl[2] // 4) if (ch.spl[2] > 4) else 1 item.level = min(item.level, 60) item.value[0] = 13034 item.value[1] = 10 item.value[2] = 20 item.value[3] = wpntype item.questmaker = ch.name if not ch.is_npc(): item.questowner = ch.name ch.put(item) handler_game.act("$p fades into existance in your hand.", ch, item, None, merc.TO_CHAR) handler_game.act("$p fades into existance in $n's hand.", ch, item, None, merc.TO_ROOM)
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_weaponform(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 ch.is_affected(merc.AFF_POLYMORPH): ch.send("You cannot do this while polymorphed.\n") return if ch.powers[merc.DPOWER_OBJ_VNUM] < 1: ch.send("You don't have the ability to change into a weapon.\n") return if ch.is_affected(merc.AFF_WEBBED): ch.send("Not with all this sticky webbing on.\n") return item_index = instance.item_templates[ch.powers[merc.DPOWER_OBJ_VNUM]] if not item_index: ch.send("You don't have the ability to change into a weapon.\n") return item = object_creator.create_item(item_index, 60) ch.in_room.put(item) handler_game.act("$n transforms into $p and falls to the ground.", ch, item, None, merc.TO_ROOM) handler_game.act("You transform into $p and fall to the ground.", ch, item, None, merc.TO_CHAR) ch.obj_vnum = ch.powers[merc.DPOWER_OBJ_VNUM] item.chobj = ch ch.chobj = item ch.affected_by.set_bit(merc.AFF_POLYMORPH) ch.extra.set_bit(merc.EXTRA_OSWITCH) ch.morph = item.short_descr
def g_e_reset(pReset, last, level, npc): item = None if pReset.arg1 not in instance.item_templates.keys(): logger.error("Reset_area: 'E' or 'G': bad vnum %d.", pReset.arg1) return last, level, npc else: itemTemplate = instance.item_templates[pReset.arg1] #if not last: # continue if not npc: logger.error("Reset_area: 'E' or 'G': None mob for vnum %d.", pReset.arg1) last = False return last, level, npc olevel = 0 if instance.npc_templates[npc.vnum].pShop: if not itemTemplate.new_format: if itemTemplate.item_type == merc.ITEM_PILL \ or itemTemplate.item_type == merc.ITEM_POTION \ or itemTemplate.item_type == merc.ITEM_SCROLL: olevel = 53 for i in itemTemplate.value: if i > 0: for j in const.skill_table[itemTemplate.value[i]].skill_level: olevel = min(olevel, j) olevel = max(0, (olevel * 3 // 4) - 2) elif itemTemplate.item_type == merc.ITEM_WAND: olevel = random.randint(10, 20) elif itemTemplate.item_type == merc.ITEM_STAFF: olevel = random.randint(15, 25) elif itemTemplate.item_type == merc.ITEM_ARMOR: olevel = random.randint(5, 15) elif itemTemplate.item_type == merc.ITEM_WEAPON: olevel = random.randint(5, 15) elif itemTemplate.item_type == merc.ITEM_TREASURE: olevel = random.randint(10, 20) item = object_creator.create_item(itemTemplate, olevel) item.flags.shop_inventory = True else: if pReset.arg2 > 50: # old format */ limit = 6 elif pReset.arg2 == -1: # no limit */ limit = 999 else: limit = pReset.arg2 if itemTemplate.count < limit or random.randint(0, 4) == 0: item = object_creator.create_item(itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) # error message if it is too high */ if item.level > npc.level + 3 \ or (item.item_type == merc.ITEM_WEAPON and pReset.command == 'E' and item.level < npc.level - 5 and item.level < 45): logger.error("Err: obj %s (%d) -- %d, mob %s (%d) -- %d", item.short_descr, item.vnum, item.level, npc.short_descr, npc.vnum, npc.level) else: return last, level, npc npc.put(item) if pReset.command == 'E': npc.equip(item, True) item = None last = True return last, level, npc
def spell_create_spring(sn, level, ch, victim, target): spring = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_SPRING], 0) spring.timer = level ch.in_room.put(spring) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_ROOM) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_CHAR)
def do_clone(ch, argument): rest, arg = game_utils.read_word(argument) mob = None obj = None if not arg: ch.send("Clone what?\n") return if "object".startswith(arg): mob = None obj = ch.get_item_here(rest) if not obj: ch.send("You don't see that here.\n") return elif "character".startswith(arg) or "mobile".startswith(arg): obj = None mob = ch.get_char_room(rest) if not mob: ch.send("You don't see that here.\n") return else: # find both mob = ch.get_char_room(argument) obj = ch.get_item_here(argument) if mob is None and obj is None: ch.send("You don't see that here.\n") return # clone an object if obj: if not handler_item.item_check(ch, obj): ch.send("Your powers are not great enough for such a task.\n") return clone = object_creator.create_item(obj.vnum, 0) object_creator.clone_item(obj, clone) if obj.in_living: clone.put(ch) else: clone.put(ch.in_room) handler_item.recursive_clone(ch, obj, clone) handler_game.act("$n has created $p.", ch, clone, None, merc.TO_ROOM) handler_game.act("You clone $p.", ch, clone, None, merc.TO_CHAR) handler_game.wiznet("$N clones $p.", ch, clone, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) return elif mob: if not state_checks.IS_NPC(mob): ch.send("You can only clone mobiles.\n") return if (mob.level > 20 and not state_checks.IS_TRUSTED(ch, merc.L4)) \ or (mob.level > 10 and not state_checks.IS_TRUSTED(ch, merc.L5)) \ or (mob.level > 5 and not state_checks.IS_TRUSTED(ch, merc.L6)) \ or (mob.level > 0 and not state_checks.IS_TRUSTED(ch, merc.L7)) \ or not state_checks.IS_TRUSTED(ch, merc.L8): ch.send("Your powers are not great enough for such a task.\n") return clone = object_creator.create_mobile(mob.vnum) object_creator.clone_mobile(mob, clone) for obj in mob.contents: if handler_item.item_check(ch, obj): new_obj = object_creator.create_item(obj.vnum, 0) object_creator.clone_item(obj, new_obj) handler_item.recursive_clone(ch, obj, new_obj) new_obj.put(clone) new_obj.equips_to = obj.equips_to clone.put(ch.in_room) handler_game.act("$n has created $N.", ch, None, clone, merc.TO_ROOM) handler_game.act("You clone $N.", ch, None, clone, merc.TO_CHAR) handler_game.wiznet("$N clones %s." % clone.short_descr, ch, None, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) return
def cmd_press(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1: ch.send("Which item do you wish to press?\n") return item = ch.get_item_wear(arg1) if not item: item = ch.get_item_here(arg1) if not item: ch.send("You can't find that item.\n") return # You should only be able to use nontake items on floor if item.flags.take: ch.send("But you are not wearing it!\n") return if not item.spectype.is_set(merc.SITEM_PRESS): ch.send("There is nothing on this item to press.\n") return if item.spectype.is_set(merc.SITEM_TARGET) and not arg2: ch.send("Who do you wish to use it on?\n") return if item.spectype.is_set(merc.SITEM_TARGET): victim = ch.get_char_room(arg2) if not victim: ch.not_here(arg2) return else: victim = ch if item.chpoweruse: handler_game.kavitem(item.chpoweruse, ch, item, None, merc.TO_CHAR) if item.victpoweruse: handler_game.kavitem(item.victpoweruse, ch, item, None, merc.TO_ROOM) if item.spectype.is_set(merc.SITEM_SPELL): castlevel = state_checks.urange(1, item.level, 60) handler_magic.obj_cast_spell(item.specpower, castlevel, ch, victim, None) ch.wait_state(merc.PULSE_VIOLENCE // 2) if item.spectype.is_set(merc.SITEM_DELAY1): ch.wait_state(merc.PULSE_VIOLENCE // 2) if item.spectype.is_set(merc.SITEM_DELAY2): ch.wait_state(merc.PULSE_VIOLENCE) return if item.spectype.is_set(merc.SITEM_TRANSPORTER): if item.chpoweron: handler_game.kavitem(item.chpoweron, ch, item, None, merc.TO_CHAR) if item.victpoweron: handler_game.kavitem(item.victpoweron, ch, item, None, merc.TO_ROOM) proomindex = instance.rooms[item.specpower] item.specpower = ch.in_room.vnum if not proomindex: return ch.in_room.get(ch) proomindex.put(ch) ch.cmd_look("auto") if item.chpoweroff: handler_game.kavitem(item.chpoweroff, ch, item, None, merc.TO_CHAR) if item.victpoweroff: handler_game.kavitem(item.victpoweroff, ch, item, None, merc.TO_ROOM) if not item.flags.artifact and ch.in_room.room_flags.is_set( merc.ROOM_NO_TELEPORT) and item.flags.take: ch.send("A powerful force hurls you from the room.\n") handler_game.act("$n is hurled from the room by a powerful force.", ch, None, None, merc.TO_ROOM) ch.position = merc.POS_STUNNED ch.in_room.get(ch) room_id = instance.instances_by_room[merc.ROOM_VNUM_TEMPLE][0] instance.rooms[room_id].put(ch) handler_game.act( "$n appears in the room, and falls to the ground stunned.", ch, None, None, merc.TO_ROOM) mount = ch.mount if mount: mount.in_room.get(mount) ch.in_room.put(mount) mount.cmd_look("auto") elif item.spectype.is_set(merc.SITEM_TELEPORTER): if item.chpoweron: handler_game.kavitem(item.chpoweron, ch, item, None, merc.TO_CHAR) if item.victpoweron: handler_game.kavitem(item.victpoweron, ch, item, None, merc.TO_ROOM) proomindex = instance.rooms[item.specpower] if not proomindex: return ch.in_room.get(ch) proomindex.put(ch) ch.cmd_look("auto") if item.chpoweroff: handler_game.kavitem(item.chpoweroff, ch, item, None, merc.TO_CHAR) if item.victpoweroff: handler_game.kavitem(item.victpoweroff, ch, item, None, merc.TO_ROOM) if not item.flags.artifact and ch.in_room.room_flags.is_set( merc.ROOM_NO_TELEPORT) and item.flags.take: ch.send("A powerful force hurls you from the room.\n") handler_game.act("$n is hurled from the room by a powerful force.", ch, None, None, merc.TO_ROOM) ch.position = merc.POS_STUNNED ch.in_room.get(ch) room_id = instance.instances_by_room[merc.ROOM_VNUM_TEMPLE][0] instance.rooms[room_id].put(ch) handler_game.act( "$n appears in the room, and falls to the ground stunned.", ch, None, None, merc.TO_ROOM) mount = ch.mount if mount: mount.in_room.get(mount) ch.in_room.put(mount) mount.cmd_look("auto") elif item.spectype.is_set(merc.SITEM_OBJECT): obj_index = instance.item_templates[item.specpower] if not obj_index: return item = object_creator.create_item(obj_index, ch.level) if item.flags.take: ch.put(item) else: ch.in_room.put(item) elif item.spectype.is_set(merc.SITEM_MOBILE): mob_index = instance.npc_templates[item.specpower] if not mob_index: return npc = object_creator.create_mobile(mob_index) ch.in_room.put(npc) elif item.spectype.is_set(merc.SITEM_ACTION): ch.interpret(item.victpoweron) if item.victpoweroff: for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] if ch == vch: continue vch.interpret(item.victpoweroff) continue
def spell_create_rose(sn, level, ch, victim, target): rose = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_ROSE], 0) handler_game.act("$n has created a beautiful red rose.", ch, rose, None, merc.TO_ROOM) ch.send("You create a beautiful red rose.\n") ch.put(rose)
def cmd_buy(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Buy what?\n") return if ch.in_room.room_flags.is_set(merc.ROOM_PET_SHOP): if ch.is_npc(): return proomindexnext = None if ch.in_room.vnum + 1 in instance.room_templates: proomindexnext = handler_room.get_room_by_vnum(ch.in_room.vnum + 1) if not proomindexnext: comm.notify( "cmd_buy: bad pet shop at vnum {}".format(ch.in_room.vnum), merc.CONSOLE_ERROR) ch.send("Sorry, you can't buy that here.\n") return in_room = ch.in_room ch.in_room = proomindexnext pet = ch.get_char_room(arg) ch.in_room = in_room if not pet or not pet.act.is_set(merc.ACT_PET): ch.send("Sorry, you can't buy that here.\n") return if ch.gold < 10 * pet.level * pet.level: ch.send("You can't afford it.\n") return if ch.level < pet.level: ch.send("You're not ready for this pet.\n") return ch.gold -= 10 * pet.level * pet.level pet = object_creator.create_mobile(instance.npc_templates[pet.vnum]) pet.act.set_bit(merc.ACT_PET) pet.affected_by.set_bit(merc.AFF_CHARM) argument, arg = game_utils.read_word(argument) if arg: pet.name = "{} {}".format(pet.name, arg) pet.description = "{}A neck tag says 'I belong to {}'.\n".format( pet.description, ch.name) ch.in_room.put(pet) pet.add_follower(ch) ch.send("Enjoy your pet.\n") handler_game.act("$n bought $N as a pet.", ch, None, pet, merc.TO_ROOM) else: keeper = shop_utils.find_keeper(ch) if not keeper: return item = keeper.get_item_carry(arg) cost = shop_utils.get_cost(keeper, item, True) if cost <= 0 or not ch.can_see_item(item): handler_game.act("$n tells you 'I don't sell that -- try 'list''.", keeper, None, ch, merc.TO_VICT) ch.reply = keeper return if ch.gold < cost: handler_game.act("$n tells you 'You can't afford to buy $p'.", keeper, item, ch, merc.TO_VICT) ch.reply = keeper return if item.level > ch.level and ch.level < 3: handler_game.act("$n tells you 'You can't use $p yet'.", keeper, item, ch, merc.TO_VICT) ch.reply = keeper return if ch.carry_number + 1 > ch.can_carry_n(): ch.send("You can't carry that many items.\n") return if ch.carry_weight + item.get_weight() > ch.can_carry_w(): ch.send("You can't carry that much weight.\n") return handler_game.act("$n buys $p.", ch, item, None, merc.TO_ROOM) handler_game.act("You buy $p.", ch, item, None, merc.TO_CHAR) ch.gold -= cost keeper.gold += cost if item.flags.inventory: item = object_creator.create_item( instance.item_templates[item.vnum], item.level) else: item.in_living.get(item) ch.put(item)
def cmd_recharge(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: recharge <quest card> <quest machine>\n") return card = ch.get_item_carry(arg1) if not card: ch.send("You are not carrying that object.\n") return if card.item_type != merc.ITEM_QUESTCARD: ch.send("That is not a quest card.\n") return machine = ch.get_item_here(arg2) if not machine: ch.send("There is nothing for you to recharge it with.\n") return if machine.item_type != merc.ITEM_QUESTMACHINE: ch.send("That is not a quest machine.\n") return count = 0 for i in range(4): if card.value[i] == -1: count += 1 if count == 4: card.quest_object() else: ch.send("You have not yet completed the current quest.\n") return handler_game.act("You place $p into a small slot in $P.", ch, card, machine, merc.TO_CHAR) handler_game.act("$n places $p into a small slot in $P.", ch, card, machine, merc.TO_ROOM) handler_game.act("$P makes a few clicks and returns $p.", ch, card, machine, merc.TO_CHAR) handler_game.act("$P makes a few clicks and returns $p.", ch, card, machine, merc.TO_ROOM) value = state_checks.urange(1, card.level, 50) item = object_creator.create_item( instance.item_templates[merc.OBJ_VNUM_PROTOPLASM], 0) 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) item.value[0] = value item.level = value item.cost = value * 1000 item.item_type = merc.ITEM_QUEST item.questmaker = ch.name ch.put(item) handler_game.act("You take $p from $P.", ch, item, machine, merc.TO_CHAR) handler_game.act("$n takes $p from $P.", ch, item, machine, merc.TO_ROOM) if not ch.is_npc(): ch.score[merc.SCORE_NUM_QUEST] += 1 ch.score[merc.SCORE_QUEST] += value comm.info("{} has completed a quest!".format( ch.name if not ch.is_npc() else ch.short_descr)) ch.save(force=True)