static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg) { long recipient; char buf[MAX_INPUT_LENGTH], **mailwrite; if (GET_LEVEL(ch) < MIN_MAIL_LEVEL) { snprintf(buf, sizeof(buf), "$n tells you, 'Sorry, you have to be level %d to send mail!'", MIN_MAIL_LEVEL); act(buf, FALSE, mailman, 0, ch, TO_VICT); return; } one_argument(arg, buf); if (!*buf) { /* you'll get no argument from me! */ act("$n tells you, 'You need to specify an addressee!'", FALSE, mailman, 0, ch, TO_VICT); return; } if (GET_GOLD(ch) < STAMP_PRICE && GET_ADMLEVEL(ch) < ADMLVL_IMMORT) { snprintf(buf, sizeof(buf), "$n tells you, 'A stamp costs %d coin%s.'\r\n" "$n tells you, '...which I see you can't afford.'", STAMP_PRICE, STAMP_PRICE == 1 ? "" : "s"); act(buf, FALSE, mailman, 0, ch, TO_VICT); return; } if ((recipient = get_id_by_name(buf)) < 0 || !mail_recip_ok(buf)) { act("$n tells you, 'No one by that name is registered here!'", FALSE, mailman, 0, ch, TO_VICT); return; } act("$n starts to write some mail.", TRUE, ch, 0, 0, TO_ROOM); snprintf(buf, sizeof(buf), "$n tells you, 'I'll take %d coins for the stamp.'\r\n" "$n tells you, 'Write your message. (/s saves /h for help).'", STAMP_PRICE); act(buf, FALSE, mailman, 0, ch, TO_VICT); if (GET_ADMLEVEL(ch) < ADMLVL_IMMORT) decrease_gold(ch, STAMP_PRICE); SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */ /* Start writing! */ CREATE(mailwrite, char *, 1); string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, recipient, NULL); }
static void npc_steal(struct char_data *ch, struct char_data *victim) { int gold; if (IS_NPC(victim)) return; if (GET_LEVEL(victim) >= LVL_IMMORT) return; if (!CAN_SEE(ch, victim)) return; if (AWAKE(victim) && (rand_number(0, GET_LEVEL(ch)) == 0)) { act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, victim, TO_VICT); act("$n tries to steal gold from $N.", TRUE, ch, 0, victim, TO_NOTVICT); } else { /* Steal some gold coins */ gold = (GET_GOLD(victim) * rand_number(1, 10)) / 100; if (gold > 0) { increase_gold(ch, gold); decrease_gold(victim, gold); } } }