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.27 by root, Mon Apr 23 18:21:54 2007 UTC vs.
Revision 1.33 by root, Sat May 12 18:14:47 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", "in your range slot", "in a human's range slot"}, 52 {"body_range" , "You can use it as your range weapon" , "It is used as a range weapon"},
53 {"body_arm", "on your arm", "on a human's arm"}, 53 {"body_shield" , "You can wield it as a shield" , "It is used as a shield"},
54 {"body_combat" , "You can wield it as your weapon" , "It is used as a combat weapon"},
55 {"body_arm" , "You can put it on your arm" , "It goes on a human's arm"},
54 {"body_torso", "on your body", "on a human's torso"}, 56 {"body_torso" , "You can wear it on your body" , "It goes on a human's torso"},
55 {"body_head", "on your head", "on a human's head"}, 57 {"body_head" , "You can wear it on your head" , "It goes on a human's head"},
56 {"body_neck", "around your neck", "around a humans neck"}, 58 {"body_neck" , "You can wear it around your neck" , "It goes around a human's neck"},
57 {"body_skill", "in your skill slot", "in a human's skill slot"}, 59 {"body_skill" , "You can have it in your skill slot" , "It goes in a human's skill slot"},
58 {"body_finger", "on your finger", "on a human's finger"} , 60 {"body_finger" , "You can wear it on your finger" , "It goes on a human's finger"} ,
59 {"body_shoulder", "around your shoulders", "around a human's shoulders"}, 61 {"body_shoulder", "You can wear it around your shoulders", "It goes around a human's shoulders"},
60 {"body_foot", "on your feet", "on a human's feet"}, 62 {"body_foot" , "You can put your feets into it" , "It goes on a human's feet"},
61 {"body_hand", "on your hands", "on a human's hands"}, 63 {"body_hand" , "You can put it on your hands" , "It goes on a human's hands"},
62 {"body_wrist", "around your wrists", "around a human's wrist"}, 64 {"body_wrist" , "You can wear it around your wrists" , "It goes around a human's wrist"},
63 {"body_waist", "around your waist", "around a human's waist"}, 65 {"body_waist" , "You can wear it around your waist" , "It goes around a human's waist"},
64/*{"body_dragon_torso", "your body", "a dragon's body"} */ 66/*{"body_dragon_torso", "your body", "a dragon's body"} */
65}; 67};
66 68
67static char numbers[21][20] = { 69static char numbers[21][20] = {
68 "no", "", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", 70 "no", "", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
270{ 272{
271 int i, tmp, enc; 273 int i, tmp, enc;
272 274
273 enc = 0; 275 enc = 0;
274 for (i = 0; i < NUM_STATS; i++) 276 for (i = 0; i < NUM_STATS; i++)
275 enc += get_attr_value (&op->stats, i); 277 enc += op->stats.stat (i);
276 278
277 /* This protection logic is pretty flawed. 20% fire resistance 279 /* This protection logic is pretty flawed. 20% fire resistance
278 * is much more valuable than 20% confusion, or 20% slow, or 280 * is much more valuable than 20% confusion, or 20% slow, or
279 * several others. Start at 1 - ignore physical - all that normal 281 * several others. Start at 1 - ignore physical - all that normal
280 * armour shouldn't be counted against 282 * armour shouldn't be counted against
500 if (!QUERY_FLAG (op, FLAG_IDENTIFIED)) 502 if (!QUERY_FLAG (op, FLAG_IDENTIFIED))
501 return buf; 503 return buf;
502 504
503 for (attr = 0; attr < NUM_STATS; attr++) 505 for (attr = 0; attr < NUM_STATS; attr++)
504 { 506 {
505 if ((val = get_attr_value (&(op->stats), attr)) != 0) 507 if ((val = op->stats.stat (attr)))
506 {
507 sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); 508 sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val);
508 }
509 } 509 }
510 510
511 if (op->stats.exp) 511 if (op->stats.exp)
512 sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); 512 sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp);
513 if (op->stats.wc) 513 if (op->stats.wc)
712 { 712 {
713 case BOW: 713 case BOW:
714 case WAND: 714 case WAND:
715 case ROD: 715 case ROD:
716 case HORN: 716 case HORN:
717 safe_strcat (buf[use_buf], " (readied)", &len, HUGE_BUF); 717 safe_strcat (buf[use_buf], op->env && op->env->current_weapon == op ? " (readied)" : " (applied)", &len, HUGE_BUF);
718 break; 718 break;
719 case WEAPON: 719 case WEAPON:
720 safe_strcat (buf[use_buf], " (wielded)", &len, HUGE_BUF); 720 safe_strcat (buf[use_buf], op->env && op->env->current_weapon == op ? " (wielded)" : " (applied)", &len, HUGE_BUF);
721 break; 721 break;
722 case ARMOUR: 722 case ARMOUR:
723 case HELMET: 723 case HELMET:
724 case SHIELD: 724 case SHIELD:
725 case RING: 725 case RING:
840 safe_strcat (buf, " ", &len, MAX_BUF); 840 safe_strcat (buf, " ", &len, MAX_BUF);
841 safe_strcat (buf, s, &len, MAX_BUF); 841 safe_strcat (buf, s, &len, MAX_BUF);
842 } 842 }
843 } 843 }
844 break; 844 break;
845
845 default: 846 default:
846 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) 847 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED)))
847 {
848 sprintf (buf + strlen (buf), " %+d", op->magic); 848 sprintf (buf + strlen (buf), " %+d", op->magic);
849 }
850 } 849 }
851 850
852 return buf; 851 return buf;
853} 852}
854 853
1083 break; /* We have more information to do below this switch */ 1082 break; /* We have more information to do below this switch */
1084 1083
1085 case POWER_CRYSTAL: 1084 case POWER_CRYSTAL:
1086 if (op->stats.maxsp > 1000) 1085 if (op->stats.maxsp > 1000)
1087 { /*higher capacity crystals */ 1086 { /*higher capacity crystals */
1088 i = (op->stats.maxsp % 100) / 10; 1087 i = (op->stats.maxsp % 1000) / 100;
1088
1089 if (i) 1089 if (i)
1090 snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 100, i); 1090 snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 1000, i);
1091 else 1091 else
1092 snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 100); 1092 snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 1000);
1093 } 1093 }
1094 else 1094 else
1095 snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); 1095 snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp);
1096
1096 strcat (retbuf, buf); 1097 strcat (retbuf, buf);
1097 i = (op->stats.sp * 10) / op->stats.maxsp; 1098 i = (op->stats.sp * 10) / op->stats.maxsp;
1098 if (op->stats.sp == 0) 1099 if (op->stats.sp == 0)
1099 strcat (retbuf, "empty."); 1100 strcat (retbuf, "empty.");
1100 else if (i == 0) 1101 else if (i == 0)
1165 { 1166 {
1166 int attr, val; 1167 int attr, val;
1167 1168
1168 for (attr = 0; attr < NUM_STATS; attr++) 1169 for (attr = 0; attr < NUM_STATS; attr++)
1169 { 1170 {
1170 if ((val = get_attr_value (&(op->stats), attr)) != 0) 1171 if ((val = op->stats.stat (attr)))
1171 { 1172 {
1172 sprintf (buf, "(%s%+d)", short_stat_name[attr], val); 1173 sprintf (buf, "(%s%+d)", short_stat_name[attr], val);
1173 strcat (retbuf, buf); 1174 strcat (retbuf, buf);
1174 } 1175 }
1175 } 1176 }
1432 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)
1433 return 1; 1434 return 1;
1434 1435
1435 /* Check to see if it increases/decreases any stats */ 1436 /* Check to see if it increases/decreases any stats */
1436 for (i = 0; i < NUM_STATS; i++) 1437 for (i = 0; i < NUM_STATS; i++)
1437 if (get_attr_value (&(op->stats), i) != 0) 1438 if (op->stats.stat (i))
1438 return 1; 1439 return 1;
1439 1440
1440 /* 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
1441 * be non magical. 1442 * be non magical.
1442 */ 1443 */
1451int 1452int
1452need_identify (const object *op) 1453need_identify (const object *op)
1453{ 1454{
1454 switch (op->type) 1455 switch (op->type)
1455 { 1456 {
1456 case RING: 1457 case RING:
1457 case WAND: 1458 case WAND:
1458 case ROD: 1459 case ROD:
1459 case HORN: 1460 case HORN:
1460 case SCROLL: 1461 case SCROLL:
1461 case SKILL: 1462 case SKILL:
1462 case SKILLSCROLL: 1463 case SKILLSCROLL:
1463 case SPELLBOOK: 1464 case SPELLBOOK:
1464 case FOOD: 1465 case FOOD:
1465 case POTION: 1466 case POTION:
1466 case BOW: 1467 case BOW:
1467 case ARROW: 1468 case ARROW:
1468 case WEAPON: 1469 case WEAPON:
1469 case ARMOUR: 1470 case ARMOUR:
1470 case SHIELD: 1471 case SHIELD:
1471 case HELMET: 1472 case HELMET:
1472 case AMULET: 1473 case AMULET:
1473 case BOOTS: 1474 case BOOTS:
1474 case GLOVES: 1475 case GLOVES:
1475 case BRACERS: 1476 case BRACERS:
1476 case GIRDLE: 1477 case GIRDLE:
1477 case CONTAINER: 1478 case CONTAINER:
1478 case DRINK: 1479 case DRINK:
1479 case FLESH: 1480 case FLESH:
1480 case INORGANIC: 1481 case INORGANIC:
1481 case CLOSE_CON: 1482 case CLOSE_CON:
1482 case CLOAK: 1483 case CLOAK:
1483 case GEM: 1484 case GEM:
1484 case POWER_CRYSTAL: 1485 case POWER_CRYSTAL:
1485 case POISON: 1486 case POISON:
1486 case BOOK: 1487 case BOOK:
1487 case SKILL_TOOL: 1488 case SKILL_TOOL:
1488 return 1; 1489 return 1;
1489 } 1490 }
1491
1490 /* 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
1491 * archetype file can be updated, and this function removed. 1493 * archetype file can be updated, and this function removed.
1492 */ 1494 */
1493#if 0 1495#if 0
1494 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