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 (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra 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 |
… | |
… | |
239 | set_dragon_name (ob, abil, skin); |
239 | set_dragon_name (ob, abil, skin); |
240 | } |
240 | } |
241 | |
241 | |
242 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
242 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
243 | |
243 | |
244 | esrv_new_player (this, ob->weight + ob->carrying); |
244 | esrv_new_player (this); |
245 | |
245 | |
246 | ob->update_stats (); |
246 | ob->update_stats (); |
247 | |
247 | |
248 | ns->floorbox_update (); |
248 | ns->floorbox_update (); |
249 | esrv_send_inventory (ob, ob); |
249 | esrv_send_inventory (ob, ob); |
… | |
… | |
851 | */ |
851 | */ |
852 | void |
852 | void |
853 | player::chargen_race_done () |
853 | player::chargen_race_done () |
854 | { |
854 | { |
855 | /* this must before then initial items are given */ |
855 | /* this must before then initial items are given */ |
856 | esrv_new_player (ob->contr, ob->weight + ob->carrying); |
856 | esrv_new_player (ob->contr); |
857 | |
857 | |
858 | treasurelist *tl = treasurelist::find ("starting_wealth"); |
858 | treasurelist *tl = treasurelist::find ("starting_wealth"); |
859 | if (tl) |
859 | if (tl) |
860 | create_treasure (tl, ob, 0, 0, 0); |
860 | create_treasure (tl, ob, 0, 0, 0); |
861 | |
861 | |
… | |
… | |
1792 | CLEAR_FLAG (item, FLAG_ANIMATE); |
1792 | CLEAR_FLAG (item, FLAG_ANIMATE); |
1793 | item->face = item->arch->face; |
1793 | item->face = item->arch->face; |
1794 | item->set_speed (0); |
1794 | item->set_speed (0); |
1795 | } |
1795 | } |
1796 | |
1796 | |
1797 | if ((tmp = item->in_player ())) |
1797 | if (object *pl = item->visible_to ()) |
1798 | esrv_update_item (UPD_ANIM, tmp, item); |
1798 | esrv_update_item (UPD_ANIM, pl, item); |
1799 | } |
1799 | } |
1800 | } |
1800 | } |
1801 | else if (item->type == ROD || item->type == HORN) |
1801 | else if (item->type == ROD || item->type == HORN) |
1802 | drain_rod_charge (item); |
1802 | drain_rod_charge (item); |
1803 | } |
1803 | } |
… | |
… | |
1980 | remove_door2 (door); /* remove door without violence ;-) */ |
1980 | remove_door2 (door); /* remove door without violence ;-) */ |
1981 | } |
1981 | } |
1982 | |
1982 | |
1983 | /* Do this after we print the message */ |
1983 | /* Do this after we print the message */ |
1984 | key->decrease (); /* Use up one of the keys */ |
1984 | key->decrease (); /* Use up one of the keys */ |
1985 | /* Need to update the weight the container the key was in */ |
|
|
1986 | if (container != op) |
|
|
1987 | esrv_update_item (UPD_WEIGHT, op, container); |
|
|
1988 | |
1985 | |
1989 | return 1; /* Nothing more to do below */ |
1986 | return 1; /* Nothing more to do below */ |
1990 | } |
1987 | } |
1991 | else if (door->type == LOCKED_DOOR) |
1988 | else if (door->type == LOCKED_DOOR) |
1992 | { |
1989 | { |
… | |
… | |
2271 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2268 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2272 | { |
2269 | { |
2273 | op->play_sound (sound_find ("ob_evaporate")); |
2270 | op->play_sound (sound_find ("ob_evaporate")); |
2274 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2271 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2275 | |
2272 | |
2276 | if (op->contr) |
|
|
2277 | esrv_del_item (op->contr, tmp->count); |
|
|
2278 | |
|
|
2279 | tmp->destroy (); |
2273 | tmp->destroy (); |
2280 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2274 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2281 | |
2275 | |
2282 | if (op->stats.hp < 0) |
2276 | if (op->stats.hp < 0) |
2283 | op->stats.hp = op->stats.maxhp; |
2277 | op->stats.hp = op->stats.maxhp; |
… | |
… | |
2295 | return 0; |
2289 | return 0; |
2296 | } |
2290 | } |
2297 | |
2291 | |
2298 | /* This goes throws the inventory and removes unpaid objects, and puts them |
2292 | /* This goes throws the inventory and removes unpaid objects, and puts them |
2299 | * back in the map (location and map determined by values of env). This |
2293 | * back in the map (location and map determined by values of env). This |
2300 | * function will descend into containers. op is the object to start the search |
2294 | * function will descend into containers. op is the object to start the search |
2301 | * from. |
2295 | * from. |
2302 | */ |
2296 | */ |
2303 | static void |
2297 | static void |
2304 | drop_unpaid_items (object *op, object *env) |
2298 | drop_unpaid_items (object *op, object *env) |
2305 | { |
2299 | { |
2306 | while (op) |
2300 | while (op) |
2307 | { |
2301 | { |
2308 | object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ |
2302 | object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ |
2309 | |
2303 | |
2310 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
2304 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
2311 | { |
|
|
2312 | if (env->type == PLAYER) |
|
|
2313 | esrv_del_item (env->contr, op->count); |
|
|
2314 | |
|
|
2315 | op->insert_at (env); |
2305 | op->insert_at (env); |
2316 | } |
|
|
2317 | else if (op->inv) |
2306 | else if (op->inv) |
2318 | drop_unpaid_items (op->inv, env); |
2307 | drop_unpaid_items (op->inv, env); |
2319 | |
2308 | |
2320 | op = next; |
2309 | op = next; |
2321 | } |
2310 | } |
… | |
… | |
3455 | else |
3444 | else |
3456 | { |
3445 | { |
3457 | /* generate misc. treasure */ |
3446 | /* generate misc. treasure */ |
3458 | tmp = arch_to_object (tr->item); |
3447 | tmp = arch_to_object (tr->item); |
3459 | new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); |
3448 | new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); |
3460 | tmp = insert_ob_in_ob (tmp, who); |
3449 | who->insert (tmp); |
3461 | if (who->type == PLAYER) |
|
|
3462 | esrv_send_item (who, tmp); |
|
|
3463 | } |
3450 | } |
3464 | } |
3451 | } |
3465 | |
3452 | |
3466 | /** |
3453 | /** |
3467 | * Unready an object for a player. This function does nothing if the object was |
3454 | * Unready an object for a player. This function does nothing if the object was |