--- deliantra/server/common/item.C 2007/04/23 18:21:54 1.27 +++ deliantra/server/common/item.C 2007/05/12 18:14:47 1.33 @@ -49,18 +49,20 @@ * "This item goes %s\n", with the use/nonuse values filling in the %s */ Body_Locations body_locations[NUM_BODY_LOCATIONS] = { - {"body_range", "in your range slot", "in a human's range slot"}, - {"body_arm", "on your arm", "on a human's arm"}, - {"body_torso", "on your body", "on a human's torso"}, - {"body_head", "on your head", "on a human's head"}, - {"body_neck", "around your neck", "around a humans neck"}, - {"body_skill", "in your skill slot", "in a human's skill slot"}, - {"body_finger", "on your finger", "on a human's finger"} , - {"body_shoulder", "around your shoulders", "around a human's shoulders"}, - {"body_foot", "on your feet", "on a human's feet"}, - {"body_hand", "on your hands", "on a human's hands"}, - {"body_wrist", "around your wrists", "around a human's wrist"}, - {"body_waist", "around your waist", "around a human's waist"}, + {"body_range" , "You can use it as your range weapon" , "It is used as a range weapon"}, + {"body_shield" , "You can wield it as a shield" , "It is used as a shield"}, + {"body_combat" , "You can wield it as your weapon" , "It is used as a combat weapon"}, + {"body_arm" , "You can put it on your arm" , "It goes on a human's arm"}, + {"body_torso" , "You can wear it on your body" , "It goes on a human's torso"}, + {"body_head" , "You can wear it on your head" , "It goes on a human's head"}, + {"body_neck" , "You can wear it around your neck" , "It goes around a human's neck"}, + {"body_skill" , "You can have it in your skill slot" , "It goes in a human's skill slot"}, + {"body_finger" , "You can wear it on your finger" , "It goes on a human's finger"} , + {"body_shoulder", "You can wear it around your shoulders", "It goes around a human's shoulders"}, + {"body_foot" , "You can put your feets into it" , "It goes on a human's feet"}, + {"body_hand" , "You can put it on your hands" , "It goes on a human's hands"}, + {"body_wrist" , "You can wear it around your wrists" , "It goes around a human's wrist"}, + {"body_waist" , "You can wear it around your waist" , "It goes around a human's waist"}, /*{"body_dragon_torso", "your body", "a dragon's body"} */ }; @@ -272,7 +274,7 @@ enc = 0; for (i = 0; i < NUM_STATS; i++) - enc += get_attr_value (&op->stats, i); + enc += op->stats.stat (i); /* This protection logic is pretty flawed. 20% fire resistance * is much more valuable than 20% confusion, or 20% slow, or @@ -502,10 +504,8 @@ for (attr = 0; attr < NUM_STATS; attr++) { - if ((val = get_attr_value (&(op->stats), attr)) != 0) - { - sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); - } + if ((val = op->stats.stat (attr))) + sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); } if (op->stats.exp) @@ -714,10 +714,10 @@ case WAND: case ROD: case HORN: - safe_strcat (buf[use_buf], " (readied)", &len, HUGE_BUF); + safe_strcat (buf[use_buf], op->env && op->env->current_weapon == op ? " (readied)" : " (applied)", &len, HUGE_BUF); break; case WEAPON: - safe_strcat (buf[use_buf], " (wielded)", &len, HUGE_BUF); + safe_strcat (buf[use_buf], op->env && op->env->current_weapon == op ? " (wielded)" : " (applied)", &len, HUGE_BUF); break; case ARMOUR: case HELMET: @@ -842,11 +842,10 @@ } } break; + default: if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) - { - sprintf (buf + strlen (buf), " %+d", op->magic); - } + sprintf (buf + strlen (buf), " %+d", op->magic); } return buf; @@ -1085,14 +1084,16 @@ case POWER_CRYSTAL: if (op->stats.maxsp > 1000) { /*higher capacity crystals */ - i = (op->stats.maxsp % 100) / 10; + i = (op->stats.maxsp % 1000) / 100; + if (i) - snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 100, i); + snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 1000, i); else - snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 100); + snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 1000); } else snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); + strcat (retbuf, buf); i = (op->stats.sp * 10) / op->stats.maxsp; if (op->stats.sp == 0) @@ -1167,7 +1168,7 @@ for (attr = 0; attr < NUM_STATS; attr++) { - if ((val = get_attr_value (&(op->stats), attr)) != 0) + if ((val = op->stats.stat (attr))) { sprintf (buf, "(%s%+d)", short_stat_name[attr], val); strcat (retbuf, buf); @@ -1434,7 +1435,7 @@ /* Check to see if it increases/decreases any stats */ for (i = 0; i < NUM_STATS; i++) - if (get_attr_value (&(op->stats), i) != 0) + if (op->stats.stat (i)) return 1; /* If it doesn't fall into any of the above categories, must @@ -1453,40 +1454,41 @@ { switch (op->type) { - case RING: - case WAND: - case ROD: - case HORN: - case SCROLL: - case SKILL: - case SKILLSCROLL: - case SPELLBOOK: - case FOOD: - case POTION: - case BOW: - case ARROW: - case WEAPON: - case ARMOUR: - case SHIELD: - case HELMET: - case AMULET: - case BOOTS: - case GLOVES: - case BRACERS: - case GIRDLE: - case CONTAINER: - case DRINK: - case FLESH: - case INORGANIC: - case CLOSE_CON: - case CLOAK: - case GEM: - case POWER_CRYSTAL: - case POISON: - case BOOK: - case SKILL_TOOL: - return 1; + case RING: + case WAND: + case ROD: + case HORN: + case SCROLL: + case SKILL: + case SKILLSCROLL: + case SPELLBOOK: + case FOOD: + case POTION: + case BOW: + case ARROW: + case WEAPON: + case ARMOUR: + case SHIELD: + case HELMET: + case AMULET: + case BOOTS: + case GLOVES: + case BRACERS: + case GIRDLE: + case CONTAINER: + case DRINK: + case FLESH: + case INORGANIC: + case CLOSE_CON: + case CLOAK: + case GEM: + case POWER_CRYSTAL: + case POISON: + case BOOK: + case SKILL_TOOL: + return 1; } + /* Try to track down some stuff that may show up here. Thus, the * archetype file can be updated, and this function removed. */