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 (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
6 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
10 | * option) any later version. |
10 | * |
11 | * |
11 | * This program is distributed in the hope that it will be useful, |
12 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
15 | * GNU General Public License for more details. |
15 | * |
16 | * |
16 | * You should have received a copy of the Affero GNU General Public License |
17 | * You should have received a copy of the Affero GNU General Public License |
17 | * and the GNU General Public License along with this program. If not, see |
18 | * and the GNU General Public License along with this program. If not, see |
18 | * <http://www.gnu.org/licenses/>. |
19 | * <http://www.gnu.org/licenses/>. |
19 | * |
20 | * |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | */ |
22 | */ |
22 | |
23 | |
23 | /* alchemy.c */ |
24 | /* alchemy.c */ |
24 | int need_identify (const object *obj); |
|
|
25 | int apply_shop_mat (object *shop_mat, object *op); |
25 | int apply_shop_mat (object *shop_mat, object *op); |
26 | const char *cost_string_from_value (sint64 cost, int approx); |
26 | const char *cost_string_from_value (sint64 cost, int approx); |
27 | void pay_player (object *pl, sint64 amount); |
27 | void pay_player (object *pl, sint64 amount); |
28 | sint64 pay_player_arch (object *pl, const char *arch, sint64 amount); |
28 | sint64 pay_player_arch (object *pl, const char *arch, sint64 amount); |
29 | void attempt_do_alchemy (object *caster, object *cauldron, object *skill); |
29 | void attempt_do_alchemy (object *caster, object *cauldron, object *skill); |
… | |
… | |
37 | void move_apply (object *trap, object *victim, object *originator); |
37 | void move_apply (object *trap, object *victim, object *originator); |
38 | void do_learn_spell (object *op, object *spell, int special_prayer); |
38 | void do_learn_spell (object *op, object *spell, int special_prayer); |
39 | void do_forget_spell (object *op, const char *spell); |
39 | void do_forget_spell (object *op, const char *spell); |
40 | void apply_scroll (object *op, object *tmp, int dir); |
40 | void apply_scroll (object *op, object *tmp, int dir); |
41 | void apply_poison (object *op, object *tmp); |
41 | void apply_poison (object *op, object *tmp); |
42 | int manual_apply (object *op, object *tmp, int aflag); |
|
|
43 | int player_apply (object *pl, object *op, int aflag, int quiet); |
|
|
44 | void player_apply_below (object *pl); |
42 | void player_apply_below (object *pl); |
45 | int can_apply_object (object *who, object *op); |
43 | int can_apply_object (object *who, object *op); |
46 | int apply_special (object *who, object *op, int aflags); |
|
|
47 | int auto_apply (object *op); |
44 | int auto_apply (object *op); |
48 | void fix_auto_apply (maptile *m); |
45 | void fix_auto_apply (maptile *m); |
49 | void eat_special_food (object *who, object *food); |
46 | void eat_special_food (object *who, object *food); |
50 | void apply_changes_to_player (object *pl, object *change); |
47 | void apply_changes_to_player (object *pl, object *change); |
51 | void handle_apply_yield (object *op); |
48 | void handle_apply_yield (object *op); |
… | |
… | |
114 | int command_south (object *op, char *params); |
111 | int command_south (object *op, char *params); |
115 | int command_southeast (object *op, char *params); |
112 | int command_southeast (object *op, char *params); |
116 | int command_southwest (object *op, char *params); |
113 | int command_southwest (object *op, char *params); |
117 | int command_west (object *op, char *params); |
114 | int command_west (object *op, char *params); |
118 | int command_stay (object *op, char *params); |
115 | int command_stay (object *op, char *params); |
|
|
116 | int command_run (object *op, char *params); |
|
|
117 | int command_run_stop (object *op, char *params); |
|
|
118 | int command_fire (object *op, char *params); |
|
|
119 | int command_fire_stop (object *op, char *params); |
119 | |
120 | |
120 | /* c_new.c */ |
121 | /* c_new.c */ |
121 | void execute_newserver_command (object *pl, char *command); |
122 | void execute_newserver_command (object *pl, char *command); |
122 | |
123 | |
123 | /* c_object.c */ |
124 | /* c_object.c */ |
… | |
… | |
137 | void drop_object (object *dropper, object *obj); |
138 | void drop_object (object *dropper, object *obj); |
138 | void drop (object *op, object *tmp); |
139 | void drop (object *op, object *tmp); |
139 | int command_dropall (object *op, char *params); |
140 | int command_dropall (object *op, char *params); |
140 | int command_drop (object *op, char *params); |
141 | int command_drop (object *op, char *params); |
141 | int command_examine (object *op, char *params); |
142 | int command_examine (object *op, char *params); |
142 | object *find_marked_object (object *op); |
|
|
143 | void examine_monster (object *op, object *tmp); |
143 | void examine_monster (object *op, object *tmp); |
144 | const char *long_desc (object *tmp, object *pl); |
144 | const char *long_desc (object *tmp, object *pl); |
145 | void examine (object *op, object *tmp); |
145 | void examine (object *op, object *tmp); |
146 | int command_pickup (object *op, char *params); |
146 | int command_pickup (object *op, char *params); |
147 | void set_pickup_mode (object *op, int i); |
147 | void set_pickup_mode (object *op, int i); |
148 | int command_search_items (object *op, char *params); |
148 | int command_search_items (object *op, char *params); |
149 | int command_rename_item (object *op, char *params); |
149 | int command_rename_item (object *op, char *params); |
150 | int command_unlock (object *op, char *params); |
150 | int command_unlock (object *op, char *params); |
151 | int command_lock (object *op, char *params); |
151 | int command_lock (object *op, char *params); |
|
|
152 | int command_mark (object *op, char *params); |
152 | |
153 | |
153 | /* c_party.c */ |
154 | /* c_party.c */ |
154 | partylist *get_firstparty (); |
155 | partylist *get_firstparty (); |
155 | void obsolete_parties (); |
156 | void obsolete_parties (); |
156 | void add_kill_to_party (partylist *party, const char *killer, const char *dead, long exp); |
157 | void add_kill_to_party (partylist *party, const char *killer, const char *dead, long exp); |
… | |
… | |
165 | int legal_range (object *op, int r); |
166 | int legal_range (object *op, int r); |
166 | int command_rotateshoottype (object *op, char *params); |
167 | int command_rotateshoottype (object *op, char *params); |
167 | |
168 | |
168 | /* c_wiz.c */ |
169 | /* c_wiz.c */ |
169 | int command_loadtest (object *op, char *params); |
170 | int command_loadtest (object *op, char *params); |
170 | int command_hide (object *op, char *params); |
|
|
171 | int command_setgod (object *op, char *params); |
171 | int command_setgod (object *op, char *params); |
172 | int command_banish (object *op, char *params); |
172 | int command_banish (object *op, char *params); |
173 | int command_save_overlay (object *op, char *params); |
173 | int command_save_overlay (object *op, char *params); |
174 | int command_freeze (object *op, char *params); |
174 | int command_freeze (object *op, char *params); |
175 | int command_arrest (object *op, char *params); |
175 | int command_arrest (object *op, char *params); |
… | |
… | |
184 | int command_free (object *op, char *params); |
184 | int command_free (object *op, char *params); |
185 | int command_addexp (object *op, char *params); |
185 | int command_addexp (object *op, char *params); |
186 | int command_speed (object *op, char *params); |
186 | int command_speed (object *op, char *params); |
187 | int command_stats (object *op, char *params); |
187 | int command_stats (object *op, char *params); |
188 | int command_abil (object *op, char *params); |
188 | int command_abil (object *op, char *params); |
189 | int command_reset (object *op, char *params); |
|
|
190 | int command_nowiz (object *op, char *params); |
|
|
191 | int command_dm (object *op, char *params); |
|
|
192 | int command_invisible (object *op, char *params); |
189 | int command_invisible (object *op, char *params); |
193 | int command_learn_spell (object *op, char *params); |
190 | int command_learn_spell (object *op, char *params); |
194 | int command_learn_special_prayer (object *op, char *params); |
191 | int command_learn_special_prayer (object *op, char *params); |
195 | int command_forget_spell (object *op, char *params); |
192 | int command_forget_spell (object *op, char *params); |
196 | int command_dmhide (object *op, char *params); |
|
|
197 | void dm_stack_push (player *pl, tag_t item); |
193 | void dm_stack_push (player *pl, tag_t item); |
198 | int command_stack_pop (object *op, char *params); |
194 | int command_stack_pop (object *op, char *params); |
199 | int command_stack_push (object *op, char *params); |
195 | int command_stack_push (object *op, char *params); |
200 | int command_stack_list (object *op, char *params); |
196 | int command_stack_list (object *op, char *params); |
201 | int command_stack_clear (object *op, char *params); |
197 | int command_stack_clear (object *op, char *params); |
202 | int command_diff (object *op, char *params); |
198 | int command_diff (object *op, char *params); |
203 | int command_insert_into (object *op, char *params); |
199 | int command_insert_into (object *op, char *params); |
204 | |
200 | |
205 | /* commands.c */ |
|
|
206 | void init_commands (); |
|
|
207 | CommFunc find_oldsocket_command (char *cmd); |
|
|
208 | CommFunc find_oldsocket_command2 (char *cmd); |
|
|
209 | |
|
|
210 | /* daemon.c */ |
201 | /* daemon.c */ |
211 | FILE *BecomeDaemon (const char *filename); |
202 | FILE *BecomeDaemon (const char *filename); |
212 | |
203 | |
213 | /* disease.c */ |
204 | /* disease.c */ |
214 | int move_disease (object *disease); |
205 | int move_disease (object *disease); |
… | |
… | |
217 | int check_physically_infect (object *victim, object *hitter); |
208 | int check_physically_infect (object *victim, object *hitter); |
218 | int cure_disease (object *sufferer, object *caster, object *spell); |
209 | int cure_disease (object *sufferer, object *caster, object *spell); |
219 | |
210 | |
220 | /* egoitem.c */ |
211 | /* egoitem.c */ |
221 | int apply_power_crystal (object *op, object *crystal); |
212 | int apply_power_crystal (object *op, object *crystal); |
222 | |
|
|
223 | /* hiscore.c */ |
|
|
224 | void check_score (object *op); |
|
|
225 | |
213 | |
226 | /* gods.c */ |
214 | /* gods.c */ |
227 | object *find_god (shstr_cmp name); |
215 | object *find_god (shstr_cmp name); |
228 | shstr_tmp determine_god (object *op); |
216 | shstr_tmp determine_god (object *op); |
229 | void pray_at_altar (object *pl, object *altar, object *skill); |
217 | void pray_at_altar (object *pl, object *altar, object *skill); |
… | |
… | |
246 | int check_name (player *me, const char *name); |
234 | int check_name (player *me, const char *name); |
247 | int create_savedir_if_needed (char *savedir); |
235 | int create_savedir_if_needed (char *savedir); |
248 | void copy_file (const char *filename, FILE *fpout); |
236 | void copy_file (const char *filename, FILE *fpout); |
249 | |
237 | |
250 | /* main.c */ |
238 | /* main.c */ |
251 | void server_tick (); |
239 | void one_tick (); |
252 | void version (object *op); |
240 | void version (object *op); |
253 | void info_keys (object *op); |
241 | void info_keys (object *op); |
254 | char *crypt_string (char *str, char *salt); |
242 | char *crypt_string (char *str, char *salt); |
255 | void enter_player_savebed (object *op); |
243 | void enter_player_savebed (object *op); |
256 | void leave_map (object *op); |
244 | void leave_map (object *op); |
… | |
… | |
276 | int can_detect_enemy (object *op, object *enemy, rv_vector *rv); |
264 | int can_detect_enemy (object *op, object *enemy, rv_vector *rv); |
277 | int stand_in_light (object *op); |
265 | int stand_in_light (object *op); |
278 | int can_see_enemy (object *op, object *enemy); |
266 | int can_see_enemy (object *op, object *enemy); |
279 | |
267 | |
280 | /* move.c */ |
268 | /* move.c */ |
281 | int move_object (object *op, int dir); |
|
|
282 | int move_ob (object *op, int dir, object *originator); |
|
|
283 | int transfer_ob (object *op, int x, int y, int randomly, object *originator); |
269 | int transfer_ob (object *op, int x, int y, int randomly, object *originator); |
284 | int teleport (object *teleporter, uint8 tele_type, object *user); |
270 | int teleport (object *teleporter, uint8 tele_type, object *user); |
285 | void recursive_roll (object *op, int dir, object *pusher); |
271 | void recursive_roll (object *op, int dir, object *pusher); |
286 | int push_ob (object *who, int dir, object *pusher); |
272 | int push_ob (object *who, int dir, object *pusher); |
287 | |
273 | |
288 | /* pets.c */ |
274 | /* pets.c */ |
289 | object *get_pet_enemy (object *pet, rv_vector *rv); |
275 | object *get_pet_enemy (object *pet, rv_vector *rv); |
290 | void terminate_all_pets (object *owner); |
276 | void terminate_all_pets (object *owner); |
291 | void remove_all_pets (maptile *map); |
277 | void move_all_pets (); |
292 | int follow_owner (object *ob, object *owner); |
278 | int follow_owner (object *ob, object *owner); |
293 | void pet_move (object *ob); |
279 | void pet_move (object *ob); |
294 | void move_golem (object *op); |
280 | void move_golem (object *op); |
295 | void control_golem (object *op, int dir); |
281 | void control_golem (object *op, int dir); |
296 | int summon_golem (object *op, object *caster, int dir, object *spob); |
282 | int summon_golem (object *op, object *caster, int dir, object *spob); |
… | |
… | |
315 | int key_roll_stat (object *op, char key); |
301 | int key_roll_stat (object *op, char key); |
316 | int key_change_class (object *op, char key); |
302 | int key_change_class (object *op, char key); |
317 | int key_confirm_quit (object *op, char key); |
303 | int key_confirm_quit (object *op, char key); |
318 | int check_pick (object *op); |
304 | int check_pick (object *op); |
319 | int fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy); |
305 | int fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy); |
320 | bool fire (object *op, int dir); |
306 | bool fire (object *who, int dir); |
321 | object *find_key (object *pl, object *container, object *door); |
307 | object *find_key (object *pl, object *container, object *door); |
322 | bool move_player_attack (object *op, int dir); |
308 | bool move_player_attack (object *op, int dir); |
323 | bool move_player (object *op, int dir); |
309 | bool move_player (object *op, int dir); |
324 | bool handle_newcs_player (object *op); |
310 | bool handle_newcs_player (object *op); |
325 | void do_some_living (object *op); |
311 | void do_some_living (object *op); |
… | |
… | |
333 | void do_hidden_move (object *op); |
319 | void do_hidden_move (object *op); |
334 | int stand_near_hostile (object *who); |
320 | int stand_near_hostile (object *who); |
335 | int player_can_view (object *pl, object *op); |
321 | int player_can_view (object *pl, object *op); |
336 | int op_on_battleground (object *op, int *x, int *y); |
322 | int op_on_battleground (object *op, int *x, int *y); |
337 | void dragon_ability_gain (object *who, int atnr, int level); |
323 | void dragon_ability_gain (object *who, int atnr, int level); |
338 | void player_unready_range_ob (player *pl, object *ob); |
|
|
339 | |
324 | |
340 | /* resurrection.c */ |
325 | /* resurrection.c */ |
341 | int cast_raise_dead_spell (object *op, object *caster, object *spell, int dir, const char *arg); |
326 | int cast_raise_dead_spell (object *op, object *caster, object *spell, int dir, const char *arg); |
342 | |
327 | |
343 | /* rune.c */ |
328 | /* rune.c */ |
… | |
… | |
350 | int trap_disarm (object *disarmer, object *trap, int risk, object *skill); |
335 | int trap_disarm (object *disarmer, object *trap, int risk, object *skill); |
351 | void trap_adjust (object *trap, int difficulty); |
336 | void trap_adjust (object *trap, int difficulty); |
352 | |
337 | |
353 | /* shop.c */ |
338 | /* shop.c */ |
354 | int get_payment (object *pl); |
339 | int get_payment (object *pl); |
355 | sint64 query_cost (const object *tmp, object *who, int flag); |
|
|
356 | const char *query_cost_string (const object *tmp, object *who, int flag); |
|
|
357 | sint64 query_money (const object *op); |
340 | sint64 query_money (const object *op); |
358 | int pay_for_amount (sint64 to_pay, object *pl); |
341 | int pay_for_amount (sint64 to_pay, object *pl); |
359 | int pay_for_item (object *op, object *pl); |
342 | int pay_for_item (object *op, object *pl); |
360 | int can_pay (object *pl); |
343 | int can_pay (object *pl); |
361 | bool sell_item (object *op, object *pl); |
344 | bool sell_item (object *op, object *pl); |
362 | double shopkeeper_approval (const maptile *map, const object *player); |
345 | double shopkeeper_approval (const maptile *map, const object *player); |
363 | int describe_shop (const object *op); |
346 | int describe_shop (const object *op); |
364 | void shop_listing (object *sign, object *op); |
347 | void shop_listing (object *sign, object *op); |
365 | bool is_in_shop (object *o); |
|
|
366 | bool is_in_shop (maptile *map, int x, int y); |
348 | bool is_in_shop (maptile *map, int x, int y); |
367 | |
349 | |
368 | /* skills.c */ |
350 | /* skills.c */ |
369 | int steal (object *op, int dir, object *skill); |
351 | int steal (object *op, int dir, object *skill); |
370 | int pick_lock (object *pl, int dir, object *skill); |
352 | int pick_lock (object *pl, int dir, object *skill); |
… | |
… | |
377 | int remove_trap (object *op, int dir, object *skill); |
359 | int remove_trap (object *op, int dir, object *skill); |
378 | int pray (object *pl, object *skill); |
360 | int pray (object *pl, object *skill); |
379 | void meditate (object *pl, object *skill); |
361 | void meditate (object *pl, object *skill); |
380 | int write_on_item (object *pl, const char *params, object *skill); |
362 | int write_on_item (object *pl, const char *params, object *skill); |
381 | int skill_throw (object *op, object *part, int dir, const char *params, object *skill); |
363 | int skill_throw (object *op, object *part, int dir, const char *params, object *skill); |
|
|
364 | bool skill_mining (object *who, object *tool, object *skill, int dir, const char *string); |
|
|
365 | bool skill_fishing (object *who, object *tool, object *skill, int dir, const char *string); |
382 | |
366 | |
383 | /* skill_util.c */ |
367 | /* skill_util.c */ |
384 | void init_skills (); |
368 | void init_skills (); |
385 | void link_player_skills (object *op); |
369 | void link_player_skills (object *op); |
386 | int do_skill (object *op, object *part, object *skill, int dir, const char *string); |
370 | int do_skill (object *op, object *part, object *skill, int dir, const char *string); |
… | |
… | |
431 | int cast_wonder (object *op, object *caster, int dir, object *spell_ob); |
415 | int cast_wonder (object *op, object *caster, int dir, object *spell_ob); |
432 | int perceive_self (object *op); |
416 | int perceive_self (object *op); |
433 | int magic_wall (object *op, object *caster, int dir, object *spell_ob); |
417 | int magic_wall (object *op, object *caster, int dir, object *spell_ob); |
434 | int dimension_door (object *op, object *caster, object *spob, int dir, const char *spellparam); |
418 | int dimension_door (object *op, object *caster, object *spob, int dir, const char *spellparam); |
435 | int cast_heal (object *op, object *caster, object *spell, int dir); |
419 | int cast_heal (object *op, object *caster, object *spell, int dir); |
436 | int change_ability_duration (object *spell, object *caster); |
|
|
437 | int cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent); |
420 | int cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent); |
438 | int cast_bless (object *op, object *caster, object *spell_ob, int dir); |
421 | int cast_bless (object *op, object *caster, object *spell_ob, int dir); |
439 | int alchemy (object *op, object *caster, object *spell_ob); |
422 | int alchemy (object *op, object *caster, object *spell_ob); |
440 | int remove_curse (object *op, object *caster, object *spell); |
423 | int remove_curse (object *op, object *caster, object *spell); |
441 | int cast_identify (object *op, object *caster, object *spell); |
424 | int cast_identify (object *op, object *caster, object *spell); |
… | |
… | |
452 | |
435 | |
453 | /* spell_util.c */ |
436 | /* spell_util.c */ |
454 | object *find_random_spell_in_ob (object *ob, shstr_cmp skill = shstr_cmp ()); |
437 | object *find_random_spell_in_ob (object *ob, shstr_cmp skill = shstr_cmp ()); |
455 | void set_spell_skill (object *op, object *caster, object *spob, object *dest); |
438 | void set_spell_skill (object *op, object *caster, object *spob, object *dest); |
456 | void spell_effect (object *spob, int x, int y, maptile *map, object *originator); |
439 | void spell_effect (object *spob, int x, int y, maptile *map, object *originator); |
457 | int min_casting_level (object *caster, object *spell); |
|
|
458 | int casting_level (object *caster, object *spell); |
|
|
459 | sint16 SP_level_spellpoint_cost (object *caster, object *spell, int flags); |
|
|
460 | int SP_level_dam_adjust (object *caster, object *spob); |
|
|
461 | int SP_level_duration_adjust (object *caster, object *spob); |
|
|
462 | int SP_level_range_adjust (object *caster, object *spob); |
|
|
463 | object *check_spell_known (object *op, shstr_cmp name); |
440 | object *check_spell_known (object *op, shstr_cmp name); |
464 | object *lookup_spell_by_name (object *op, const char *spname); |
|
|
465 | int reflwall (maptile *m, int x, int y, object *sp_op); |
441 | int reflwall (maptile *m, int x, int y, object *sp_op); |
466 | int cast_create_obj (object *op, object *caster, object *new_op, int dir); |
442 | bool cast_create_obj (object *op, object *caster, object *new_op, int dir); |
467 | int ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop); |
443 | int ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop); |
468 | int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell); |
444 | int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell); |
469 | void regenerate_rod (object *rod); |
445 | void regenerate_rod (object *rod); |
470 | void drain_rod_charge (object *rod); |
446 | void drain_rod_charge (object *rod); |
471 | object *find_target_for_friendly_spell (object *op, int dir); |
447 | object *find_target_for_friendly_spell (object *op, int dir); |
… | |
… | |
506 | void move_marker (object *op); |
482 | void move_marker (object *op); |
507 | void process_object (object *op); |
483 | void process_object (object *op); |
508 | |
484 | |
509 | /* weather.c */ |
485 | /* weather.c */ |
510 | void adjust_daylight (); |
486 | void adjust_daylight (); |
|
|
487 | |