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 |
… | |
… | |
122 | continue; |
122 | continue; |
123 | |
123 | |
124 | if (*buf == '%') |
124 | if (*buf == '%') |
125 | { /* send one news */ |
125 | { /* send one news */ |
126 | if (size > 0) |
126 | if (size > 0) |
127 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", (char *)"%s\n%s", subject, news); /*send previously read news */ |
127 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, |
|
|
128 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
|
|
129 | "INFORMATION: %s\n%s", (char *)"%s\n%s", |
|
|
130 | subject, news); /*send previously read news */ |
128 | |
131 | |
129 | strcpy (subject, buf + 1); |
132 | strcpy (subject, buf + 1); |
130 | strip_endline (subject); |
133 | strip_endline (subject); |
131 | size = 0; |
134 | size = 0; |
132 | news[0] = '\0'; |
135 | news[0] = '\0'; |
… | |
… | |
215 | |
218 | |
216 | /* make sure he's a player -- needed because of class change. */ |
219 | /* make sure he's a player -- needed because of class change. */ |
217 | ob->type = PLAYER; // we are paranoid |
220 | ob->type = PLAYER; // we are paranoid |
218 | ob->race = ob->arch->race; |
221 | ob->race = ob->arch->race; |
219 | |
222 | |
220 | ob->carrying = sum_weight (ob); |
223 | ob->update_weight (); |
221 | link_player_skills (ob); |
224 | link_skills (); |
222 | |
225 | |
223 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
226 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
224 | |
227 | |
225 | assign (title, ob->arch->object::name); |
228 | assign (title, ob->arch->object::name); |
226 | |
229 | |
… | |
… | |
239 | set_dragon_name (ob, abil, skin); |
242 | set_dragon_name (ob, abil, skin); |
240 | } |
243 | } |
241 | |
244 | |
242 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
245 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
243 | |
246 | |
244 | esrv_new_player (this, ob->weight + ob->carrying); |
247 | esrv_new_player (this); |
245 | |
248 | |
246 | ob->update_stats (); |
249 | ob->update_stats (); |
247 | |
250 | |
248 | ns->floorbox_update (); |
251 | ns->floorbox_update (); |
249 | esrv_send_inventory (ob, ob); |
252 | esrv_send_inventory (ob, ob); |
… | |
… | |
291 | player::set_object (object *op) |
294 | player::set_object (object *op) |
292 | { |
295 | { |
293 | ob = observe = op; |
296 | ob = observe = op; |
294 | ob->contr = this; /* this aren't yet in archetype */ |
297 | ob->contr = this; /* this aren't yet in archetype */ |
295 | |
298 | |
296 | ob->speed = 1.0f; |
299 | ob->speed = 1.0f; |
297 | ob->speed_left = 0.5f; |
300 | ob->speed_left = 0.5f; |
298 | |
301 | |
299 | ob->direction = 5; /* So player faces south */ |
302 | ob->direction = 5; /* So player faces south */ |
300 | |
303 | |
301 | ob->flag [FLAG_READY_WEAPON] = false; |
304 | ob->flag [FLAG_READY_WEAPON] = false; |
302 | ob->flag [FLAG_READY_SKILL] = false; |
305 | ob->flag [FLAG_READY_SKILL] = false; |
303 | ob->flag [FLAG_READY_BOW] = false; |
306 | ob->flag [FLAG_READY_BOW] = false; |
304 | |
307 | |
… | |
… | |
321 | combat_ob = op; |
324 | combat_ob = op; |
322 | break; |
325 | break; |
323 | } |
326 | } |
324 | |
327 | |
325 | ob->change_weapon (combat_ob ? combat_ob : ranged_ob); |
328 | ob->change_weapon (combat_ob ? combat_ob : ranged_ob); |
326 | ob->deactivate (); // change_Weapon activates, fix this better |
329 | ob->deactivate (); // change_weapon activates, fix this better |
327 | } |
330 | } |
328 | |
331 | |
329 | void |
332 | void |
330 | player::set_observe (object *op) |
333 | player::set_observe (object *op) |
331 | { |
334 | { |
… | |
… | |
345 | savebed_map = first_map_path; /* Init. respawn position */ |
348 | savebed_map = first_map_path; /* Init. respawn position */ |
346 | |
349 | |
347 | gen_sp_armour = 10; |
350 | gen_sp_armour = 10; |
348 | bowtype = bow_normal; |
351 | bowtype = bow_normal; |
349 | petmode = pet_normal; |
352 | petmode = pet_normal; |
350 | listening = 10; |
|
|
351 | usekeys = containers; |
353 | usekeys = containers; |
352 | peaceful = 1; /* default peaceful */ |
354 | peaceful = 1; /* default peaceful */ |
353 | do_los = 1; |
355 | do_los = 1; |
354 | |
356 | |
355 | weapon_sp = 1.0f; |
357 | weapon_sp = 1.0f; |
… | |
… | |
364 | attachable::do_destroy (); |
366 | attachable::do_destroy (); |
365 | |
367 | |
366 | if (ob) |
368 | if (ob) |
367 | { |
369 | { |
368 | ob->destroy_inv (false); |
370 | ob->destroy_inv (false); |
369 | ob->destroy (); |
371 | ob->destroy (true); |
370 | } |
372 | } |
371 | |
373 | |
372 | ob = observe = 0; |
374 | ob = observe = 0; |
373 | } |
375 | } |
374 | |
376 | |
… | |
… | |
666 | || op->type == CLOAK || op->type == HELMET |
668 | || op->type == CLOAK || op->type == HELMET |
667 | || op->type == SHIELD || op->type == GLOVES |
669 | || op->type == SHIELD || op->type == GLOVES |
668 | || op->type == BRACERS || op->type == GIRDLE)) |
670 | || op->type == BRACERS || op->type == GIRDLE)) |
669 | || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) |
671 | || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) |
670 | { |
672 | { |
671 | op->destroy (); |
673 | op->destroy (true); |
672 | continue; |
674 | continue; |
673 | } |
675 | } |
674 | } |
676 | } |
675 | |
677 | |
676 | /* This really needs to be better - we should really give |
678 | /* This really needs to be better - we should really give |
… | |
… | |
687 | if (tmp->type == op->type && tmp->name == op->name) |
689 | if (tmp->type == op->type && tmp->name == op->name) |
688 | break; |
690 | break; |
689 | |
691 | |
690 | if (tmp) |
692 | if (tmp) |
691 | { |
693 | { |
692 | op->destroy (); |
694 | op->destroy (true); |
693 | LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); |
695 | LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); |
694 | continue; |
696 | continue; |
695 | } |
697 | } |
696 | |
698 | |
697 | if (op->nrof > 1) |
699 | if (op->nrof > 1) |
… | |
… | |
712 | CLEAR_FLAG (op, FLAG_DAMNED); |
714 | CLEAR_FLAG (op, FLAG_DAMNED); |
713 | } |
715 | } |
714 | |
716 | |
715 | if (op->type == SPELL) |
717 | if (op->type == SPELL) |
716 | { |
718 | { |
717 | op->destroy (); |
719 | op->destroy (true); |
718 | continue; |
720 | continue; |
719 | } |
721 | } |
720 | else if (op->type == SKILL) |
722 | else if (op->type == SKILL) |
721 | { |
723 | { |
722 | SET_FLAG (op, FLAG_CAN_USE_SKILL); |
724 | SET_FLAG (op, FLAG_CAN_USE_SKILL); |
… | |
… | |
726 | else /* lock all 'normal items by default */ |
728 | else /* lock all 'normal items by default */ |
727 | SET_FLAG (op, FLAG_INV_LOCKED); |
729 | SET_FLAG (op, FLAG_INV_LOCKED); |
728 | } /* for loop of objects in player inv */ |
730 | } /* for loop of objects in player inv */ |
729 | |
731 | |
730 | /* Need to set up the skill pointers */ |
732 | /* Need to set up the skill pointers */ |
731 | link_player_skills (pl); |
733 | pl->contr->link_skills (); |
732 | } |
734 | } |
733 | |
735 | |
734 | void |
736 | void |
735 | get_party_password (object *op, partylist *party) |
737 | get_party_password (object *op, partylist *party) |
736 | { |
738 | { |
… | |
… | |
851 | */ |
853 | */ |
852 | void |
854 | void |
853 | player::chargen_race_done () |
855 | player::chargen_race_done () |
854 | { |
856 | { |
855 | /* this must before then initial items are given */ |
857 | /* this must before then initial items are given */ |
856 | esrv_new_player (ob->contr, ob->weight + ob->carrying); |
858 | esrv_new_player (ob->contr); |
857 | |
859 | |
858 | treasurelist *tl = treasurelist::find ("starting_wealth"); |
860 | treasurelist *tl = treasurelist::find ("starting_wealth"); |
859 | if (tl) |
861 | if (tl) |
860 | create_treasure (tl, ob, 0, 0, 0); |
862 | create_treasure (tl, ob, 0, 0, 0); |
861 | |
863 | |
… | |
… | |
865 | ob->contr->ns->state = ST_PLAYING; |
867 | ob->contr->ns->state = ST_PLAYING; |
866 | |
868 | |
867 | if (ob->msg) |
869 | if (ob->msg) |
868 | ob->msg = 0; |
870 | ob->msg = 0; |
869 | |
871 | |
870 | /* We create this now because some of the unique maps will need it |
|
|
871 | * to save here. |
|
|
872 | */ |
|
|
873 | { |
|
|
874 | char buf[MAX_BUF]; |
|
|
875 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &ob->name); |
|
|
876 | make_path_to_file (buf); |
|
|
877 | } |
|
|
878 | |
|
|
879 | start_info (ob); |
872 | start_info (ob); |
880 | CLEAR_FLAG (ob, FLAG_WIZ); |
873 | CLEAR_FLAG (ob, FLAG_WIZ); |
881 | give_initial_items (ob, ob->randomitems); |
874 | give_initial_items (ob, ob->randomitems); |
882 | link_player_skills (ob); |
|
|
883 | esrv_send_inventory (ob, ob); |
875 | esrv_send_inventory (ob, ob); |
884 | ob->update_stats (); |
876 | ob->update_stats (); |
885 | |
877 | |
886 | /* This moves the player to a different start map, if there |
878 | /* This moves the player to a different start map, if there |
887 | * is one for this race |
879 | * is one for this race |
888 | */ |
880 | */ |
889 | if (*first_map_ext_path) |
881 | if (*first_map_ext_path) |
890 | { |
882 | ob->player_goto (format ("%s/%s", &first_map_ext_path, &ob->arch->archname), ob->x, ob->y); |
891 | object *tmp; |
|
|
892 | char mapname[MAX_BUF]; |
|
|
893 | |
|
|
894 | snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &ob->arch->archname); |
|
|
895 | tmp = object::create (); |
|
|
896 | EXIT_PATH (tmp) = mapname; |
|
|
897 | EXIT_X (tmp) = ob->x; |
|
|
898 | EXIT_Y (tmp) = ob->y; |
|
|
899 | ob->enter_exit (tmp); /* we don't really care if it succeeded; |
|
|
900 | * if the map isn't there, then stay on the |
|
|
901 | * default initial map */ |
|
|
902 | tmp->destroy (); |
|
|
903 | } |
|
|
904 | else |
883 | else |
905 | LOG (llevDebug, "first_map_ext_path not set\n"); |
884 | LOG (llevDebug, "first_map_ext_path not set\n"); |
906 | } |
885 | } |
907 | |
886 | |
908 | void |
887 | void |
… | |
… | |
1327 | if (op->contr->mode & PU_RATIO) |
1306 | if (op->contr->mode & PU_RATIO) |
1328 | { |
1307 | { |
1329 | /* use value density to decide what else to grab */ |
1308 | /* use value density to decide what else to grab */ |
1330 | /* >=7 was >= op->contr->mode */ |
1309 | /* >=7 was >= op->contr->mode */ |
1331 | /* >=7 is the old standard setting. Now we take the last 4 bits |
1310 | /* >=7 is the old standard setting. Now we take the last 4 bits |
1332 | * and multiply them by 5, giving 0..15*5== 5..75 */ |
1311 | */ |
1333 | wvratio = (op->contr->mode & PU_RATIO) * 5; |
1312 | wvratio = op->contr->mode & PU_RATIO; |
1334 | if ((query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1))) >= (unsigned int) wvratio) |
1313 | if (1000 * query_cost (tmp, op, F_TRUE) / tmp->total_weight () >= wvratio * 100) |
1335 | { |
1314 | { |
1336 | CHK_PICK_PICKUP; |
1315 | CHK_PICK_PICKUP; |
1337 | #if 0 |
1316 | #if 0 |
1338 | fprintf (stderr, "HIGH WEIGHT/VALUE ["); |
1317 | fprintf (stderr, "HIGH WEIGHT/VALUE ["); |
1339 | if (tmp->name != NULL) |
1318 | if (tmp->name != NULL) |
… | |
… | |
1405 | } |
1384 | } |
1406 | } |
1385 | } |
1407 | else if (arrow->type == ARROW && arrow->race == type) |
1386 | else if (arrow->type == ARROW && arrow->race == type) |
1408 | { |
1387 | { |
1409 | /* allways prefer assasination/slaying */ |
1388 | /* allways prefer assasination/slaying */ |
1410 | if (target->race != NULL && arrow->slaying != NULL && strstr (arrow->slaying, target->race)) |
1389 | if (target->race && arrow->slaying && strstr (arrow->slaying, target->race)) |
1411 | { |
1390 | { |
1412 | if (arrow->attacktype & AT_DEATH) |
1391 | if (arrow->attacktype & AT_DEATH) |
1413 | { |
1392 | { |
1414 | *better = 100; |
1393 | *better = 100; |
1415 | return arrow; |
1394 | return arrow; |
… | |
… | |
1443 | betterby = 1 + arrow->magic + arrow->stats.dam; |
1422 | betterby = 1 + arrow->magic + arrow->stats.dam; |
1444 | } |
1423 | } |
1445 | } |
1424 | } |
1446 | } |
1425 | } |
1447 | } |
1426 | } |
|
|
1427 | |
1448 | if (tmp == NULL && arrow == NULL) |
1428 | if (tmp == NULL && arrow == NULL) |
1449 | return find_arrow (op, type); |
1429 | return find_arrow (op, type); |
1450 | |
1430 | |
1451 | *better = betterby; |
1431 | *better = betterby; |
1452 | return tmp; |
1432 | return tmp; |
… | |
… | |
1598 | } |
1578 | } |
1599 | |
1579 | |
1600 | /* this should not happen, but sometimes does */ |
1580 | /* this should not happen, but sometimes does */ |
1601 | if (arrow->nrof == 0) |
1581 | if (arrow->nrof == 0) |
1602 | { |
1582 | { |
|
|
1583 | LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ()); |
1603 | arrow->destroy (); |
1584 | arrow->destroy (true); |
1604 | return 0; |
1585 | return 0; |
1605 | } |
1586 | } |
1606 | |
1587 | |
1607 | left = arrow; /* these are arrows left to the player */ |
1588 | left = arrow; /* these are arrows left to the player */ |
1608 | arrow = get_split_ob (arrow, 1); |
1589 | arrow = arrow->split (); |
1609 | if (!arrow) |
1590 | if (!arrow) |
1610 | { |
1591 | { |
1611 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1592 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1612 | return 0; |
1593 | return 0; |
1613 | } |
1594 | } |
… | |
… | |
1680 | op->play_sound (sound_find ("fire_arrow")); |
1661 | op->play_sound (sound_find ("fire_arrow")); |
1681 | m->insert (arrow, sx, sy, op); |
1662 | m->insert (arrow, sx, sy, op); |
1682 | |
1663 | |
1683 | if (!arrow->destroyed ()) |
1664 | if (!arrow->destroyed ()) |
1684 | move_arrow (arrow); |
1665 | move_arrow (arrow); |
1685 | |
|
|
1686 | if (op->type == PLAYER) |
|
|
1687 | { |
|
|
1688 | if (left->destroyed ()) |
|
|
1689 | esrv_del_item (op->contr, left->count); |
|
|
1690 | else |
|
|
1691 | esrv_send_item (op, left); |
|
|
1692 | } |
|
|
1693 | |
1666 | |
1694 | return 1; |
1667 | return 1; |
1695 | } |
1668 | } |
1696 | |
1669 | |
1697 | /* Special fire code for players - this takes into |
1670 | /* Special fire code for players - this takes into |
… | |
… | |
1771 | return; |
1744 | return; |
1772 | } |
1745 | } |
1773 | } |
1746 | } |
1774 | else if (item->type == ROD || item->type == HORN) |
1747 | else if (item->type == ROD || item->type == HORN) |
1775 | { |
1748 | { |
1776 | if (item->stats.hp < MAX (item->inv->stats.sp, item->inv->stats.grace)) |
1749 | sint16 spell_sp = MAX (item->inv->stats.sp, item->inv->stats.grace); |
|
|
1750 | |
|
|
1751 | // using the maximum of the rods charge allows at least one spell cast |
|
|
1752 | // for a rod or horn, this fixes some broken rods. |
|
|
1753 | if (item->stats.hp < MIN (spell_sp, item->stats.maxhp)) |
1777 | { |
1754 | { |
1778 | op->contr->play_sound (sound_find ("wand_poof")); |
1755 | op->contr->play_sound (sound_find ("wand_poof")); |
1779 | |
1756 | |
1780 | if (item->type == ROD) |
1757 | if (item->type == ROD) |
1781 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s whines for a while, but nothing happens.", query_base_name (item, 0)); |
1758 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s whines for a while, but nothing happens.", query_base_name (item, 0)); |
… | |
… | |
1800 | CLEAR_FLAG (item, FLAG_ANIMATE); |
1777 | CLEAR_FLAG (item, FLAG_ANIMATE); |
1801 | item->face = item->arch->face; |
1778 | item->face = item->arch->face; |
1802 | item->set_speed (0); |
1779 | item->set_speed (0); |
1803 | } |
1780 | } |
1804 | |
1781 | |
1805 | if ((tmp = item->in_player ())) |
1782 | if (object *pl = item->visible_to ()) |
1806 | esrv_update_item (UPD_ANIM, tmp, item); |
1783 | esrv_update_item (UPD_ANIM, pl, item); |
1807 | } |
1784 | } |
1808 | } |
1785 | } |
1809 | else if (item->type == ROD || item->type == HORN) |
1786 | else if (item->type == ROD || item->type == HORN) |
1810 | drain_rod_charge (item); |
1787 | drain_rod_charge (item); |
1811 | } |
1788 | } |
… | |
… | |
1987 | op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN); |
1964 | op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN); |
1988 | remove_door2 (door); /* remove door without violence ;-) */ |
1965 | remove_door2 (door); /* remove door without violence ;-) */ |
1989 | } |
1966 | } |
1990 | |
1967 | |
1991 | /* Do this after we print the message */ |
1968 | /* Do this after we print the message */ |
1992 | decrease_ob (key); /* Use up one of the keys */ |
1969 | key->decrease (); /* Use up one of the keys */ |
1993 | /* Need to update the weight the container the key was in */ |
|
|
1994 | if (container != op) |
|
|
1995 | esrv_update_item (UPD_WEIGHT, op, container); |
|
|
1996 | |
1970 | |
1997 | return 1; /* Nothing more to do below */ |
1971 | return 1; /* Nothing more to do below */ |
1998 | } |
1972 | } |
1999 | else if (door->type == LOCKED_DOOR) |
1973 | else if (door->type == LOCKED_DOOR) |
2000 | { |
1974 | { |
… | |
… | |
2279 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2253 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2280 | { |
2254 | { |
2281 | op->play_sound (sound_find ("ob_evaporate")); |
2255 | op->play_sound (sound_find ("ob_evaporate")); |
2282 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2256 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2283 | |
2257 | |
2284 | if (op->contr) |
|
|
2285 | esrv_del_item (op->contr, tmp->count); |
|
|
2286 | |
|
|
2287 | tmp->destroy (); |
2258 | tmp->destroy (true); |
2288 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2259 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2289 | |
2260 | |
2290 | if (op->stats.hp < 0) |
2261 | if (op->stats.hp < 0) |
2291 | op->stats.hp = op->stats.maxhp; |
2262 | op->stats.hp = op->stats.maxhp; |
2292 | |
2263 | |
… | |
… | |
2303 | return 0; |
2274 | return 0; |
2304 | } |
2275 | } |
2305 | |
2276 | |
2306 | /* This goes throws the inventory and removes unpaid objects, and puts them |
2277 | /* This goes throws the inventory and removes unpaid objects, and puts them |
2307 | * back in the map (location and map determined by values of env). This |
2278 | * back in the map (location and map determined by values of env). This |
2308 | * function will descend into containers. op is the object to start the search |
2279 | * function will descend into containers. op is the object to start the search |
2309 | * from. |
2280 | * from. |
2310 | */ |
2281 | */ |
2311 | static void |
2282 | static void |
2312 | drop_unpaid_items (object *op, object *env) |
2283 | drop_unpaid_items (object *op, object *env) |
2313 | { |
2284 | { |
2314 | while (op) |
2285 | while (op) |
2315 | { |
2286 | { |
2316 | object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ |
2287 | object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ |
2317 | |
2288 | |
2318 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
2289 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
2319 | { |
|
|
2320 | if (env->type == PLAYER) |
|
|
2321 | esrv_del_item (env->contr, op->count); |
|
|
2322 | |
|
|
2323 | op->insert_at (env); |
2290 | op->insert_at (env); |
2324 | } |
|
|
2325 | else if (op->inv) |
2291 | else if (op->inv) |
2326 | drop_unpaid_items (op->inv, env); |
2292 | drop_unpaid_items (op->inv, env); |
2327 | |
2293 | |
2328 | op = next; |
2294 | op = next; |
2329 | } |
2295 | } |
… | |
… | |
2341 | * Moved from apply.c to player.c - player.c is what |
2307 | * Moved from apply.c to player.c - player.c is what |
2342 | * actually uses this function. player.c may not be quite the |
2308 | * actually uses this function. player.c may not be quite the |
2343 | * best, a misc file for object actions is probably better, |
2309 | * best, a misc file for object actions is probably better, |
2344 | * but there isn't one in the server directory. |
2310 | * but there isn't one in the server directory. |
2345 | */ |
2311 | */ |
2346 | char * |
2312 | const char * |
2347 | gravestone_text (object *op) |
2313 | gravestone_text (object *op) |
2348 | { |
2314 | { |
2349 | static char buf2[MAX_BUF]; |
2315 | static dynbuf_text buf; |
2350 | char buf[MAX_BUF]; |
|
|
2351 | time_t now = time (NULL); |
|
|
2352 | |
2316 | |
2353 | strcpy (buf2, " R.I.P.\n\n"); |
2317 | buf << "---- R.I.P. ----\n\n" |
|
|
2318 | << op->name; |
|
|
2319 | |
2354 | if (op->type == PLAYER) |
2320 | if (op->type == PLAYER) |
2355 | sprintf (buf, "%s the %s\n", &op->name, op->contr->title); |
2321 | buf << " the " << op->contr->title; |
2356 | else |
|
|
2357 | sprintf (buf, "%s\n", &op->name); |
|
|
2358 | |
2322 | |
2359 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2323 | buf << "\n\n"; |
2360 | strcat (buf2, buf); |
2324 | |
|
|
2325 | buf << "who was level "; |
|
|
2326 | buf << (sint32)op->level << "\n\n" // OO breakdown |
|
|
2327 | << " when " << (op->contr ? "killed" : "died") << "\n\n"; |
|
|
2328 | |
2361 | if (op->type == PLAYER) |
2329 | if (op->type == PLAYER) |
2362 | sprintf (buf, "who was in level %d when killed\n", op->level); |
2330 | buf << "by " << op->contr->killer_name () << ".\n\n"; |
2363 | else |
|
|
2364 | sprintf (buf, "who was in level %d when died.\n\n", op->level); |
|
|
2365 | |
2331 | |
2366 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
|
|
2367 | strcat (buf2, buf); |
|
|
2368 | if (op->type == PLAYER) |
|
|
2369 | { |
2332 | { |
2370 | sprintf (buf, "by %s.\n\n", op->contr->killer); |
2333 | static char buf2[128]; |
2371 | strncat (buf2, " ", 21 - strlen (buf) / 2); |
2334 | time_t now = time (NULL); |
2372 | strcat (buf2, buf); |
|
|
2373 | } |
|
|
2374 | |
|
|
2375 | strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now)); |
2335 | strftime (buf2, 128, "%b %d %Y\n\n", localtime (&now)); |
2376 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2336 | buf << buf2; |
2377 | strcat (buf2, buf); |
2337 | } |
2378 | |
2338 | |
2379 | return buf2; |
2339 | return buf; |
2380 | } |
2340 | } |
2381 | |
2341 | |
2382 | void |
2342 | void |
2383 | do_some_living (object *op) |
2343 | do_some_living (object *op) |
2384 | { |
2344 | { |
… | |
… | |
2565 | op->stats.food--; |
2525 | op->stats.food--; |
2566 | } |
2526 | } |
2567 | |
2527 | |
2568 | if (op->stats.food < 0 && op->stats.hp >= 0) |
2528 | if (op->stats.food < 0 && op->stats.hp >= 0) |
2569 | { |
2529 | { |
2570 | object *tmp, *flesh = 0; |
2530 | object *flesh = 0; |
2571 | |
2531 | |
2572 | for (tmp = op->inv; tmp; tmp = tmp->below) |
2532 | for_inv_removable (op, tmp) |
2573 | { |
2533 | { |
2574 | if (!QUERY_FLAG (tmp, FLAG_UNPAID)) |
2534 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
|
|
2535 | continue; |
|
|
2536 | |
|
|
2537 | if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) |
2575 | { |
2538 | { |
2576 | if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) |
2539 | op->statusmsg ("You blindly grab for a bite of food. " |
2577 | { |
2540 | "H<To prevent you from starving, you ate some random item from your backpack.>"); |
2578 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
|
|
2579 | manual_apply (op, tmp, 0); |
2541 | manual_apply (op, tmp, 0); |
|
|
2542 | |
2580 | if (op->stats.food >= 0 || op->stats.hp < 0) |
2543 | if (op->stats.food >= 0 || op->stats.hp < 0) |
2581 | break; |
2544 | break; |
2582 | } |
2545 | } |
2583 | else if (tmp->type == FLESH) |
2546 | else if (tmp->type == FLESH) |
2584 | flesh = tmp; |
2547 | flesh = tmp; |
2585 | } /* End if paid for object */ |
2548 | } |
2586 | } /* end of for loop */ |
|
|
2587 | |
2549 | |
2588 | /* If player is still starving, it means they don't have any food, so |
2550 | /* If player is still starving, it means they don't have any food, so |
2589 | * eat flesh instead. |
2551 | * eat flesh instead. |
2590 | */ |
2552 | */ |
2591 | if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) |
2553 | if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) |
2592 | { |
2554 | { |
2593 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
2555 | op->statusmsg ("You blindly grab for a bite of food. " |
|
|
2556 | "H<To prevent you from starving, you ate some random item from your backpack.>"); |
2594 | manual_apply (op, flesh, 0); |
2557 | manual_apply (op, flesh, 0); |
2595 | } |
2558 | } |
|
|
2559 | |
|
|
2560 | // If player is still starving, alert him! |
|
|
2561 | if (op->stats.food < 0) |
|
|
2562 | op->failmsg ("You are starving! " |
|
|
2563 | "H<Eat some food to increase your food and prevent you from an untimely death.>"); |
2596 | } |
2564 | } |
2597 | |
2565 | |
2598 | if (op->stats.food < 0) |
2566 | if (op->stats.food < 0) |
2599 | { |
2567 | { |
2600 | op->stats.hp += op->stats.food; |
2568 | op->stats.hp += op->stats.food; |
2601 | op->stats.food = 0; |
2569 | op->stats.food = 0; |
|
|
2570 | |
|
|
2571 | if (op->stats.hp < 0) |
|
|
2572 | { |
|
|
2573 | op->contr->killer = archetype::get ("killer_starvation"); |
|
|
2574 | op->contr->killer->destroy (true); |
2602 | } |
2575 | } |
|
|
2576 | } |
2603 | |
2577 | |
|
|
2578 | /* killer should be set here already */ |
2604 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2579 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2605 | kill_player (op); |
2580 | kill_player (op); |
2606 | } |
2581 | } |
2607 | } |
2582 | } |
2608 | |
2583 | |
… | |
… | |
2635 | |
2610 | |
2636 | /* restore player */ |
2611 | /* restore player */ |
2637 | at = archetype::find ("poisoning"); |
2612 | at = archetype::find ("poisoning"); |
2638 | if (object *tmp = present_arch_in_ob (at, op)) |
2613 | if (object *tmp = present_arch_in_ob (at, op)) |
2639 | { |
2614 | { |
2640 | tmp->destroy (); |
2615 | tmp->destroy (true); |
2641 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2616 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2642 | } |
2617 | } |
2643 | |
2618 | |
2644 | at = archetype::find ("confusion"); |
2619 | at = archetype::find ("confusion"); |
2645 | if (object *tmp = present_arch_in_ob (at, op)) |
2620 | if (object *tmp = present_arch_in_ob (at, op)) |
2646 | { |
2621 | { |
2647 | tmp->destroy (); |
2622 | tmp->destroy (true); |
2648 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2623 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2649 | } |
2624 | } |
2650 | |
2625 | |
2651 | cure_disease (op, 0, 0); /* remove any disease */ |
2626 | cure_disease (op, 0, 0); /* remove any disease */ |
2652 | op->stats.hp = op->stats.maxhp; |
2627 | op->stats.hp = op->stats.maxhp; |
… | |
… | |
2658 | { |
2633 | { |
2659 | tmp->name = format ("%s's finger" , &op->name); |
2634 | tmp->name = format ("%s's finger" , &op->name); |
2660 | tmp->name_pl = format ("%s's fingers", &op->name); |
2635 | tmp->name_pl = format ("%s's fingers", &op->name); |
2661 | tmp->msg = format ( |
2636 | tmp->msg = format ( |
2662 | "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", |
2637 | "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", |
2663 | &op->name, op->contr->title, (int) (op->level), op->contr->killer |
2638 | &op->name, op->contr->title, |
|
|
2639 | (int)op->level, |
|
|
2640 | op->contr->killer_name () |
2664 | ); |
2641 | ); |
2665 | tmp->value = 0, tmp->type = 0; |
2642 | tmp->value = 0, tmp->type = 0; |
2666 | tmp->materialname = "organics"; |
2643 | tmp->materialname = "organics"; |
2667 | tmp->insert_at (op, tmp); |
2644 | tmp->insert_at (op, tmp); |
2668 | } |
2645 | } |
… | |
… | |
2674 | } |
2651 | } |
2675 | |
2652 | |
2676 | INVOKE_PLAYER (DEATH, op->contr); |
2653 | INVOKE_PLAYER (DEATH, op->contr); |
2677 | |
2654 | |
2678 | command_kill_pets (op, 0); |
2655 | command_kill_pets (op, 0); |
2679 | |
|
|
2680 | if (op->stats.food < 0) |
|
|
2681 | strcpy (op->contr->killer, "starvation"); |
|
|
2682 | |
2656 | |
2683 | op->contr->play_sound (sound_find ("player_dies")); |
2657 | op->contr->play_sound (sound_find ("player_dies")); |
2684 | |
2658 | |
2685 | /* save the map location for corpse, gravestone */ |
2659 | /* save the map location for corpse, gravestone */ |
2686 | x = op->x; |
2660 | x = op->x; |
… | |
… | |
2795 | lost_a_stat = 1; |
2769 | lost_a_stat = 1; |
2796 | } |
2770 | } |
2797 | } |
2771 | } |
2798 | } |
2772 | } |
2799 | } |
2773 | } |
|
|
2774 | |
2800 | /* If no stat lost, tell the player. */ |
2775 | /* If no stat lost, tell the player. */ |
2801 | if (!lost_a_stat) |
2776 | if (!lost_a_stat) |
2802 | { |
2777 | { |
2803 | /* determine_god() seems to not work sometimes... why is this? |
2778 | /* determine_god() seems to not work sometimes... why is this? |
2804 | Should I be using something else? GD */ |
2779 | Should I be using something else? GD */ |
… | |
… | |
2808 | new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god); |
2783 | new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god); |
2809 | else |
2784 | else |
2810 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you."); |
2785 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you."); |
2811 | } |
2786 | } |
2812 | #else |
2787 | #else |
2813 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely."); |
2788 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you from losing yourself completely."); |
2814 | #endif |
2789 | #endif |
2815 | |
2790 | |
2816 | /* Put a gravestone up where the character 'almost' died. List the |
2791 | /* Put a gravestone up where the character 'almost' died. List the |
2817 | * exp loss on the stone. |
2792 | * exp loss on the stone. |
2818 | */ |
2793 | */ |
2819 | tmp = arch_to_object (archetype::find ("gravestone")); |
2794 | tmp = arch_to_object (archetype::find ("gravestone")); |
2820 | sprintf (buf, "%s's gravestone", &op->name); |
2795 | tmp->name = format ("%s's gravestone", &op->name); |
2821 | tmp->name = buf; |
2796 | tmp->name_pl = format ("%s's gravestones", &op->name); |
2822 | sprintf (buf, "%s's gravestones", &op->name); |
2797 | tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n", |
2823 | tmp->name_pl = buf; |
2798 | &op->name, op->contr->title, op->contr->killer_name ()); |
2824 | sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer); |
|
|
2825 | tmp->msg = buf; |
|
|
2826 | tmp->x = op->x, tmp->y = op->y; |
2799 | tmp->x = op->x, tmp->y = op->y; |
2827 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2800 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2828 | |
2801 | |
2829 | /**************************************/ |
2802 | /**************************************/ |
2830 | /* */ |
2803 | /* */ |
… | |
… | |
2839 | at = archetype::find ("poisoning"); |
2812 | at = archetype::find ("poisoning"); |
2840 | tmp = present_arch_in_ob (at, op); |
2813 | tmp = present_arch_in_ob (at, op); |
2841 | |
2814 | |
2842 | if (tmp) |
2815 | if (tmp) |
2843 | { |
2816 | { |
2844 | tmp->destroy (); |
2817 | tmp->destroy (true); |
2845 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2818 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2846 | } |
2819 | } |
2847 | |
2820 | |
2848 | at = archetype::find ("confusion"); |
2821 | at = archetype::find ("confusion"); |
2849 | tmp = present_arch_in_ob (at, op); |
2822 | tmp = present_arch_in_ob (at, op); |
2850 | if (tmp) |
2823 | if (tmp) |
2851 | { |
2824 | { |
2852 | tmp->destroy (); |
2825 | tmp->destroy (true); |
2853 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2826 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2854 | } |
2827 | } |
2855 | |
2828 | |
2856 | cure_disease (op, 0, 0); /* remove any disease */ |
2829 | cure_disease (op, 0, 0); /* remove any disease */ |
|
|
2830 | |
|
|
2831 | // remove all spell effects that are active |
|
|
2832 | // to avoid long-term effects such as word-of-recall |
|
|
2833 | for (object *item = op->inv; item; ) |
|
|
2834 | { |
|
|
2835 | object *next = item->below; |
|
|
2836 | |
|
|
2837 | if (item->type == SPELL_EFFECT && item->active) |
|
|
2838 | item->destroy (true); |
|
|
2839 | |
|
|
2840 | item = next; |
|
|
2841 | } |
2857 | |
2842 | |
2858 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2843 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2859 | apply_death_exp_penalty (op); |
2844 | apply_death_exp_penalty (op); |
|
|
2845 | |
2860 | if (op->stats.food < 100) |
2846 | if (op->stats.food < 100) |
2861 | op->stats.food = 900; |
2847 | op->stats.food = 900; |
|
|
2848 | |
2862 | op->stats.hp = op->stats.maxhp; |
2849 | op->stats.hp = op->stats.maxhp; |
2863 | op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); |
2850 | op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); |
2864 | op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); |
2851 | op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); |
2865 | |
2852 | |
2866 | /* |
2853 | /* |
… | |
… | |
2904 | if (will_kill_again & (1 << at)) |
2891 | if (will_kill_again & (1 << at)) |
2905 | force->resist[at] = 100; |
2892 | force->resist[at] = 100; |
2906 | |
2893 | |
2907 | insert_ob_in_ob (force, op); |
2894 | insert_ob_in_ob (force, op); |
2908 | op->update_stats (); |
2895 | op->update_stats (); |
2909 | |
|
|
2910 | } |
2896 | } |
2911 | |
2897 | |
2912 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2898 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2913 | } |
2899 | } |
2914 | |
2900 | |
… | |
… | |
2934 | |
2920 | |
2935 | if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(rndm (3)))) |
2921 | if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(rndm (3)))) |
2936 | { |
2922 | { |
2937 | if (tmp->nrof > 1) |
2923 | if (tmp->nrof > 1) |
2938 | { |
2924 | { |
2939 | tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1)); |
2925 | tmp->decrease (rndm (1, tmp->nrof - 1)); |
2940 | tmp2->destroy (); |
|
|
2941 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2926 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2942 | } |
2927 | } |
2943 | else |
2928 | else |
2944 | tmp->destroy (); |
2929 | tmp->destroy (true); |
2945 | } |
2930 | } |
2946 | else |
2931 | else |
2947 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2932 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2948 | } |
2933 | } |
2949 | } |
2934 | } |
… | |
… | |
2956 | void |
2941 | void |
2957 | fix_weight (void) |
2942 | fix_weight (void) |
2958 | { |
2943 | { |
2959 | for_all_players (pl) |
2944 | for_all_players (pl) |
2960 | { |
2945 | { |
2961 | int old = pl->ob->carrying, sum = sum_weight (pl->ob); |
2946 | sint32 old = pl->ob->carrying; |
2962 | |
2947 | |
2963 | if (old == sum) |
2948 | pl->ob->update_weight (); |
2964 | continue; |
2949 | |
|
|
2950 | if (old != pl->ob->carrying) |
|
|
2951 | { |
2965 | pl->ob->update_stats (); |
2952 | pl->ob->update_stats (); |
2966 | LOG (llevDebug, "Fixed inventory in %s (%d -> %d)\n", &pl->ob->name, old, sum); |
2953 | LOG (llevDebug, "Fixed inventory in %s (%d -> %d)\n", &pl->ob->name, (int)old, (int)pl->ob->carrying); |
|
|
2954 | } |
2967 | } |
2955 | } |
2968 | } |
2956 | } |
2969 | |
2957 | |
2970 | void |
2958 | void |
2971 | fix_luck (void) |
2959 | fix_luck (void) |
… | |
… | |
3007 | if (op->type == PLAYER) |
2995 | if (op->type == PLAYER) |
3008 | new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); |
2996 | new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); |
3009 | |
2997 | |
3010 | cast_spell (op, throw_ob, dir, spob, NULL); |
2998 | cast_spell (op, throw_ob, dir, spob, NULL); |
3011 | |
2999 | |
3012 | throw_ob->destroy (); |
3000 | throw_ob->destroy (true); |
3013 | } |
3001 | } |
3014 | |
3002 | |
3015 | void |
3003 | void |
3016 | make_visible (object *op) |
3004 | make_visible (object *op) |
3017 | { |
3005 | { |
… | |
… | |
3085 | * spot (surrounded by clear terrain in broad daylight). -b.t. |
3073 | * spot (surrounded by clear terrain in broad daylight). -b.t. |
3086 | */ |
3074 | */ |
3087 | void |
3075 | void |
3088 | do_hidden_move (object *op) |
3076 | do_hidden_move (object *op) |
3089 | { |
3077 | { |
3090 | int hide = 0, num = random_roll (0, 19, op, PREFER_LOW); |
3078 | int hide = 0; |
3091 | object *skop; |
|
|
3092 | |
3079 | |
3093 | if (!op || !op->map) |
3080 | if (!op || !op->map) |
3094 | return; |
3081 | return; |
3095 | |
3082 | |
3096 | skop = find_obj_by_type_subtype (op, SKILL, SK_HIDING); |
3083 | object *skop = find_obj_by_type_subtype (op, SKILL, SK_HIDING); |
|
|
3084 | int num = random_roll (0, 19, op, PREFER_LOW); |
3097 | |
3085 | |
3098 | /* its *extremely* hard to run and sneak/hide at the same time! */ |
3086 | /* its *extremely* hard to run and sneak/hide at the same time! */ |
3099 | if (op->type == PLAYER && op->contr->run_on) |
3087 | if (op->type == PLAYER && op->contr->run_on) |
3100 | if (!skop || num >= skop->level) |
3088 | if (!skop || num >= skop->level) |
3101 | { |
3089 | { |
… | |
… | |
3111 | num -= hide; |
3099 | num -= hide; |
3112 | |
3100 | |
3113 | if ((op->type == PLAYER && hide < -10) || ((op->invisible -= num) <= 0)) |
3101 | if ((op->type == PLAYER && hide < -10) || ((op->invisible -= num) <= 0)) |
3114 | { |
3102 | { |
3115 | make_visible (op); |
3103 | make_visible (op); |
|
|
3104 | |
3116 | if (op->type == PLAYER) |
3105 | if (op->type == PLAYER) |
3117 | new_draw_info (NDI_UNIQUE, 0, op, "You moved out of hiding! You are visible!"); |
3106 | new_draw_info (NDI_UNIQUE, 0, op, "You moved out of hiding! You are visible!"); |
3118 | } |
3107 | } |
3119 | else if (op->type == PLAYER && skop) |
3108 | else if (op->type == PLAYER && skop) |
3120 | change_exp (op, calc_skill_exp (op, NULL, skop), skop->skill, 0); |
3109 | change_exp (op, calc_skill_exp (op, NULL, skop), skop->skill, 0); |
… | |
… | |
3461 | else |
3450 | else |
3462 | { |
3451 | { |
3463 | /* generate misc. treasure */ |
3452 | /* generate misc. treasure */ |
3464 | tmp = arch_to_object (tr->item); |
3453 | tmp = arch_to_object (tr->item); |
3465 | new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); |
3454 | new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); |
3466 | tmp = insert_ob_in_ob (tmp, who); |
3455 | who->insert (tmp); |
3467 | if (who->type == PLAYER) |
|
|
3468 | esrv_send_item (who, tmp); |
|
|
3469 | } |
3456 | } |
3470 | } |
3457 | } |
3471 | |
3458 | |
3472 | /** |
3459 | /** |
3473 | * Unready an object for a player. This function does nothing if the object was |
3460 | * Unready an object for a player. This function does nothing if the object was |