1 | /* |
|
|
2 | * static char *rcsid_info_c = |
|
|
3 | * "$Id: info.C,v 1.1 2006/08/13 17:16:00 elmex Exp $"; |
|
|
4 | */ |
|
|
5 | |
|
|
6 | /* |
1 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
8 | |
3 | |
9 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
10 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
21 | |
16 | |
22 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
23 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
24 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | |
20 | |
26 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
27 | */ |
22 | */ |
28 | |
23 | |
29 | #include <global.h> |
24 | #include <global.h> |
30 | |
25 | |
31 | /* |
26 | /* |
… | |
… | |
35 | |
30 | |
36 | /* |
31 | /* |
37 | * Dump to standard out the abilities of all monsters. |
32 | * Dump to standard out the abilities of all monsters. |
38 | */ |
33 | */ |
39 | |
34 | |
|
|
35 | void |
40 | void dump_abilities(void) { |
36 | dump_abilities (void) |
|
|
37 | { |
41 | archetype *at; |
38 | archetype *at; |
42 | for(at = first_archetype; at; at=at->next) { |
|
|
43 | char *ch; |
|
|
44 | const char *gen_name = ""; |
|
|
45 | archetype *gen; |
|
|
46 | |
39 | |
47 | if(!QUERY_FLAG(&at->clone,FLAG_MONSTER)) |
40 | for (at = first_archetype; at; at = at->next) |
48 | continue; |
41 | { |
|
|
42 | char *ch; |
|
|
43 | const char *gen_name = ""; |
|
|
44 | archetype *gen; |
49 | |
45 | |
50 | /* Get rid of e.g. multiple black puddings */ |
|
|
51 | if (QUERY_FLAG(&at->clone,FLAG_CHANGING)) |
46 | if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) |
52 | continue; |
47 | continue; |
53 | |
48 | |
|
|
49 | /* Get rid of e.g. multiple black puddings */ |
|
|
50 | if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) |
|
|
51 | continue; |
|
|
52 | |
54 | for (gen = first_archetype; gen; gen = gen->next) { |
53 | for (gen = first_archetype; gen; gen = gen->next) |
|
|
54 | { |
55 | if (gen->clone.other_arch && gen->clone.other_arch == at) { |
55 | if (gen->clone.other_arch && gen->clone.other_arch == at) |
|
|
56 | { |
56 | gen_name = gen->name; |
57 | gen_name = gen->name; |
57 | break; |
58 | break; |
|
|
59 | } |
58 | } |
60 | } |
|
|
61 | |
|
|
62 | ch = describe_item (&at->clone, NULL); |
|
|
63 | printf ("%-16s|%6lld|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp, |
|
|
64 | at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name); |
59 | } |
65 | } |
60 | |
|
|
61 | ch = describe_item(&at->clone, NULL); |
|
|
62 | #ifndef WIN32 |
|
|
63 | printf("%-16s|%6lld|%4d|%3d|%s|%s|%s\n",at->clone.name,at->clone.stats.exp, |
|
|
64 | at->clone.stats.hp,at->clone.stats.ac,ch,at->name,gen_name); |
|
|
65 | #else |
|
|
66 | printf("%-16s|%6I64d|%4d|%3d|%s|%s|%s\n",at->clone.name,at->clone.stats.exp, |
|
|
67 | at->clone.stats.hp,at->clone.stats.ac,ch,at->name,gen_name); |
|
|
68 | #endif |
|
|
69 | } |
|
|
70 | } |
66 | } |
71 | |
67 | |
72 | /* |
68 | /* |
73 | * As dump_abilities(), but with an alternative way of output. |
69 | * As dump_abilities(), but with an alternative way of output. |
74 | */ |
70 | */ |
75 | |
71 | |
|
|
72 | void |
76 | void print_monsters(void) { |
73 | print_monsters (void) |
|
|
74 | { |
77 | archetype *at; |
75 | archetype *at; |
78 | object *op; |
76 | object *op; |
79 | char attbuf[34]; |
77 | char attbuf[34]; |
80 | int i; |
78 | int i; |
81 | |
79 | |
|
|
80 | printf |
82 | printf(" | | | | | attack | resistances |\n"); |
81 | (" | | | | | attack | resistances |\n"); |
|
|
82 | printf |
83 | printf("monster | hp |dam| ac | wc |pmf ecw adw gpd ptf|phy mag fir ele cld cfs acd drn wmg ght poi slo par tud fer cnc dep dth chs csp gpw hwd bln int | exp | new exp |\n"); |
83 | ("monster | hp |dam| ac | wc |pmf ecw adw gpd ptf|phy mag fir ele cld cfs acd drn wmg ght poi slo par tud fer cnc dep dth chs csp gpw hwd bln int | exp | new exp |\n"); |
|
|
84 | printf |
84 | printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
85 | ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
85 | for(at=first_archetype;at!=NULL;at=at->next) { |
86 | for (at = first_archetype; at != NULL; at = at->next) |
|
|
87 | { |
86 | op = arch_to_object(at); |
88 | op = arch_to_object (at); |
87 | if (QUERY_FLAG(op,FLAG_MONSTER)) { |
89 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
|
|
90 | { |
88 | bitstostring((long)op->attacktype, NROFATTACKS, attbuf); |
91 | bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); |
89 | printf("%-15s|%5d|%3d|%4d|%4d|%s|", |
92 | printf ("%-15s|%5d|%3d|%4d|%4d|%s|", &op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, op->stats.wc, attbuf); |
90 | op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, |
|
|
91 | op->stats.wc,attbuf); |
|
|
92 | for (i=0; i<NROFATTACKS; i++) |
93 | for (i = 0; i < NROFATTACKS; i++) |
93 | printf("%4d", op->resist[i]); |
94 | printf ("%4d", op->resist[i]); |
94 | printf("|%8lld|%9d|\n",op->stats.exp, new_exp(op)); |
95 | printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op)); |
|
|
96 | } |
|
|
97 | op->destroy (0); |
95 | } |
98 | } |
96 | free_object(op); |
|
|
97 | } |
|
|
98 | } |
99 | } |
99 | |
100 | |
100 | /* |
101 | /* |
101 | * Writes <num> ones and zeros to the given string based on the |
102 | * Writes <num> ones and zeros to the given string based on the |
102 | * <bits> variable. |
103 | * <bits> variable. |
103 | */ |
104 | */ |
104 | |
105 | |
|
|
106 | void |
105 | void bitstostring(long bits, int num, char *str) |
107 | bitstostring (long bits, int num, char *str) |
106 | { |
108 | { |
107 | int i,j=0; |
109 | int i, j = 0; |
108 | |
110 | |
109 | if (num > 32) |
111 | if (num > 32) |
110 | num = 32; |
112 | num = 32; |
111 | |
113 | |
112 | for (i=0;i<num;i++) { |
114 | for (i = 0; i < num; i++) |
|
|
115 | { |
113 | if (i && (i%3)==0) { |
116 | if (i && (i % 3) == 0) |
|
|
117 | { |
114 | str[i+j] = ' '; |
118 | str[i + j] = ' '; |
115 | j++; |
119 | j++; |
|
|
120 | } |
|
|
121 | if (bits & 1) |
|
|
122 | str[i + j] = '1'; |
|
|
123 | else |
|
|
124 | str[i + j] = '0'; |
|
|
125 | bits >>= 1; |
116 | } |
126 | } |
117 | if (bits&1) |
|
|
118 | str[i+j] = '1'; |
|
|
119 | else |
|
|
120 | str[i+j] = '0'; |
|
|
121 | bits >>= 1; |
|
|
122 | } |
|
|
123 | str[i+j] = '\0'; |
127 | str[i + j] = '\0'; |
124 | return; |
128 | return; |
125 | } |
129 | } |