Beispiel #1
0
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
Beispiel #2
0
def load_rooms(area, pArea):
    area, w = game_utils.read_word(area, False)
    w = w[1:]  # strip the pound
    while w != '0':
        room = handler_room.Room()
        room.vnum = int(w)
        if room.vnum in instance.room_templates:
            logger.critical('Dupicate room Vnum: %d', room.vnum)
            sys.exit(1)

        instance.room_templates[room.vnum] = room
        room.area = pArea
        area, room.name = game_utils.read_string(area)
        area, room.description = game_utils.read_string(area)
        area, number = game_utils.read_int(area)  # area number
        area, room.room_flags = game_utils.read_flags(area)
        area, room.sector_type = game_utils.read_int(area)
        while True:
            area, letter = game_utils.read_letter(area)

            if letter == 'S':
                break
            elif letter == 'H':  # Healing Room
                area, room.heal_rate = game_utils.read_int(area)
            elif letter == 'M':  # Mana Room
                area, room.mana_rate = game_utils.read_int(area)
            elif letter == 'C':  # Clan
                area, room.clan = game_utils.read_string(area)
            elif letter == 'D':  # exit
                nexit = world_classes.Exit()
                area, door = game_utils.read_int(area)
                area, nexit.description = game_utils.read_string(area)
                area, nexit.keyword = game_utils.read_string(area)
                area, locks = game_utils.read_int(area)
                area, nexit.key = game_utils.read_int(area)
                area, nexit.to_room = game_utils.read_int(area)
                room.exit[door] = nexit
            elif letter == 'E':
                ed = world_classes.ExtraDescrData()
                area, ed.keyword = game_utils.read_string(area)
                area, ed.description = game_utils.read_string(area)
                room.extra_descr.append(ed)
            elif letter == 'O':
                area, room.owner = game_utils.read_string(area)
            else:
                logger.critical("RoomIndexData(%d) has flag other than SHMCDEO: %s", (room.vnum, letter))
                sys.exit(1)
        area, w = game_utils.read_word(area, False)
        w = w[1:]  # strip the pound
        pArea.room_dict[room.vnum] = room
    return area
Beispiel #3
0
def do_string(ch, argument):
    argument, type = game_utils.read_word(argument)
    argument, arg1 = game_utils.read_word(argument)
    argument, arg2 = game_utils.read_word(argument)
    arg3 = argument.strip()

    if not type or not arg1 or not arg2 or not arg3:
        ch.send("Syntax:\n")
        ch.send("  string char <name> <field> <string>\n")
        ch.send("    fields: name short long desc title spec\n")
        ch.send("  string obj  <name> <field> <string>\n")
        ch.send("    fields: name short long extended\n")
        return
    if "mobile".startswith(type) or "character".startswith(type):
        victim = ch.get_char_world(arg1)
        if not victim:
            ch.send("They aren't here.\n")
            return
        # clear zone for mobs
        victim.zone = None
        # string something
        if "name".startswith(arg2):
            if not victim.is_npc():
                ch.send("Not on PC's.\n")
                return
            victim.name = arg3
            return
        if "description".startswith(arg2):
            victim.description = arg3
            return
        if "short".startswith(arg2):
            victim.short_descr = arg3
            return
        if "long".startswith(arg2):
            victim.long_descr = arg3 + "\n"
            return
        if "title".startswith(arg2):
            if victim.is_npc():
                ch.send("Not on NPC's.\n")
                return
            game_utils.set_title(victim, arg3)
            return
        if "spec".startswith(arg2):
            if not victim.is_npc():
                ch.send("Not on PC's.\n")
                return
            spec = state_checks.prefix_lookup(special.spec_table, arg3)
            if not spec:
                ch.send("No such spec fun.\n")
                return
            victim.spec_fun = spec
            ch.send("spec_fun set.\n")
            return
    if "object".startswith(type):
        # string an obj
        obj = ch.get_item_world(arg1)
        if not obj:
            ch.send("Nothing like that in heaven or earth.\n")
            return
        if "name".startswith(arg2):
            obj.name = arg3
            return
        if "short".startswith(arg2):
            obj.short_descr = arg3
            return
        if "long".startswith(arg2):
            obj.description = arg3
            return
        if "extended".startswith(arg2) or "ed".startswith(arg2):
            argument, arg3 = game_utils.read_word(argument)
            if argument is None:
                ch.send("Syntax: oset <object> ed <keyword> <string>\n")
                return
            argument += "\n"
            ed = world_classes.ExtraDescrData()
            ed.keyword = arg3
            ed.description = argument
            obj.extra_descr.append(ed)
            return
    # echo bad use message
    ch.do_string("")
Beispiel #4
0
def cmd_oset(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: oset <object> <field>  <value>\n"
                "or:     oset <object> <string> <value>\n"
                "or:     oset <object> <affect> <value>\n\n"
                "Field being one of:\n"
                "  value0 value1 value2 value3\n"
                "  level weight cost timer morph\n\n"
                "String being one of:\n"
                "  name short long ed type extra wear owner\n\n"
                "Affect being one of:\n"
                "  str dex int wis con\n"
                "  hit dam ac hp mana move\n")
        return

    obj = ch.get_item_world(arg1)
    if not obj:
        ch.send("Nothing like that in heaven or earth.\n")
        return

    if obj.carried_by and not obj.carried_by.is_npc() and obj.carried_by.act.is_set(merc.PLR_GODLESS) and ch.trust < merc.NO_GODLESS and \
            not ch.extra.is_set(merc.EXTRA_ANTI_GODLESS):
        ch.send("You failed.\n")
        return

    if not ch.is_judge() and (not obj.questmaker or
                              not game_utils.str_cmp(ch.name, obj.questmaker)):
        ch.send("You don't have permission to change that item.\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, ["value0", "v0"]):
        if obj.item_type == merc.ITEM_WEAPON and not ch.is_judge():
            ch.send("You are not authorised to create spell weapons.\n")
            return
        elif obj.item_type == merc.ITEM_QUEST:
            ch.send("You cannot change a quest tokens value with oset.\n")
            return
        elif obj.item_type == merc.ITEM_ARMOR and value > 15:
            obj.value[0] = 15
        else:
            obj.value[0] = value
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, ["value1", "v1"]):
        if obj.item_type == merc.ITEM_WEAPON and value > 10:
            obj.value[1] = 10
        else:
            obj.value[1] = value
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, ["value2", "v2"]):
        if obj.item_type == merc.ITEM_WEAPON and value > 20:
            obj.value[2] = 20
        else:
            obj.value[2] = value
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, ["value3", "v3"]):
        if obj.item_type == merc.ITEM_ARMOR and not ch.is_judge():
            ch.send("You are not authorised to create spell armour.\n")
        else:
            obj.value[3] = value
            ch.send("Ok.\n")
            obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "level"):
        value = state_checks.urange(1, value, 50)
        if not ch.is_judge():
            ch.send("You are not authorised to change an items level.\n")
        else:
            obj.level = value
            ch.send("Ok.\n")
            obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "weight"):
        obj.weight = value
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "cost"):
        if value > 100000 and not ch.is_judge():
            ch.send("Don't be so damn greedy!\n")
        else:
            obj.cost = value
            ch.send("Ok.\n")
            obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "timer"):
        obj.timer = value
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, ["hitroll", "hit"]):
        ch.oset_affect(obj, value, merc.APPLY_HITROLL, False)
        return
    elif game_utils.str_cmp(arg2, ["damroll", "dam"]):
        ch.oset_affect(obj, value, merc.APPLY_DAMROLL, False)
        return
    elif game_utils.str_cmp(arg2, ["armor", "ac"]):
        ch.oset_affect(obj, value, merc.APPLY_AC, False)
        return
    elif game_utils.str_cmp(arg2, ["hitpoints", "hp"]):
        ch.oset_affect(obj, value, merc.APPLY_HIT, False)
        return
    elif game_utils.str_cmp(arg2, "mana"):
        ch.oset_affect(obj, value, merc.APPLY_MANA, False)
        return
    elif game_utils.str_cmp(arg2, ["move", "movement"]):
        ch.oset_affect(obj, value, merc.APPLY_MOVE, False)
        return
    elif game_utils.str_cmp(arg2, ["str", "strength"]):
        ch.oset_affect(obj, value, merc.APPLY_STR, False)
        return
    elif game_utils.str_cmp(arg2, ["dex", "dexterity"]):
        ch.oset_affect(obj, value, merc.APPLY_DEX, False)
        return
    elif game_utils.str_cmp(arg2, ["int", "intelligence"]):
        ch.oset_affect(obj, value, merc.APPLY_INT, False)
        return
    elif game_utils.str_cmp(arg2, ["wis", "wisdom"]):
        ch.oset_affect(obj, value, merc.APPLY_WIS, False)
        return
    elif game_utils.str_cmp(arg2, ["con", "constitution"]):
        ch.oset_affect(obj, value, merc.APPLY_CON, False)
        return

    if game_utils.str_cmp(arg2, "type"):
        if not ch.is_judge():
            ch.send("You are not authorised to change an item type.\n")
            return

        item_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),
                     ("stake", merc.ITEM_STAKE)]
        for (aa, bb) in item_list:
            if game_utils.str_cmp(arg3, aa):
                obj.item_type = bb
                break
        else:
            ch.send(
                "Type can be one of: Light, Scroll, Wand, Staff, Weapon, Treasure, Armor,\n"
                "Potion, Furniture, Trash, Container, Drink, Key, Food, Money, Boat, Corpse,\n"
                "Fountain, Pill, Portal, Stake.\n")
            return
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "owner"):
        if ch.is_npc():
            ch.send("Not while switched.\n")
            return

        if not ch.is_judge() and (not obj.questmaker or not game_utils.str_cmp(
                ch.name, obj.questmaker)):
            ch.send("Someone else has already changed this item.\n")
            return

        victim = ch.get_char_world(arg3)
        if not victim:
            ch.not_here(arg3)
            return

        if victim.is_npc():
            ch.not_npc()
            return

        obj.questmaker = ch.name
        obj.questowner = victim.name
        ch.send("Ok.\n")
        return

    if game_utils.str_cmp(arg2, "name"):
        obj.name = arg3
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "short"):
        obj.short_descr = arg3
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "long"):
        obj.description = arg3
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "ed"):
        argument, arg3 = game_utils.read_word(argument)

        if not argument:
            ch.send("Syntax: oset <object> ed <keyword> <string>\n")
            return

        edd = world_classes.ExtraDescrData(keyword=arg3, description=argument)
        obj.extra_descr.append(edd)
        ch.send("Ok.\n")
        obj.questmaker = ch.name
        return

    # Generate usage message.
    ch.cmd_oset("")
