1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
47 | * Note that using the term 'human' may not be very accurate, humanoid |
47 | * Note that using the term 'human' may not be very accurate, humanoid |
48 | * may be better. |
48 | * may be better. |
49 | * Basically, for the use/nonuse, the code does something like: |
49 | * Basically, for the use/nonuse, the code does something like: |
50 | * "This item goes %s\n", with the use/nonuse values filling in the %s |
50 | * "This item goes %s\n", with the use/nonuse values filling in the %s |
51 | */ |
51 | */ |
|
|
52 | // see include/object.h |
52 | Body_Locations body_locations[NUM_BODY_LOCATIONS] = { |
53 | Body_Locations body_locations[NUM_BODY_LOCATIONS] = { |
53 | {KW_body_skill , "You can use it as your skill" , "It is used as a skill"}, |
54 | {KW_body_skill , "You can use it as your skill" , "It is used as a skill"}, |
54 | {KW_body_combat , "You can wield it as your weapon" , "It is used as a combat weapon"}, |
55 | {KW_body_combat , "You can wield it as your weapon" , "It is used as a combat weapon"}, |
55 | {KW_body_range , "You can use it as your range weapon" , "It is used as a range weapon"}, |
56 | {KW_body_range , "You can use it as your range weapon" , "It is used as a range weapon"}, |
56 | {KW_body_shield , "You can wield it as a shield" , "It is used as a shield"}, |
57 | {KW_body_shield , "You can wield it as a shield" , "It is used as a shield"}, |
… | |
… | |
70 | static char numbers_10[10][20] = { |
71 | static char numbers_10[10][20] = { |
71 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
72 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
72 | "eighty", "ninety" |
73 | "eighty", "ninety" |
73 | }; |
74 | }; |
74 | |
75 | |
75 | static char levelnumbers[21][20] = { |
76 | static char ordnumbers[21][20] = { |
76 | "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", |
77 | "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", |
77 | "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", |
78 | "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", |
78 | "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteen", |
79 | "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", |
79 | "nineteen", "twentieth" |
80 | "nineteenth", "twentieth" |
80 | }; |
81 | }; |
81 | |
82 | |
82 | static char levelnumbers_10[11][20] = { |
83 | static char ordnumbers_10[11][20] = { |
83 | "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", |
84 | "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", |
84 | "seventieth", "eightieth", "ninetieth" |
85 | "seventieth", "eightieth", "ninetieth" |
85 | }; |
86 | }; |
86 | |
87 | |
87 | /* The following is a large table of item types, the fields are: |
88 | /* The following is a large table of item types, the fields are: |
… | |
… | |
150 | {EXIT, "exit", "exits", 0, 0}, |
151 | {EXIT, "exit", "exits", 0, 0}, |
151 | {ENCOUNTER, "encounter", "encounters", 0, 0}, |
152 | {ENCOUNTER, "encounter", "encounters", 0, 0}, |
152 | {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, |
153 | {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, |
153 | {SHOP_MAT, "shop mat", "shop mats", 0, 0}, |
154 | {SHOP_MAT, "shop mat", "shop mats", 0, 0}, |
154 | {RING, "ring", "rings", SK_JEWELER, 0}, |
155 | {RING, "ring", "rings", SK_JEWELER, 0}, |
155 | {FLOOR, "floor", "floors", 0, 0}, |
156 | // {FLOOR, "floor", "floors", 0, 0}, |
156 | {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, |
157 | {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, |
157 | {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, |
158 | {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, |
158 | {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, |
159 | {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, |
159 | {LIGHTER, "lighter", "lighters", 0, 0}, |
160 | {LIGHTER, "lighter", "lighters", 0, 0}, |
160 | {BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0}, |
161 | {BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0}, |
… | |
… | |
386 | /* |
387 | /* |
387 | * Returns the pointer to a static buffer containing |
388 | * Returns the pointer to a static buffer containing |
388 | * the number requested (of the form first, second, third...) |
389 | * the number requested (of the form first, second, third...) |
389 | */ |
390 | */ |
390 | const char * |
391 | const char * |
391 | get_levelnumber (int i) |
392 | ordinal (int i) |
392 | { |
393 | { |
393 | static char buf[MAX_BUF]; |
394 | if (i < 0) |
394 | |
395 | return format ("minus %s", ordinal (-i)); |
395 | if (i > 99) |
|
|
396 | { |
|
|
397 | sprintf (buf, "%d.", i); |
|
|
398 | return buf; |
|
|
399 | } |
|
|
400 | |
396 | |
401 | if (i < 21) |
397 | if (i < 21) |
402 | return levelnumbers[i]; |
398 | return ordnumbers[i]; |
403 | |
399 | |
|
|
400 | int digit = i % 10; |
|
|
401 | |
404 | if (!(i % 10)) |
402 | if (i >= 100) |
|
|
403 | return format ( |
|
|
404 | digit == 1 ? "%dst" |
|
|
405 | : digit == 2 ? "%dnd" |
|
|
406 | : digit == 3 ? "%drd" |
|
|
407 | : "%dth", |
|
|
408 | i |
|
|
409 | ); |
|
|
410 | |
|
|
411 | if (digit == 0) |
405 | return levelnumbers_10[i / 10]; |
412 | return ordnumbers_10[i / 10]; |
406 | |
413 | else |
407 | strcpy (buf, numbers_10[i / 10]); |
414 | return format ("%s%s", numbers_10[i / 10], ordnumbers[i % 10]); |
408 | strcat (buf, levelnumbers[i % 10]); |
|
|
409 | return buf; |
|
|
410 | } |
415 | } |
411 | |
416 | |
412 | /* |
417 | /* |
413 | * Returns pointer to static buffer containing ring's or amulet's |
418 | * Returns pointer to static buffer containing ring's or amulet's |
414 | * abilities |
419 | * abilities |
… | |
… | |
426 | ring_desc (const object *op) |
431 | ring_desc (const object *op) |
427 | { |
432 | { |
428 | static dynbuf_text buf; buf.clear (); |
433 | static dynbuf_text buf; buf.clear (); |
429 | int attr, val, len; |
434 | int attr, val, len; |
430 | |
435 | |
431 | if (QUERY_FLAG (op, FLAG_IDENTIFIED)) |
436 | if (op->flag [FLAG_IDENTIFIED]) |
432 | { |
437 | { |
433 | for (attr = 0; attr < NUM_STATS; attr++) |
438 | for (attr = 0; attr < NUM_STATS; attr++) |
434 | if ((val = op->stats.stat (attr))) |
439 | if ((val = op->stats.stat (attr))) |
435 | buf.printf ("(%s%+d)", short_stat_name[attr], val); |
440 | buf.printf ("(%s%+d)", short_stat_name[attr], val); |
436 | |
441 | |
… | |
… | |
445 | if (op->stats.grace) buf.printf ("(grace%+d)", op->stats.grace); |
450 | if (op->stats.grace) buf.printf ("(grace%+d)", op->stats.grace); |
446 | if (op->stats.sp && op->type != SKILL) buf.printf ("(magic%+d)", op->stats.sp); |
451 | if (op->stats.sp && op->type != SKILL) buf.printf ("(magic%+d)", op->stats.sp); |
447 | if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp); |
452 | if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp); |
448 | if (op->stats.luck) buf.printf ("(luck%+d)", op->stats.luck); |
453 | if (op->stats.luck) buf.printf ("(luck%+d)", op->stats.luck); |
449 | |
454 | |
450 | if (QUERY_FLAG (op, FLAG_LIFESAVE)) buf << "(lifesaving)"; |
455 | if (op->flag [FLAG_LIFESAVE]) buf << "(lifesaving)"; |
451 | if (QUERY_FLAG (op, FLAG_REFL_SPELL)) buf << "(reflect spells)"; |
456 | if (op->flag [FLAG_REFL_SPELL]) buf << "(reflect spells)"; |
452 | if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) buf << "(reflect missiles)"; |
457 | if (op->flag [FLAG_REFL_MISSILE]) buf << "(reflect missiles)"; |
453 | if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealth)"; |
458 | if (op->flag [FLAG_STEALTH]) buf << "(stealth)"; |
454 | |
459 | |
455 | buf.add_paths ("Attuned" , op->path_attuned); |
460 | buf.add_paths ("Attuned" , op->path_attuned); |
456 | buf.add_paths ("Repelled", op->path_repelled); |
461 | buf.add_paths ("Repelled", op->path_repelled); |
457 | buf.add_paths ("Denied" , op->path_denied); |
462 | buf.add_paths ("Denied" , op->path_denied); |
458 | |
463 | |
… | |
… | |
484 | |
489 | |
485 | static dynbuf_text buf; buf.clear (); |
490 | static dynbuf_text buf; buf.clear (); |
486 | |
491 | |
487 | buf << (op->nrof <= 1 ? op->name : op->name_pl); |
492 | buf << (op->nrof <= 1 ? op->name : op->name_pl); |
488 | |
493 | |
489 | if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED)) |
494 | if (op->title && op->flag [FLAG_IDENTIFIED]) |
490 | buf << ' ' << op->title; |
495 | buf << ' ' << op->title; |
491 | |
496 | |
492 | switch (op->type) |
497 | switch (op->type) |
493 | { |
498 | { |
494 | case SPELLBOOK: |
499 | case SPELLBOOK: |
495 | case SCROLL: |
500 | case SCROLL: |
496 | case WAND: |
501 | case WAND: |
497 | case ROD: |
502 | case ROD: |
498 | if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
503 | if (op->flag [FLAG_IDENTIFIED] || op->flag [FLAG_BEEN_APPLIED]) |
499 | { |
504 | { |
500 | if (!op->title) |
505 | if (!op->title) |
501 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
506 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
502 | |
507 | |
503 | if (op->type != SPELLBOOK) |
508 | if (op->type != SPELLBOOK) |
… | |
… | |
542 | buf << " " << s; |
547 | buf << " " << s; |
543 | } |
548 | } |
544 | break; |
549 | break; |
545 | |
550 | |
546 | default: |
551 | default: |
547 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
552 | if (op->magic && ((op->flag [FLAG_BEEN_APPLIED] && need_identify (op)) || op->flag [FLAG_IDENTIFIED])) |
548 | buf.printf (" %+d", op->magic); |
553 | buf.printf (" %+d", op->magic); |
549 | } |
554 | } |
550 | |
555 | |
551 | return buf; |
556 | return buf; |
552 | } |
557 | } |
… | |
… | |
561 | * returned is good forever.) However, it makes printing statements that |
566 | * returned is good forever.) However, it makes printing statements that |
562 | * use several names much easier (don't need to store them to temp variables.) |
567 | * use several names much easier (don't need to store them to temp variables.) |
563 | * |
568 | * |
564 | * It is used extensively within messages, so should return only a prose |
569 | * It is used extensively within messages, so should return only a prose |
565 | * and short description of the item. |
570 | * and short description of the item. |
|
|
571 | * It is also used by examine/ex and similar functions. |
566 | */ |
572 | */ |
567 | const char * |
573 | const char * |
568 | query_name (const object *op) |
574 | query_name (const object *op) |
569 | { |
575 | { |
570 | int len = 0; |
576 | int len = 0; |
… | |
… | |
582 | buf << op->material->description << ' '; |
588 | buf << op->material->description << ' '; |
583 | #endif |
589 | #endif |
584 | |
590 | |
585 | buf << query_short_name (op); |
591 | buf << query_short_name (op); |
586 | |
592 | |
587 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
593 | if (op->flag [FLAG_INV_LOCKED]) |
588 | buf << " *"; |
594 | buf << " *"; |
589 | if (op->is_open_container ()) |
595 | if (op->is_open_container ()) |
590 | buf << " (open)"; |
596 | buf << " (open)"; |
591 | |
597 | |
592 | if (QUERY_FLAG (op, FLAG_KNOWN_CURSED)) |
598 | if (op->flag [FLAG_KNOWN_CURSED]) |
593 | { |
599 | { |
594 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
600 | if (op->flag [FLAG_DAMNED]) |
595 | buf << " (damned)"; |
601 | buf << " (damned)"; |
596 | else if (QUERY_FLAG (op, FLAG_CURSED)) |
602 | else if (op->flag [FLAG_CURSED]) |
597 | buf << " (cursed)"; |
603 | buf << " (cursed)"; |
598 | } |
604 | } |
599 | |
605 | |
600 | /* Basically, if the object is known magical (detect magic spell on it), |
606 | /* Basically, if the object is known magical (detect magic spell on it), |
601 | * and it isn't identified, print out the fact that |
607 | * and it isn't identified, print out the fact that |
… | |
… | |
604 | * |
610 | * |
605 | * Changed in V 0.91.4 - still print that the object is magical even |
611 | * Changed in V 0.91.4 - still print that the object is magical even |
606 | * if it has been applied. Equipping an item does not tell full |
612 | * if it has been applied. Equipping an item does not tell full |
607 | * abilities, especially for artifact items. |
613 | * abilities, especially for artifact items. |
608 | */ |
614 | */ |
609 | if (QUERY_FLAG (op, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (op, FLAG_IDENTIFIED)) |
615 | if (op->flag [FLAG_KNOWN_MAGICAL] && !op->flag [FLAG_IDENTIFIED]) |
610 | buf << " (magic)"; |
616 | buf << " (magic)"; |
611 | |
617 | |
612 | #if 0 |
618 | #if 0 |
613 | /* item_power will be returned in describe_item - it shouldn't really |
619 | /* item_power will be returned in describe_item - it shouldn't really |
614 | * be returned in the name. |
620 | * be returned in the name. |
… | |
… | |
616 | if (op->item_power) |
622 | if (op->item_power) |
617 | sprintf (buf[use_buf] + strlen (buf[use_buf]), "(item_power %+d)", op->item_power); |
623 | sprintf (buf[use_buf] + strlen (buf[use_buf]), "(item_power %+d)", op->item_power); |
618 | |
624 | |
619 | #endif |
625 | #endif |
620 | |
626 | |
621 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
627 | if (op->flag [FLAG_APPLIED]) |
622 | { |
628 | { |
623 | switch (op->type) |
629 | switch (op->type) |
624 | { |
630 | { |
625 | case BOW: |
631 | case BOW: |
626 | case WAND: |
632 | case WAND: |
627 | case ROD: |
633 | case ROD: |
628 | case HORN: |
634 | case HORN: |
629 | buf << (op->env && op->env->current_weapon == op ? " (readied)" : " (applied)"); |
635 | buf << " (applied)"; |
630 | break; |
636 | break; |
631 | case WEAPON: |
637 | case WEAPON: |
632 | buf << (op->env && op->env->current_weapon == op ? " (wielded)" : " (applied)"); |
638 | buf << " (applied)"; |
633 | break; |
639 | break; |
634 | case ARMOUR: |
640 | case ARMOUR: |
635 | case HELMET: |
641 | case HELMET: |
636 | case SHIELD: |
642 | case SHIELD: |
637 | case RING: |
643 | case RING: |
… | |
… | |
669 | else if (op->stats.food <= 0) |
675 | else if (op->stats.food <= 0) |
670 | buf << " (burned out)"; |
676 | buf << " (burned out)"; |
671 | break; |
677 | break; |
672 | } |
678 | } |
673 | |
679 | |
674 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
680 | if (op->flag [FLAG_UNPAID]) |
675 | buf << " (unpaid)"; |
681 | buf << " (unpaid)"; |
676 | |
682 | |
677 | return buf; |
683 | return buf; |
678 | } |
684 | } |
679 | |
685 | |
… | |
… | |
686 | * and sending to client. |
692 | * and sending to client. |
687 | * If plural is set, we generate the plural name of this. |
693 | * If plural is set, we generate the plural name of this. |
688 | * |
694 | * |
689 | * It is sometimes used to display messages, and usually only used to match stuff, |
695 | * It is sometimes used to display messages, and usually only used to match stuff, |
690 | * so maybe this function should be removed. |
696 | * so maybe this function should be removed. |
|
|
697 | * It is also used for client-side inventory/item descriptions. |
691 | */ |
698 | */ |
692 | const char * |
699 | const char * |
693 | query_base_name (const object *op, int plural) |
700 | query_base_name (const object *op, int plural) |
694 | { |
701 | { |
695 | if ((!plural && !op->name) || (plural && !op->name_pl)) |
702 | if ((!plural && !op->name) || (plural && !op->name_pl)) |
696 | return "(null)"; |
703 | return "(null)"; |
697 | |
704 | |
698 | if (!op->nrof && !op->weight && !op->title && !is_magical (op)) |
705 | if (!op->nrof && !op->weight && !op->title && !is_magical (op) |
|
|
706 | && op->type != EXIT) |
699 | return op->name; /* To speed things up (or make things slower?) */ |
707 | return op->name; /* To speed things up (or make things slower?) */ |
700 | |
708 | |
701 | static dynbuf_text buf; buf.clear (); |
709 | static dynbuf_text buf; buf.clear (); |
702 | |
710 | |
703 | #if 0 |
711 | #if 0 |
… | |
… | |
706 | buf << op->material->description << ' '; |
714 | buf << op->material->description << ' '; |
707 | #endif |
715 | #endif |
708 | |
716 | |
709 | buf << (plural ? op->name_pl : op->name); |
717 | buf << (plural ? op->name_pl : op->name); |
710 | |
718 | |
711 | if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED)) |
719 | if (op->title && op->flag [FLAG_IDENTIFIED]) |
712 | buf << ' ' << op->title; |
720 | buf << ' ' << op->title; |
713 | |
721 | |
714 | switch (op->type) |
722 | switch (op->type) |
715 | { |
723 | { |
716 | case SPELLBOOK: |
724 | case SPELLBOOK: |
717 | case SCROLL: |
725 | case SCROLL: |
718 | case WAND: |
726 | case WAND: |
719 | case ROD: |
727 | case ROD: |
720 | if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
728 | if (op->flag [FLAG_IDENTIFIED] || op->flag [FLAG_BEEN_APPLIED]) |
721 | { |
729 | { |
722 | if (!op->title) |
730 | if (!op->title) |
723 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
731 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
724 | |
732 | |
725 | if (op->type != SPELLBOOK) |
733 | if (op->type != SPELLBOOK) |
… | |
… | |
739 | if (s && *s) |
747 | if (s && *s) |
740 | buf << ' ' << s; |
748 | buf << ' ' << s; |
741 | } |
749 | } |
742 | break; |
750 | break; |
743 | |
751 | |
|
|
752 | case EXIT: |
|
|
753 | // random map exits "unfortunately" get patched, so this only works before entering |
|
|
754 | if (EXIT_PATH (op) == shstr_random_map_exit) |
|
|
755 | buf << " (random map)"; |
|
|
756 | else if (!EXIT_PATH (op)) |
|
|
757 | buf << " (closed)"; |
|
|
758 | break; |
|
|
759 | |
744 | default: |
760 | default: |
745 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
761 | if (op->magic && ((op->flag [FLAG_BEEN_APPLIED] && need_identify (op)) || op->flag [FLAG_IDENTIFIED])) |
746 | buf.printf (" %+d", op->magic); |
762 | buf.printf (" %+d", op->magic); |
747 | } |
763 | } |
748 | |
764 | |
749 | return buf; |
765 | return buf; |
750 | } |
766 | } |
… | |
… | |
763 | /* Note that the resolution this provides for players really isn't |
779 | /* Note that the resolution this provides for players really isn't |
764 | * very good. Any player with a speed greater than .67 will |
780 | * very good. Any player with a speed greater than .67 will |
765 | * fall into the 'lightning fast movement' category. |
781 | * fall into the 'lightning fast movement' category. |
766 | */ |
782 | */ |
767 | if (op->has_active_speed ()) |
783 | if (op->has_active_speed ()) |
768 | switch ((int)((fabs (op->speed)) * 15.)) |
784 | switch ((int)(op->speed * 15.)) |
769 | { |
785 | { |
770 | case 0: |
786 | case 0: |
771 | buf << "(very slow movement)"; |
787 | buf << "(very slow movement)"; |
772 | break; |
788 | break; |
773 | case 1: |
789 | case 1: |
… | |
… | |
793 | default: |
809 | default: |
794 | buf << "(lightning fast movement)"; |
810 | buf << "(lightning fast movement)"; |
795 | break; |
811 | break; |
796 | } |
812 | } |
797 | |
813 | |
798 | if (QUERY_FLAG (op, FLAG_UNDEAD)) buf << "(undead)"; |
814 | if (op->flag [FLAG_UNDEAD]) buf << "(undead)"; |
799 | if (QUERY_FLAG (op, FLAG_SEE_INVISIBLE)) buf << "(see invisible)"; |
815 | if (op->flag [FLAG_SEE_INVISIBLE]) buf << "(see invisible)"; |
800 | if (QUERY_FLAG (op, FLAG_USE_WEAPON)) buf << "(wield weapon)"; |
816 | if (op->flag [FLAG_USE_WEAPON]) buf << "(wield weapon)"; |
801 | if (QUERY_FLAG (op, FLAG_USE_BOW)) buf << "(archer)"; |
817 | if (op->flag [FLAG_USE_BOW]) buf << "(archer)"; |
802 | if (QUERY_FLAG (op, FLAG_USE_ARMOUR)) buf << "(wear armour)"; |
818 | if (op->flag [FLAG_USE_ARMOUR]) buf << "(wear armour)"; |
803 | if (QUERY_FLAG (op, FLAG_USE_RING)) buf << "(wear ring)"; |
819 | if (op->flag [FLAG_USE_RING]) buf << "(wear ring)"; |
804 | if (QUERY_FLAG (op, FLAG_USE_SCROLL)) buf << "(read scroll)"; |
820 | if (op->flag [FLAG_USE_SCROLL]) buf << "(read scroll)"; |
805 | if (QUERY_FLAG (op, FLAG_USE_RANGE)) buf << "(fires wand/rod/horn)"; |
821 | if (op->flag [FLAG_USE_RANGE]) buf << "(fires wand/rod/horn)"; |
806 | if (QUERY_FLAG (op, FLAG_CAN_USE_SKILL)) buf << "(skill user)"; |
822 | if (op->flag [FLAG_CAN_USE_SKILL]) buf << "(skill user)"; |
807 | if (QUERY_FLAG (op, FLAG_CAST_SPELL)) buf << "(spellcaster)"; |
823 | if (op->flag [FLAG_CAST_SPELL]) buf << "(spellcaster)"; |
808 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) buf << "(friendly)"; |
824 | if (op->flag [FLAG_FRIENDLY]) buf << "(friendly)"; |
809 | if (QUERY_FLAG (op, FLAG_UNAGGRESSIVE)) buf << "(unaggressive)"; |
825 | if (op->flag [FLAG_UNAGGRESSIVE]) buf << "(unaggressive)"; |
810 | if (QUERY_FLAG (op, FLAG_HITBACK)) buf << "(hitback)"; |
826 | if (op->flag [FLAG_HITBACK]) buf << "(hitback)"; |
811 | if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealthy)"; |
827 | if (op->flag [FLAG_STEALTH]) buf << "(stealthy)"; |
812 | |
828 | |
813 | if (op->randomitems) |
829 | if (op->randomitems) |
814 | { |
830 | { |
815 | bool first = 1; |
831 | bool first = 1; |
816 | |
832 | |
… | |
… | |
843 | if (op->stats.luck) |
859 | if (op->stats.luck) |
844 | buf.printf ("(luck%+d)", op->stats.luck); |
860 | buf.printf ("(luck%+d)", op->stats.luck); |
845 | } |
861 | } |
846 | |
862 | |
847 | /* describe attacktypes */ |
863 | /* describe attacktypes */ |
848 | if (is_dragon_pl (op)) |
864 | if (op->is_dragon ()) |
849 | { |
865 | { |
850 | /* for dragon players display the attacktypes from clawing skill |
866 | /* for dragon players display the attacktypes from clawing skill |
851 | * Break apart the for loop - move the comparison checking down - |
867 | * Break apart the for loop - move the comparison checking down - |
852 | * this makes it more readable. |
868 | * this makes it more readable. |
853 | */ |
869 | */ |
… | |
… | |
898 | * item (eg, debug dump or the like) |
914 | * item (eg, debug dump or the like) |
899 | */ |
915 | */ |
900 | const char * |
916 | const char * |
901 | describe_item (const object *op, object *owner) |
917 | describe_item (const object *op, object *owner) |
902 | { |
918 | { |
903 | if (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER) |
919 | if (op->flag [FLAG_MONSTER] || op->type == PLAYER) |
904 | return describe_monster (op); |
920 | return describe_monster (op); |
905 | |
921 | |
906 | static dynbuf_text buf; buf.clear (); |
922 | static dynbuf_text buf; buf.clear (); |
907 | int identified, i; |
923 | int identified, i; |
908 | |
924 | |
909 | /* figure this out once, instead of making multiple calls to need_identify. |
925 | /* figure this out once, instead of making multiple calls to need_identify. |
910 | * also makes the code easier to read. |
926 | * also makes the code easier to read. |
911 | */ |
927 | */ |
912 | identified = !need_identify (op) || QUERY_FLAG (op, FLAG_IDENTIFIED); |
928 | identified = !need_identify (op) || op->flag [FLAG_IDENTIFIED]; |
913 | if (!identified) |
929 | if (!identified) |
914 | buf << "(unidentified)"; |
930 | buf << "(unidentified)"; |
915 | |
931 | |
916 | switch (op->type) |
932 | switch (op->type) |
917 | { |
933 | { |
… | |
… | |
936 | if (op->stats.maxsp > 1000) |
952 | if (op->stats.maxsp > 1000) |
937 | { /*higher capacity crystals */ |
953 | { /*higher capacity crystals */ |
938 | i = (op->stats.maxsp % 1000) / 100; |
954 | i = (op->stats.maxsp % 1000) / 100; |
939 | |
955 | |
940 | if (i) |
956 | if (i) |
941 | buf.printf ("(capacity %d.%dk). It is ", op->stats.maxsp / 1000, i); |
957 | buf.printf ("(capacity %d.%dk; it is ", op->stats.maxsp / 1000, i); |
942 | else |
958 | else |
943 | buf.printf ("(capacity %dk). It is ", op->stats.maxsp / 1000); |
959 | buf.printf ("(capacity %dk; it is ", op->stats.maxsp / 1000); |
944 | } |
960 | } |
945 | else |
961 | else |
946 | buf.printf ("(capacity %d). It is ", op->stats.maxsp); |
962 | buf.printf ("(capacity %d; it is ", op->stats.maxsp); |
947 | |
963 | |
948 | i = (op->stats.sp * 10) / op->stats.maxsp; |
964 | i = (op->stats.sp * 10) / op->stats.maxsp; |
949 | if (op->stats.sp == 0) |
965 | if (op->stats.sp == 0) |
950 | buf << "empty."; |
966 | buf << "empty"; |
951 | else if (i == 0) |
967 | else if (i == 0) |
952 | buf << "almost empty."; |
968 | buf << "almost empty"; |
953 | else if (i < 3) |
969 | else if (i < 3) |
954 | buf << "partially filled."; |
970 | buf << "partially filled"; |
955 | else if (i < 6) |
971 | else if (i < 6) |
956 | buf << "half full."; |
972 | buf << "half full"; |
957 | else if (i < 9) |
973 | else if (i < 9) |
958 | buf << "well charged."; |
974 | buf << "well charged"; |
959 | else if (op->stats.sp == op->stats.maxsp) |
975 | else if (op->stats.sp == op->stats.maxsp) |
960 | buf << "fully charged."; |
976 | buf << "fully charged"; |
961 | else |
977 | else |
962 | buf << "almost full."; |
978 | buf << "almost full"; |
|
|
979 | |
|
|
980 | buf << ')'; |
963 | break; |
981 | break; |
964 | |
982 | |
965 | case LAMP: |
983 | case LAMP: |
966 | { |
984 | { |
967 | int percent = ((double) 100 / op->arch->stats.food) * op->stats.food; |
985 | int percent = ((double) 100 / op->arch->stats.food) * op->stats.food; |
… | |
… | |
985 | break; |
1003 | break; |
986 | |
1004 | |
987 | case FOOD: |
1005 | case FOOD: |
988 | case FLESH: |
1006 | case FLESH: |
989 | case DRINK: |
1007 | case DRINK: |
990 | if (identified || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
1008 | if (identified || op->flag [FLAG_BEEN_APPLIED]) |
991 | { |
1009 | { |
992 | buf.printf ("(food+%d)", op->stats.food); |
1010 | buf.printf ("(food+%d)", op->stats.food); |
993 | |
1011 | |
994 | if (op->type == FLESH && op->last_eat > 0 && atnr_is_dragon_enabled (op->last_eat)) |
1012 | if (op->type == FLESH && op->last_eat > 0 && atnr_is_dragon_enabled (op->last_eat)) |
995 | buf.printf ("(%s metabolism)", change_resist_msg[op->last_eat]); |
1013 | buf.printf ("(%s metabolism)", change_resist_msg[op->last_eat]); |
996 | |
1014 | |
997 | if (!QUERY_FLAG (op, FLAG_CURSED)) |
1015 | if (!op->flag [FLAG_CURSED]) |
998 | { |
1016 | { |
999 | if (op->stats.hp) buf << "(heals)"; |
1017 | if (op->stats.hp) buf << "(heals)"; |
1000 | if (op->stats.sp) buf << "(spellpoint regen)"; |
1018 | if (op->stats.sp) buf << "(spellpoint regen)"; |
1001 | } |
1019 | } |
1002 | else |
1020 | else |
… | |
… | |
1023 | } |
1041 | } |
1024 | |
1042 | |
1025 | /* Down here, we more further describe equipment type items. |
1043 | /* Down here, we more further describe equipment type items. |
1026 | * only describe them if they have been identified or the like. |
1044 | * only describe them if they have been identified or the like. |
1027 | */ |
1045 | */ |
1028 | if (identified || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
1046 | if (identified || op->flag [FLAG_BEEN_APPLIED]) |
1029 | { |
1047 | { |
1030 | int attr, val; |
1048 | int attr, val; |
1031 | |
1049 | |
1032 | for (attr = 0; attr < NUM_STATS; attr++) |
1050 | for (attr = 0; attr < NUM_STATS; attr++) |
1033 | if ((val = op->stats.stat (attr))) |
1051 | if ((val = op->stats.stat (attr))) |
… | |
… | |
1064 | |
1082 | |
1065 | default: |
1083 | default: |
1066 | break; |
1084 | break; |
1067 | } |
1085 | } |
1068 | |
1086 | |
1069 | if (QUERY_FLAG (op, FLAG_XRAYS)) buf << "(xray-vision)"; |
1087 | if (op->flag [FLAG_XRAYS]) buf << "(xray-vision)"; |
1070 | if (QUERY_FLAG (op, FLAG_SEE_IN_DARK)) buf << "(infravision)"; |
1088 | if (op->flag [FLAG_SEE_IN_DARK]) buf << "(infravision)"; |
1071 | |
1089 | |
1072 | /* levitate was what is was before, so we'll keep it */ |
1090 | /* levitate was what is was before, so we'll keep it */ |
1073 | if (op->move_type & MOVE_FLY_LOW) buf << "(levitate)"; |
1091 | if (op->move_type & MOVE_FLY_LOW) buf << "(levitate)"; |
1074 | if (op->move_type & MOVE_FLY_HIGH) buf << "(fly)"; |
1092 | if (op->move_type & MOVE_FLY_HIGH) buf << "(fly)"; |
1075 | if (op->move_type & MOVE_SWIM) buf << "(swim)"; |
1093 | if (op->move_type & MOVE_SWIM) buf << "(swim)"; |
… | |
… | |
1137 | } |
1155 | } |
1138 | |
1156 | |
1139 | if (op->stats.luck) |
1157 | if (op->stats.luck) |
1140 | buf.printf ("(luck%+d)", op->stats.luck); |
1158 | buf.printf ("(luck%+d)", op->stats.luck); |
1141 | |
1159 | |
1142 | if (QUERY_FLAG (op, FLAG_LIFESAVE)) buf << "(lifesaving)"; |
1160 | if (op->flag [FLAG_LIFESAVE]) buf << "(lifesaving)"; |
1143 | if (QUERY_FLAG (op, FLAG_REFL_SPELL)) buf << "(reflect spells)"; |
1161 | if (op->flag [FLAG_REFL_SPELL]) buf << "(reflect spells)"; |
1144 | if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) buf << "(reflect missiles)"; |
1162 | if (op->flag [FLAG_REFL_MISSILE]) buf << "(reflect missiles)"; |
1145 | if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealth)"; |
1163 | if (op->flag [FLAG_STEALTH]) buf << "(stealth)"; |
1146 | |
1164 | |
1147 | if (op->slaying && op->type != FOOD) |
1165 | if (op->slaying && op->type != FOOD) |
1148 | buf.printf ("(slay %s)", &op->slaying); |
1166 | buf.printf ("(slay %s)", &op->slaying); |
1149 | |
1167 | |
1150 | if (op->type == SKILL_TOOL && op->skill) |
1168 | if (op->type == SKILL_TOOL && op->skill) |
… | |
… | |
1152 | |
1170 | |
1153 | buf.add_abilities ("Attacks", op->attacktype); |
1171 | buf.add_abilities ("Attacks", op->attacktype); |
1154 | /* resistance on flesh is only visible for quetzals. If |
1172 | /* resistance on flesh is only visible for quetzals. If |
1155 | * non flesh, everyone can see its resistances |
1173 | * non flesh, everyone can see its resistances |
1156 | */ |
1174 | */ |
1157 | if (op->type != FLESH || (owner && is_dragon_pl (owner))) |
1175 | if (op->type != FLESH || (owner && owner->is_dragon ())) |
1158 | buf << describe_resistance (op, 0); |
1176 | buf << describe_resistance (op, 0); |
1159 | |
1177 | |
1160 | buf.add_paths ("Attuned", op->path_attuned); |
1178 | buf.add_paths ("Attuned", op->path_attuned); |
1161 | buf.add_paths ("Repelled", op->path_repelled); |
1179 | buf.add_paths ("Repelled", op->path_repelled); |
1162 | buf.add_paths ("Denied", op->path_denied); |
1180 | buf.add_paths ("Denied", op->path_denied); |
… | |
… | |
1167 | |
1185 | |
1168 | std::string |
1186 | std::string |
1169 | object::describe_item (object *who) |
1187 | object::describe_item (object *who) |
1170 | { |
1188 | { |
1171 | return std::string (::describe_item (this, who)); |
1189 | return std::string (::describe_item (this, who)); |
|
|
1190 | } |
|
|
1191 | |
|
|
1192 | static void |
|
|
1193 | describe_dump_object (dynbuf &buf, object *ob) |
|
|
1194 | { |
|
|
1195 | char *txt = dump_object (ob); |
|
|
1196 | for (char *p = txt; *p; ++p) if (*p == '\n') *p = '\r'; |
|
|
1197 | buf << "\n" << txt << "\n"; |
|
|
1198 | |
|
|
1199 | if (!ob->is_arch ()) |
|
|
1200 | describe_dump_object (buf, ob->arch); |
|
|
1201 | } |
|
|
1202 | |
|
|
1203 | std::string |
|
|
1204 | object::describe (object *who) |
|
|
1205 | { |
|
|
1206 | dynbuf_text buf (1024, 1024); |
|
|
1207 | |
|
|
1208 | buf.printf ("That is: %s.\r", long_desc (who).c_str ()); |
|
|
1209 | |
|
|
1210 | if (custom_name) |
|
|
1211 | buf.printf ("You call it %s.\r", &custom_name); |
|
|
1212 | |
|
|
1213 | switch (type) |
|
|
1214 | { |
|
|
1215 | case SPELLBOOK: |
|
|
1216 | if (flag [FLAG_IDENTIFIED] && inv) |
|
|
1217 | buf.printf ("%s is a %s level %s spell.\r", &inv->name, ordinal (inv->level), &inv->skill); |
|
|
1218 | break; |
|
|
1219 | |
|
|
1220 | case BOOK: |
|
|
1221 | if (msg) |
|
|
1222 | buf << "Something is written in it.\r"; |
|
|
1223 | break; |
|
|
1224 | |
|
|
1225 | case CONTAINER: |
|
|
1226 | if (race) |
|
|
1227 | { |
|
|
1228 | if (weight_limit && stats.Str < 100) |
|
|
1229 | buf.printf ("It can hold only %s and its weight limit is %.1f kg.\r", |
|
|
1230 | &race, weight_limit / (10.0 * (100 - stats.Str))); |
|
|
1231 | else |
|
|
1232 | buf.printf ("It can hold only %s.\r", &race); |
|
|
1233 | } |
|
|
1234 | else if (weight_limit && stats.Str < 100) |
|
|
1235 | buf.printf ("Its weight limit is %.1f kg.\r", weight_limit / (10.0 * (100 - stats.Str))); |
|
|
1236 | break; |
|
|
1237 | |
|
|
1238 | case WAND: |
|
|
1239 | if (flag [FLAG_IDENTIFIED]) |
|
|
1240 | buf.printf ("It has %d %s left.\r", stats.food, stats.food == 1 ? "charge" : "charges"); |
|
|
1241 | break; |
|
|
1242 | } |
|
|
1243 | |
|
|
1244 | if (material != MATERIAL_NULL && !msg) |
|
|
1245 | buf << (nrof > 1 ? "They are made of " : "It is made of ") |
|
|
1246 | << material->description |
|
|
1247 | << ".\r"; |
|
|
1248 | |
|
|
1249 | if (who) |
|
|
1250 | /* Where to wear this item */ |
|
|
1251 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
|
|
1252 | if (slot[i].info) |
|
|
1253 | { |
|
|
1254 | buf << (who->slot[i].info ? body_locations[i].use_name : body_locations[i].nonuse_name); |
|
|
1255 | |
|
|
1256 | if (slot[i].info < -1 && who->slot[i].info) |
|
|
1257 | buf.printf ("(%d)", -slot[i].info); |
|
|
1258 | |
|
|
1259 | buf << ".\r"; |
|
|
1260 | } |
|
|
1261 | |
|
|
1262 | if (weight) |
|
|
1263 | buf.printf ("%s %3.3f kg.\r", nrof > 1 ? "They weigh" : "It weighs", weight * (nrof ? nrof : 1) / 1000.0); |
|
|
1264 | |
|
|
1265 | if (flag [FLAG_STARTEQUIP]) |
|
|
1266 | buf << (nrof > 1 ? "They were" : "It was") |
|
|
1267 | << " given by a god and will vanish when dropped.\r"; |
|
|
1268 | |
|
|
1269 | if (value && !flag [FLAG_STARTEQUIP] && !flag [FLAG_NO_PICK] && who) |
|
|
1270 | { |
|
|
1271 | buf.printf ("You reckon %s worth %s.\r", nrof > 1 ? "they are" : "it is", query_cost_string (this, who, F_TRUE | F_APPROX)); |
|
|
1272 | |
|
|
1273 | if (who->is_in_shop ()) |
|
|
1274 | { |
|
|
1275 | if (flag [FLAG_UNPAID]) |
|
|
1276 | buf.printf ("%s would cost you %s.\r", nrof > 1 ? "They" : "It", query_cost_string (this, who, F_BUY | F_SHOP)); |
|
|
1277 | else |
|
|
1278 | buf.printf ("You are offered %s for %s.\r", query_cost_string (this, who, F_SELL + F_SHOP), nrof > 1 ? "them" : "it"); |
|
|
1279 | } |
|
|
1280 | } |
|
|
1281 | |
|
|
1282 | if (flag [FLAG_MONSTER]) |
|
|
1283 | buf << describe_monster (who); |
|
|
1284 | |
|
|
1285 | /* Is this item buildable? */ |
|
|
1286 | if (flag [FLAG_IS_BUILDABLE]) |
|
|
1287 | buf << "This is a buildable item.\r"; |
|
|
1288 | |
|
|
1289 | /* Does the object have a message? Don't show message for all object |
|
|
1290 | * types - especially if the first entry is a match |
|
|
1291 | */ |
|
|
1292 | if (msg) |
|
|
1293 | { |
|
|
1294 | if (type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ()) |
|
|
1295 | { |
|
|
1296 | buf << '\r'; |
|
|
1297 | |
|
|
1298 | /* This is just a hack so when identifying the items, we print |
|
|
1299 | * out the extra message |
|
|
1300 | */ |
|
|
1301 | if (need_identify (this) && flag [FLAG_IDENTIFIED]) |
|
|
1302 | buf << "The object has a story:\r"; |
|
|
1303 | |
|
|
1304 | buf << msg << '\n'; |
|
|
1305 | } |
|
|
1306 | } |
|
|
1307 | else if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED] |
|
|
1308 | && (type == SPELLBOOK || type == ROD || type == WAND |
|
|
1309 | || type == ROD || type == POTION || type == SCROLL)) |
|
|
1310 | // for spellbooks and other stuff that contains spells, print the spell message, |
|
|
1311 | // unless the object has a custom message handled above. |
|
|
1312 | buf << '\r' << inv->msg << '\n'; |
|
|
1313 | |
|
|
1314 | // try to display the duration for some potions and scrolls |
|
|
1315 | // this includes change ability potions and group spells, |
|
|
1316 | // but does not handle protection potions |
|
|
1317 | if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED] |
|
|
1318 | && (type == POTION || type == SCROLL)) |
|
|
1319 | { |
|
|
1320 | object *spell = inv; |
|
|
1321 | |
|
|
1322 | if (spell->subtype == SP_PARTY_SPELL) |
|
|
1323 | spell = spell->other_arch; |
|
|
1324 | |
|
|
1325 | if (spell->subtype == SP_CHANGE_ABILITY) |
|
|
1326 | buf.printf ("\nH<The effect will last about %.10g seconds.>", |
|
|
1327 | TICK2TIME (change_ability_duration (spell, this))); |
|
|
1328 | } |
|
|
1329 | |
|
|
1330 | // some help text for skill tools |
|
|
1331 | if (type == SKILL_TOOL) |
|
|
1332 | buf << "\nH<This item is a skill tool: as long as you have this item applied " |
|
|
1333 | "you can use the " << &skill << " skill as if you had learned it.>"; |
|
|
1334 | |
|
|
1335 | // Display a hint about inscribable items [empty books] |
|
|
1336 | // This includes the amount of text they can hold. |
|
|
1337 | if (type == INSCRIBABLE) |
|
|
1338 | { |
|
|
1339 | if (other_arch && other_arch->type == SCROLL) |
|
|
1340 | buf.printf ("\nH<You can use the inscription skill to inscribe a spell into it.>"); |
|
|
1341 | else |
|
|
1342 | buf.printf ("\nH<You can use the inscription skill to inscribe text into it. It has room for up to %d characters.>", |
|
|
1343 | weight_limit); |
|
|
1344 | } |
|
|
1345 | |
|
|
1346 | buf << '\n'; |
|
|
1347 | |
|
|
1348 | // the dungeon master additionally gets a complete dump |
|
|
1349 | if (who && who->flag [FLAG_WIZLOOK]) |
|
|
1350 | { |
|
|
1351 | buf << "\nT<Object>\n"; |
|
|
1352 | describe_dump_object (buf, this); |
|
|
1353 | |
|
|
1354 | if (inv) |
|
|
1355 | { |
|
|
1356 | buf << "\nT<Top Inventory>\n"; |
|
|
1357 | describe_dump_object (buf, inv); |
|
|
1358 | } |
|
|
1359 | } |
|
|
1360 | |
|
|
1361 | return std::string (buf.linearise (), buf.size ()); |
1172 | } |
1362 | } |
1173 | |
1363 | |
1174 | void |
1364 | void |
1175 | examine (object *op, object *tmp) |
1365 | examine (object *op, object *tmp) |
1176 | { |
1366 | { |
… | |
… | |
1188 | object::query_inventory (object *who, const char *indent) |
1378 | object::query_inventory (object *who, const char *indent) |
1189 | { |
1379 | { |
1190 | static dynbuf_text buf; buf.clear (); |
1380 | static dynbuf_text buf; buf.clear (); |
1191 | |
1381 | |
1192 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1382 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1193 | if (who && QUERY_FLAG (who, FLAG_WIZ)) |
1383 | if (who && who->flag [FLAG_WIZ]) |
1194 | buf.printf ("%s- %-28.28s (%5d) %-8s\n", indent, tmp->query_name (), tmp->count, tmp->query_weight ()); |
1384 | buf.printf ("%s- %-28.28s %-8s (%9d) %s\n", indent, tmp->query_name (), tmp->query_weight (), tmp->count, tmp->uuid.c_str ()); |
1195 | else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED))) |
1385 | else if (!tmp->invisible && (type == CONTAINER || tmp->flag [FLAG_APPLIED])) |
1196 | buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); |
1386 | buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); |
1197 | |
1387 | |
1198 | if (buf.size ()) |
1388 | if (buf.size ()) |
1199 | buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); |
1389 | buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); |
1200 | else |
1390 | else |
… | |
… | |
1213 | is_magical (const object *op) |
1403 | is_magical (const object *op) |
1214 | { |
1404 | { |
1215 | int i; |
1405 | int i; |
1216 | |
1406 | |
1217 | /* living creatures are considered non magical */ |
1407 | /* living creatures are considered non magical */ |
1218 | if (QUERY_FLAG (op, FLAG_ALIVE)) |
1408 | if (op->flag [FLAG_ALIVE]) |
1219 | return 0; |
1409 | return 0; |
1220 | |
1410 | |
1221 | /* This is a test for it being an artifact, as artifacts have titles */ |
1411 | /* This is a test for it being an artifact, as artifacts have titles */ |
1222 | if (op->title != NULL) |
1412 | if (op->title != NULL) |
1223 | return 1; |
1413 | return 1; |
… | |
… | |
1229 | (op->stats.ac || op->stats.food || op->stats.exp || op->stats.dam || op->stats.wc || op->stats.sp || op->stats.hp || op->stats.luck)) |
1419 | (op->stats.ac || op->stats.food || op->stats.exp || op->stats.dam || op->stats.wc || op->stats.sp || op->stats.hp || op->stats.luck)) |
1230 | return 1; |
1420 | return 1; |
1231 | |
1421 | |
1232 | /* Check for stealty, speed, flying, or just plain magic in the boots */ |
1422 | /* Check for stealty, speed, flying, or just plain magic in the boots */ |
1233 | /* Presume any boots that hvae a move_type are special. */ |
1423 | /* Presume any boots that hvae a move_type are special. */ |
1234 | if (op->type == BOOTS && ((QUERY_FLAG (op, FLAG_STEALTH) || op->move_type || op->stats.exp))) |
1424 | if (op->type == BOOTS && ((op->flag [FLAG_STEALTH] || op->move_type || op->stats.exp))) |
1235 | return 1; |
1425 | return 1; |
1236 | |
1426 | |
1237 | /* Take care of amulet/shield that reflects spells/missiles */ |
1427 | /* Take care of amulet/shield that reflects spells/missiles */ |
1238 | if ((op->type == AMULET || op->type == SHIELD) && (QUERY_FLAG (op, FLAG_REFL_SPELL) || QUERY_FLAG (op, FLAG_REFL_MISSILE))) |
1428 | if ((op->type == AMULET || op->type == SHIELD) && (op->flag [FLAG_REFL_SPELL] || op->flag [FLAG_REFL_MISSILE])) |
1239 | return 1; |
1429 | return 1; |
1240 | |
1430 | |
1241 | /* Take care of helmet of xrays */ |
1431 | /* Take care of helmet of xrays */ |
1242 | if (op->type == HELMET && QUERY_FLAG (op, FLAG_XRAYS)) |
1432 | if (op->type == HELMET && op->flag [FLAG_XRAYS]) |
1243 | return 1; |
1433 | return 1; |
1244 | |
1434 | |
1245 | /* Potions & rods are always magical. Wands/staves are also magical, |
1435 | /* Potions & rods are always magical. Wands/staves are also magical, |
1246 | * assuming they still have any charges left. |
1436 | * assuming they still have any charges left. |
1247 | */ |
1437 | */ |
… | |
… | |
1336 | * Supposed to fix face-values as well here, but later. |
1526 | * Supposed to fix face-values as well here, but later. |
1337 | */ |
1527 | */ |
1338 | void |
1528 | void |
1339 | identify (object *op) |
1529 | identify (object *op) |
1340 | { |
1530 | { |
1341 | SET_FLAG (op, FLAG_IDENTIFIED); |
1531 | op->set_flag (FLAG_IDENTIFIED); |
1342 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
1532 | op->clr_flag (FLAG_KNOWN_MAGICAL); |
1343 | CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT); |
1533 | op->clr_flag (FLAG_NO_SKILL_IDENT); |
1344 | |
1534 | |
1345 | /* |
1535 | /* |
1346 | * We want autojoining of equal objects: |
1536 | * We want autojoining of equal objects: |
1347 | */ |
1537 | */ |
1348 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
1538 | if (op->flag [FLAG_CURSED] || op->flag [FLAG_DAMNED]) |
1349 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
1539 | op->set_flag (FLAG_KNOWN_CURSED); |
1350 | |
1540 | |
1351 | if (op->type == POTION) |
1541 | if (op->type == POTION) |
1352 | { |
1542 | { |
1353 | if (op->inv && op->randomitems) |
1543 | if (op->inv && op->randomitems) |
1354 | op->title = op->inv->name; |
1544 | op->title = op->inv->name; |