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.68 by root, Sun Nov 29 09:41:27 2009 UTC vs.
Revision 1.77 by root, Sat Apr 3 02:27:24 2010 UTC

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
52Body_Locations body_locations[NUM_BODY_LOCATIONS] = { 53Body_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"},
561 * returned is good forever.) However, it makes printing statements that 562 * 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.) 563 * use several names much easier (don't need to store them to temp variables.)
563 * 564 *
564 * It is used extensively within messages, so should return only a prose 565 * It is used extensively within messages, so should return only a prose
565 * and short description of the item. 566 * and short description of the item.
567 * It is also used by examine/ex and similar functions.
566 */ 568 */
567const char * 569const char *
568query_name (const object *op) 570query_name (const object *op)
569{ 571{
570 int len = 0; 572 int len = 0;
624 { 626 {
625 case BOW: 627 case BOW:
626 case WAND: 628 case WAND:
627 case ROD: 629 case ROD:
628 case HORN: 630 case HORN:
629 buf << (op->env && op->env->current_weapon == op ? " (readied)" : " (applied)"); 631 buf << " (applied)";
630 break; 632 break;
631 case WEAPON: 633 case WEAPON:
632 buf << (op->env && op->env->current_weapon == op ? " (wielded)" : " (applied)"); 634 buf << " (applied)";
633 break; 635 break;
634 case ARMOUR: 636 case ARMOUR:
635 case HELMET: 637 case HELMET:
636 case SHIELD: 638 case SHIELD:
637 case RING: 639 case RING:
686 * and sending to client. 688 * and sending to client.
687 * If plural is set, we generate the plural name of this. 689 * If plural is set, we generate the plural name of this.
688 * 690 *
689 * It is sometimes used to display messages, and usually only used to match stuff, 691 * It is sometimes used to display messages, and usually only used to match stuff,
690 * so maybe this function should be removed. 692 * so maybe this function should be removed.
693 * It is also used for client-side inventory/item descriptions.
691 */ 694 */
692const char * 695const char *
693query_base_name (const object *op, int plural) 696query_base_name (const object *op, int plural)
694{ 697{
695 if ((!plural && !op->name) || (plural && !op->name_pl)) 698 if ((!plural && !op->name) || (plural && !op->name_pl))
696 return "(null)"; 699 return "(null)";
697 700
698 if (!op->nrof && !op->weight && !op->title && !is_magical (op)) 701 if (!op->nrof && !op->weight && !op->title && !is_magical (op)
702 && op->type != EXIT)
699 return op->name; /* To speed things up (or make things slower?) */ 703 return op->name; /* To speed things up (or make things slower?) */
700 704
701 static dynbuf_text buf; buf.clear (); 705 static dynbuf_text buf; buf.clear ();
702 706
703#if 0 707#if 0
737 const char *s = ring_desc (op); 741 const char *s = ring_desc (op);
738 742
739 if (s && *s) 743 if (s && *s)
740 buf << ' ' << s; 744 buf << ' ' << s;
741 } 745 }
746 break;
747
748 case EXIT:
749 // random map exits "unfortunately" get patched, so this only works before entering
750 if (EXIT_PATH (op) == shstr_random_map_exit)
751 buf << " (random map)";
752 else if (!EXIT_PATH (op))
753 buf << " (closed)";
742 break; 754 break;
743 755
744 default: 756 default:
745 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) 757 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED)))
746 buf.printf (" %+d", op->magic); 758 buf.printf (" %+d", op->magic);
843 if (op->stats.luck) 855 if (op->stats.luck)
844 buf.printf ("(luck%+d)", op->stats.luck); 856 buf.printf ("(luck%+d)", op->stats.luck);
845 } 857 }
846 858
847 /* describe attacktypes */ 859 /* describe attacktypes */
848 if (is_dragon_pl (op)) 860 if (op->is_dragon ())
849 { 861 {
850 /* for dragon players display the attacktypes from clawing skill 862 /* for dragon players display the attacktypes from clawing skill
851 * Break apart the for loop - move the comparison checking down - 863 * Break apart the for loop - move the comparison checking down -
852 * this makes it more readable. 864 * this makes it more readable.
853 */ 865 */
1152 1164
1153 buf.add_abilities ("Attacks", op->attacktype); 1165 buf.add_abilities ("Attacks", op->attacktype);
1154 /* resistance on flesh is only visible for quetzals. If 1166 /* resistance on flesh is only visible for quetzals. If
1155 * non flesh, everyone can see its resistances 1167 * non flesh, everyone can see its resistances
1156 */ 1168 */
1157 if (op->type != FLESH || (owner && is_dragon_pl (owner))) 1169 if (op->type != FLESH || (owner && owner->is_dragon ()))
1158 buf << describe_resistance (op, 0); 1170 buf << describe_resistance (op, 0);
1159 1171
1160 buf.add_paths ("Attuned", op->path_attuned); 1172 buf.add_paths ("Attuned", op->path_attuned);
1161 buf.add_paths ("Repelled", op->path_repelled); 1173 buf.add_paths ("Repelled", op->path_repelled);
1162 buf.add_paths ("Denied", op->path_denied); 1174 buf.add_paths ("Denied", op->path_denied);
1189{ 1201{
1190 static dynbuf_text buf; buf.clear (); 1202 static dynbuf_text buf; buf.clear ();
1191 1203
1192 for (object *tmp = inv; tmp; tmp = tmp->below) 1204 for (object *tmp = inv; tmp; tmp = tmp->below)
1193 if (who && QUERY_FLAG (who, FLAG_WIZ)) 1205 if (who && QUERY_FLAG (who, FLAG_WIZ))
1194 buf.printf ("%s- %-28.28s (%5d) %-8s\n", indent, tmp->query_name (), tmp->count, tmp->query_weight ()); 1206 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))) 1207 else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED)))
1196 buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); 1208 buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ());
1197 1209
1198 if (buf.size ()) 1210 if (buf.size ())
1199 buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); 1211 buf.printf ("%s(total weight: %s)\n", indent, query_weight ());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines