the #showgold command */
| 4500 | |
| 4501 | /* the #showgold command */ |
| 4502 | int |
| 4503 | doprgold(void) |
| 4504 | { |
| 4505 | /* Command takes containers into account. */ |
| 4506 | long umoney = money_cnt(gi.invent); |
| 4507 | |
| 4508 | /* Only list the money you know about. Guards and shopkeepers |
| 4509 | can somehow tell if there is any gold anywhere on your |
| 4510 | person, but you have no such preternatural gold-sense. */ |
| 4511 | long hmoney = hidden_gold(FALSE); |
| 4512 | |
| 4513 | if (flags.verbose) { |
| 4514 | char buf[BUFSZ]; |
| 4515 | |
| 4516 | if (!umoney) { |
| 4517 | Strcpy(buf, "Your wallet is empty"); |
| 4518 | } else { |
| 4519 | Sprintf(buf, "Your wallet contains %ld %s", |
| 4520 | umoney, currency(umoney)); |
| 4521 | } |
| 4522 | if (hmoney) { |
| 4523 | Sprintf(eos(buf), |
| 4524 | ", %s you have %ld %s stashed away in your pack", |
| 4525 | umoney ? "and" : "but", hmoney, |
| 4526 | umoney ? "more" : currency(hmoney)); |
| 4527 | } |
| 4528 | pline("%s.", buf); |
| 4529 | } else { |
| 4530 | long total = umoney + hmoney; |
| 4531 | if (total) |
| 4532 | You("are carrying a total of %ld %s.", total, currency(total)); |
| 4533 | else |
| 4534 | You("have no money."); |
| 4535 | } |
| 4536 | shopper_financial_report(); |
| 4537 | |
| 4538 | if (umoney && iflags.menu_requested) { |
| 4539 | char dollarsign[] = "$"; |
| 4540 | |
| 4541 | /* mustn't use TRUE or gold wouldn't show up unless it was quivered */ |
| 4542 | (void) dispinv_with_action(dollarsign, FALSE, NULL); |
| 4543 | } |
| 4544 | |
| 4545 | return ECMD_OK; |
| 4546 | } |
| 4547 | |
| 4548 | /* the #seeweapon command */ |
| 4549 | int |
no test coverage detected