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.26 by root, Mon Apr 23 18:09:57 2007 UTC vs.
Revision 1.30 by root, Mon May 7 03:05:57 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
7 * 7 *
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", "in your range slot", "in a human's range slot"},
53 {"body_shield", "as a shield", "as a protective shield"},
54 {"body_combat", "as a combat weapon", "as a combat weapon"},
53 {"body_arm", "on your arm", "on a human's arm"}, 55 {"body_arm", "on your arm", "on a human's arm"},
54 {"body_torso", "on your body", "on a human's torso"}, 56 {"body_torso", "on your body", "on a human's torso"},
55 {"body_head", "on your head", "on a human's head"}, 57 {"body_head", "on your head", "on a human's head"},
56 {"body_neck", "around your neck", "around a humans neck"}, 58 {"body_neck", "around your neck", "around a humans neck"},
57 {"body_skill", "in your skill slot", "in a human's skill slot"}, 59 {"body_skill", "in your skill slot", "in a human's skill slot"},
250}; 252};
251 253
252int 254int
253get_power_from_ench (int ench) 255get_power_from_ench (int ench)
254{ 256{
255 if (ench < 0) 257 if (ench < 0) ench = 0;
256 ench = 0; 258 if (ench > 20) ench = 20;
257 if (ench > 20) 259
258 ench = 20;
259 return enc_to_item_power[ench]; 260 return enc_to_item_power[ench];
260} 261}
261 262
262/* This takes an object 'op' and figures out what its item_power 263/* This takes an object 'op' and figures out what its item_power
263 * rating should be. This should only really be used by the treasure 264 * rating should be. This should only really be used by the treasure
342 enc += 1; 343 enc += 1;
343 if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) 344 if (QUERY_FLAG (op, FLAG_MAKE_INVIS))
344 enc += 1; 345 enc += 1;
345 346
346 return get_power_from_ench (enc); 347 return get_power_from_ench (enc);
347
348} 348}
349 349
350/* returns the typedata that has a number equal to itemtype, if there 350/* returns the typedata that has a number equal to itemtype, if there
351 * isn't one, returns NULL */ 351 * isn't one, returns NULL */
352
353const typedata * 352const typedata *
354get_typedata (int itemtype) 353get_typedata (int itemtype)
355{ 354{
356 int i; 355 int i;
357 356
362} 361}
363 362
364/* returns the typedata that has a name equal to itemtype, if there 363/* returns the typedata that has a name equal to itemtype, if there
365 * isn't one, return the plural name that matches, if there still isn't 364 * isn't one, return the plural name that matches, if there still isn't
366 * one return NULL */ 365 * one return NULL */
367
368const typedata * 366const typedata *
369get_typedata_by_name (const char *name) 367get_typedata_by_name (const char *name)
370{ 368{
371 int i; 369 int i;
372 370
509 if ((val = get_attr_value (&(op->stats), attr)) != 0) 507 if ((val = get_attr_value (&(op->stats), attr)) != 0)
510 { 508 {
511 sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); 509 sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val);
512 } 510 }
513 } 511 }
512
514 if (op->stats.exp) 513 if (op->stats.exp)
515 sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); 514 sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp);
516 if (op->stats.wc) 515 if (op->stats.wc)
517 sprintf (buf + strlen (buf), "(wc%+d)", op->stats.wc); 516 sprintf (buf + strlen (buf), "(wc%+d)", op->stats.wc);
518 if (op->stats.dam) 517 if (op->stats.dam)
540 strcat (buf, "(reflect spells)"); 539 strcat (buf, "(reflect spells)");
541 if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) 540 if (QUERY_FLAG (op, FLAG_REFL_MISSILE))
542 strcat (buf, "(reflect missiles)"); 541 strcat (buf, "(reflect missiles)");
543 if (QUERY_FLAG (op, FLAG_STEALTH)) 542 if (QUERY_FLAG (op, FLAG_STEALTH))
544 strcat (buf, "(stealth)"); 543 strcat (buf, "(stealth)");
544
545 /* Shorten some of the names, so they appear better in the windows */ 545 /* Shorten some of the names, so they appear better in the windows */
546 len = strlen (buf); 546 len = strlen (buf);
547 DESCRIBE_PATH_SAFE (buf, op->path_attuned, "Attuned", &len, VERY_BIG_BUF); 547 DESCRIBE_PATH_SAFE (buf, op->path_attuned, "Attuned", &len, VERY_BIG_BUF);
548 DESCRIBE_PATH_SAFE (buf, op->path_repelled, "Repelled", &len, VERY_BIG_BUF); 548 DESCRIBE_PATH_SAFE (buf, op->path_repelled, "Repelled", &len, VERY_BIG_BUF);
549 DESCRIBE_PATH_SAFE (buf, op->path_denied, "Denied", &len, VERY_BIG_BUF); 549 DESCRIBE_PATH_SAFE (buf, op->path_denied, "Denied", &len, VERY_BIG_BUF);
714 { 714 {
715 case BOW: 715 case BOW:
716 case WAND: 716 case WAND:
717 case ROD: 717 case ROD:
718 case HORN: 718 case HORN:
719 safe_strcat (buf[use_buf], " (readied)", &len, HUGE_BUF); 719 safe_strcat (buf[use_buf], op->env && op->env->current_weapon == op ? " (readied)" : " (applied)", &len, HUGE_BUF);
720 break; 720 break;
721 case WEAPON: 721 case WEAPON:
722 safe_strcat (buf[use_buf], " (wielded)", &len, HUGE_BUF); 722 safe_strcat (buf[use_buf], op->env && op->env->current_weapon == op ? " (wielded)" : " (applied)", &len, HUGE_BUF);
723 break; 723 break;
724 case ARMOUR: 724 case ARMOUR:
725 case HELMET: 725 case HELMET:
726 case SHIELD: 726 case SHIELD:
727 case RING: 727 case RING:
842 safe_strcat (buf, " ", &len, MAX_BUF); 842 safe_strcat (buf, " ", &len, MAX_BUF);
843 safe_strcat (buf, s, &len, MAX_BUF); 843 safe_strcat (buf, s, &len, MAX_BUF);
844 } 844 }
845 } 845 }
846 break; 846 break;
847
847 default: 848 default:
848 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) 849 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED)))
849 {
850 sprintf (buf + strlen (buf), " %+d", op->magic); 850 sprintf (buf + strlen (buf), " %+d", op->magic);
851 }
852 } 851 }
853 852
854 return buf; 853 return buf;
855} 854}
856 855

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines