|
|
1 | |
1 | /* |
2 | /* |
2 | * static char *rcsid_info_c = |
3 | * static char *rcsid_info_c = |
3 | * "$Id: info.C,v 1.3 2006/09/03 00:18:39 root Exp $"; |
4 | * "$Id: info.C,v 1.4 2006/09/10 16:00:23 root Exp $"; |
4 | */ |
5 | */ |
5 | |
6 | |
6 | /* |
7 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
8 | |
9 | |
… | |
… | |
35 | |
36 | |
36 | /* |
37 | /* |
37 | * Dump to standard out the abilities of all monsters. |
38 | * Dump to standard out the abilities of all monsters. |
38 | */ |
39 | */ |
39 | |
40 | |
|
|
41 | void |
40 | void dump_abilities(void) { |
42 | dump_abilities (void) |
|
|
43 | { |
41 | archetype *at; |
44 | archetype *at; |
42 | for(at = first_archetype; at; at=at->next) { |
|
|
43 | char *ch; |
|
|
44 | const char *gen_name = ""; |
|
|
45 | archetype *gen; |
|
|
46 | |
45 | |
47 | if(!QUERY_FLAG(&at->clone,FLAG_MONSTER)) |
46 | for (at = first_archetype; at; at = at->next) |
48 | continue; |
47 | { |
|
|
48 | char *ch; |
|
|
49 | const char *gen_name = ""; |
|
|
50 | archetype *gen; |
49 | |
51 | |
50 | /* Get rid of e.g. multiple black puddings */ |
|
|
51 | if (QUERY_FLAG(&at->clone,FLAG_CHANGING)) |
52 | if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) |
52 | continue; |
53 | continue; |
53 | |
54 | |
|
|
55 | /* Get rid of e.g. multiple black puddings */ |
|
|
56 | if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) |
|
|
57 | continue; |
|
|
58 | |
54 | for (gen = first_archetype; gen; gen = gen->next) { |
59 | for (gen = first_archetype; gen; gen = gen->next) |
|
|
60 | { |
55 | if (gen->clone.other_arch && gen->clone.other_arch == at) { |
61 | if (gen->clone.other_arch && gen->clone.other_arch == at) |
|
|
62 | { |
56 | gen_name = gen->name; |
63 | gen_name = gen->name; |
57 | break; |
64 | break; |
|
|
65 | } |
58 | } |
66 | } |
|
|
67 | |
|
|
68 | ch = describe_item (&at->clone, NULL); |
|
|
69 | #ifndef WIN32 |
|
|
70 | printf ("%-16s|%6lld|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp, |
|
|
71 | at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name); |
|
|
72 | #else |
|
|
73 | printf ("%-16s|%6I64d|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp, |
|
|
74 | at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name); |
|
|
75 | #endif |
59 | } |
76 | } |
60 | |
|
|
61 | ch = describe_item(&at->clone, NULL); |
|
|
62 | #ifndef WIN32 |
|
|
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); |
|
|
65 | #else |
|
|
66 | printf("%-16s|%6I64d|%4d|%3d|%s|%s|%s\n",&at->clone.name,(long long)at->clone.stats.exp, |
|
|
67 | at->clone.stats.hp,at->clone.stats.ac,ch,&at->name,gen_name); |
|
|
68 | #endif |
|
|
69 | } |
|
|
70 | } |
77 | } |
71 | |
78 | |
72 | /* |
79 | /* |
73 | * As dump_abilities(), but with an alternative way of output. |
80 | * As dump_abilities(), but with an alternative way of output. |
74 | */ |
81 | */ |
75 | |
82 | |
|
|
83 | void |
76 | void print_monsters(void) { |
84 | print_monsters (void) |
|
|
85 | { |
77 | archetype *at; |
86 | archetype *at; |
78 | object *op; |
87 | object *op; |
79 | char attbuf[34]; |
88 | char attbuf[34]; |
80 | int i; |
89 | int i; |
81 | |
90 | |
|
|
91 | printf |
82 | printf(" | | | | | attack | resistances |\n"); |
92 | (" | | | | | attack | resistances |\n"); |
|
|
93 | 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"); |
94 | ("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"); |
|
|
95 | printf |
84 | printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
96 | ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
85 | for(at=first_archetype;at!=NULL;at=at->next) { |
97 | for (at = first_archetype; at != NULL; at = at->next) |
|
|
98 | { |
86 | op = arch_to_object(at); |
99 | op = arch_to_object (at); |
87 | if (QUERY_FLAG(op,FLAG_MONSTER)) { |
100 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
|
|
101 | { |
88 | bitstostring((long)op->attacktype, NROFATTACKS, attbuf); |
102 | bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); |
89 | printf("%-15s|%5d|%3d|%4d|%4d|%s|", |
|
|
90 | &op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, op->stats.wc,attbuf); |
103 | printf ("%-15s|%5d|%3d|%4d|%4d|%s|", &op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, op->stats.wc, attbuf); |
91 | for (i=0; i<NROFATTACKS; i++) |
104 | for (i = 0; i < NROFATTACKS; i++) |
92 | printf("%4d", op->resist[i]); |
105 | printf ("%4d", op->resist[i]); |
93 | printf("|%8lld|%9d|\n", (long long)op->stats.exp, new_exp(op)); |
106 | printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op)); |
|
|
107 | } |
|
|
108 | free_object (op); |
94 | } |
109 | } |
95 | free_object(op); |
|
|
96 | } |
|
|
97 | } |
110 | } |
98 | |
111 | |
99 | /* |
112 | /* |
100 | * Writes <num> ones and zeros to the given string based on the |
113 | * Writes <num> ones and zeros to the given string based on the |
101 | * <bits> variable. |
114 | * <bits> variable. |
102 | */ |
115 | */ |
103 | |
116 | |
|
|
117 | void |
104 | void bitstostring(long bits, int num, char *str) |
118 | bitstostring (long bits, int num, char *str) |
105 | { |
119 | { |
106 | int i,j=0; |
120 | int i, j = 0; |
107 | |
121 | |
108 | if (num > 32) |
122 | if (num > 32) |
109 | num = 32; |
123 | num = 32; |
110 | |
124 | |
111 | for (i=0;i<num;i++) { |
125 | for (i = 0; i < num; i++) |
|
|
126 | { |
112 | if (i && (i%3)==0) { |
127 | if (i && (i % 3) == 0) |
|
|
128 | { |
113 | str[i+j] = ' '; |
129 | str[i + j] = ' '; |
114 | j++; |
130 | j++; |
|
|
131 | } |
|
|
132 | if (bits & 1) |
|
|
133 | str[i + j] = '1'; |
|
|
134 | else |
|
|
135 | str[i + j] = '0'; |
|
|
136 | bits >>= 1; |
115 | } |
137 | } |
116 | if (bits&1) |
|
|
117 | str[i+j] = '1'; |
|
|
118 | else |
|
|
119 | str[i+j] = '0'; |
|
|
120 | bits >>= 1; |
|
|
121 | } |
|
|
122 | str[i+j] = '\0'; |
138 | str[i + j] = '\0'; |
123 | return; |
139 | return; |
124 | } |
140 | } |