Beispiel #5
0
def load_rooms(area, pArea):
    area, w = game_utils.read_word(area, False)
    w = w[1:]  # strip the pound
    while w != '0':
        room = handler_room.Room(None)
        room.vnum = int(w)
        if room.vnum in instance.room_templates:
            logger.critical('Dupicate room Vnum: %d', room.vnum)
            sys.exit(1)
        instance.room_templates[room.vnum] = room
        room.area = pArea.name
        area, room.name = game_utils.read_string(area)

        area, room.description = game_utils.read_string(area)
        room.description = miniboa.terminal.escape(room.description, 'pyom')

        area, number = game_utils.read_int(area)  # area number
        area, room.room_flags = game_utils.read_flags(area)
        area, room.sector_type = game_utils.read_int(area)
        while True:
            area, letter = game_utils.read_letter(area)

            if letter == 'S':
                break
            elif letter == 'H':  # Healing Room
                area, room.heal_rate = game_utils.read_int(area)
            elif letter == 'M':  # Mana Room
                area, room.mana_rate = game_utils.read_int(area)
            elif letter == 'C':  # Clan
                area, room.clan = game_utils.read_string(area)
            elif letter == 'D':  # exit
                nexit = world_classes.Exit(None)
                area, door = game_utils.read_int(area)
                area, nexit.description = game_utils.read_string(area)
                area, nexit.keyword = game_utils.read_string(area)
                #Replaced Locks code
                area = nexit.exit_info.read_bits(area)
                area, nexit.key = game_utils.read_int(area)
                area, nexit.to_room_vnum = game_utils.read_int(area)
                nexit.name = "Exit %s %d to %d" % \
                             (nexit.keyword,
                              room.vnum,
                              nexit.to_room_vnum)

                room.exit[door] = nexit
            elif letter == 'E':
                ed = world_classes.ExtraDescrData()
                area, ed.keyword = game_utils.read_string(area)
                area, ed.description = game_utils.read_string(area)
                room.extra_descr.append(ed)
            elif letter == 'O':
                area, room.owner = game_utils.read_string(area)
            else:
                logger.critical(
                    "RoomIndexData(%d) has flag other than SHMCDEO: %s",
                    (room.vnum, letter))
                sys.exit(1)
        area, w = game_utils.read_word(area, False)
        w = w[1:]  # strip the pound
        # Create our instances
        room_instance = object_creator.create_room(room)
        room_instance.environment = pArea.instance_id
    return area
Beispiel #6
0
def load_objects(area, pArea):
    area, w = game_utils.read_word(area, False)
    w = w[1:]  # strip the pound
    while w != '0':
        flag_data = collections.namedtuple(
            'item_flags', ('slots', 'restrictions', 'attributes', 'weapon'))
        flag_data.slots = set({})
        flag_data.restrictions = set({})
        flag_data.weapon = set({})
        flag_data.attributes = set({})
        item = handler_item.Items(None)
        item.vnum = int(w)
        instance.item_templates[item.vnum] = item
        item.area = pArea.name
        area, item.name = game_utils.read_string(area)
        area, item.short_descr = game_utils.read_string(area)

        area, item.description = game_utils.read_string(area)
        item.description = miniboa.terminal.escape(item.description, 'pyom')

        area, item.material = game_utils.read_string(area)
        area, item.item_type = game_utils.read_word(area, False)
        area, extra_bits = game_utils.read_flags(area)
        game_utils.item_flags_from_bits(extra_bits, flag_data, 'extra flags')
        area, wear_bits = game_utils.read_flags(area)
        game_utils.item_flags_from_bits(wear_bits, flag_data, 'wear flags')
        if merc.ITEM_LIGHT == item.item_type:
            flag_data.slots.update({'light'})
        item.equips_to = flag_data.slots
        item.item_restrictions = flag_data.restrictions
        item.item_attributes = flag_data.attributes

        if item.item_type == merc.ITEM_WEAPON:
            area, item.value[0] = game_utils.read_word(area, False)
            area, item.value[1] = game_utils.read_int(area)
            area, item.value[2] = game_utils.read_int(area)
            area, item.value[3] = game_utils.read_word(area, False)
            item.value[3] = state_checks.name_lookup(const.attack_table,
                                                     item.value[3])
            area, item.value[4] = game_utils.read_flags(area)
            game_utils.item_flags_from_bits(item.value[4], flag_data,
                                            'weapon flags')
            item.weapon_attributes = flag_data.weapon
        elif item.item_type == merc.ITEM_CONTAINER:
            area, item.value[0] = game_utils.read_int(area)
            area, item.value[1] = game_utils.read_flags(area)
            area, item.value[2] = game_utils.read_int(area)
            area, item.value[3] = game_utils.read_int(area)
            area, item.value[4] = game_utils.read_int(area)
        elif item.item_type == merc.ITEM_DRINK_CON or item.item_type == merc.ITEM_FOUNTAIN:
            area, item.value[0] = game_utils.read_int(area)
            area, item.value[1] = game_utils.read_int(area)
            area, item.value[2] = game_utils.read_word(area, False)
            area, item.value[3] = game_utils.read_int(area)
            area, item.value[4] = game_utils.read_int(area)
        elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF:
            area, item.value[0] = game_utils.read_int(area)
            area, item.value[1] = game_utils.read_int(area)
            area, item.value[2] = game_utils.read_int(area)
            area, item.value[3] = game_utils.read_word(area, False)
            area, item.value[4] = game_utils.read_int(area)
        elif item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_SCROLL \
                or item.item_type == merc.ITEM_PILL:
            area, item.value[0] = game_utils.read_int(area)
            area, item.value[1] = game_utils.read_word(area, False)
            area, item.value[2] = game_utils.read_word(area, False)
            area, item.value[3] = game_utils.read_word(area, False)
            area, item.value[4] = game_utils.read_word(area, False)
        else:
            area, item.value[0] = game_utils.read_flags(area)
            area, item.value[1] = game_utils.read_flags(area)
            area, item.value[2] = game_utils.read_flags(area)
            area, item.value[3] = game_utils.read_flags(area)
            area, item.value[4] = game_utils.read_flags(area)

        area, item.level = game_utils.read_int(area)
        area, item.weight = game_utils.read_int(area)
        area, item.cost = game_utils.read_int(area)
        area, item.condition = game_utils.read_word(area, False)
        if item.condition == 'P':
            item.condition = 100
        elif item.condition == 'G':
            item.condition = 90
        elif item.condition == 'A':
            item.condition = 75
        elif item.condition == 'W':
            item.condition = 50
        elif item.condition == 'D':
            item.condition = 25
        elif item.condition == 'B':
            item.condition = 10
        elif item.condition == 'R':
            item.condition = 0
        else:
            item.condition = 100

        area, w = game_utils.read_word(area, False)

        while w == 'F' or w == 'A' or w == 'E':
            if w == 'F':
                area, word = game_utils.read_word(area, False)
                area, number = game_utils.read_int(area)
                area, number = game_utils.read_int(area)
                area, flags = game_utils.read_flags(area)
            elif w == 'A':
                paf = handler_game.AFFECT_DATA()
                paf.where = merc.TO_OBJECT
                paf.type = -1
                paf.level = 20
                paf.duration = -1
                area, paf.location = game_utils.read_int(area)
                area, paf.modifier = game_utils.read_int(area)
                paf.bitvector = 0
                item.affected += [paf]
            elif w == 'E':
                ed = world_classes.ExtraDescrData()
                area, ed.keyword = game_utils.read_string(area)
                area, ed.description = game_utils.read_string(area)
                item.extra_descr.append(ed)

            area, w = game_utils.read_word(area, False)
        w = w[1:]  # strip the pound
    return area
Beispiel #7
0
def load_objects(area, pArea):
    area, w = game_utils.read_word(area, False)
    w = w[1:]  # strip the pound
    while w != '0':
        obj = handler_item.Items()
        obj.vnum = int(w)
        instance.item_templates[obj.vnum] = obj
        area, obj.name = game_utils.read_string(area)
        area, obj.short_descr = game_utils.read_string(area)

        area, obj.description = game_utils.read_string(area)
        area, obj.material = game_utils.read_string(area)
        area, item_type = game_utils.read_word(area, False)
        area, obj.extra_flags = game_utils.read_flags(area)
        area, obj.wear_flags = game_utils.read_flags(area)
        obj.item_type = item_type

        if obj.item_type == merc.ITEM_WEAPON:
            area, obj.value[0] = game_utils.read_word(area, False)
            area, obj.value[1] = game_utils.read_int(area)
            area, obj.value[2] = game_utils.read_int(area)
            area, obj.value[3] = game_utils.read_word(area, False)
            obj.value[3] = state_checks.name_lookup(const.attack_table, obj.value[3])
            area, obj.value[4] = game_utils.read_flags(area)
        elif obj.item_type == merc.ITEM_CONTAINER:
            area, obj.value[0] = game_utils.read_int(area)
            area, obj.value[1] = game_utils.read_flags(area)
            area, obj.value[2] = game_utils.read_int(area)
            area, obj.value[3] = game_utils.read_int(area)
            area, obj.value[4] = game_utils.read_int(area)
        elif obj.item_type == merc.ITEM_DRINK_CON or obj.item_type == merc.ITEM_FOUNTAIN:
            area, obj.value[0] = game_utils.read_int(area)
            area, obj.value[1] = game_utils.read_int(area)
            area, obj.value[2] = game_utils.read_word(area, False)
            area, obj.value[3] = game_utils.read_int(area)
            area, obj.value[4] = game_utils.read_int(area)
        elif obj.item_type == merc.ITEM_WAND or obj.item_type == merc.ITEM_STAFF:
            area, obj.value[0] = game_utils.read_int(area)
            area, obj.value[1] = game_utils.read_int(area)
            area, obj.value[2] = game_utils.read_int(area)
            area, obj.value[3] = game_utils.read_word(area, False)
            area, obj.value[4] = game_utils.read_int(area)
        elif obj.item_type == merc.ITEM_POTION or obj.item_type == merc.ITEM_SCROLL or obj.item_type == merc.ITEM_PILL:
            area, obj.value[0] = game_utils.read_int(area)
            area, obj.value[1] = game_utils.read_word(area, False)
            area, obj.value[2] = game_utils.read_word(area, False)
            area, obj.value[3] = game_utils.read_word(area, False)
            area, obj.value[4] = game_utils.read_word(area, False)
        else:
            area, obj.value[0] = game_utils.read_flags(area)
            area, obj.value[1] = game_utils.read_flags(area)
            area, obj.value[2] = game_utils.read_flags(area)
            area, obj.value[3] = game_utils.read_flags(area)
            area, obj.value[4] = game_utils.read_flags(area)

        area, obj.level = game_utils.read_int(area)
        area, obj.weight = game_utils.read_int(area)
        area, obj.cost = game_utils.read_int(area)
        area, obj.condition = game_utils.read_word(area, False)
        if obj.condition == 'P':
            obj.condition = 100
        elif obj.condition == 'G':
            obj.condition = 90
        elif obj.condition == 'A':
            obj.condition = 75
        elif obj.condition == 'W':
            obj.condition = 50
        elif obj.condition == 'D':
            obj.condition = 25
        elif obj.condition == 'B':
            obj.condition = 10
        elif obj.condition == 'R':
            obj.condition = 0
        else:
            obj.condition = 100

        area, w = game_utils.read_word(area, False)

        while w == 'F' or w == 'A' or w == 'E':
            if w == 'F':
                area, word = game_utils.read_word(area, False)
                area, number = game_utils.read_int(area)
                area, number = game_utils.read_int(area)
                area, flags = game_utils.read_flags(area)
            elif w == 'A':
                area, number = game_utils.read_int(area)
                area, number = game_utils.read_int(area)
            elif w == 'E':
                ed = world_classes.ExtraDescrData()
                area, ed.keyword = game_utils.read_string(area)
                area, ed.description = game_utils.read_string(area)
                obj.extra_descr.append(ed)

            area, w = game_utils.read_word(area, False)

        pArea.object_dict[obj.vnum] = obj
        w = w[1:]  # strip the pound
    return area
Beispiel #8
0
def load_rooms(area, parea):
    area, w = game_utils.read_word(area, False)
    w = w[1:]  # strip the pound
    while w != "0":
        vnum = int(w)
        if vnum in instance.room_templates:
            comm.notify("load_rooms: duplicate vnum {}".format(vnum),
                        merc.CONSOLE_CRITICAL)
            sys.exit(1)

        room = handler_room.Room(None)
        room.vnum = vnum
        instance.room_templates[room.vnum] = room
        room.area = parea.name
        area, room.name = game_utils.read_string(area)
        area, room.description = game_utils.read_string(area)
        room.description = miniboa.terminal.escape(room.description, "ANSI")

        area, dummy = game_utils.read_int(area)  # area number
        area, room_flags = game_utils.read_int(area)
        room.room_flags.bits = room_flags
        area, room.sector_type = game_utils.read_int(area)

        area, w = game_utils.read_word(area, None)
        while w in ["S", "D0", "D1", "D2", "D3", "D4", "D5", "E", "T"]:
            if w == "S":
                pass
            elif w in ["D0", "D1", "D2", "D3", "D4", "D5"]:  # exit
                door = int(w[1:])
                if door not in range(merc.MAX_DIR):
                    comm.notify(
                        "load_rooms: vnum {} has bad door number".format(vnum),
                        merc.CONSOLE_CRITICAL)
                    sys.exit(1)

                nexit = world_classes.Exit(None)
                area, nexit.description = game_utils.read_string(area)
                area, nexit.keyword = game_utils.read_string(area)
                area, exit_info = game_utils.read_int(area)
                nexit.exit_info.bits = exit_info
                area, nexit.key = game_utils.read_int(area)
                area, nexit.to_room_vnum = game_utils.read_int(area)
                room.exit[door] = nexit
            elif w == "E":
                edd = world_classes.ExtraDescrData()
                area, edd.keyword = game_utils.read_string(area)
                area, edd.description = game_utils.read_string(area)
                room.extra_descr.append(edd)
            elif w == "T":
                rt = handler_room.Roomtext()
                area, rt.input = game_utils.read_string(area)
                area, rt.output = game_utils.read_string(area)
                area, rt.choutput = game_utils.read_string(area)
                area, rt.name = game_utils.read_string(area)
                area, rt.type = game_utils.read_int(area)
                area, rt.power = game_utils.read_int(area)
                area, rt.mob = game_utils.read_int(area)
                room.roomtext.append(rt)
            else:
                comm.notify("load_rooms: bad flag DEST ({})".format(w),
                            merc.CONSOLE_CRITICAL)
                sys.exit(1)
            area, w = game_utils.read_word(area, False)

        w = w[1:]  # strip the pound

        # Create our instances
        room_instance = object_creator.create_room(room)
        room_instance.environment = parea.instance_id
    return area
Beispiel #9
0
def load_objects(area, parea):
    area, w = game_utils.read_word(area, False)
    w = w[1:]  # strip the pound
    while w != "0":
        vnum = int(w)
        if vnum in instance.item_templates:
            comm.notify("load_objects: vnum {} duplicated.".format(vnum),
                        merc.CONSOLE_CRITICAL)
            sys.exit(1)

        flag_data = collections.namedtuple(
            "item_flags", ("slots", "restrictions", "attributes", "weapon"))
        flag_data.slots = set({})
        flag_data.restrictions = set({})
        flag_data.weapon = set({})
        flag_data.attributes = set({})

        item = handler_item.Items(None)
        item.vnum = vnum
        instance.item_templates[item.vnum] = item
        item.area = parea.name
        area, item.name = game_utils.read_string(area)
        area, item.short_descr = game_utils.read_string(area)
        item.short_descr = miniboa.terminal.escape(item.short_descr, "ANSI")
        area, item.description = game_utils.read_string(area)
        item.description = miniboa.terminal.escape(item.description, "ANSI")
        area, dummy = game_utils.read_string(area)

        area, item_type = game_utils.read_int(area)
        item_list = [(1, merc.ITEM_LIGHT), (2, merc.ITEM_SCROLL),
                     (3, merc.ITEM_WAND), (4, merc.ITEM_STAFF),
                     (5, merc.ITEM_WEAPON), (8, merc.ITEM_TREASURE),
                     (9, merc.ITEM_ARMOR), (10, merc.ITEM_POTION),
                     (12, merc.ITEM_FURNITURE), (15, merc.ITEM_CONTAINER),
                     (17, merc.ITEM_DRINK_CON), (18, merc.ITEM_KEY),
                     (19, merc.ITEM_FOOD), (20, merc.ITEM_MONEY),
                     (22, merc.ITEM_BOAT), (23, merc.ITEM_CORPSE_NPC),
                     (24, merc.ITEM_CORPSE_PC), (25, merc.ITEM_FOUNTAIN),
                     (26, merc.ITEM_PILL), (27, merc.ITEM_PORTAL),
                     (28, merc.ITEM_EGG), (29, merc.ITEM_VOODOO),
                     (30, merc.ITEM_STAKE), (31, merc.ITEM_MISSILE),
                     (32, merc.ITEM_AMMO), (33, merc.ITEM_QUEST),
                     (34, merc.ITEM_QUESTCARD), (35, merc.ITEM_QUESTMACHINE),
                     (36, merc.ITEM_SYMBOL), (37, merc.ITEM_BOOK),
                     (38, merc.ITEM_PAGE), (39, merc.ITEM_TOOL)]
        for (aa, bb) in item_list:
            if item_type == aa:
                item.item_type = bb
                break
        else:
            item.item_type = merc.ITEM_TRASH

        area, extra_bits = game_utils.read_int(area)
        game_utils.item_flags_from_bits(extra_bits, flag_data, "extra flags")
        area, wear_bits = game_utils.read_int(area)
        game_utils.item_flags_from_bits(wear_bits, flag_data, "wear flags")

        if item.item_type == merc.ITEM_LIGHT:
            flag_data.slots.update({"right_hand", "left_hand"})
        item.equips_to = flag_data.slots
        item.item_restrictions = flag_data.restrictions
        item.item_attributes = flag_data.attributes

        area, item.value[0] = game_utils.read_flags(area)
        area, item.value[1] = game_utils.read_flags(area)
        area, item.value[2] = game_utils.read_flags(area)
        area, item.value[3] = game_utils.read_flags(area)

        area, item.weight = game_utils.read_int(area)
        area, item.cost = game_utils.read_int(area)
        area, dummy = game_utils.read_int(area)

        area, w = game_utils.read_word(area, False)
        while w in ["A", "E", "Q"]:
            if w == "A":
                paf = handler_game.AffectData()
                paf.type = -1
                paf.duration = -1
                area, paf.location = game_utils.read_int(area)
                area, paf.modifier = game_utils.read_int(area)
                item.affected.append(paf)
            elif w == "E":
                edd = world_classes.ExtraDescrData()
                area, edd.keyword = game_utils.read_string(area)
                area, edd.description = game_utils.read_string(area)
                item.extra_descr.append(edd)
            elif w == "Q":
                area, item.chpoweron = game_utils.read_string(area)
                area, item.chpoweroff = game_utils.read_string(area)
                area, item.chpoweruse = game_utils.read_string(area)
                area, item.victpoweron = game_utils.read_string(area)
                area, item.victpoweroff = game_utils.read_string(area)
                area, item.victpoweruse = game_utils.read_string(area)
                area, sitem_bits = game_utils.read_flags(area)
                game_utils.item_flags_from_bits(sitem_bits, flag_data,
                                                "sitem flags")
                area, item.specpower = game_utils.read_int(area)

            area, w = game_utils.read_word(area, False)

        w = w[1:]  # strip the pound
    return area
def cmd_quest(ch, argument):
    argument, arg1 = game_utils.read_word(argument)
    argument, arg2 = game_utils.read_word(argument)
    arg3 = argument

    if arg1 and game_utils.str_cmp(arg1, "create"):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to create new objects.\n")
            return

        if ch.quest == 0:
            ch.send("You must first earn some quest points.\n")
            return

        if not arg2:
            ch.send(
                "Syntax: quest create <object> <field>\n"
                "Object being one of: Light (10 QP), Weapon < type > (50 QP), Armor(30 QP),\n"
                "Container(10 QP), Boat(10 QP), Fountain < type > (10 QP), Stake(10 QP).\n"
            )
            return

        type_list = [("light", merc.ITEM_LIGHT, 10),
                     ("weapon", merc.ITEM_WEAPON, 50),
                     (["armor", "armour"], merc.ITEM_ARMOR, 20),
                     ("container", merc.ITEM_CONTAINER, 10),
                     ("boat", merc.ITEM_BOAT, 10),
                     ("fountain", merc.ITEM_FOUNTAIN, 10),
                     ("stake", merc.ITEM_STAKE, 10)]
        for (aa, bb, cc) in type_list:
            if game_utils.str_cmp(arg2, aa):
                add = bb
                value = 10
                break
        else:
            ch.cmd_quest("create")
            return

        if ch.quest < value:
            ch.send(
                "You don't have the required {} quest points.\n".format(value))
            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, 25)
        item.weight = 1
        item.cost = 1000
        item.item_type = add

        if add == merc.ITEM_WEAPON:
            if not arg3:
                ch.send(
                    "Please specify weapon type: Slice, Stab, Slash, Whip, Claw, Blast, Pound,\n"
                    "Crush, Pierce, or Suck.\n")
                item.extract()
                return

            wpn_list = [("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),
                        ("pierce", merc.WPN_PIERCE), ("suck", merc.WPN_SUCK)]
            for (aa, bb) in wpn_list:
                if game_utils.str_cmp(arg3, aa):
                    item.value[3] = bb
                    break
            else:
                ch.cmd_quest("create weapon")
                item.extract()
                return

            item.value[1] = 10
            item.value[2] = 20
            item.level = 50
        elif add == merc.ITEM_FOUNTAIN:
            if not arg3:
                ch.send(
                    "Please specify fountain contents: Water, Beer, Wine, Ale, Darkale, Whisky,\n"
                    "Firebreather, Specialty, Slime, Milk, Tea, Coffee, Blood, Saltwater.\n"
                )
                item.extract()
                return

            item_list = [("water", 0), ("beer", 1), ("wine", 2), ("ale", 3),
                         ("darkale", 4), ("whisky", 5), ("firebreather", 7),
                         ("specialty", 8), ("slime", 9), ("milk", 10),
                         ("tea", 11), ("coffee", 12), ("blood", 13),
                         ("saltwater", 14)]
            for (aa, bb) in item_list:
                if game_utils.str_cmp(arg3, aa):
                    item.value[2] = bb
                    break
            else:
                ch.cmd_quest("create fountain")
                item.extract()
                return

            item.value[0] = 1000
            item.value[1] = 1000
        elif add == merc.ITEM_CONTAINER:
            item.value[0] = 999
        elif add == merc.ITEM_LIGHT:
            item.value[2] = -1
        elif add == merc.ITEM_ARMOR:
            item.value[0] = 15

        ch.quest -= value
        ch.put(item)
        item.quest.set_bit(merc.QUEST_FREENAME)
        item.questmaker = ch.name
        item.questowner = 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)
        return

    if not arg1 or not arg2:
        ch.send(
            "- - - - - - - - - - ----====[ QUEST ITEM COSTS ]====---- - - - - - - - - - -\n"
            "Create: Creates a new personalized object, costing between 10 and 50 QP.\n"
            "Name/Short/Long: Rename the object.  1 QP for all three.\n"
            "Protection: Sets AC on armour at 1 QP per point.\n"
            "Min/Max: Sets min/max damage on weapon at 1 QP per point.\n"
            "Weapon: Sets weapon type for 10 QP.\n"
            "Extra (add/remove): Glow(1/1), Hum(1/1), Invis(1/1), Anti-Good(1/10),\n"
            "                    Anti-Neutral(1/10), Anti-Evil(1/10), Loyal(10/1).\n"
            "Wear: Select location, costs 20 QP's.  Type 'quest <obj> wear' to see locations.\n"
            "Power: Spell power for spell weapons.  Costs 1 QP per power point.\n"
            "Spell: Spell weapons or affect.  Costs 50 QP.\n"
            "Transporter: Future transportation to that room.  Costs 50 QP.\n"
            "Special: Set activate/twist/press/pull flags.\n"
            "You-in/You-out/Other-in/Other-out: Renames for transporter actions.\n"
            "You-wear/You-remove/You-use: What you see when you wear/remove/use.\n"
            "Other-wear/Other-remove/Other-use: What others see when you wear/remove/use.\n"
            "Weight: Set objects weight to 1.  Costs 10 QP.\n"
            "Str, Dex, Int, Wis, Con... max =   3 each, at  20 quest points per +1 stat.\n"
            "Hp, Mana, Move............ max =  25 each, at   5 quest points per point.\n"
            "Hitroll, Damroll.......... max =   5 each, at  30 quest points per point.\n"
            "Ac........................ max = -25,      at  10 points per point.\n"
            "- - - - - - - - - - ----====[ QUEST ITEM COSTS ]====---- - - - - - - - - - -\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 in [
            merc.ITEM_QUEST, merc.ITEM_AMMO, merc.ITEM_EGG, merc.ITEM_VOODOO,
            merc.ITEM_MONEY, merc.ITEM_TREASURE, merc.ITEM_TOOL,
            merc.ITEM_SYMBOL, merc.ITEM_PAGE
    ] or item.flags.artifact:
        ch.send("You cannot quest-change that item.\n")
        return

    if not ch.is_immortal() and (not item.questowner or not game_utils.str_cmp(
            ch.name, item.questowner)):
        ch.send("You can only change an item you own.\n")
        return

    # Snarf the value (which need not be numeric).
    value = int(arg3) if arg3.isdigit() else 0

    if game_utils.str_cmp(arg2, "protection"):
        if not arg3:
            ch.send("How much armor class?\n")
            return

        if item.item_type != merc.ITEM_ARMOR:
            ch.send("That item is not armor.\n")
            return

        if item.item_type == merc.ITEM_ARMOR and (value + item.value[0]) > 15:
            if item.value[0] < 15:
                ch.send("The armor class can be increased by {}.\n".format(
                    15 - item.value[0]))
            else:
                ch.send("The armor class cannot be increased any further.\n")
            return

        if ch.quest < value:
            ch.send("You don't have enough quest points.\n")
            return

        item.value[0] += value
        if item.value < 0:
            item.value[0] = 0

        ch.send("Ok.\n")
        if value < 1:
            value = 1

        ch.quest -= value
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "min"):
        if not arg3:
            ch.send("How much min damage?\n")
            return

        if item.item_type != merc.ITEM_WEAPON:
            ch.send("That item is not a weapon.\n")
            return

        if item.item_type == merc.ITEM_WEAPON and (value + item.value[1]) > 10:
            if item.value[1] < 10:
                ch.send("The minimum damage can be increased by {}.\n".format(
                    10 - item.value[1]))
            else:
                ch.send(
                    "The minimum damage cannot be increased any further.\n")
            return

        if ch.quest < value:
            ch.send("You don't have enough quest points.\n")
            return

        item.value[1] += value
        if item.value[1] < 1:
            item.value[1] = 1

        ch.send("Ok.\n")
        if value < 1:
            value = 1

        ch.quest -= value
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "max"):
        if not arg3:
            ch.send("How much max damage?\n")
            return

        if item.item_type != merc.ITEM_WEAPON:
            ch.send("That item is not a weapon.\n")
            return

        if item.item_type == merc.ITEM_WEAPON and (value + item.value[2]) > 20:
            if item.value[2] < 20:
                ch.send("The maximum damage can be increased by {}.\n".format(
                    20 - item.value[2]))
            else:
                ch.send(
                    "The maximum damage cannot be increased any further.\n")
            return

        if ch.quest < value:
            ch.send("You don't have enough quest points.\n")
            return

        item.value[2] += value
        if item.value[2] < 0:
            item.value[2] = 0

        ch.send("Ok.\n")
        if value < 1:
            value = 1

        ch.quest -= value
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "weapon"):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to change weapon types.\n")
            return

        if item.item_type == merc.ITEM_WEAPON:
            if item.flags.relic:
                ch.send("Not on a relic.\n")
                return

            if ch.quest < 10:
                ch.send("You don't have enough quest points.\n")
                return

            if not arg3:
                ch.send(
                    "Please specify weapon type: Slice, Stab, Slash, Whip, Claw, Blast, Pound,\n"
                    "Crush, Pierce, or Suck.\n")
                return

            wpn_list = [("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),
                        ("pierce", merc.WPN_PIERCE), ("suck", merc.WPN_SUCK)]
            for (aa, bb) in wpn_list:
                if game_utils.str_cmp(arg3, aa):
                    value = bb
                    break
            else:
                ch.send(
                    "Please specify weapon type: Slice, Stab, Slash, Whip, Claw, Blast, Pound,\n"
                    "Crush, Pierce, or Suck.\n")
                return

            if item.value[3] == value:
                ch.send("It is already that weapon type.\n")
                return

            item.value[3] = value
            ch.quest -= 10
            ch.send("Ok.\n")
            item.questmaker = ch.name
        else:
            ch.send("That item is not a weapon.\n")
        return

    if game_utils.str_cmp(arg2, "extra"):
        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if not arg3:
            ch.send(
                "Enter one of: Glow, Hum, Invis, Anti-good, Anti-evil, Anti-neutral, Loyal,\n"
                "Silver.\n")
            return

        if game_utils.str_cmp(arg3, "glow"):
            value = item.flags.glow
            add = 1
            remove = 1
        elif game_utils.str_cmp(arg3, "hum"):
            value = item.flags.hum
            add = 1
            remove = 1
        elif game_utils.str_cmp(arg3, "invis"):
            value = item.flags.invis
            add = 1
            remove = 1
        elif game_utils.str_cmp(arg3, "anti-good"):
            value = item.flags.anti_good
            add = 1
            remove = 10
        elif game_utils.str_cmp(arg3, "anti-evil"):
            value = item.flags.anti_evil
            add = 1
            remove = 10
        elif game_utils.str_cmp(arg3, "anti-neutral"):
            value = item.flags.anti_neutral
            add = 1
            remove = 10
        elif game_utils.str_cmp(arg3, "loyal"):
            value = item.flags.loyal
            add = 10
            remove = 1
        elif game_utils.str_cmp(arg3, "silver"):
            value = item.flags.silver
            add = 100
            remove = 0
        else:
            ch.send(
                "Enter one of: Glow, Hum, Invis, Anti-good, Anti-evil, Anti-neutral, Loyal,\n"
                "Silver.\n")
            return

        if game_utils.str_cmp(arg3, "silver"):
            if item.flags.silver:
                ch.send("That item is already silver.\n")
                return

            if ch.quest < add:
                ch.send("Sorry, you need {} quest points to set that flag.\n".
                        format(add))
                return

            ch.quest -= add
            item.flags.silver = True
        elif value:
            if ch.quest < remove:
                ch.send(
                    "Sorry, you need {} quest points to remove that flag.\n".
                    format(remove))
                return

            ch.quest -= remove
            value = False
        else:
            if ch.quest < add:
                ch.send("Sorry, you need {} quest points to set that flag.\n".
                        format(add))
                return

            ch.quest -= add
            value = True

        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "wear"):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to change object wear locations.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if not arg3:
            ch.send(
                "Wear location can be from: Finger, Neck, Body, Head, Legs, Hands, Arms,\n"
                "About, Waist, Wrist, Hold, Face.\n")
            return

        if game_utils.str_cmp(arg3, "finger"):
            value = merc.ITEM_WEAR_FINGER
        elif game_utils.str_cmp(arg3, "neck"):
            value = merc.ITEM_WEAR_NECK
        elif game_utils.str_cmp(arg3, "body"):
            value = merc.ITEM_WEAR_BODY
        elif game_utils.str_cmp(arg3, "head"):
            value = merc.ITEM_WEAR_HEAD
        elif game_utils.str_cmp(arg3, "legs"):
            value = merc.ITEM_WEAR_LEGS
        elif game_utils.str_cmp(arg3, "feet"):
            value = merc.ITEM_WEAR_FEET
        elif game_utils.str_cmp(arg3, "hands"):
            value = merc.ITEM_WEAR_HANDS
        elif game_utils.str_cmp(arg3, "arms"):
            value = merc.ITEM_WEAR_ARMS
        elif game_utils.str_cmp(arg3, "about"):
            value = merc.ITEM_WEAR_ABOUT
        elif game_utils.str_cmp(arg3, "waist"):
            value = merc.ITEM_WEAR_WAIST
        elif game_utils.str_cmp(arg3, "wrist"):
            value = merc.ITEM_WEAR_WRIST
        elif game_utils.str_cmp(arg3, "hold"):
            value = merc.ITEM_WIELD
        elif game_utils.str_cmp(arg3, "face"):
            value = merc.ITEM_WEAR_FACE
        else:
            ch.send(
                "Wear location can be from: Finger, Neck, Body, Head, Legs, Hands, Arms,\n"
                "About, Waist, Wrist, Hold, Face.\n")
            return

        if item.flags.take:
            value += 1

        if item.wear_flags == value or item.wear_flags == (value + 1):
            handler_game.act("But $p is already worn in that location!", ch,
                             item, None, merc.TO_CHAR)
            return

        if value != merc.ITEM_WIELD and value != (
                merc.ITEM_WIELD + 1) and item.item_type == merc.ITEM_WEAPON:
            handler_game.act("You can only HOLD a weapon.", ch, item, None,
                             merc.TO_CHAR)
            return

        if ch.quest < 20 and not (item.vnum == 30037 and item.wear_flags == 1):
            ch.send("It costs 20 quest points to change a location.\n")
            return

        if not (item.vnum == 30037 and item.wear_flags == 1):
            ch.quest -= 20

        item.wear_flags = value
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "replacespell"):
        if item.flags.relic and not ch.is_demon():
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if not arg3:
            ch.send(
                "Spell weapons: Acid, Dark, Holy, Vampiric, Flaming, Electrified, Poisonous.\n"
                "Spell affects: Blind, Seeinvis, Fly,Infravision, Invis, Passdoor, Protection,\n"
                "Sanct, Sneak, Shockshield,Fireshield, Iceshield, Acidshield, Seehidden.\n"
            )
            return

        spl_list = [("acid", 1, True), ("dark", 4, True), ("holy", 30, True),
                    ("vampiric", 34, True), ("flaming", 37, True),
                    ("electrified", 48, True), ("poisonous", 53, True),
                    ("infravision", 1, False), ("seeinvis", 2, False),
                    ("fly", 3, False), ("blind", 4, False),
                    ("invis", 5, False), ("passdoor", 6, False),
                    ("protection", 7, False), ("sanct", 8, False),
                    ("sneak", 9, False), ("shockshield", 10, False),
                    ("fireshield", 11, False), ("iceshield", 12, False),
                    ("acidshield", 13, False), ("seehidden", 60, False)]
        for (aa, bb, cc) in spl_list:
            if game_utils.str_cmp(arg3, aa):
                weapon = 0 if not cc else cc
                affect = 0 if not cc else cc
                break
        else:
            ch.send(
                "Spell weapons: Dark, Holy, Vampiric, Flaming, Electrified, Poisonous.\n"
                "Spell affects: Blind, Seeinvis, Fly,Infravision, Invis, Passdoor, Protection,\n"
                "Sanct, Sneak, Shockshield, Fireshield, Iceshield, Acidshield, Seehidden.\n"
            )
            return

        if item.item_type != merc.ITEM_WEAPON and weapon > 0:
            ch.send("You can only put that power on a weapon.\n")
            return
        elif item.item_type not in [merc.ITEM_WEAPON, merc.ITEM_ARMOR
                                    ] and affect > 0:
            ch.send(
                "You can only put that power on a weapon or a piece of armour.\n"
            )
            return

        if ch.quest < 50:
            ch.send(
                "It costs 50 quest points to create a spell weapon or affect.\n"
            )
            return

        if weapon > 0:
            if item.value[0] >= 1000:
                item.value[0] = ((item.value[0] // 1000) * 1000)
            else:
                item.value[0] = 0
            item.value[0] += weapon
        elif affect > 0:
            if item.item_type == merc.ITEM_WEAPON:
                if item.value[0] >= 1000:
                    item.value[0] -= ((item.value[0] // 1000) * 1000)
                item.value[0] += (affect * 1000)
            elif item.item_type == merc.ITEM_ARMOR:
                item.value[3] = affect

        ch.quest -= 50
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "spell"):
        if item.flags.relic and not ch.is_demon():
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if not arg3:
            ch.send(
                "Spell weapons: Acid, Dark, Holy, Vampiric, Flaming, Electrified, Poisonous.\n"
                "Spell affects: Blind, Seeinvis, Fly, Infravision, Invis, Passdoor, Protection,\n"
                "Sanct, Sneak, Shockshield, Fireshield, Iceshield, Acidshield, Seehidden.\n"
            )
            return

        spl_list = [("acid", 1, True), ("dark", 4, True), ("holy", 30, True),
                    ("vampiric", 34, True), ("flaming", 37, True),
                    ("electrified", 48, True), ("poisonous", 53, True),
                    ("infravision", 1, False), ("seeinvis", 2, False),
                    ("fly", 3, False), ("blind", 4, False),
                    ("invis", 5, False), ("passdoor", 6, False),
                    ("protection", 7, False), ("sanct", 8, False),
                    ("sneak", 9, False), ("shockshield", 10, False),
                    ("fireshield", 11, False), ("iceshield", 12, False),
                    ("acidshield", 13, False), ("seehidden", 60, False)]
        for (aa, bb, cc) in spl_list:
            if game_utils.str_cmp(arg3, aa):
                weapon = 0 if not cc else cc
                affect = 0 if not cc else cc
                break
        else:
            ch.send(
                "Spell weapons: Acid, Dark, Holy, Vampiric, Flaming, Electrified, Poisonous.\n"
                "Spell affects: Blind, Seeinvis, Fly, Infravision, Invis, Passdoor, Protection,\n"
                "Sanct, Sneak, Shockshield, Fireshield, Iceshield, Acidshield, Seehidden.\n"
            )
            return

        if item.item_type != merc.ITEM_WEAPON and weapon > 0:
            ch.send("You can only put that power on a weapon.\n")
            return
        elif item.item_type not in [merc.ITEM_WEAPON, merc.ITEM_ARMOR
                                    ] and affect > 0:
            ch.send(
                "You can only put that power on a weapon or a piece of armour.\n"
            )
            return

        if ch.quest < 50:
            ch.send(
                "It costs 50 quest points to create a spell weapon or affect.\n"
            )
            return

        if weapon > 0:
            if item.value[0] - ((item.value[0] // 1000) * 1000) != 0:
                ch.send(
                    "That item already has a spell weapon power.  If you wish to replace the \n"
                    "current spell power, use the format: quest <object> replacespell <spell>.\n"
                )
                return

            if item.value[0] >= 1000:
                item.value[0] = ((item.value[0] // 1000) * 1000)
            else:
                item.value[0] = 0
            item.value[0] += weapon
        elif affect > 0:
            if item.item_type == merc.ITEM_WEAPON:
                if item.value[0] >= 1000:
                    ch.send(
                        "That item already has a spell affect power.  If you wish to replace the \n"
                        "current spell power, use the format: quest <object> replacespell <spell>.\n"
                    )
                    return

                if item.value[0] >= 1000:
                    item.value[0] -= ((item.value[0] // 1000) * 1000)

                item.value[0] += (affect * 1000)
            elif item.item_type == merc.ITEM_ARMOR:
                if item.value[3] > 0:
                    ch.send(
                        "That item already has a spell affect power.  If you wish to replace the\n"
                        "current spell power, use the format: quest <object> replacespell <spell>.\n"
                    )
                    return

                item.value[3] = affect

        ch.quest -= 50
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "power"):
        if not arg3:
            ch.send("Please specify the amount of power.\n")
            return

        if item.item_type != merc.ITEM_WEAPON:
            ch.send("Only weapons have a spell power.\n")
            return

        if item.level >= 50:
            ch.send("This weapon can hold no more spell power.\n")
            return

        if value + item.level > 50:
            ch.send("You can only add {} more spell power to this weapon.\n".
                    format(50 - item.level))
            return

        if ch.quest < value:
            ch.send(
                "You don't have enough quest points to increase the spell power.\n"
            )
            return

        item.level += value
        if item.level < 0:
            item.level = 0

        if value < 1:
            value = 1

        ch.quest -= value
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "weight"):
        if item.weight < 2:
            ch.send("You cannot reduce the weight of this item any further.\n")
            return

        if ch.quest < 10:
            ch.send(
                "It costs 10 quest point to remove the weight of an object.\n")
            return

        item.weight = 1
        ch.quest -= 10
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "transporter"):
        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if item.spectype.is_set(merc.SITEM_TELEPORTER):
            ch.send("This item is already a transporter.\n")
            return
        elif item.spectype.is_set(merc.SITEM_TRANSPORTER):
            ch.send("This item is already a teleporter.\n")
            return
        elif item.spectype.is_set(merc.SITEM_SPELL):
            ch.send("This item is already a spell caster.\n")
            return
        elif item.spectype.is_set(merc.SITEM_OBJECT):
            ch.send("This item is already an object creator.\n")
            return
        elif item.spectype.is_set(merc.SITEM_MOBILE):
            ch.send("This item is already a creature creator.\n")
            return
        elif item.spectype.is_set(merc.SITEM_ACTION):
            ch.send("This item is already a commanding device.\n")
            return

        if ch.quest < 50:
            ch.send("It costs 50 quest point to create a transporter.\n")
            return

        item.spectype.set_bit(merc.SITEM_ACTIVATE)
        item.spectype.set_bit(merc.SITEM_TELEPORTER)
        item.specpower = ch.in_room.vnum
        ch.quest -= 50
        ch.send("Ok.\n")
        item.questmaker = ch.name
        item.chpoweron = "You transform into a fine mist and seep into the ground."
        item.victpoweron = "$n transforms into a fine mist and seeps into the ground."
        item.chpoweroff = "You seep up from the ground and reform your body."
        item.victpowreoff = "A fine mist seeps up from the ground and reforms into $n."
        item.chpoweruse = "You activate $p."
        item.victpoweruse = "$n activates $p."
        return

    if game_utils.str_cmp(arg2, "retransporter"):
        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if not item.spectype.is_set(merc.SITEM_TELEPORTER):
            ch.send("This item is not a transporter.\n")
            return
        elif item.spectype.is_set(merc.SITEM_TRANSPORTER):
            ch.send("This item is already a teleporter.\n")
            return
        elif item.spectype.is_set(merc.SITEM_SPELL):
            ch.send("This item is already a spell caster.\n")
            return
        elif item.spectype.is_set(merc.SITEM_OBJECT):
            ch.send("This item is already an object creator.\n")
            return
        elif item.spectype.is_set(merc.SITEM_MOBILE):
            ch.send("This item is already a creature creator.\n")
            return
        elif item.spectype.is_set(merc.SITEM_ACTION):
            ch.send("This item is already a commanding device.\n")
            return

        if ch.quest < 50:
            ch.send("It costs 50 quest point to create a transporter.\n")
            return

        item.spectype.set_bit(merc.SITEM_ACTIVATE)
        item.spectype.set_bit(merc.SITEM_TELEPORTER)
        item.specpower = ch.in_room.vnum
        ch.quest -= 50
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if not arg3:
        ch.send(
            "- - - - - - - - - - ----====[ QUEST ITEM COSTS ]====---- - - - - - - - - - -\n"
            "Create: Creates a new personalized object, costing between 10 and 50 QP.\n"
            "Name/Short/Long: Rename the object.  1 QP for all three.\n"
            "Protection: Sets AC on armour at 1 QP per point.\n"
            "Min/Max: Sets min/max damage on weapon at 1 QP per point.\n"
            "Weapon: Sets weapon type for 10 QP.\n"
            "Extra (add/remove): Glow(1/1), Hum(1/1), Invis(1/1), Anti-Good(1/10),\n"
            "                    Anti-Neutral(1/10), Anti-Evil(1/10), Loyal(10/1).\n"
            "Wear: Select location, costs 20 QP's.  Type 'quest <obj> wear' to see locations.\n"
            "Power: Spell power for spell weapons.  Costs 1 QP per power point.\n"
            "Spell: Spell weapons or affect.  Costs 50 QP.\n"
            "Transporter: Future transportation to that room.  Costs 50 QP.\n"
            "Special: Set activate/twist/press/pull flags.\n"
            "You-in/You-out/Other-in/Other-out: Renames for transporter actions.\n"
            "You-wear/You-remove/You-use: What you see when you wear/remove/use.\n"
            "Other-wear/Other-remove/Other-use: What others see when you wear/remove/use.\n"
            "Weight: Set objects weight to 1.  Costs 10 QP.\n"
            "Str, Dex, Int, Wis, Con... max =   3 each, at  20 quest points per +1 stat.\n"
            "Hp, Mana, Move............ max =  25 each, at   5 quest points per point.\n"
            "Hitroll, Damroll.......... max =   5 each, at  30 quest points per point.\n"
            "Ac........................ max = -25,      at  10 points per point.\n"
            "- - - - - - - - - - ----====[ QUEST ITEM COSTS ]====---- - - - - - - - - - -\n"
        )
        return

    if item.item_type != merc.ITEM_BOOK:
        if game_utils.str_cmp(arg2, ["hitroll", "hit"]):
            ch.oset_affect(item, value, merc.APPLY_HITROLL, True)
            return
        elif game_utils.str_cmp(arg2, ["damroll", "dam"]):
            ch.oset_affect(item, value, merc.APPLY_DAMROLL, True)
            return
        elif game_utils.str_cmp(arg2, ["armor", "ac"]):
            ch.oset_affect(item, value, merc.APPLY_AC, True)
            return
        elif game_utils.str_cmp(arg2, ["hitpoints", "hp"]):
            ch.oset_affect(item, value, merc.APPLY_HIT, True)
            return
        elif game_utils.str_cmp(arg2, "mana"):
            ch.oset_affect(item, value, merc.APPLY_MANA, True)
            return
        elif game_utils.str_cmp(arg2, ["move", "movement"]):
            ch.oset_affect(item, value, merc.APPLY_MOVE, True)
            return
        elif game_utils.str_cmp(arg2, ["str", "strength"]):
            ch.oset_affect(item, value, merc.APPLY_STR, True)
            return
        elif game_utils.str_cmp(arg2, ["dex", "dexterity"]):
            ch.oset_affect(item, value, merc.APPLY_DEX, True)
            return
        elif game_utils.str_cmp(arg2, ["int", "intelligence"]):
            ch.oset_affect(item, value, merc.APPLY_INT, True)
            return
        elif game_utils.str_cmp(arg2, ["wis", "wisdom"]):
            ch.oset_affect(item, value, merc.APPLY_WIS, True)
            return
        elif game_utils.str_cmp(arg2, ["con", "constitution"]):
            ch.oset_affect(item, value, merc.APPLY_CON, True)
            return

    if game_utils.str_cmp(arg2, "name"):
        value = 1

        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to rename objects.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if not item.quest.is_set(merc.QUEST_NAME) and (item.quest.is_set(
                merc.QUEST_SHORT) or item.quest.is_set(merc.QUEST_LONG)):
            item.quest.set_bit(merc.QUEST_NAME)
            value = 0
        elif item.quest.is_set(merc.QUEST_NAME):
            item.quest.rem_bit(merc.QUEST_SHORT)
            item.quest.rem_bit(merc.QUEST_LONG)
        else:
            item.quest.set_bit(merc.QUEST_NAME)

        if item.quest.is_set(merc.QUEST_FREENAME):
            value = 0
            item.quest.rem_bit(merc.QUEST_FREENAME)

        if ch.quest < value:
            ch.send("It costs 1 quest point to rename an object.\n")
            return

        if len(arg3) < 3:
            ch.send("Name should be at least 3 characters long.\n")
            return

        ch.quest -= value
        item.name = arg3.lower()
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "short"):
        value = 1

        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to rename objects.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if not item.quest.is_set(merc.QUEST_SHORT) and (item.quest.is_set(
                merc.QUEST_NAME) or item.quest.is_set(merc.QUEST_LONG)):
            item.quest.set_bit(merc.QUEST_SHORT)
            value = 0
        elif item.quest.is_set(merc.QUEST_SHORT):
            item.quest.rem_bit(merc.QUEST_NAME)
            item.quest.rem_bit(merc.QUEST_LONG)
        else:
            item.quest.set_bit(merc.QUEST_SHORT)

        if item.quest.is_set(merc.QUEST_FREENAME):
            value = 0
            item.quest.rem_bit(merc.QUEST_FREENAME)

        if ch.quest < value:
            ch.send("It costs 1 quest point to rename an object.\n")
            return

        if len(arg3) < 3:
            ch.send("Name should be at least 3 characters long.\n")
            return

        ch.quest -= value
        item.short_descr = arg3
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "long"):
        value = 1

        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to rename objects.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if not item.quest.is_set(merc.QUEST_LONG) and (item.quest.is_set(
                merc.QUEST_NAME) or item.quest.is_set(merc.QUEST_SHORT)):
            item.quest.set_bit(merc.QUEST_LONG)
            value = 0
        elif item.quest.is_set(merc.QUEST_LONG):
            item.quest.rem_bit(merc.QUEST_NAME)
            item.quest.rem_bit(merc.QUEST_SHORT)
        else:
            item.quest.set_bit(merc.QUEST_LONG)

        if item.quest.is_set(merc.QUEST_FREENAME):
            value = 0
            item.quest.rem_bit(merc.QUEST_FREENAME)

        if ch.quest < value:
            ch.send("It costs 1 quest point to rename an object.\n")
            return

        if len(arg3) < 3:
            ch.send("Name should be at least 3 characters long.\n")
            return

        ch.quest -= value
        item.description = arg3[0].upper() + arg3[1:]
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "ed"):
        argument, arg3 = game_utils.read_word(argument)

        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not allowed to rename objects.\n")
            return

        if item.quest.relic:
            ch.send("Not on a relic.\n")
            return

        if not argument:
            ch.send("Syntax: quest <object> ed <keyword> <string>\n")
            return

        edd = world_classes.ExtraDescrData(keyword=arg3,
                                           description=argument[0].upper() +
                                           argument[1:] + "\n")
        item.extra_descr.append(edd)
        ch.send("Ok.\n")
        item.questmaker = ch.name
        return

    if game_utils.str_cmp(arg2, "special"):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if not arg3:
            ch.send("Please enter ACTIVATE, TWIST, PRESS or PULL.\n")
            return

        arg_list = [("press", merc.SITEM_PRESS),
                    ("activate", merc.SITEM_ACTIVATE),
                    ("pull", merc.SITEM_PULL), ("twist", merc.SITEM_TWIST)]
        for (aa, bb) in arg_list:
            if game_utils.str_cmp(arg3, aa):
                item.spectype.rem_bit(merc.SITEM_ACTIVATE)
                item.spectype.rem_bit(merc.SITEM_TWIST)
                item.spectype.rem_bit(merc.SITEM_PRESS)
                item.spectype.rem_bit(merc.SITEM_PULL)
                item.spectype.set_bit(bb)
                break
        else:
            ch.send("Please enter ACTIVATE, TWIST, PRESS or PULL.\n")
            return

        ch.send("{} flag set.\n".format(arg3[0].upper() + arg3[1:].lower()))
        return

    if game_utils.str_cmp(arg2, ["you-out", "you-wear"]):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.quest.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if game_utils.str_cmp(
                arg2,
                "you-out") and not item.spectype.is_set(merc.SITEM_TELEPORTER):
            ch.send("That item is not a transporter.\n")
            return

        if game_utils.str_cmp(arg2, "you-wear") and item.spectype.is_set(
                merc.SITEM_TELEPORTER):
            ch.send("Not on a transporter.\n")
            return

        buf = item.chpoweron if item.chpoweron else ""

        if game_utils.str_cmp(arg3, "clear"):
            item.chpoweron = ""
        elif item.chpowron and buf:
            if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4:
                ch.send("Line too long.\n")
                return
            else:
                item.chpoweron = buf + "\n" + arg3
        else:
            item.chpoweron = arg3
        ch.send("Ok.\n")
    elif game_utils.str_cmp(arg2, ["other-out", "other-wear"]):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if game_utils.str_cmp(arg2, "other-out") and not item.spectype.is_set(
                merc.SITEM_TELEPORTER):
            ch.send("That item is not a transporter.\n")
            return

        if game_utils.str_cmp(arg2, "other-wear") and item.spectype.is_set(
                merc.SITEM_TELEPORTER):
            ch.send("Not on a transporter.\n")
            return

        buf = item.victpoweron if item.victpoweron else ""

        if game_utils.str_cmp(arg3, "clear"):
            item.victpoweron = ""
        elif item.victpoweron and buf:
            if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4:
                ch.send("Line too long.\n")
                return
            else:
                item.victpoweron = buf + "\n" + arg3
        else:
            item.victpoweron = arg3
        ch.send("Ok.\n")
    elif game_utils.str_cmp(arg2, ["you-in", "you-remove"]):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if game_utils.str_cmp(
                arg2,
                "you-in") and not item.spectype.is_set(merc.SITEM_TELEPORTER):
            ch.send("That item is not a transporter.\n")
            return

        if game_utils.str_cmp(arg2, "you-remove") and item.spectype.is_set(
                merc.SITEM_TELEPORTER):
            ch.send("Not on a transporter.\n")
            return

        buf = item.chpoweroff if item.chpoweroff else ""

        if game_utils.str_cmp(arg3, "clear"):
            item.chpoweroff = ""
        elif item.chpoweroff and buf:
            if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4:
                ch.send("Line too long.\n")
                return
            else:
                item.chpoweroff = buf + "\n" + arg3
        else:
            item.chpoweroff = arg3
        ch.send("Ok.\n")
    elif game_utils.str_cmp(arg2, ["other-in", "other-remove"]):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        if game_utils.str_cmp(arg2, "other-in") and not item.spectype.is_set(
                merc.SITEM_TELEPORTER):
            ch.send("That item is not a transporter.\n")
            return

        if game_utils.str_cmp(arg2, "other-remove") and item.spectype.is_set(
                merc.SITEM_TELEPORTER):
            ch.send("Not on a transporter.\n")
            return

        buf = item.victpoweroff if item.victpoweroff else ""

        if game_utils.str_cmp(arg3, "clear"):
            item.victpoweroff = ""
        elif item.victpoweroff and buf:
            if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4:
                ch.send("Line too long.\n")
                return
            else:
                item.victpoweroff = buf + "\n" + arg3
        else:
            item.victpoweroff = arg3
        ch.send("Ok.\n")
    elif game_utils.str_cmp(arg2, "you-use"):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        buf = item.chpoewruse if item.chpoweruse else ""

        if game_utils.str_cmp(arg3, "clear"):
            item.chpoweruse = ""
        elif item.chpoweruse and buf:
            if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4:
                ch.send("Line too long.\n")
                return
            else:
                item.chpoweruse = buf + "\n" + arg3
        else:
            item.chpoweruse = arg3
        ch.send("Ok.\n")
    elif game_utils.str_cmp(arg2, "other-use"):
        if not ch.extra.is_set(merc.EXTRA_TRUSTED):
            ch.send("You are not permitted to change an object in this way.\n")
            return

        if item.flags.relic:
            ch.send("Not on a relic.\n")
            return

        if item.item_type == merc.ITEM_BOOK:
            ch.send("Not on a book.\n")
            return

        buf = item.victpoweruse if item.victpoweruse else ""

        if game_utils.str_cmp(arg3, "clear"):
            item.victpoweruse = ""
        elif item.victpoweruse and buf:
            if len(buf) + len(arg3) >= settings.MAX_STRING_LENGTH - 4:
                ch.send("Line too long.\n")
                return
            else:
                item.victpoweruse = buf + "\n" + arg3
        else:
            item.victpoweruse = arg3
        ch.send("Ok.\n")