ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/item.C
(Generate patch)

Comparing deliantra/server/common/item.C (file contents):
Revision 1.32 by root, Fri May 11 08:08:02 2007 UTC vs.
Revision 1.35 by root, Sun May 27 23:56:21 2007 UTC

47 * may be better. 47 * may be better.
48 * Basically, for the use/nonuse, the code does something like: 48 * Basically, for the use/nonuse, the code does something like:
49 * "This item goes %s\n", with the use/nonuse values filling in the %s 49 * "This item goes %s\n", with the use/nonuse values filling in the %s
50 */ 50 */
51Body_Locations body_locations[NUM_BODY_LOCATIONS] = { 51Body_Locations body_locations[NUM_BODY_LOCATIONS] = {
52 {"body_range" , "You can use it as your range weapon" , "It is used as a range weapon"},
53 {"body_shield" , "You can wield it as a shield" , "It is used as a shield"}, 52 {KW_body_skill , "You can use it as your skill" , "It is used as a skill"},
54 {"body_combat" , "You can wield it as your weapon" , "It is used as a combat weapon"}, 53 {KW_body_combat , "You can wield it as your weapon" , "It is used as a combat weapon"},
54 {KW_body_range , "You can use it as your range weapon" , "It is used as a range weapon"},
55 {KW_body_shield , "You can wield it as a shield" , "It is used as a shield"},
55 {"body_arm" , "You can put it on your arm" , "It goes on a human's arm"}, 56 {KW_body_arm , "You can put it on your arm" , "It goes on a human's arm"},
56 {"body_torso" , "You can wear it on your body" , "It goes on a human's torso"}, 57 {KW_body_torso , "You can wear it on your body" , "It goes on a human's torso"},
57 {"body_head" , "You can wear it on your head" , "It goes on a human's head"}, 58 {KW_body_head , "You can wear it on your head" , "It goes on a human's head"},
58 {"body_neck" , "You can wear it around your neck" , "It goes around a human's neck"}, 59 {KW_body_neck , "You can wear it around your neck" , "It goes around a human's neck"},
59 {"body_skill" , "You can have it in your skill slot" , "It goes in a human's skill slot"},
60 {"body_finger" , "You can wear it on your finger" , "It goes on a human's finger"} , 60 {KW_body_finger , "You can wear it on your finger" , "It goes on a human's finger"} ,
61 {"body_shoulder", "You can wear it around your shoulders", "It goes around a human's shoulders"}, 61 {KW_body_shoulder, "You can wear it around your shoulders", "It goes around a human's shoulders"},
62 {"body_foot" , "You can put your feets into it" , "It goes on a human's feet"}, 62 {KW_body_foot , "You can put it on your foot" , "It goes on a human's foot"},
63 {"body_hand" , "You can put it on your hands" , "It goes on a human's hands"}, 63 {KW_body_hand , "You can put it on your hand" , "It goes on a human's hand"},
64 {"body_wrist" , "You can wear it around your wrists" , "It goes around a human's wrist"}, 64 {KW_body_wrist , "You can wear it around your wrist" , "It goes around a human's wrist"},
65 {"body_waist" , "You can wear it around your waist" , "It goes around a human's waist"}, 65 {KW_body_waist , "You can wear it around your waist" , "It goes around a human's waist"},
66/*{"body_dragon_torso", "your body", "a dragon's body"} */ 66/*{"body_dragon_torso", "your body", "a dragon's body"} */
67}; 67};
68 68
69static char numbers[21][20] = { 69static char numbers[21][20] = {
70 "no", "", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", 70 "no", "", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
272{ 272{
273 int i, tmp, enc; 273 int i, tmp, enc;
274 274
275 enc = 0; 275 enc = 0;
276 for (i = 0; i < NUM_STATS; i++) 276 for (i = 0; i < NUM_STATS; i++)
277 enc += get_attr_value (&op->stats, i); 277 enc += op->stats.stat (i);
278 278
279 /* This protection logic is pretty flawed. 20% fire resistance 279 /* This protection logic is pretty flawed. 20% fire resistance
280 * is much more valuable than 20% confusion, or 20% slow, or 280 * is much more valuable than 20% confusion, or 20% slow, or
281 * several others. Start at 1 - ignore physical - all that normal 281 * several others. Start at 1 - ignore physical - all that normal
282 * armour shouldn't be counted against 282 * armour shouldn't be counted against
502 if (!QUERY_FLAG (op, FLAG_IDENTIFIED)) 502 if (!QUERY_FLAG (op, FLAG_IDENTIFIED))
503 return buf; 503 return buf;
504 504
505 for (attr = 0; attr < NUM_STATS; attr++) 505 for (attr = 0; attr < NUM_STATS; attr++)
506 { 506 {
507 if ((val = get_attr_value (&(op->stats), attr)) != 0) 507 if ((val = op->stats.stat (attr)))
508 {
509 sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); 508 sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val);
510 }
511 } 509 }
512 510
513 if (op->stats.exp) 511 if (op->stats.exp)
514 sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); 512 sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp);
515 if (op->stats.wc) 513 if (op->stats.wc)
1168 { 1166 {
1169 int attr, val; 1167 int attr, val;
1170 1168
1171 for (attr = 0; attr < NUM_STATS; attr++) 1169 for (attr = 0; attr < NUM_STATS; attr++)
1172 { 1170 {
1173 if ((val = get_attr_value (&(op->stats), attr)) != 0) 1171 if ((val = op->stats.stat (attr)))
1174 { 1172 {
1175 sprintf (buf, "(%s%+d)", short_stat_name[attr], val); 1173 sprintf (buf, "(%s%+d)", short_stat_name[attr], val);
1176 strcat (retbuf, buf); 1174 strcat (retbuf, buf);
1177 } 1175 }
1178 } 1176 }
1435 if (op->magic || op->type == POWER_CRYSTAL || op->type == SPELLBOOK || op->type == SCROLL || op->type == GIRDLE) 1433 if (op->magic || op->type == POWER_CRYSTAL || op->type == SPELLBOOK || op->type == SCROLL || op->type == GIRDLE)
1436 return 1; 1434 return 1;
1437 1435
1438 /* Check to see if it increases/decreases any stats */ 1436 /* Check to see if it increases/decreases any stats */
1439 for (i = 0; i < NUM_STATS; i++) 1437 for (i = 0; i < NUM_STATS; i++)
1440 if (get_attr_value (&(op->stats), i) != 0) 1438 if (op->stats.stat (i))
1441 return 1; 1439 return 1;
1442 1440
1443 /* If it doesn't fall into any of the above categories, must 1441 /* If it doesn't fall into any of the above categories, must
1444 * be non magical. 1442 * be non magical.
1445 */ 1443 */
1454int 1452int
1455need_identify (const object *op) 1453need_identify (const object *op)
1456{ 1454{
1457 switch (op->type) 1455 switch (op->type)
1458 { 1456 {
1459 case RING: 1457 case RING:
1460 case WAND: 1458 case WAND:
1461 case ROD: 1459 case ROD:
1462 case HORN: 1460 case HORN:
1463 case SCROLL: 1461 case SCROLL:
1464 case SKILL: 1462 case SKILL:
1465 case SKILLSCROLL: 1463 case SKILLSCROLL:
1466 case SPELLBOOK: 1464 case SPELLBOOK:
1467 case FOOD: 1465 case FOOD:
1468 case POTION: 1466 case POTION:
1469 case BOW: 1467 case BOW:
1470 case ARROW: 1468 case ARROW:
1471 case WEAPON: 1469 case WEAPON:
1472 case ARMOUR: 1470 case ARMOUR:
1473 case SHIELD: 1471 case SHIELD:
1474 case HELMET: 1472 case HELMET:
1475 case AMULET: 1473 case AMULET:
1476 case BOOTS: 1474 case BOOTS:
1477 case GLOVES: 1475 case GLOVES:
1478 case BRACERS: 1476 case BRACERS:
1479 case GIRDLE: 1477 case GIRDLE:
1480 case CONTAINER: 1478 case CONTAINER:
1481 case DRINK: 1479 case DRINK:
1482 case FLESH: 1480 case FLESH:
1483 case INORGANIC: 1481 case INORGANIC:
1484 case CLOSE_CON: 1482 case CLOSE_CON:
1485 case CLOAK: 1483 case CLOAK:
1486 case GEM: 1484 case GEM:
1487 case POWER_CRYSTAL: 1485 case POWER_CRYSTAL:
1488 case POISON: 1486 case POISON:
1489 case BOOK: 1487 case BOOK:
1490 case SKILL_TOOL: 1488 case SKILL_TOOL:
1491 return 1; 1489 return 1;
1492 } 1490 }
1491
1493 /* Try to track down some stuff that may show up here. Thus, the 1492 /* Try to track down some stuff that may show up here. Thus, the
1494 * archetype file can be updated, and this function removed. 1493 * archetype file can be updated, and this function removed.
1495 */ 1494 */
1496#if 0 1495#if 0
1497 LOG (llevDebug, "need_identify: %s does not need to be id'd\n", op->name); 1496 LOG (llevDebug, "need_identify: %s does not need to be id'd\n", op->name);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines