示例#1
0
def cmd_ostat(ch, argument):
    argument, arg = game_utils.read_word(argument)

    if not arg:
        ch.send("Ostat what?\n")
        return

    item = ch.get_item_world(arg)
    if not item:
        ch.send("Nothing like that in hell, earth, or heaven.\n")
        return

    nm1 = item.questmaker if item.questmaker else "None"
    nm2 = item.questowner if item.questowner else "None"

    buf = ["Name: {}.\n".format(item.name)]
    buf += "Vnum: {}.  Type: {}.\n".format(item.vnum, item.item_type)
    buf += "Short description: {}.\nLong description: {}\n".format(item.short_descr, item.description)
    buf += "Object creator: {}.  Object owner: {}.  Quest points: {}.\n".format(nm1, nm2, item.points)

    if not item.quest.empty():
        buf += "Quest selections:"

        quest_list = [(merc.QUEST_STR, "Str"), (merc.QUEST_DEX, "Dex"), (merc.QUEST_INT, "Int"), (merc.QUEST_WIS, "Wis"), (merc.QUEST_CON, "Con"),
                      (merc.QUEST_HIT, "Hp"), (merc.QUEST_MANA, "Mana"), (merc.QUEST_MOVE, "Move"), (merc.QUEST_HITROLL, "Hit"),
                      (merc.QUEST_DAMROLL, "Dam"), (merc.QUEST_AC, "Ac")]
        for (aa, bb) in quest_list:
            if item.quest.is_set(aa):
                buf += " " + bb
        buf += ".\n"

    buf += "Wear bits: {}.  Extra bits: {}.\n".format(item.equips_to_names, item.item_attribute_names)
    buf += "Weight: {}/{}.\n".format(item.weight, item.get_weight())
    buf += "Cost: {}.  Timer: {}.  Level: {}.\n".format(item.cost, item.timer, item.level)
    buf += "In room: {}.  In object: {}.  Carried by: {}.\n".format(0 if not item.in_room else item.in_room.vnum,
                                                                    "(none)" if not item.in_item else item.in_item.short_descr,
                                                                    "(none)" if not item.in_living else item.in_living.name)
    buf += "Values: {}.\n".format([v for v in item.value])

    if item.extra_descr:
        buf += "Extra description keywords: '"

        extra_descr = list(item.extra_descr)
        extra_descr.extend(item.extra_descr)
        for edd in extra_descr:
            buf += edd.keyword + " "
        buf += "'\n"

    affected = list(item.affected)
    for paf in affected:
        buf += "Affects {} by {}.\n".format(merc.affect_loc_name(paf.location), paf.modifier)
    ch.send("".join(buf))
示例#2
0
def do_affects(ch, argument):
    paf_last = None
    if ch.affected:
        ch.send("You are affected by the following spells:\n")
        for paf in ch.affected:
            if paf_last and paf.type == paf_last.type:
                if ch.level >= 20:
                    ch.send("                      ")
                else:
                    continue
            else:
                ch.send("Spell: %-15s" % paf.type.name)
            if ch.level >= 20:
                ch.send(": modifies %s by %d " % (merc.affect_loc_name(paf.location), paf.modifier))
            if paf.duration == -1:
                ch.send("permanently")
            else:
                ch.send("for %d hours" % paf.duration)
            ch.send("\n")
            paf_last = paf
    else:
        ch.send("You are not affected by any spells.\n")
示例#3
0
def do_affects(ch, argument):
    paf_last = None
    if ch.affected:
        ch.send("You are affected by the following spells:\n")
        for paf in ch.affected:
            if paf_last and paf.type == paf_last.type:
                if ch.level >= 20:
                    ch.send("                      ")
                else:
                    continue
            else:
                ch.send("Spell: %-15s" % paf.type.name)
            if ch.level >= 20:
                ch.send(": modifies %s by %d " %
                        (merc.affect_loc_name(paf.location), paf.modifier))
            if paf.duration == -1:
                ch.send("permanently")
            else:
                ch.send("for %d hours" % paf.duration)
            ch.send("\n")
            paf_last = paf
    else:
        ch.send("You are not affected by any spells.\n")
示例#4
0
def do_mstat(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Stat whom?\n")
        return
    victim = ch.get_char_world(arg)
    if not victim:
        ch.send("They aren't here.\n")
        return
    ch.send("Name: %s\n" % victim.name)
    ch.send(
        "Vnum: %d  Format: %s  Race: %s  Group: %d  Sex: %s  Room: %d\n" %
        (0 if not victim.is_npc() else victim.vnum,
         "pc" if not victim.is_npc() else "new", victim.race.name, 0 if
         not victim.is_npc() else victim.group, tables.sex_table[victim.sex],
         0 if not victim.in_room else victim.in_room.vnum))

    if victim.is_npc():
        ch.send("Count: %d  Killed: %d\n" % (victim.count, victim.killed))
    ch.send(
        "Str: %d(%d)  Int: %d(%d)  Wis: %d(%d)  Dex: %d(%d)  Con: %d(%d)\n" %
        (victim.perm_stat[merc.STAT_STR], victim.stat(merc.STAT_STR),
         victim.perm_stat[merc.STAT_INT], victim.stat(merc.STAT_INT),
         victim.perm_stat[merc.STAT_WIS], victim.stat(merc.STAT_WIS),
         victim.perm_stat[merc.STAT_DEX], victim.stat(merc.STAT_DEX),
         victim.perm_stat[merc.STAT_CON], victim.stat(merc.STAT_CON)))
    ch.send(
        "Hp: %d/%d  Mana: %d/%d  Move: %d/%d  Practices: %d\n" %
        (victim.hit, victim.max_hit, victim.mana, victim.max_mana, victim.move,
         victim.max_move, 0 if victim.is_npc() else victim.practice))
    ch.send("Lv: %d  Class: %s  Align: %d  Gold: %ld  Silver: %ld  Exp: %d\n" %
            (victim.level, "mobile" if victim.is_npc() else victim.guild.name,
             victim.alignment, victim.gold, victim.silver, victim.exp))
    ch.send("Armor: pierce: %d  bash: %d  slash: %d  magic: %d\n" %
            (state_checks.GET_AC(victim, merc.AC_PIERCE),
             state_checks.GET_AC(victim, merc.AC_BASH),
             state_checks.GET_AC(victim, merc.AC_SLASH),
             state_checks.GET_AC(victim, merc.AC_EXOTIC)))
    ch.send(
        "Hit: %d  Dam: %d  Saves: %d  Size: %s  Position: %s  Wimpy: %d\n" %
        (state_checks.GET_HITROLL(victim), state_checks.GET_DAMROLL(victim),
         victim.saving_throw, tables.size_table[victim.size],
         tables.position_table[victim.position].name, victim.wimpy))
    if victim.is_npc():
        ch.send(
            "Damage: %dd%d  Message:  %s\n" %
            (victim.damage[merc.DICE_NUMBER], victim.damage[merc.DICE_TYPE],
             const.attack_table[victim.dam_type].noun))
    ch.send("Fighting: %s\n" %
            (victim.fighting.name if victim.fighting else "(none)"))
    if not victim.is_npc():
        ch.send("Thirst: %d  Hunger: %d  Full: %d  Drunk: %d\n" %
                (victim.condition[merc.COND_THIRST],
                 victim.condition[merc.COND_HUNGER],
                 victim.condition[merc.COND_FULL],
                 victim.condition[merc.COND_DRUNK]))
    ch.send("Carry number: %d  Carry weight: %ld\n" %
            (victim.carry_number, state_checks.get_carry_weight(victim) // 10))
    if not victim.is_npc():
        ch.send("Age: %d  Played: %d  Last Level: %d  Timer: %d\n" %
                (victim.get_age(),
                 (int)(victim.played + time.time() - victim.logon) // 3600,
                 victim.last_level, victim.timer))
    ch.send("Act: %s\n" % repr(victim.act))
    if victim.comm:
        ch.send("Comm: %s\n" % repr(victim.comm))
    if victim.is_npc() and victim.off_flags:
        ch.send("Offense: %s\n" % repr(victim.off_flags))
    if victim.imm_flags:
        ch.send("Immune: %s\n" % repr(victim.imm_flags))
    if victim.res_flags:
        ch.send("Resist: %s\n" % repr(victim.res_flags))
    if victim.vuln_flags:
        ch.send("Vulnerable: %s\n" % repr(victim.vuln_flags))
    ch.send("Form: %s\nParts: %s\n" % (repr(victim.form), repr(victim.parts)))
    if victim.affected_by:
        ch.send("Affected by %s\n" % repr(victim.affected_by))
    ch.send("Master: %s  Leader: %s  Pet: %s\n" %
            (victim.master.name if victim.master else "(none)",
             victim.leader.name if victim.leader else "(none)",
             victim.pet.name if victim.pet else "(none)"))
    ch.send("Short description: %s\nLong  description: %s" %
            (victim.short_descr,
             victim.long_descr if victim.long_descr else "(none)\n"))
    if victim.is_npc() and victim.spec_fun is not None:
        ch.send("Npc has special procedure %s.\n" % victim.spec_fun.__name__)

    for paf in victim.affected:
        ch.send(
            "Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n"
            % (paf.type, merc.affect_loc_name(paf.location), paf.modifier,
               paf.duration, merc.affect_bit_name(paf.bitvector), paf.level))
示例#5
0
def do_ostat(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Stat what?\n")
        return
    obj = ch.get_item_world(arg)
    if not obj:
        ch.send("Nothing like that in hell, earth, or heaven.\n")
        return

    ch.send("Name(s): %s\n" % obj.name)
    ch.send("Vnum: %d  Format: %s  Type: %s  Resets: %d\n" %
            (obj.vnum, "new" if obj.new_format else "old", obj.item_type,
             obj.reset_num))
    ch.send("Short description: %s\nLong description: %s\n" %
            (obj.short_descr, obj.description))
    ch.send("Wear bits: %s\nExtra bits: %s\n" %
            (obj.equips_to_names, obj.item_attribute_names))
    ch.send(
        "Number: 1/%d  Weight: %d/%d/%d (10th pounds)\n" %
        (obj.get_number(), obj.weight, obj.get_weight(), obj.true_weight()))
    ch.send("Level: %d  Cost: %d  Condition: %d  Timer: %d\n" %
            (obj.level, obj.cost, obj.condition, obj.timer))

    ch.send(
        "In room: %d  In object: %s  Carried by: %s\n" %
        (0 if not obj.in_room else obj.in_room.vnum,
         "(none)" if not obj.in_item else obj.in_item.short_descr,
         "(noone)" if not obj.in_living else
         "someone" if not ch.can_see(obj.in_living) else obj.in_living.name))
    ch.send("Values: %s\n" % [v for v in obj.value])
    # now give out vital statistics as per identify

    if obj.item_type == merc.ITEM_SCROLL \
            or obj.item_type == merc.ITEM_POTION \
            or obj.item_type == merc.ITEM_PILL:
        ch.send("Level %d spells of:", obj.value[0])
        for value in obj.value:
            if value and value in const.skill_table:
                ch.send(" '%s'" % const.skill_table[value].name)

        ch.send(".\n")
    elif obj.item_type == merc.ITEM_WAND \
            or obj.item_type == merc.ITEM_STAFF:
        ch.send("Has %d(%d) charges of level %d" %
                (obj.value[1], obj.value[2], obj.value[0]))

        if obj.value[3] and obj.value[3] in const.skill_table:
            ch.send(" '%s'" % const.skill_table[obj.value[3]].name)
        ch.send(".\n")
    elif obj.item_type == merc.ITEM_DRINK_CON:
        ch.send("It holds %s-colored %s.\n" %
                (const.liq_table[obj.value[2]].color,
                 const.liq_table[obj.value[2]].name))
    elif obj.item_type == merc.ITEM_WEAPON:
        ch.send("Weapon type is ")
        weapon_type = {
            merc.WEAPON_EXOTIC: "exotic",
            merc.WEAPON_SWORD: "sword",
            merc.WEAPON_DAGGER: "dagger",
            merc.WEAPON_SPEAR: "spear/staff",
            merc.WEAPON_MACE: "mace/club",
            merc.WEAPON_AXE: "axe",
            merc.WEAPON_FLAIL: "flail",
            merc.WEAPON_WHIP: "whip",
            merc.WEAPON_POLEARM: "polearm"
        }
        if obj.value[0] not in weapon_type:
            ch.send("unknown\n")
        else:
            ch.send(const.weapon_table[obj.value[0]] + "\n")
        if obj.new_format:
            ch.send("Damage is %dd%d (average %d)\n" %
                    (obj.value[1], obj.value[2],
                     (1 + obj.value[2]) * obj.value[1] // 2))
        else:
            ch.send("Damage is %d to %d (average %d)\n" %
                    (obj.value[1], obj.value[2],
                     (obj.value[1] + obj.value[2]) // 2))
        ch.send("Damage noun is %s.\n" %
                (const.attack_table[obj.value[3]].noun
                 if obj.value[3] in const.attack_table else "undefined"))
        if obj.value[4] > 0:  # weapon flags
            ch.send("Weapons flags: %s\n" % merc.weapon_bit_name(obj.value[4]))
    elif obj.item_type == merc.ITEM_ARMOR:
        ch.send(
            "Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n" %
            (obj.value[0], obj.value[1], obj.value[2], obj.value[3]))
    elif obj.item_type == merc.ITEM_CONTAINER:
        ch.send("Capacity: %d#  Maximum weight: %d#  flags: %s\n" %
                (obj.value[0], obj.value[3], merc.cont_bit_name(obj.value[1])))
        if obj.value[4] != 100:
            ch.send("Weight multiplier: %d%%\n" % obj.value[4])

    if obj.extra_descr or obj.extra_descr:
        ch.send("Extra description keywords: '")
        extra_descr = list(obj.extra_descr)
        extra_descr.extend(obj.extra_descr)
        for ed in extra_descr:
            ch.send(ed.keyword)
            ch.send(" ")
        ch.send("'\n")

    affected = list(obj.affected)
    #TODO: This may not be necessary at all.
    #if not obj.enchanted:
    #    objTemplate = merc.itemTemplate[obj.vnum]
    #    affected.extend(objTemplate.affected)
    for paf in affected:
        ch.send("Affects %s by %d, level %d" %
                (merc.affect_loc_name(paf.location), paf.modifier, paf.level))
        if paf.duration > -1:
            ch.send(", %d hours.\n" % paf.duration)
        else:
            ch.send(".\n")
        if paf.bitvector:
            if paf.where == merc.TO_AFFECTS:
                ch.send("Adds %s affect.\n" %
                        merc.affect_bit_name(paf.bitvector))
            elif paf.where == merc.TO_WEAPON:
                ch.send("Adds %s weapon flags.\n" %
                        merc.weapon_bit_name(paf.bitvector))
            elif paf.where == merc.TO_OBJECT:
                ch.send("Adds %s object flag.\n" %
                        merc.extra_bit_name(paf.bitvector))
            elif paf.where == merc.TO_IMMUNE:
                ch.send("Adds immunity to %s.\n" %
                        merc.imm_bit_name(paf.bitvector))
            elif paf.where == merc.TO_RESIST:
                ch.send("Adds resistance to %s.\n" %
                        merc.imm_bit_name(paf.bitvector))
            elif paf.where == merc.TO_VULN:
                ch.send("Adds vulnerability to %s.\n" %
                        merc.imm_bit_name(paf.bitvector))
            else:
                ch.send("Unknown bit %d: %d\n" % paf.where, paf.bitvector)
示例#6
0
def do_mstat(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Stat whom?\n")
        return
    victim = ch.get_char_world(arg)
    if not victim:
        ch.send("They aren't here.\n")
        return
    ch.send("Name: %s\n" % victim.name)
    ch.send("Vnum: %d  Format: %s  Race: %s  Group: %d  Sex: %s  Room: %d\n" % (
        0 if not victim.is_npc() else victim.vnum,
        "pc" if not victim.is_npc() else "new",
        victim.race.name,
        0 if not victim.is_npc() else victim.group, tables.sex_table[victim.sex],
        0 if not victim.in_room else victim.in_room.vnum ))

    if victim.is_npc():
        ch.send("Count: %d  Killed: %d\n" % (victim.count, victim.killed))
    ch.send("Str: %d(%d)  Int: %d(%d)  Wis: %d(%d)  Dex: %d(%d)  Con: %d(%d)\n" % (
        victim.perm_stat[merc.STAT_STR], victim.stat(merc.STAT_STR),
        victim.perm_stat[merc.STAT_INT], victim.stat(merc.STAT_INT),
        victim.perm_stat[merc.STAT_WIS], victim.stat(merc.STAT_WIS),
        victim.perm_stat[merc.STAT_DEX], victim.stat(merc.STAT_DEX),
        victim.perm_stat[merc.STAT_CON], victim.stat(merc.STAT_CON)))
    ch.send("Hp: %d/%d  Mana: %d/%d  Move: %d/%d  Practices: %d\n" % (
        victim.hit, victim.max_hit,
        victim.mana, victim.max_mana,
        victim.move, victim.max_move,
        0 if victim.is_npc() else victim.practice ))
    ch.send("Lv: %d  Class: %s  Align: %d  Gold: %ld  Silver: %ld  Exp: %d\n" % (
        victim.level,
        "mobile" if victim.is_npc() else victim.guild.name,
        victim.alignment, victim.gold, victim.silver, victim.exp ))
    ch.send("Armor: pierce: %d  bash: %d  slash: %d  magic: %d\n" % (
        state_checks.GET_AC(victim, merc.AC_PIERCE), state_checks.GET_AC(victim, merc.AC_BASH),
        state_checks.GET_AC(victim, merc.AC_SLASH), state_checks.GET_AC(victim, merc.AC_EXOTIC)))
    ch.send("Hit: %d  Dam: %d  Saves: %d  Size: %s  Position: %s  Wimpy: %d\n" % (
        state_checks.GET_HITROLL(victim), state_checks.GET_DAMROLL(victim), victim.saving_throw,
        tables.size_table[victim.size], tables.position_table[victim.position].name,
        victim.wimpy ))
    if victim.is_npc():
        ch.send("Damage: %dd%d  Message:  %s\n" % (
            victim.damage[merc.DICE_NUMBER], victim.damage[merc.DICE_TYPE],
            const.attack_table[victim.dam_type].noun))
    ch.send("Fighting: %s\n" % (victim.fighting.name if victim.fighting else "(none)" ))
    if not victim.is_npc():
        ch.send("Thirst: %d  Hunger: %d  Full: %d  Drunk: %d\n" % (
            victim.condition[merc.COND_THIRST],
            victim.condition[merc.COND_HUNGER],
            victim.condition[merc.COND_FULL],
            victim.condition[merc.COND_DRUNK] ))
    ch.send("Carry number: %d  Carry weight: %ld\n" % (victim.carry_number, state_checks.get_carry_weight(victim) // 10 ))
    if not victim.is_npc():
        ch.send("Age: %d  Played: %d  Last Level: %d  Timer: %d\n" % (victim.get_age(),
                (int)(victim.played + time.time() - victim.logon) // 3600,
                victim.last_level, victim.timer))
    ch.send("Act: %s\n" %repr(victim.act))
    if victim.comm:
        ch.send("Comm: %s\n" % repr(victim.comm))
    if victim.is_npc() and victim.off_flags:
        ch.send("Offense: %s\n" % repr(victim.off_flags))
    if victim.imm_flags:
        ch.send("Immune: %s\n" % repr(victim.imm_flags))
    if victim.res_flags:
        ch.send("Resist: %s\n" % repr(victim.res_flags))
    if victim.vuln_flags:
        ch.send("Vulnerable: %s\n" % repr(victim.vuln_flags))
    ch.send("Form: %s\nParts: %s\n" % (repr(victim.form), repr(victim.parts)))
    if victim.affected_by:
        ch.send("Affected by %s\n" % repr(victim.affected_by))
    ch.send("Master: %s  Leader: %s  Pet: %s\n" % (
        victim.master.name if victim.master else "(none)",
        victim.leader.name if victim.leader else "(none)",
        victim.pet.name if victim.pet else "(none)"))
    ch.send("Short description: %s\nLong  description: %s" % (  victim.short_descr,
                                                                victim.long_descr if victim.long_descr else "(none)\n" ))
    if victim.is_npc() and victim.spec_fun is not None:
        ch.send("Npc has special procedure %s.\n" % victim.spec_fun.__name__)

    for paf in victim.affected:
        ch.send("Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n" % (
            paf.type,
            merc.affect_loc_name(paf.location),
            paf.modifier,
            paf.duration,
            merc.affect_bit_name(paf.bitvector),
            paf.level))
示例#7
0
def cmd_mstat(ch, argument):
    argument, arg = game_utils.read_word(argument)

    if not arg:
        ch.send("Mstat whom?\n")
        return

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

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

    buf = ["Name: {}\n".format(victim.name)]
    buf += "Vnum: {}.  Sex: {}.  Room: {}.\n".format(0 if not victim.is_npc() else victim.vnum, tables.sex_table[victim.sex],
                                                     0 if not victim.in_room else victim.in_room.vnum)
    buf += "Str: {}.  Int: {}.  Wis: {}.  Dex: {}.  Con: {}.\n".format(victim.stat(merc.STAT_STR), victim.stat(merc.STAT_INT),
                                                                       victim.stat(merc.STAT_WIS), victim.stat(merc.STAT_DEX),
                                                                       victim.stat(merc.STAT_CON))
    buf += "Hp: {}/{}.  Mana: {}/{}.  Move: {}/{}.  Primal: {}.\n".format(victim.hit, victim.max_hit, victim.mana, victim.max_mana,
                                                                          victim.move, victim.max_move, victim.practice)
    buf += "Lv: {}.  Align: {}.  AC: {}.  Gold: {}.  Exp: {}.\n".format(victim.level, victim.alignment, victim.armor, victim.gold, victim.exp)
    buf += "Hitroll: {}.  Damroll: {}.  Position: {}.  Wimpy: {}.\n".format(victim.hitroll, victim.damroll, tables.position_table[victim.position].name,
                                                                            victim.wimpy)
    buf += "Fighting: {}.\n".format(victim.fighting.name if victim.fighting else "(none)")

    if not victim.is_npc():
        buf += "Saving throw: {}.\n".format(victim.saving_throw)

        if victim.is_vampire() or victim.is_werewolf():
            buf += "Clan: {}. ".format(victim.clan if victim.clan else "None")
            buf += "Rage: {}. ".format(victim.powers[merc.UNI_RAGE])

            if victim.is_vampire():
                buf += "Beast: {}. ".format(victim.beast)
                buf += "Blood: {}.".format(victim.blood)
            buf += "\n"

        if victim.is_demon() or victim.special.is_set(merc.SPC_CHAMPION):
            if victim.special.is_set(merc.SPC_CHAMPION):
                buf += "Lord: {}. ".format(victim.lord if victim.lord else "None")

            buf += "Demonic armor: {} pieces. ".format(victim.powers[merc.DEMON_POWER])
            buf += "Power: {} ({}).\n".format(victim.powers[merc.DEMON_CURRENT], victim.powers[merc.DEMON_TOTAL])

    buf += "Carry number: {}.  Carry weight: {}.\n".format(victim.carry_number, state_checks.get_carry_weight(victim))
    buf += "Age: {}.  Played: {}.  Timer: {}.  Act: {}.\n".format(victim.get_age(), victim.played, victim.timer, repr(victim.act))
    buf += "Master: {}.  Leader: {}.  Affected by: {}.\n".format(instance.characters[victim.master].name if victim.master else "(none)",
                                                                 victim.leader.name if victim.leader else "(none)", repr(victim.affected_by))
    buf += "Short description: {}.\nLong  description: {}".format(victim.short_descr, victim.long_descr if victim.long_descr else "(none).\n")

    if victim.is_npc() and victim.spec_fun:
        buf += "Mobile has spec fun.\n"

    for paf in victim.affected:
        buf += "Spell: '{}' modifies {} by {} for {} hours with bits {}.\n".format(paf.type, merc.affect_loc_name(paf.location), paf.modifier,
                                                                                   paf.duration, merc.affect_bit_name(paf.bitvector))
    ch.send("".join(buf))
示例#8
0
def obj_score(ch, item):
    buf = ["You are {}.\n".format(item.short_descr)]

    extra = item.item_attribute_names + " " + item.item_restriction_names
    buf += "Type {}, Extra flags {}.\n".format(item.item_type, extra)
    buf += "You weigh {} pounds and are worth {} gold coins.\n".format(
        item.weight, item.cost)

    if item.questmaker and item.questowner:
        buf += "You were created by {}, and are owned by {}.\n".format(
            item.questmaker, item.questowner)
    elif item.questmaker:
        buf += "You were created by {}.\n".format(item.questmaker)
    elif item.questowner:
        buf += "You are owned by {}.\n".format(item.questowner)

    itype = item.item_type
    if itype in [merc.ITEM_PILL, merc.ITEM_SCROLL, merc.ITEM_POTION]:
        buf += "Level {} spells of:".format(item.value[0])

        for i in item.value:
            if 0 <= i < merc.MAX_SKILL:
                buf += " '" + const.skill_table[i].name + "'"
        buf += ".\n"
    elif itype == merc.ITEM_QUEST:
        buf += "Your quest point value is {}.\n".format(item.value[0])
    elif itype in [merc.ITEM_WAND, merc.ITEM_STAFF]:
        buf += "You have {}({}) charges of level {}".format(
            item.value[1], item.value[2], item.value[0])

        if 0 <= item.value[3] <= merc.MAX_SKILL:
            buf += " '" + const.skill_table[item.value[3]].name + "'"
        buf += ".\n"
    elif itype == merc.ITEM_WEAPON:
        buf += "You inflict {} to {} damage in combat (average {}).\n".format(
            item.value[1], item.value[2], (item.value[1] + item.value[2]) // 2)

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

        if itemtype > 0:
            level_list = [(10, " minor"), (20, " lesser"), (30, "n average"),
                          (40, " greater"), (50, " major"), (51, " supreme")]
            for (aa, bb) in level_list:
                if item.level < aa:
                    buf += "You are a{} spell weapon.\n".format(bb)
                    break
            else:
                buf += "You are an ultimate spell weapon.\n"

            if itemtype == 1:
                buf += "You are dripping with corrosive acid.\n"
            elif itemtype == 4:
                buf += "You radiates an aura of darkness.\n"
            elif itemtype == 30:
                buf += "You are the bane of all evil.\n"
            elif itemtype == 34:
                buf += "You drink the souls of your victims.\n"
            elif itemtype == 37:
                buf += "You have been tempered in hellfire.\n"
            elif itemtype == 48:
                buf += "You crackle with sparks of lightning.\n"
            elif itemtype == 53:
                buf += "You are dripping with a dark poison.\n"
            else:
                buf += "You have been imbued with the power of {}.\n".format(
                    const.skill_table[itemtype].name)

        itemtype = item.value[0] // 1000 if item.value[0] >= 1000 else 0
        if itemtype > 0:
            if itemtype == 4:
                buf += "You radiate an aura of darkness.\n"
            elif itemtype in [27, 2]:
                buf += "You a allow your wielder to see invisible things.\n"
            elif itemtype in [39, 3]:
                buf += "You grant your wielder the power of flight.\n"
            elif itemtype in [45, 1]:
                buf += "You allow your wielder to see in the dark.\n"
            elif itemtype in [46, 5]:
                buf += "You render your wielder invisible to the human eye.\n"
            elif itemtype in [52, 6]:
                buf += "You allow your wielder to walk through solid doors.\n"
            elif itemtype in [54, 7]:
                buf += "You protect your wielder from evil.\n"
            elif itemtype in [57, 8]:
                buf += "You protect your wielder in combat.\n"
            elif itemtype == 9:
                buf += "You allow your wielder to walk in complete silence.\n"
            elif itemtype == 10:
                buf += "You surround your wielder with a shield of lightning.\n"
            elif itemtype == 11:
                buf += "You surround your wielder with a shield of fire.\n"
            elif itemtype == 12:
                buf += "You surround your wielder with a shield of ice.\n"
            elif itemtype == 13:
                buf += "You surround your wielder with a shield of acid.\n"
            elif itemtype == 14:
                buf += "You protect your wielder from clan DarkBlade guardians.\n"
            elif itemtype == 15:
                buf += "You surround your wielder with a shield of chaos.\n"
            elif itemtype == 16:
                buf += "You regenerate the wounds of your wielder.\n"
            elif itemtype == 17:
                buf += "You enable your wielder to move at supernatural speed.\n"
            elif itemtype == 18:
                buf += "You can slice through armour without difficulty.\n"
            elif itemtype == 19:
                buf += "You protect your wielder from player attacks.\n"
            elif itemtype == 20:
                buf += "You surround your wielder with a shield of darkness.\n"
            elif itemtype == 21:
                buf += "You grant your wielder superior protection.\n"
            elif itemtype == 22:
                buf += "You grant your wielder supernatural vision.\n"
            elif itemtype == 23:
                buf += "You make your wielder fleet-footed.\n"
            elif itemtype == 24:
                buf += "You conceal your wielder from sight.\n"
            elif itemtype == 25:
                buf += "You invoke the power of your wielders beast.\n"
            else:
                buf += "You are bugged...please report it.\n"
    elif itype == merc.ITEM_ARMOR:
        buf += "Your armor class is {}.\n".format(item.value[0])

        if item.value[3] > 0:
            if item.value[3] == 4:
                buf += "You radiate an aura of darkness.\n"
            elif item.value[3] in [27, 2]:
                buf += "You allow your wearer to see invisible things.\n"
            elif item.value[3] in [39, 3]:
                buf += "You grant your wearer the power of flight.\n"
            elif item.value[3] in [45, 1]:
                buf += "You allow your wearer to see in the dark.\n"
            elif item.value[3] in [46, 5]:
                buf += "You allow your wearer invisible to the human eye.\n"
            elif item.value[3] in [52, 6]:
                buf += "You allow your wearer to walk through solid doors.\n"
            elif item.value[3] in [54, 7]:
                buf += "You protect your wearer from evil.\n"
            elif item.value[3] in [57, 8]:
                buf += "You protect your wearer in combat.\n"
            elif item.value[3] == 9:
                buf += "You allow your wearer to walk in complete silence.\n"
            elif item.value[3] == 10:
                buf += "You surround your wearer with a shield of lightning.\n"
            elif item.value[3] == 11:
                buf += "You surround your wearer with a shield of fire.\n"
            elif item.value[3] == 12:
                buf += "You surround your wearer with a shield of ice.\n"
            elif item.value[3] == 13:
                buf += "You surround your wearer with a shield of acid.\n"
            elif item.value[3] == 14:
                buf += "You protect your wearer from clan DarkBlade guardians.\n"
            elif item.value[3] == 15:
                buf += "You surround your wearer with a shield of chaos.\n"
            elif item.value[3] == 16:
                buf += "You regnerate the wounds of your wearer.\n"
            elif item.value[3] == 17:
                buf += "You enable your wearer to move at supernatural speed.\n"
            elif item.value[3] == 18:
                buf += "You can slice through armour without difficulty.\n"
            elif item.value[3] == 19:
                buf += "You protect your wearer from player attacks.\n"
            elif item.value[3] == 20:
                buf += "You surround your wearer with a shield of darkness.\n"
            elif item.value[3] == 21:
                buf += "You grant your wearer superior protection.\n"
            elif item.value[3] == 22:
                buf += "You grant your wearer supernatural vision.\n"
            elif item.value[3] == 23:
                buf += "You make your wearer fleet-footed.\n"
            elif item.value[3] == 24:
                buf += "You conceal your wearer from sight.\n"
            elif item.value[3] == 25:
                buf += "You invoke the power of your wearers beast.\n"
            else:
                buf += "You are bugged...please report it.\n"

    for aff in item.affected:
        if aff.location != merc.APPLY_NONE and aff.modifier != 0:
            buf += "You affect {} by {}.\n".format(
                merc.affect_loc_name(aff.location), aff.modifier)
    ch.send("".join(buf))
示例#9
0
def cmd_score(ch, argument):
    if not ch.is_npc() and (ch.extra.is_set(merc.EXTRA_OSWITCH)
                            or ch.head.is_set(merc.LOST_HEAD)):
        obj_score(ch, ch.chobj)
        return

    buf = [
        "You are {}{}.  You have been playing for {} hours.\n".format(
            ch.name, "" if ch.is_npc() else ch.title, (ch.get_age() - 17) * 2)
    ]

    if not ch.is_npc():
        buf += ch.other_age(is_self=True)

    if ch.trust != ch.level:
        buf += "You are trusted at level {}.\n".format(ch.trust)

    buf += "You have {}/{} hit, {}/{} mana, {}/{} movement, {} primal energy.\n".format(
        ch.hit, ch.max_hit, ch.mana, ch.max_mana, ch.move, ch.max_move,
        ch.practice)
    buf += "You are carrying {}/{} items with weight {}/{} kg.\n".format(
        ch.carry_number, ch.can_carry_n(), ch.carry_weight, ch.can_carry_w())
    buf += "Str: {}  Int: {}  Wis: {}  Dex: {}  Con: {}.\n".format(
        ch.stat(merc.STAT_STR), ch.stat(merc.STAT_INT), ch.stat(merc.STAT_WIS),
        ch.stat(merc.STAT_DEX), ch.stat(merc.STAT_CON))
    buf += "You have scored {} exp, and have {} gold coins.\n".format(
        ch.exp, ch.gold)

    if not ch.is_npc() and (ch.is_demon()
                            or ch.special.is_set(merc.SPC_CHAMPION)):
        buf += "You have {} out of {} points of demonic power stored.\n".format(
            ch.powers[merc.DEMON_CURRENT], ch.powers[merc.DEMON_TOTAL])

    buf += "Autoexit: {}.  Autoloot: {}.  Autosac: {}.\n".format(
        "yes" if
        (not ch.is_npc() and ch.act.is_set(merc.PLR_AUTOEXIT)) else "no",
        "yes" if
        (not ch.is_npc() and ch.act.is_set(merc.PLR_AUTOLOOT)) else "no",
        "yes" if
        (not ch.is_npc() and ch.act.is_set(merc.PLR_AUTOSAC)) else "no")
    buf += "Wimpy set to {} hit points.\n".format(ch.wimpy)

    pos_list = [
        (merc.POS_DEAD, "DEAD!!"), (merc.POS_MORTAL, "mortally wounded."),
        (merc.POS_INCAP, "incapacitated."), (merc.POS_STUNNED, "stunned."),
        (merc.POS_SLEEPING, "sleeping."), (merc.POS_RESTING, "resting."),
        (merc.POS_MEDITATING, "meditating."), (merc.POS_SITTING, "sitting."),
        (merc.POS_STANDING, "standing."), (merc.POS_FIGHTING, "fighting.")
    ]
    for (aa, bb) in pos_list:
        if ch.position == aa:
            buf += "You are {}\n".format(bb)
            break

    buf += "AC: {}.  You are ".format(ch.armor)
    ac_list = [(101, "naked!\n"), (80, "barely clothed.\n"),
               (60, "wearing clothes.\n"), (40, "slightly armored.\n"),
               (20, "somewhat armored.\n"), (0, "armored.\n"),
               (-50, "well armored.\n"), (-100, "strongly armored.\n"),
               (-250, "heavily armored.\n"), (-500, "superbly armored.\n"),
               (-749, "divinely armored.\n")]
    for (aa, bb) in ac_list:
        if ch.armor >= aa:
            buf += bb
            break
    else:
        buf += "ultimately armored!\n"

    buf += "Hitroll: {}.  Damroll: {}.  ".format(ch.hitroll, ch.damroll)

    if not ch.is_npc() and ch.is_vampire():
        buf += "Blood: %d.\n".format(ch.blood)
        buf += "Beast: {}.  ".format(ch.beast)

        beast_list = [
            (0, "You have attained Golconda!\n"),
            (5, "You have almost reached Golconda!\n"),
            (10, "You are nearing Golconda!\n"),
            (15, "You have great control over your beast.\n"),
            (20, "Your beast has little influence over your actions.\n"),
            (30, "You are in control of your beast.\n"),
            (40, "You are able to hold back the beast.\n"),
            (60, "You are constantly struggling for control of your beast.\n"),
            (75, "Your beast has great control over your actions.\n"),
            (90, "The power of the beast overwhelms you.\n"),
            (99, "You have almost lost your battle with the beast!\n")
        ]
        for (aa, bb) in beast_list:
            if ch.beast <= aa:
                buf += bb
                break
        else:
            buf += "The beast has taken over!\n"
    else:
        buf += "\n"

    buf += "Alignment: {}.  You are ".format(ch.alignment)
    align_list = [(900, "angelic.\n"), (700, "saintly.\n"), (350, "good.\n"),
                  (100, "kind.\n"), (-100, "neutral.\n"), (-350, "mean.\n"),
                  (-700, "evil.\n"), (-900, "demonic.\n")]
    for (aa, bb) in align_list:
        if ch.alignment > aa:
            buf += bb
            break
    else:
        buf += "satanic.\n"

    if not ch.is_npc():
        buf += "Status: {}.  You are ".format(ch.race)

        if ch.level == 1:
            buf += "a Mortal.\n"
        elif ch.level == 2:
            buf += "a Mortal.\n"
        elif ch.level == 7:
            buf += "a Builder.\n"
        elif ch.level == 8:
            buf += "a Quest Maker.\n"
        elif ch.level == 9:
            buf += "an Enforcer.\n"
        elif ch.level == 10:
            buf += "a Judge.\n"
        elif ch.level == 11:
            buf += "a High Judge.\n"
        elif ch.level == 12:
            buf += "an Implementor.\n"
        elif ch.race <= 0:
            buf += "an Avatar.\n"
        elif ch.race <= 4:
            buf += "an Immortal.\n"
        elif ch.race <= 9:
            buf += "a Godling.\n"
        elif ch.race <= 14:
            buf += "a Demigod.\n"
        elif ch.race <= 19:
            buf += "a Lesser God.\n"
        elif ch.race <= 24:
            buf += "a Greater God.\n"
        else:
            buf += "a Supreme God.\n"

        if ch.pkill == 0:
            ss1 = "no players"
        elif ch.pkill == 1:
            ss1 = "{} player".format(ch.pkill)
        else:
            ss1 = "{} players".format(ch.pkill)
        if ch.pdeath == 0:
            ss2 = "no players"
        elif ch.pdeath == 1:
            ss2 = "{} player".format(ch.pdeath)
        else:
            ss2 = "{} players".format(ch.pdeath)
        buf += "You have killed {} and have been killed by {}.\n".format(
            ss1, ss2)

        if ch.mkill == 0:
            ss1 = "no mobs"
        elif ch.mkill == 1:
            ss1 = "{} mob".format(ch.mkill)
        else:
            ss1 = "{} mobs".format(ch.mkill)
        if ch.mdeath == 0:
            ss2 = "no mobs"
        elif ch.mdeath == 1:
            ss2 = "{} mob".format(ch.mdeath)
        else:
            ss2 = "{} mobs".format(ch.mdeath)
        buf += "You have killed {} and have been killed by {}.\n".format(
            ss1, ss2)

        if ch.quest > 0:
            if ch.quest == 1:
                buf += "You have a single quest point.\n"
            else:
                buf += "You have {} quest points.\n".format(ch.quest)

    if ch.is_affected(merc.AFF_HIDE):
        buf += "You are keeping yourself hidden from those around you.\n"

    if not ch.is_npc():
        if ch.is_werewolf() and ch.powers[merc.WPOWER_SILVER] > 0:
            buf += "You have attained {} points of silver tolerance.\n".format(
                ch.powers[merc.WPOWER_SILVER])

        if ch.is_vampire() and ch.powers[merc.UNI_RAGE] > 0:
            buf += "The beast is in control of your actions:  Affects Hitroll and Damroll by +{}.\n".format(
                ch.powers[merc.UNI_RAGE])
        elif ch.special.is_set(
                merc.SPC_WOLFMAN) and ch.powers[merc.UNI_RAGE] > 0:
            buf += "You are raging:  Affects Hitroll and Damroll by +{}.\n".format(
                ch.powers[merc.UNI_RAGE])
        elif ch.is_demon() and ch.powers[merc.DEMON_POWER] > 0:
            buf += "You are wearing demonic armour:  Affects Hitroll and Damroll by +{}.\n".format(
                ch.powers[merc.DEMON_POWER] * ch.powers[merc.DEMON_POWER])
        elif ch.special.is_set(
                merc.SPC_CHAMPION) and ch.powers[merc.DEMON_POWER] > 0:
            buf += "You are wearing demonic armour:  Affects Hitroll and Damroll by +{}.\n".format(
                ch.powers[merc.DEMON_POWER] * ch.powers[merc.DEMON_POWER])

    if ch.affected:
        buf += "You are affected by:\n"

        for paf in ch.affected:
            buf += "Spell: '{}'".format(const.skill_table[paf.type].name)
            buf += " modifies {} by {} for {} hours with bits {}.\n".format(
                merc.affect_loc_name(paf.location), paf.modifier, paf.duration,
                merc.affect_bit_name(paf.bitvector))
    ch.send("".join(buf))
示例#10
0
def spell_identify(sn, level, ch, victim, target):
    item = victim
    if type(item) is int:
        item = instance.items[item]
    ch.send("Item '{item.name}' is type {item.item_type}, "
            "weight is {weight}".format(item=item, weight=(item.weight // 10)))
    ch.send("Equips to: {item.equips_to_names}\n".format(item=item))
    ch.send("Item Attribute Flags: {item.item_attribute_names}\n".format(item=item))
    ch.send("Item Restriction Flags: {item.item_restriction_names}\n".format(item=item))
    ch.send("Value is {item.cost}, level is {item.level}.\n".format(item=item))
    if item.item_type == merc.ITEM_SCROLL or item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_PILL:
        ch.send("Level {item.value[0]} spells of:".format(item=item))
        for i in item.value:
            if 0 <= i < merc.MAX_SKILL:
                ch.send(" '{skill}'".format(skill=const.skill_table[i].name))
        ch.send(".\n")
    elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF:
        ch.send("Has {item.value[2]} charges of level {item.value[0]}".format(item=item))
        if 0 <= item.value[3] < merc.MAX_SKILL:
            ch.send("' {skill}'".format(skill=const.skill_table[item.value[3]].name))
        ch.send(".\n")
    elif item.item_type == merc.ITEM_DRINK_CON:
        ch.send("It holds {color}-colored {liquid}.\n".format(color=const.liq_table[item.value[2]].color,
                                                              liquid=const.liq_table[item.value[2]].name))
    elif item.item_type == merc.ITEM_CONTAINER:
        ch.send("Capacity: {item.value[0]}#  "
                "Maximum weight: {item.value[3]}#  "
                "flags: {cflag}\n".format(item=item, cflag=cont_bit_name(item.value[1])))
        if item.value[4] != 100:
            ch.send("Weight multiplier: {item.value[4]}%%\n".format(item=item))
    elif item.item_type == merc.ITEM_WEAPON:
        ch.send("Weapon type is ")

        weapons = {merc.WEAPON_EXOTIC: "exotic",
                   merc.WEAPON_SWORD: "sword",
                   merc.WEAPON_DAGGER: "dagger",
                   merc.WEAPON_SPEAR: "spear//staff",
                   merc.WEAPON_MACE: "mace//club",
                   merc.WEAPON_AXE: "axe",
                   merc.WEAPON_FLAIL: "flail",
                   merc.WEAPON_WHIP: "whip",
                   merc.WEAPON_POLEARM: "polearm"}

        if item.value[0] not in weapons:
            ch.send("unknown")
        else:
            ch.send(weapons[item.value[0]])

        if item.new_format:
            ch.send("Damage is {item.value[1]}d{item.value[2]} "
                    "(average {average}).\n".format(item=item, average=((1 + item.value[2]) * item.value[1] // 2)))

        else:
            ch.send("Damage is {item.value[1]} to {item.value[2]} "
                    "(average {average}).\n".format(item=item, average=((item.value[2] + item.value[1]) // 2)))

        if item.weapon_attributes:  # weapon flags */
            ch.send("Weapons flags: {item.weapon_attribute_names}\n".format(item=item))
    elif item.item_type == merc.ITEM_ARMOR:
        ch.send("Armor class is {item.value[0]} pierce, {item.value[1]} bash, "
                "{item.value[2]} slash, and {item.value[3]} vs. magic.\n".format(item=item))

    affected = item.affected
    if not item.enchanted:
        affected.extend(instance.item_templates[item.vnum].affected)

    for paf in affected:
        if paf.location != merc.APPLY_NONE and paf.modifier != 0:
            ch.send("Affects {aff_loc} by {modifier}.\n".format(aff_loc=affect_loc_name(paf.location),
                                                                modifier=paf.modifier))
            if paf.bitvector:
                if paf.where == merc.TO_AFFECTS:
                    ch.send("Adds {aff_name} affect.\n".format(aff_name=affect_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_OBJECT:
                    ch.send("Adds {bit_name} item flag.\n".format(bit_name=extra_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_IMMUNE:
                    ch.send("Adds immunity to {imm}.\n".format(imm=imm_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_RESIST:
                    ch.send("Adds resistance to {res}.\n".format(res=imm_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_VULN:
                    ch.send("Adds vulnerability to {vuln}.\n".format(vuln=imm_bit_name(paf.bitvector)))
                else:
                    ch.send("Unknown bit {bit_name}: {bit}\n".format(bit_name=paf.where, bit=paf.bitvector))
def spl_identify(sn, level, ch, victim, target):
    item = victim
    handler_game.act("You examine $p carefully.", ch, item, None, merc.TO_CHAR)
    handler_game.act("$n examines $p carefully.", ch, item, None, merc.TO_ROOM)

    extra = item.item_attribute_names
    if extra and item.item_restriction_names:
        extra += ", "
    extra += item.item_restriction_names
    buf = ["Object '{}' is type {}, extra flags {}.\nWeight is {}, value is {}.\n".format(item.name, item.item_type, extra, item.weight, item.cost)]

    if item.points > 0 and item.item_type not in [merc.ITEM_QUEST, merc.ITEM_PAGE]:
        buf += "Quest point value is {}.\n".format(item.points)

    if item.questmaker and item.questowner:
        buf += "This object was created by {}, and is owned by {}.\n".format(item.questmaker, item.questowner)
    elif item.questmaker:
        buf += "This object was created by {}.\n".format(item.questmaker)
    elif item.questowner:
        buf += "This object is owned by {}.\n".format(item.questowner)

    if item.flags.enchanted:
        buf += "This item has been enchanted.\n"

    if item.flags.spellproof:
        buf += "This item is resistant to offensive spells.\n"

    if item.flags.demonic:
        buf += "This item is crafted from demonsteel.\n"
    elif item.flags.silver:
        buf += "This item is crafted from gleaming silver.\n"

    itype = item.item_type
    if itype in [merc.ITEM_PILL, merc.ITEM_SCROLL, merc.ITEM_POTION]:
        buf += "Level {} spells of:".format(item.value[0])

        for i in item.value:
            if 0 <= i < merc.MAX_SKILL:
                buf += " '" + const.skill_table[i].name + "'"
        buf += ".\n"
    elif itype == merc.ITEM_QUEST:
        buf += "Quest point value is {}.\n".format(item.value[0])
    elif itype == merc.ITEM_QUESTCARD:
        buf += "Quest completion reward is {} quest points.\n".format(item.level)
    elif itype in [merc.ITEM_WAND, merc.ITEM_STAFF]:
        buf += "Has {}({}) charges of level {}".format(item.value[1], item.value[2], item.value[0])

        if 0 <= item.value[3] <= merc.MAX_SKILL:
            buf += " '" + const.skill_table[item.value[3]].name + "'"
        buf += ".\n"
    elif itype == merc.ITEM_WEAPON:
        buf += "Damage is {} to {} (average {}).\n".format(item.value[1], item.value[2], (item.value[1] + item.value[2]) // 2)

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

        if itemtype > 0:
            level_list = [(10, " minor"), (20, " lesser"), (30, "n average"), (40, " greater"), (50, " major"), (51, " supreme")]
            for (aa, bb) in level_list:
                if item.level < aa:
                    buf += "{} is a{} spell weapon.\n".format(item.short_descr[0].upper() + item.short_descr[1:], bb)
                    break
            else:
                buf += "{} is an ultimate spell weapon.\n".format(item.short_descr[0].upper() + item.short_descr[1:])

            if itemtype == 1:
                buf += "This weapon is dripping with corrosive acid.\n"
            elif itemtype == 4:
                buf += "This weapon radiates an aura of darkness.\n"
            elif itemtype == 30:
                buf += "This ancient relic is the bane of all evil.\n"
            elif itemtype == 34:
                buf += "This vampiric weapon drinks the souls of its victims.\n"
            elif itemtype == 37:
                buf += "This weapon has been tempered in hellfire.\n"
            elif itemtype == 48:
                buf += "This weapon crackles with sparks of lightning.\n"
            elif itemtype == 53:
                buf += "This weapon is dripping with a dark poison.\n"
            else:
                buf += "This weapon has been imbued with the power of {}.\n".format(const.skill_table[itemtype].name)

        itemtype = item.value[0] // 1000 if item.value[0] >= 1000 else 0
        if itemtype > 0:
            if itemtype == 4:
                buf += "This weapon radiates an aura of darkness.\n"
            elif itemtype in [27, 2]:
                buf += "This weapon allows the wielder to see invisible things.\n"
            elif itemtype in [39, 3]:
                buf += "This weapon grants the power of flight.\n"
            elif itemtype in [45, 1]:
                buf += "This weapon allows the wielder to see in the dark.\n"
            elif itemtype in [46, 5]:
                buf += "This weapon renders the wielder invisible to the human eye.\n"
            elif itemtype in [52, 6]:
                buf += "This weapon allows the wielder to walk through solid doors.\n"
            elif itemtype in [54, 7]:
                buf += "This holy weapon protects the wielder from evil.\n"
            elif itemtype in [57, 8]:
                buf += "This ancient weapon protects the wielder in combat.\n"
            elif itemtype == 9:
                buf += "This crafty weapon allows the wielder to walk in complete silence.\n"
            elif itemtype == 10:
                buf += "This powerful weapon surrounds its wielder with a shield of lightning.\n"
            elif itemtype == 11:
                buf += "This powerful weapon surrounds its wielder with a shield of fire.\n"
            elif itemtype == 12:
                buf += "This powerful weapon surrounds its wielder with a shield of ice.\n"
            elif itemtype == 13:
                buf += "This powerful weapon surrounds its wielder with a shield of acid.\n"
            elif itemtype == 14:
                buf += "This weapon protects its wielder from clan DarkBlade guardians.\n"
            elif itemtype == 15:
                buf += "This ancient weapon surrounds its wielder with a shield of chaos.\n"
            elif itemtype == 16:
                buf += "This ancient weapon regenerates the wounds of its wielder.\n"
            elif itemtype == 17:
                buf += "This ancient weapon allows its wielder to move at supernatural speed.\n"
            elif itemtype == 18:
                buf += "This razor sharp weapon can slice through armour without difficulty.\n"
            elif itemtype == 19:
                buf += "This ancient weapon protects its wearer from player attacks.\n"
            elif itemtype == 20:
                buf += "This ancient weapon surrounds its wielder with a shield of darkness.\n"
            elif itemtype == 21:
                buf += "This ancient weapon grants superior protection to its wielder.\n"
            elif itemtype == 22:
                buf += "This ancient weapon grants its wielder supernatural vision.\n"
            elif itemtype == 23:
                buf += "This ancient weapon makes its wielder fleet-footed.\n"
            elif itemtype == 24:
                buf += "This ancient weapon conceals its wielder from sight.\n"
            elif itemtype == 25:
                buf += "This ancient weapon invokes the power of the beast.\n"
            else:
                buf += "This item is bugged...please report it.\n"
    elif itype == merc.ITEM_ARMOR:
        buf += "Armor class is {}.\n".format(item.value[0])

        if item.value[3] > 0:
            if item.value[3] == 4:
                buf += "This object radiates an aura of darkness.\n"
            elif item.value[3] in [27, 2]:
                buf += "This item allows the wearer to see invisible things.\n"
            elif item.value[3] in [39, 3]:
                buf += "This object grants the power of flight.\n"
            elif item.value[3] in [45, 1]:
                buf += "This item allows the wearer to see in the dark.\n"
            elif item.value[3] in [46, 5]:
                buf += "This object renders the wearer invisible to the human eye.\n"
            elif item.value[3] in [52, 6]:
                buf += "This object allows the wearer to walk through solid doors.\n"
            elif item.value[3] in [54, 7]:
                buf += "This holy relic protects the wearer from evil.\n"
            elif item.value[3] in [57, 8]:
                buf += "This ancient relic protects the wearer in combat.\n"
            elif item.value[3] == 9:
                buf += "This crafty item allows the wearer to walk in complete silence.\n"
            elif item.value[3] == 10:
                buf += "This powerful item surrounds its wearer with a shield of lightning.\n"
            elif item.value[3] == 11:
                buf += "This powerful item surrounds its wearer with a shield of fire.\n"
            elif item.value[3] == 12:
                buf += "This powerful item surrounds its wearer with a shield of ice.\n"
            elif item.value[3] == 13:
                buf += "This powerful item surrounds its wearer with a shield of acid.\n"
            elif item.value[3] == 14:
                buf += "This object protects its wearer from clan DarkBlade guardians.\n"
            elif item.value[3] == 15:
                buf += "This ancient item surrounds its wearer with a shield of chaos.\n"
            elif item.value[3] == 16:
                buf += "This ancient item regenerates the wounds of its wearer.\n"
            elif item.value[3] == 17:
                buf += "This ancient item allows its wearer to move at supernatural speed.\n"
            elif item.value[3] == 18:
                buf += "This powerful item allows its wearer to shear through armour without difficulty.\n"
            elif item.value[3] == 19:
                buf += "This powerful item protects its wearer from player attacks.\n"
            elif item.value[3] == 20:
                buf += "This ancient item surrounds its wearer with a shield of darkness.\n"
            elif item.value[3] == 21:
                buf += "This ancient item grants superior protection to its wearer.\n"
            elif item.value[3] == 22:
                buf += "This ancient item grants its wearer supernatural vision.\n"
            elif item.value[3] == 23:
                buf += "This ancient item makes its wearer fleet-footed.\n"
            elif item.value[3] == 24:
                buf += "This ancient item conceals its wearer from sight.\n"
            elif item.value[3] == 25:
                buf += "This ancient item invokes the power of the beast.\n"
            else:
                buf += "This item is bugged...please report it.\n"

    for aff in item.affected:
        if aff.location != merc.APPLY_NONE and aff.modifier != 0:
            buf += "Affects {} by {}.\n".format(merc.affect_loc_name(aff.location), aff.modifier)
    ch.send("".join(buf))
示例#12
0
def do_ostat(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Stat what?\n")
        return
    obj = ch.get_item_world(arg)
    if not obj:
        ch.send("Nothing like that in hell, earth, or heaven.\n")
        return

    ch.send("Name(s): %s\n" % obj.name)
    ch.send("Vnum: %d  Format: %s  Type: %s  Resets: %d\n" % (
        obj.vnum, "new" if obj.new_format else "old",
        obj.item_type, obj.reset_num ))
    ch.send("Short description: %s\nLong description: %s\n" % (obj.short_descr, obj.description ))
    ch.send("Wear bits: %s\nExtra bits: %s\n" % (obj.equips_to_names,
                                                 obj.item_attribute_names))
    ch.send("Number: 1/%d  Weight: %d/%d/%d (10th pounds)\n" % ( obj.get_number(),
                                                                 obj.weight, obj.get_weight(), obj.true_weight() ))
    ch.send("Level: %d  Cost: %d  Condition: %d  Timer: %d\n" % (obj.level, obj.cost, obj.condition, obj.timer ))

    ch.send("In room: %d  In object: %s  Carried by: %s\n" % (
        0 if not obj.in_room else obj.in_room.vnum,
        "(none)" if not obj.in_item else obj.in_item.short_descr,
        "(noone)" if not obj.in_living else "someone" if not ch.can_see(obj.in_living) else obj.in_living.name ))
    ch.send("Values: %s\n" % [v for v in obj.value])
    # now give out vital statistics as per identify

    if obj.item_type == merc.ITEM_SCROLL \
            or obj.item_type == merc.ITEM_POTION \
            or obj.item_type == merc.ITEM_PILL:
        ch.send("Level %d spells of:", obj.value[0])
        for value in obj.value:
            if value and value in const.skill_table:
                ch.send(" '%s'" % const.skill_table[value].name)

        ch.send(".\n")
    elif obj.item_type == merc.ITEM_WAND \
            or obj.item_type == merc.ITEM_STAFF:
        ch.send("Has %d(%d) charges of level %d" % (obj.value[1], obj.value[2], obj.value[0] ))

        if obj.value[3] and obj.value[3] in const.skill_table:
            ch.send(" '%s'" % const.skill_table[obj.value[3]].name)
        ch.send(".\n")
    elif obj.item_type == merc.ITEM_DRINK_CON:
        ch.send("It holds %s-colored %s.\n" % (const.liq_table[obj.value[2]].color,
                                               const.liq_table[obj.value[2]].name))
    elif obj.item_type == merc.ITEM_WEAPON:
        ch.send("Weapon type is ")
        weapon_type = {merc.WEAPON_EXOTIC: "exotic", merc.WEAPON_SWORD: "sword",
                       merc.WEAPON_DAGGER: "dagger", merc.WEAPON_SPEAR: "spear/staff",
                       merc.WEAPON_MACE: "mace/club", merc.WEAPON_AXE: "axe",
                       merc.WEAPON_FLAIL: "flail", merc.WEAPON_WHIP: "whip",
                       merc.WEAPON_POLEARM: "polearm"}
        if obj.value[0] not in weapon_type:
            ch.send("unknown\n")
        else:
            ch.send(const.weapon_table[obj.value[0]] + "\n")
        if obj.new_format:
            ch.send(
                "Damage is %dd%d (average %d)\n" % (obj.value[1], obj.value[2], (1 + obj.value[2]) * obj.value[1] // 2))
        else:
            ch.send("Damage is %d to %d (average %d)\n" % (
            obj.value[1], obj.value[2], ( obj.value[1] + obj.value[2] ) // 2 ))
        ch.send("Damage noun is %s.\n" % (
        const.attack_table[obj.value[3]].noun if obj.value[3] in const.attack_table else "undefined"))
        if obj.value[4] > 0:  # weapon flags
            ch.send("Weapons flags: %s\n" % merc.weapon_bit_name(obj.value[4]))
    elif obj.item_type == merc.ITEM_ARMOR:
        ch.send("Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n" % (
            obj.value[0], obj.value[1], obj.value[2], obj.value[3] ))
    elif obj.item_type == merc.ITEM_CONTAINER:
        ch.send("Capacity: %d#  Maximum weight: %d#  flags: %s\n" % (
        obj.value[0], obj.value[3], merc.cont_bit_name(obj.value[1])))
        if obj.value[4] != 100:
            ch.send("Weight multiplier: %d%%\n" % obj.value[4])

    if obj.extra_descr or obj.extra_descr:
        ch.send("Extra description keywords: '")
        extra_descr = list(obj.extra_descr)
        extra_descr.extend(obj.extra_descr)
        for ed in extra_descr:
            ch.send(ed.keyword)
            ch.send(" ")
        ch.send("'\n")

    affected = list(obj.affected)
    #TODO: This may not be necessary at all.
    #if not obj.enchanted:
    #    objTemplate = merc.itemTemplate[obj.vnum]
    #    affected.extend(objTemplate.affected)
    for paf in affected:
        ch.send("Affects %s by %d, level %d" % (merc.affect_loc_name(paf.location), paf.modifier, paf.level))
        if paf.duration > -1:
            ch.send(", %d hours.\n" % paf.duration)
        else:
            ch.send(".\n")
        if paf.bitvector:
            if paf.where == merc.TO_AFFECTS:
                ch.send("Adds %s affect.\n" % merc.affect_bit_name(paf.bitvector))
            elif paf.where == merc.TO_WEAPON:
                ch.send("Adds %s weapon flags.\n" % merc.weapon_bit_name(paf.bitvector))
            elif paf.where == merc.TO_OBJECT:
                ch.send("Adds %s object flag.\n" % merc.extra_bit_name(paf.bitvector))
            elif paf.where == merc.TO_IMMUNE:
                ch.send("Adds immunity to %s.\n" % merc.imm_bit_name(paf.bitvector))
            elif paf.where == merc.TO_RESIST:
                ch.send("Adds resistance to %s.\n" % merc.imm_bit_name(paf.bitvector))
            elif paf.where == merc.TO_VULN:
                ch.send("Adds vulnerability to %s.\n" % merc.imm_bit_name(paf.bitvector))
            else:
                ch.send("Unknown bit %d: %d\n" % paf.where, paf.bitvector)
示例#13
0
def spell_identify(sn, level, ch, victim, target):
    item = victim
    if type(item) is int:
        item = instance.items[item]
    ch.send("Item '{item.name}' is type {item.item_type}, "
            "weight is {weight}".format(item=item, weight=(item.weight // 10)))
    ch.send("Equips to: {item.equips_to_names}\n".format(item=item))
    ch.send("Item Attribute Flags: {item.item_attribute_names}\n".format(
        item=item))
    ch.send("Item Restriction Flags: {item.item_restriction_names}\n".format(
        item=item))
    ch.send("Value is {item.cost}, level is {item.level}.\n".format(item=item))
    if item.item_type == merc.ITEM_SCROLL or item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_PILL:
        ch.send("Level {item.value[0]} spells of:".format(item=item))
        for i in item.value:
            if 0 <= i < merc.MAX_SKILL:
                ch.send(" '{skill}'".format(skill=const.skill_table[i].name))
        ch.send(".\n")
    elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF:
        ch.send("Has {item.value[2]} charges of level {item.value[0]}".format(
            item=item))
        if 0 <= item.value[3] < merc.MAX_SKILL:
            ch.send("' {skill}'".format(
                skill=const.skill_table[item.value[3]].name))
        ch.send(".\n")
    elif item.item_type == merc.ITEM_DRINK_CON:
        ch.send("It holds {color}-colored {liquid}.\n".format(
            color=const.liq_table[item.value[2]].color,
            liquid=const.liq_table[item.value[2]].name))
    elif item.item_type == merc.ITEM_CONTAINER:
        ch.send("Capacity: {item.value[0]}#  "
                "Maximum weight: {item.value[3]}#  "
                "flags: {cflag}\n".format(item=item,
                                          cflag=cont_bit_name(item.value[1])))
        if item.value[4] != 100:
            ch.send("Weight multiplier: {item.value[4]}%%\n".format(item=item))
    elif item.item_type == merc.ITEM_WEAPON:
        ch.send("Weapon type is ")

        weapons = {
            merc.WEAPON_EXOTIC: "exotic",
            merc.WEAPON_SWORD: "sword",
            merc.WEAPON_DAGGER: "dagger",
            merc.WEAPON_SPEAR: "spear//staff",
            merc.WEAPON_MACE: "mace//club",
            merc.WEAPON_AXE: "axe",
            merc.WEAPON_FLAIL: "flail",
            merc.WEAPON_WHIP: "whip",
            merc.WEAPON_POLEARM: "polearm"
        }

        if item.value[0] not in weapons:
            ch.send("unknown")
        else:
            ch.send(weapons[item.value[0]])

        if item.new_format:
            ch.send("Damage is {item.value[1]}d{item.value[2]} "
                    "(average {average}).\n".format(
                        item=item,
                        average=((1 + item.value[2]) * item.value[1] // 2)))

        else:
            ch.send("Damage is {item.value[1]} to {item.value[2]} "
                    "(average {average}).\n".format(
                        item=item,
                        average=((item.value[2] + item.value[1]) // 2)))

        if item.weapon_attributes:  # weapon flags */
            ch.send("Weapons flags: {item.weapon_attribute_names}\n".format(
                item=item))
    elif item.item_type == merc.ITEM_ARMOR:
        ch.send(
            "Armor class is {item.value[0]} pierce, {item.value[1]} bash, "
            "{item.value[2]} slash, and {item.value[3]} vs. magic.\n".format(
                item=item))

    affected = item.affected
    if not item.enchanted:
        affected.extend(instance.item_templates[item.vnum].affected)

    for paf in affected:
        if paf.location != merc.APPLY_NONE and paf.modifier != 0:
            ch.send("Affects {aff_loc} by {modifier}.\n".format(
                aff_loc=affect_loc_name(paf.location), modifier=paf.modifier))
            if paf.bitvector:
                if paf.where == merc.TO_AFFECTS:
                    ch.send("Adds {aff_name} affect.\n".format(
                        aff_name=affect_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_OBJECT:
                    ch.send("Adds {bit_name} item flag.\n".format(
                        bit_name=extra_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_IMMUNE:
                    ch.send("Adds immunity to {imm}.\n".format(
                        imm=imm_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_RESIST:
                    ch.send("Adds resistance to {res}.\n".format(
                        res=imm_bit_name(paf.bitvector)))
                elif paf.where == merc.TO_VULN:
                    ch.send("Adds vulnerability to {vuln}.\n".format(
                        vuln=imm_bit_name(paf.bitvector)))
                else:
                    ch.send("Unknown bit {bit_name}: {bit}\n".format(
                        bit_name=paf.where, bit=paf.bitvector))