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 | * |
… | |
… | |
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 | */ |
51 | Body_Locations body_locations[NUM_BODY_LOCATIONS] = { |
51 | Body_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 | |
67 | static char numbers[21][20] = { |
69 | static 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", |
… | |
… | |
250 | }; |
252 | }; |
251 | |
253 | |
252 | int |
254 | int |
253 | get_power_from_ench (int ench) |
255 | get_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 | |
|
|
353 | const typedata * |
352 | const typedata * |
354 | get_typedata (int itemtype) |
353 | get_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 | |
|
|
368 | const typedata * |
366 | const typedata * |
369 | get_typedata_by_name (const char *name) |
367 | get_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 | |
… | |
… | |
1085 | break; /* We have more information to do below this switch */ |
1084 | break; /* We have more information to do below this switch */ |
1086 | |
1085 | |
1087 | case POWER_CRYSTAL: |
1086 | case POWER_CRYSTAL: |
1088 | if (op->stats.maxsp > 1000) |
1087 | if (op->stats.maxsp > 1000) |
1089 | { /*higher capacity crystals */ |
1088 | { /*higher capacity crystals */ |
1090 | i = (op->stats.maxsp % 100) / 10; |
1089 | i = (op->stats.maxsp % 1000) / 100; |
|
|
1090 | |
1091 | if (i) |
1091 | if (i) |
1092 | snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 100, i); |
1092 | snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 1000, i); |
1093 | else |
1093 | else |
1094 | snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 100); |
1094 | snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 1000); |
1095 | } |
1095 | } |
1096 | else |
1096 | else |
1097 | snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); |
1097 | snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); |
|
|
1098 | |
1098 | strcat (retbuf, buf); |
1099 | strcat (retbuf, buf); |
1099 | i = (op->stats.sp * 10) / op->stats.maxsp; |
1100 | i = (op->stats.sp * 10) / op->stats.maxsp; |
1100 | if (op->stats.sp == 0) |
1101 | if (op->stats.sp == 0) |
1101 | strcat (retbuf, "empty."); |
1102 | strcat (retbuf, "empty."); |
1102 | else if (i == 0) |
1103 | else if (i == 0) |