1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
26 | #include <loader.h> |
25 | #include <loader.h> |
27 | #include <sproto.h> |
26 | #include <sproto.h> |
… | |
… | |
47 | new_draw_info (NDI_UNIQUE, 0, op, "Heap checks out OK."); |
46 | new_draw_info (NDI_UNIQUE, 0, op, "Heap checks out OK."); |
48 | return 1; |
47 | return 1; |
49 | } |
48 | } |
50 | #endif |
49 | #endif |
51 | |
50 | |
52 | int |
|
|
53 | command_whereabouts (object *op, char *params) |
|
|
54 | { |
|
|
55 | //TODO: should obviously not waste space in struct region for this. |
|
|
56 | /* |
|
|
57 | * reset the counter on the region, then use it to store the number of |
|
|
58 | * players there. |
|
|
59 | * I don't know how thread-safe this would be, I suspect not very.... |
|
|
60 | */ |
|
|
61 | for_all_regions (rgn) |
|
|
62 | rgn->counter = 0; |
|
|
63 | |
|
|
64 | for_all_players (pl) |
|
|
65 | if (pl->ob->map) |
|
|
66 | ++pl->ob->region ()->counter; |
|
|
67 | |
|
|
68 | /* we only want to print out by places with a 'longname' field... */ |
|
|
69 | for_all_regions (rgn) |
|
|
70 | { |
|
|
71 | if (!rgn->longname && rgn->counter > 0) |
|
|
72 | { |
|
|
73 | if (rgn->parent) |
|
|
74 | { |
|
|
75 | rgn->parent->counter += rgn->counter; |
|
|
76 | rgn->counter = 0; |
|
|
77 | } |
|
|
78 | else /*uh oh, we shouldn't be here. */ |
|
|
79 | LOG (llevError, "command_whereabouts() Region %s with no longname has no parent", &rgn->name); |
|
|
80 | } |
|
|
81 | } |
|
|
82 | |
|
|
83 | new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:"); |
|
|
84 | |
|
|
85 | for_all_regions (rgn) |
|
|
86 | if (rgn->counter) |
|
|
87 | new_draw_info_format (NDI_UNIQUE, 0, op, "%u players %s", rgn->counter, &rgn->longname); |
|
|
88 | |
|
|
89 | return 1; |
|
|
90 | } |
|
|
91 | |
|
|
92 | typedef struct |
51 | typedef struct |
93 | { |
52 | { |
94 | char namebuf[MAX_BUF]; |
53 | char namebuf[MAX_BUF]; |
95 | int login_order; |
54 | int login_order; |
96 | } chars_names; |
55 | } chars_names; |
… | |
… | |
101 | print_tod (op); |
60 | print_tod (op); |
102 | return 1; |
61 | return 1; |
103 | } |
62 | } |
104 | |
63 | |
105 | int |
64 | int |
106 | command_weather (object *op, char *params) |
|
|
107 | { |
|
|
108 | #if 0 |
|
|
109 | int wx, wy, temp, sky; |
|
|
110 | char buf[MAX_BUF]; |
|
|
111 | |
|
|
112 | if (settings.dynamiclevel < 1) |
|
|
113 | return 1; |
|
|
114 | |
|
|
115 | if (op->map == NULL) |
|
|
116 | return 1; |
|
|
117 | |
|
|
118 | if (worldmap_to_weathermap (op->x, op->y, &wx, &wy, op->map) != 0) |
|
|
119 | return 1; |
|
|
120 | |
|
|
121 | if (QUERY_FLAG (op, FLAG_WIZ)) |
|
|
122 | { |
|
|
123 | /* dump the weather, Dm style! Yo! */ |
|
|
124 | new_draw_info_format (NDI_UNIQUE, 0, op, "Real temp: %d", real_world_temperature (op->x, op->y, op->map)); |
|
|
125 | new_draw_info_format (NDI_UNIQUE, 0, op, "Base temp: %d", weathermap[wx][wy].temp); |
|
|
126 | new_draw_info_format (NDI_UNIQUE, 0, op, "Humid: %d", weathermap[wx][wy].humid); |
|
|
127 | new_draw_info_format (NDI_UNIQUE, 0, op, "Wind: dir=%d speed=%d", weathermap[wx][wy].winddir, weathermap[wx][wy].windspeed); |
|
|
128 | new_draw_info_format (NDI_UNIQUE, 0, op, "Pressure: %d", weathermap[wx][wy].pressure); |
|
|
129 | new_draw_info_format (NDI_UNIQUE, 0, op, "Avg Elevation: %d", weathermap[wx][wy].avgelev); |
|
|
130 | new_draw_info_format (NDI_UNIQUE, 0, op, "Rainfall: %d Water: %d", weathermap[wx][wy].rainfall, weathermap[wx][wy].water); |
|
|
131 | } |
|
|
132 | |
|
|
133 | temp = real_world_temperature (op->x, op->y, op->map); |
|
|
134 | new_draw_info_format (NDI_UNIQUE, 0, op, "It's currently %d degrees " "Centigrade out.", temp); |
|
|
135 | |
|
|
136 | /* humid */ |
|
|
137 | if (weathermap[wx][wy].humid < 20) |
|
|
138 | new_draw_info (NDI_UNIQUE, 0, op, "It is very dry."); |
|
|
139 | else if (weathermap[wx][wy].humid < 40) |
|
|
140 | new_draw_info (NDI_UNIQUE, 0, op, "It is very comfortable today."); |
|
|
141 | else if (weathermap[wx][wy].humid < 60) |
|
|
142 | new_draw_info (NDI_UNIQUE, 0, op, "It is a bit muggy."); |
|
|
143 | else if (weathermap[wx][wy].humid < 80) |
|
|
144 | new_draw_info (NDI_UNIQUE, 0, op, "It is muggy."); |
|
|
145 | else |
|
|
146 | new_draw_info (NDI_UNIQUE, 0, op, "It is uncomfortably muggy."); |
|
|
147 | |
|
|
148 | /* wind */ |
|
|
149 | switch (weathermap[wx][wy].winddir) |
|
|
150 | { |
|
|
151 | case 1: |
|
|
152 | sprintf (buf, "north"); |
|
|
153 | break; |
|
|
154 | case 2: |
|
|
155 | sprintf (buf, "northeast"); |
|
|
156 | break; |
|
|
157 | case 3: |
|
|
158 | sprintf (buf, "east"); |
|
|
159 | break; |
|
|
160 | case 4: |
|
|
161 | sprintf (buf, "southeast"); |
|
|
162 | break; |
|
|
163 | case 5: |
|
|
164 | sprintf (buf, "south"); |
|
|
165 | break; |
|
|
166 | case 6: |
|
|
167 | sprintf (buf, "southwest"); |
|
|
168 | break; |
|
|
169 | case 7: |
|
|
170 | sprintf (buf, "west"); |
|
|
171 | break; |
|
|
172 | case 8: |
|
|
173 | sprintf (buf, "northwest"); |
|
|
174 | break; |
|
|
175 | } |
|
|
176 | if (weathermap[wx][wy].windspeed < 5) |
|
|
177 | new_draw_info_format (NDI_UNIQUE, 0, op, "There is a mild breeze " "coming from the %s.", buf); |
|
|
178 | else if (weathermap[wx][wy].windspeed < 10) |
|
|
179 | new_draw_info_format (NDI_UNIQUE, 0, op, "There is a strong breeze " "coming from the %s.", buf); |
|
|
180 | else if (weathermap[wx][wy].windspeed < 15) |
|
|
181 | new_draw_info_format (NDI_UNIQUE, 0, op, "There is a light wind " "coming from the %s.", buf); |
|
|
182 | else if (weathermap[wx][wy].windspeed < 25) |
|
|
183 | new_draw_info_format (NDI_UNIQUE, 0, op, "There is a strong wind " "coming from the %s.", buf); |
|
|
184 | else if (weathermap[wx][wy].windspeed < 35) |
|
|
185 | new_draw_info_format (NDI_UNIQUE, 0, op, "There is a heavy wind " "coming from the %s.", buf); |
|
|
186 | else |
|
|
187 | new_draw_info_format (NDI_UNIQUE, 0, op, "The wind from the %s is " "incredibly strong!", buf); |
|
|
188 | |
|
|
189 | sky = weathermap[wx][wy].sky; |
|
|
190 | if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG) |
|
|
191 | sky += 10; /*let it snow */ |
|
|
192 | switch (sky) |
|
|
193 | { |
|
|
194 | case SKY_CLEAR: |
|
|
195 | new_draw_info (NDI_UNIQUE, 0, op, "There isn''t a cloud in the sky."); |
|
|
196 | break; |
|
|
197 | case SKY_LIGHTCLOUD: |
|
|
198 | new_draw_info (NDI_UNIQUE, 0, op, "There are a few light clouds in the sky."); |
|
|
199 | break; |
|
|
200 | case SKY_OVERCAST: |
|
|
201 | new_draw_info (NDI_UNIQUE, 0, op, "The sky is cloudy and dreary."); |
|
|
202 | break; |
|
|
203 | case SKY_LIGHT_RAIN: |
|
|
204 | new_draw_info (NDI_UNIQUE, 0, op, "It is raining softly."); |
|
|
205 | break; |
|
|
206 | case SKY_RAIN: |
|
|
207 | new_draw_info (NDI_UNIQUE, 0, op, "It is raining."); |
|
|
208 | break; |
|
|
209 | case SKY_HEAVY_RAIN: |
|
|
210 | new_draw_info (NDI_UNIQUE, 0, op, "It is raining heavily."); |
|
|
211 | break; |
|
|
212 | case SKY_HURRICANE: |
|
|
213 | new_draw_info (NDI_UNIQUE, 0, op, "There is a heavy storm! You should go inside!"); |
|
|
214 | break; |
|
|
215 | case SKY_FOG: |
|
|
216 | new_draw_info (NDI_UNIQUE, 0, op, "It''s foggy and miserable."); |
|
|
217 | break; |
|
|
218 | case SKY_HAIL: |
|
|
219 | new_draw_info (NDI_UNIQUE, 0, op, "It''s hailing out! Take cover!"); |
|
|
220 | break; |
|
|
221 | case SKY_LIGHT_SNOW: |
|
|
222 | new_draw_info (NDI_UNIQUE, 0, op, "Snow is gently falling from the sky."); |
|
|
223 | break; |
|
|
224 | case SKY_SNOW: |
|
|
225 | new_draw_info (NDI_UNIQUE, 0, op, "It''s snowing out."); |
|
|
226 | break; |
|
|
227 | case SKY_HEAVY_SNOW: |
|
|
228 | new_draw_info (NDI_UNIQUE, 0, op, "The snow is falling very heavily now."); |
|
|
229 | break; |
|
|
230 | case SKY_BLIZZARD: |
|
|
231 | new_draw_info (NDI_UNIQUE, 0, op, "A full blown blizzard is in effect. You might want to take cover!"); |
|
|
232 | break; |
|
|
233 | } |
|
|
234 | #endif |
|
|
235 | return 1; |
|
|
236 | } |
|
|
237 | |
|
|
238 | int |
|
|
239 | command_hiscore (object *op, char *params) |
|
|
240 | { |
|
|
241 | display_high_score (op, op == NULL ? 9999 : 50, params); |
|
|
242 | return 1; |
|
|
243 | } |
|
|
244 | |
|
|
245 | int |
|
|
246 | command_debug (object *op, char *params) |
65 | command_debug (object *op, char *params) |
247 | { |
66 | { |
248 | int i; |
67 | int i; |
249 | char buf[MAX_BUF]; |
68 | char buf[MAX_BUF]; |
250 | |
69 | |
… | |
… | |
252 | { |
71 | { |
253 | sprintf (buf, "Global debug level is %d.", settings.debug); |
72 | sprintf (buf, "Global debug level is %d.", settings.debug); |
254 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
73 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
255 | return 1; |
74 | return 1; |
256 | } |
75 | } |
257 | settings.debug = (enum LogLevel) FABS (i); |
76 | |
|
|
77 | settings.debug = i; |
|
|
78 | |
258 | sprintf (buf, "Set debug level to %d.", i); |
79 | sprintf (buf, "Set debug level to %d.", i); |
259 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
80 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
260 | return 1; |
81 | return 1; |
261 | } |
82 | } |
262 | |
83 | |
… | |
… | |
334 | new_draw_info_format (NDI_UNIQUE, 0, pl, " Experience: %" PRId64, pl->stats.exp); |
155 | new_draw_info_format (NDI_UNIQUE, 0, pl, " Experience: %" PRId64, pl->stats.exp); |
335 | new_draw_info_format (NDI_UNIQUE, 0, pl, " Next Level: %" PRId64, level_exp (pl->level + 1, pl->expmul)); |
156 | new_draw_info_format (NDI_UNIQUE, 0, pl, " Next Level: %" PRId64, level_exp (pl->level + 1, pl->expmul)); |
336 | new_draw_info (NDI_UNIQUE, 0, pl, "\nStat Nat/Real/Max"); |
157 | new_draw_info (NDI_UNIQUE, 0, pl, "\nStat Nat/Real/Max"); |
337 | |
158 | |
338 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Str %2d/ %3d/%3d", |
159 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Str %2d/ %3d/%3d", |
339 | pl->contr->orig_stats.Str, pl->stats.Str, 20 + pl->arch->clone.stats.Str); |
160 | pl->contr->orig_stats.Str, pl->stats.Str, 20 + pl->arch->stats.Str); |
340 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Dex %2d/ %3d/%3d", |
161 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Dex %2d/ %3d/%3d", |
341 | pl->contr->orig_stats.Dex, pl->stats.Dex, 20 + pl->arch->clone.stats.Dex); |
162 | pl->contr->orig_stats.Dex, pl->stats.Dex, 20 + pl->arch->stats.Dex); |
342 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Con %2d/ %3d/%3d", |
163 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Con %2d/ %3d/%3d", |
343 | pl->contr->orig_stats.Con, pl->stats.Con, 20 + pl->arch->clone.stats.Con); |
164 | pl->contr->orig_stats.Con, pl->stats.Con, 20 + pl->arch->stats.Con); |
344 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Int %2d/ %3d/%3d", |
165 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Int %2d/ %3d/%3d", |
345 | pl->contr->orig_stats.Int, pl->stats.Int, 20 + pl->arch->clone.stats.Int); |
166 | pl->contr->orig_stats.Int, pl->stats.Int, 20 + pl->arch->stats.Int); |
346 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Wis %2d/ %3d/%3d", |
167 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Wis %2d/ %3d/%3d", |
347 | pl->contr->orig_stats.Wis, pl->stats.Wis, 20 + pl->arch->clone.stats.Wis); |
168 | pl->contr->orig_stats.Wis, pl->stats.Wis, 20 + pl->arch->stats.Wis); |
348 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Pow %2d/ %3d/%3d", |
169 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Pow %2d/ %3d/%3d", |
349 | pl->contr->orig_stats.Pow, pl->stats.Pow, 20 + pl->arch->clone.stats.Pow); |
170 | pl->contr->orig_stats.Pow, pl->stats.Pow, 20 + pl->arch->stats.Pow); |
350 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Cha %2d/ %3d/%3d", |
171 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Cha %2d/ %3d/%3d", |
351 | pl->contr->orig_stats.Cha, pl->stats.Cha, 20 + pl->arch->clone.stats.Cha); |
172 | pl->contr->orig_stats.Cha, pl->stats.Cha, 20 + pl->arch->stats.Cha); |
352 | new_draw_info_format (NDI_UNIQUE, 0, pl, "\nAttack Mode: %s", pl->contr->peaceful ? "Peaceful" : "Hostile"); |
173 | new_draw_info_format (NDI_UNIQUE, 0, pl, "\nAttack Mode: %s", pl->contr->peaceful ? "Peaceful" : "Hostile"); |
353 | |
174 | |
354 | /* Can't think of anything else to print right now */ |
175 | /* Can't think of anything else to print right now */ |
355 | return 0; |
176 | return 0; |
356 | } |
177 | } |
… | |
… | |
488 | int attack; |
309 | int attack; |
489 | object *tmp; |
310 | object *tmp; |
490 | |
311 | |
491 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
312 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
492 | { |
313 | { |
493 | if ((tmp->type == FORCE) && (strcmp (tmp->arch->name, "dragon_skin_force") == 0)) |
314 | if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) |
494 | { |
315 | { |
495 | new_draw_info (NDI_UNIQUE, 0, op, "\nNatural skin resistances:"); |
316 | new_draw_info (NDI_UNIQUE, 0, op, "\nNatural skin resistances:"); |
496 | for (attack = 0; attack < NROFATTACKS; attack++) |
317 | for (attack = 0; attack < NROFATTACKS; attack++) |
497 | { |
318 | { |
498 | if (atnr_is_dragon_enabled (attack)) |
319 | if (atnr_is_dragon_enabled (attack)) |