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 |
… | |
… | |
20 | * |
20 | * |
21 | * 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> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #include <funcpoint.h> |
|
|
26 | #include <living.h> |
25 | #include <living.h> |
27 | #include <spells.h> |
26 | #include <spells.h> |
28 | |
27 | |
29 | const char *const coins[NUM_COINS + 1] = { "royalty", "platinacoin", "goldcoin", "silvercoin", 0 }; |
28 | const char *const coins[NUM_COINS + 1] = { "royalty", "platinacoin", "goldcoin", "silvercoin", 0 }; |
30 | |
29 | |
… | |
… | |
419 | */ |
418 | */ |
420 | const char * |
419 | const char * |
421 | query_weight (const object *op) |
420 | query_weight (const object *op) |
422 | { |
421 | { |
423 | static char buf[10]; |
422 | static char buf[10]; |
424 | sint32 i = (op->nrof ? op->nrof : 1) * op->weight + op->carrying; |
423 | sint32 i = op->total_weight (); |
425 | |
424 | |
426 | if (op->weight < 0) |
425 | if (op->weight < 0) |
427 | return " "; |
426 | return " "; |
428 | |
427 | |
429 | if (i % 1000) |
428 | if (i % 1000) |
… | |
… | |
574 | break; |
573 | break; |
575 | |
574 | |
576 | case ALTAR: |
575 | case ALTAR: |
577 | case TRIGGER_ALTAR: |
576 | case TRIGGER_ALTAR: |
578 | case IDENTIFY_ALTAR: |
577 | case IDENTIFY_ALTAR: |
|
|
578 | case CONVERTER: |
579 | if (op->slaying == shstr_money) |
579 | if (op->slaying == shstr_money) |
580 | { |
580 | { |
581 | bool wrap = !!buf.size (); |
581 | bool wrap = !!buf.size (); |
582 | |
582 | |
583 | if (wrap) buf << " ["; |
583 | if (wrap) buf << " ["; |
… | |
… | |
589 | if (op->stats.food % coin->value == 0) |
589 | if (op->stats.food % coin->value == 0) |
590 | break; |
590 | break; |
591 | |
591 | |
592 | sint32 coins = op->stats.food / coin->value; |
592 | sint32 coins = op->stats.food / coin->value; |
593 | |
593 | |
594 | buf.printf ("drop %d %s", coins, coins == 1 ? &coin->name : &coin->name_pl); |
594 | buf.printf ("drop %d %s (or equivalent)", coins, coins == 1 ? &coin->name : &coin->name_pl); |
595 | |
595 | |
596 | if (wrap) buf << ']'; |
596 | if (wrap) buf << ']'; |
597 | } |
597 | } |
598 | break; |
598 | break; |
599 | |
599 | |
… | |
… | |
1193 | } |
1193 | } |
1194 | |
1194 | |
1195 | void |
1195 | void |
1196 | examine (object *op, object *tmp) |
1196 | examine (object *op, object *tmp) |
1197 | { |
1197 | { |
1198 | std::string s = tmp->describe (op); |
1198 | std::string info = tmp->describe (op); |
1199 | |
1199 | op->contr->infobox (MSG_CHANNEL ("examine"), info.c_str ()); |
1200 | new_draw_info (NDI_UNIQUE, 0, op, s.c_str ()); |
|
|
1201 | } |
1200 | } |
1202 | |
1201 | |
1203 | /* |
1202 | /* |
1204 | * inventory prints object's inventory. If inv==NULL then print player's |
1203 | * inventory prints object's inventory. If inv==NULL then print player's |
1205 | * inventory. |
1204 | * inventory. |
… | |
… | |
1357 | * Supposed to fix face-values as well here, but later. |
1356 | * Supposed to fix face-values as well here, but later. |
1358 | */ |
1357 | */ |
1359 | void |
1358 | void |
1360 | identify (object *op) |
1359 | identify (object *op) |
1361 | { |
1360 | { |
1362 | object *pl; |
|
|
1363 | |
|
|
1364 | SET_FLAG (op, FLAG_IDENTIFIED); |
1361 | SET_FLAG (op, FLAG_IDENTIFIED); |
1365 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
1362 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
1366 | CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT); |
1363 | CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT); |
1367 | |
1364 | |
1368 | /* |
1365 | /* |
… | |
… | |
1375 | { |
1372 | { |
1376 | if (op->inv && op->randomitems) |
1373 | if (op->inv && op->randomitems) |
1377 | op->title = op->inv->name; |
1374 | op->title = op->inv->name; |
1378 | else if (op->arch) |
1375 | else if (op->arch) |
1379 | { |
1376 | { |
1380 | op->name = op->arch->object::name; |
1377 | op->name = op->arch->object::name; |
1381 | op->name_pl = op->arch->object::name_pl; |
1378 | op->name_pl = op->arch->object::name_pl; |
1382 | } |
1379 | } |
1383 | } |
1380 | } |
1384 | |
1381 | |
1385 | /* If the object is on a map, make sure we update its face */ |
1382 | /* If the object is on a map, make sure we update its face */ |
1386 | if (op->map) |
1383 | if (op->map) |
1387 | update_object (op, UP_OBJ_CHANGE); |
1384 | update_object (op, UP_OBJ_CHANGE); |
1388 | else |
1385 | else if (object *pl = op->visible_to ()) |
1389 | { |
|
|
1390 | pl = op->in_player (); |
|
|
1391 | if (pl) |
|
|
1392 | /* A lot of the values can change from an update - might as well send |
1386 | /* A lot of the values can change from an update - might as well send |
1393 | * it all. |
1387 | * it all. |
1394 | */ |
1388 | */ |
1395 | esrv_send_item (pl, op); |
1389 | esrv_send_item (pl, op); |
1396 | } |
|
|
1397 | } |
1390 | } |
1398 | |
1391 | |