… | |
… | |
85 | } |
85 | } |
86 | return 0; |
86 | return 0; |
87 | } |
87 | } |
88 | |
88 | |
89 | int |
89 | int |
90 | command_dumpfriendlyobjects (object *op, char *params) |
|
|
91 | { |
|
|
92 | dump_friendly_objects (); |
|
|
93 | return 0; |
|
|
94 | } |
|
|
95 | |
|
|
96 | int |
|
|
97 | command_version (object *op, char *params) |
90 | command_version (object *op, char *params) |
98 | { |
91 | { |
99 | version (op); |
92 | version (op); |
100 | return 0; |
93 | return 0; |
101 | } |
|
|
102 | |
|
|
103 | #ifndef BUG_LOG |
|
|
104 | # define BUG_LOG "bug_log" |
|
|
105 | #endif |
|
|
106 | void |
|
|
107 | bug_report (const char *reportstring) |
|
|
108 | { |
|
|
109 | FILE *fp; |
|
|
110 | |
|
|
111 | if ((fp = fopen (BUG_LOG, "a")) != NULL) |
|
|
112 | { |
|
|
113 | fprintf (fp, "%s\n", reportstring); |
|
|
114 | fclose (fp); |
|
|
115 | } |
|
|
116 | else |
|
|
117 | { |
|
|
118 | LOG (llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror (errno)); |
|
|
119 | } |
|
|
120 | } |
94 | } |
121 | |
95 | |
122 | /* Prints out some useful information for the character. Everything we print |
96 | /* Prints out some useful information for the character. Everything we print |
123 | * out can be determined by the docs, so we aren't revealing anything extra - |
97 | * out can be determined by the docs, so we aren't revealing anything extra - |
124 | * rather, we are making it convenient to find the values. params have |
98 | * rather, we are making it convenient to find the values. params have |
… | |
… | |
127 | int |
101 | int |
128 | command_statistics (object *pl, char *params) |
102 | command_statistics (object *pl, char *params) |
129 | { |
103 | { |
130 | if (!pl->contr) |
104 | if (!pl->contr) |
131 | return 1; |
105 | return 1; |
132 | new_draw_info_format (NDI_UNIQUE, 0, pl, " Experience: %" PRId64, pl->stats.exp); |
|
|
133 | new_draw_info_format (NDI_UNIQUE, 0, pl, " Next Level: %" PRId64, level_exp (pl->level + 1, pl->expmul)); |
|
|
134 | new_draw_info (NDI_UNIQUE, 0, pl, "\nStat Nat/Real/Max"); |
|
|
135 | |
106 | |
136 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Str %2d/ %3d/%3d", |
107 | dynbuf_text msg (2048, 1024); |
137 | pl->contr->orig_stats.Str, pl->stats.Str, 20 + pl->arch->stats.Str); |
108 | |
138 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Dex %2d/ %3d/%3d", |
109 | msg << " Experience: " << pl->stats.exp << '\n' |
139 | pl->contr->orig_stats.Dex, pl->stats.Dex, 20 + pl->arch->stats.Dex); |
110 | << " Next Level: " << level_exp (pl->level + 1, pl->expmul) << '\n' |
140 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Con %2d/ %3d/%3d", |
111 | << "\n Stat Nat/Real/Max\n"; |
141 | pl->contr->orig_stats.Con, pl->stats.Con, 20 + pl->arch->stats.Con); |
112 | |
142 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Int %2d/ %3d/%3d", |
113 | for (int i = 0; i < NUM_STATS; ++i) |
143 | pl->contr->orig_stats.Int, pl->stats.Int, 20 + pl->arch->stats.Int); |
114 | msg.printf (" %s %2d/ %3d/%3d\n", short_stat_name [i], pl->contr->orig_stats.stat (i), pl->stats.stat (i), 20 + pl->arch->stats.stat (i)); |
144 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Wis %2d/ %3d/%3d", |
115 | |
145 | pl->contr->orig_stats.Wis, pl->stats.Wis, 20 + pl->arch->stats.Wis); |
116 | msg << "\nYou are " << (pl->contr->peaceful ? "peaceful" : "hostile") << '.'; |
146 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Pow %2d/ %3d/%3d", |
117 | |
147 | pl->contr->orig_stats.Pow, pl->stats.Pow, 20 + pl->arch->stats.Pow); |
118 | pl->contr->infobox (MSG_CHANNEL ("statistics"), msg); |
148 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Cha %2d/ %3d/%3d", |
|
|
149 | pl->contr->orig_stats.Cha, pl->stats.Cha, 20 + pl->arch->stats.Cha); |
|
|
150 | new_draw_info_format (NDI_UNIQUE, 0, pl, "\nAttack Mode: %s", pl->contr->peaceful ? "Peaceful" : "Hostile"); |
|
|
151 | |
119 | |
152 | /* Can't think of anything else to print right now */ |
120 | /* Can't think of anything else to print right now */ |
153 | return 0; |
121 | return 0; |
154 | } |
122 | } |
155 | |
123 | |
… | |
… | |
165 | |
133 | |
166 | int |
134 | int |
167 | command_bowmode (object *op, char *params) |
135 | command_bowmode (object *op, char *params) |
168 | { |
136 | { |
169 | bowtype_t oldtype = op->contr->bowtype; |
137 | bowtype_t oldtype = op->contr->bowtype; |
170 | static const char *const types[] = { "normal", "threewide", "spreadshot", "firenorth", |
138 | static const char *const types[] = { |
|
|
139 | "normal", "threewide", "spreadshot", "firenorth", |
171 | "firene", "fireeast", "firese", "firesouth", |
140 | "firene", "fireeast", "firese", "firesouth", |
172 | "firesw", "firewest", "firenw", "bestarrow" |
141 | "firesw", "firewest", "firenw", "bestarrow" |
173 | }; |
142 | }; |
174 | char buf[MAX_BUF]; |
143 | char buf[MAX_BUF]; |
175 | int i, found; |
144 | int i, found; |
… | |
… | |
191 | } |
160 | } |
192 | |
161 | |
193 | if (!found) |
162 | if (!found) |
194 | { |
163 | { |
195 | sprintf (buf, "bowmode: Unknown options %s, valid options are:", params); |
164 | sprintf (buf, "bowmode: Unknown options %s, valid options are:", params); |
|
|
165 | |
196 | for (i = 0; i <= bow_bestarrow; i++) |
166 | for (i = 0; i <= bow_bestarrow; i++) |
197 | { |
167 | { |
198 | strcat (buf, " "); |
168 | strcat (buf, " "); |
199 | strcat (buf, types[i]); |
169 | strcat (buf, types[i]); |
200 | if (i < bow_nw) |
170 | if (i < bow_nw) |
… | |
… | |
211 | } |
181 | } |
212 | |
182 | |
213 | int |
183 | int |
214 | command_showpets (object *op, char *params) |
184 | command_showpets (object *op, char *params) |
215 | { |
185 | { |
216 | objectlink *obl, *next; |
|
|
217 | int counter = 0, target = 0; |
186 | int counter = 0, target = 0; |
218 | int have_shown_pet = 0; |
187 | int have_shown_pet = 0; |
219 | |
188 | |
|
|
189 | dynbuf_text msg (2048, 1024); |
|
|
190 | |
220 | if (params != NULL) |
191 | if (params) |
221 | target = atoi (params); |
192 | target = atoi (params); |
|
|
193 | |
222 | for (obl = first_friendly_object; obl != NULL; obl = next) |
194 | for (objectlink *obl = first_friendly_object; obl; obl = obl->next) |
223 | { |
195 | { |
224 | object *ob = obl->ob; |
196 | object *ob = obl->ob; |
225 | |
197 | |
226 | next = obl->next; |
|
|
227 | if (ob->owner == op) |
198 | if (ob->owner == op) |
228 | { |
199 | { |
229 | if (target == 0) |
200 | if (target == 0) |
230 | { |
201 | { |
231 | if (counter == 0) |
202 | if (counter == 0) |
232 | new_draw_info (NDI_UNIQUE, 0, op, "Pets:"); |
203 | msg << "T<Pets>\n\n"; |
|
|
204 | |
233 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d %s - level %d", ++counter, &ob->name, ob->level); |
205 | msg.printf (" %3d %s, level %d\n", ++counter, &ob->name, ob->level); |
234 | } |
206 | } |
235 | else if (!have_shown_pet && ++counter == target) |
207 | else if (!have_shown_pet && ++counter == target) |
236 | { |
208 | { |
237 | new_draw_info_format (NDI_UNIQUE, 0, op, "level %d %s", ob->level, &ob->name); |
209 | msg.printf ("T<%s>\n\n" |
238 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d/%d HP, %d/%d SP", ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp); |
210 | " level %d\n" |
239 | /* this is not a nice way to do this, it should be made to be more like the statistics command */ |
211 | " %d/%d HP, %d/%d SP\n" |
240 | new_draw_info_format (NDI_UNIQUE, 0, op, "Str %d", ob->stats.Str); |
212 | " Str %2d\n" |
241 | new_draw_info_format (NDI_UNIQUE, 0, op, "Dex %d", ob->stats.Dex); |
213 | " Dex %2d\n" |
242 | new_draw_info_format (NDI_UNIQUE, 0, op, "Con %d", ob->stats.Con); |
214 | " Con %2d\n" |
243 | new_draw_info_format (NDI_UNIQUE, 0, op, "Int %d", ob->stats.Int); |
215 | " Int %2d\n" |
244 | new_draw_info_format (NDI_UNIQUE, 0, op, "Wis %d", ob->stats.Wis); |
216 | " Wis %2d\n" |
245 | new_draw_info_format (NDI_UNIQUE, 0, op, "Cha %d", ob->stats.Cha); |
217 | " Cha %2d\n" |
246 | new_draw_info_format (NDI_UNIQUE, 0, op, "Pow %d", ob->stats.Pow); |
218 | " Pow %2d\n" |
247 | new_draw_info_format (NDI_UNIQUE, 0, op, "wc %d damage %d ac %d ", ob->stats.wc, ob->stats.dam, ob->stats.ac); |
219 | " wc %d damage %d ac %d\n", |
|
|
220 | &ob->name, |
|
|
221 | &ob->name, |
|
|
222 | ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp, |
|
|
223 | ob->stats.Str, |
|
|
224 | ob->stats.Dex, |
|
|
225 | ob->stats.Con, |
|
|
226 | ob->stats.Int, |
|
|
227 | ob->stats.Wis, |
|
|
228 | ob->stats.Cha, |
|
|
229 | ob->stats.Pow, |
|
|
230 | ob->stats.wc, ob->stats.dam, ob->stats.ac); |
|
|
231 | |
248 | have_shown_pet = 1; |
232 | have_shown_pet = 1; |
249 | } |
233 | } |
250 | } |
234 | } |
251 | } |
235 | } |
|
|
236 | |
252 | if (counter == 0) |
237 | if (counter == 0) |
253 | new_draw_info (NDI_UNIQUE, 0, op, "you have no pets."); |
238 | msg << "you have no pets."; |
254 | else if (target != 0 && have_shown_pet == 0) |
239 | else if (target != 0 && have_shown_pet == 0) |
255 | new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); |
240 | msg << "no such pet."; |
|
|
241 | |
|
|
242 | op->contr->infobox (MSG_CHANNEL ("pets"), msg); |
|
|
243 | |
256 | return 0; |
244 | return 0; |
257 | } |
245 | } |
258 | |
246 | |
259 | int |
247 | int |
260 | command_resistances (object *op, char *params) |
248 | command_resistances (object *op, char *params) |
261 | { |
249 | { |
262 | int i; |
250 | dynbuf_text msg (2048, 1024); |
263 | |
251 | |
264 | if (!op) |
252 | msg << "Resistances:\n\n"; |
265 | return 0; |
|
|
266 | |
253 | |
267 | for (i = 0; i < NROFATTACKS; i++) |
254 | for (int i = 0; i < NROFATTACKS; i++) |
268 | { |
|
|
269 | if (i == ATNR_INTERNAL) |
255 | if (i != ATNR_INTERNAL) |
270 | continue; |
256 | msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]); |
271 | |
|
|
272 | new_draw_info_format (NDI_UNIQUE, 0, op, "%-20s %+5d", attacktype_desc[i], op->resist[i]); |
|
|
273 | } |
|
|
274 | |
257 | |
275 | /* If dragon player, let's display natural resistances */ |
258 | /* If dragon player, let's display natural resistances */ |
276 | if (is_dragon_pl (op)) |
259 | if (is_dragon_pl (op)) |
277 | { |
|
|
278 | int attack; |
|
|
279 | object *tmp; |
|
|
280 | |
|
|
281 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
260 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
282 | { |
|
|
283 | if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) |
261 | if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) |
284 | { |
262 | { |
285 | new_draw_info (NDI_UNIQUE, 0, op, "\nNatural skin resistances:"); |
263 | msg << "\nOf those, these are natural skin resistances:\n\n"; |
|
|
264 | |
286 | for (attack = 0; attack < NROFATTACKS; attack++) |
265 | for (int attack = 0; attack < NROFATTACKS; attack++) |
287 | { |
|
|
288 | if (atnr_is_dragon_enabled (attack)) |
266 | if (atnr_is_dragon_enabled (attack)) |
289 | { |
267 | msg.printf (" %-20s %+4d\n", change_resist_msg [attack], tmp->resist [attack]); |
290 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s: %d", change_resist_msg[attack], tmp->resist[attack]); |
268 | |
291 | } |
|
|
292 | } |
|
|
293 | break; |
269 | break; |
294 | } |
270 | } |
295 | } |
271 | |
296 | } |
272 | op->contr->infobox (MSG_CHANNEL ("resistances"), msg); |
297 | |
273 | |
298 | return 0; |
274 | return 0; |
299 | } |
275 | } |
300 | |
276 | |
301 | /* |
277 | /* |