int Crash_offer_rent(struct char_data * ch, struct char_data * receptionist, int display, int factor) { char buf[MAX_INPUT_LENGTH]; int i; long totalcost = 0, numitems = 0, norent = 0; norent = Crash_report_unrentables(ch, receptionist, ch->carrying); for (i = 0; i < NUM_WEARS; i++) norent += Crash_report_unrentables(ch, receptionist, GET_EQ(ch, i)); if (norent) return 0; totalcost = min_rent_cost * factor; Crash_report_rent(ch, receptionist, ch->carrying, &totalcost, &numitems, display, factor); for (i = 0; i < NUM_WEARS; i++) Crash_report_rent(ch, receptionist, GET_EQ(ch, i), &totalcost, &numitems, display, factor); if (!numitems) { sprintf(buf, "%s But you are not carrying anything! Just quit!", GET_NAME(ch)); do_tell(receptionist, buf, 0, 0); return (0); } if (numitems > max_obj_save) { sprintf(buf, "%s Sorry, but I cannot store more than %d items.", GET_NAME(ch), max_obj_save); do_tell(receptionist, buf, 0, 0); return (0); } if (display) { sprintf(buf, "%s Plus, my %d coin fee..", GET_NAME(ch), min_rent_cost * factor); do_tell(receptionist, buf, 0, 0); sprintf(buf, "%s Totalling %ld, minus your rent credit of %ld...", GET_NAME(ch), totalcost, (long)(GET_LEVEL(ch) * 800)); do_tell(receptionist, buf, 0, 0); totalcost = MAX(0, (int)(totalcost - (GET_LEVEL(ch) * 800))); sprintf(buf, "%s That will be %ld coin%s%s.", GET_NAME(ch), totalcost, (totalcost == 1 ? "" : "s"), (factor == RENT_FACTOR ? " per day" : "")); do_tell(receptionist, buf, 0, 0); if (totalcost > GET_GOLD(ch)) { sprintf(buf, "%s ...which I see you can't afford.", GET_NAME(ch)); do_tell(receptionist, buf, 0, 0); return (0); } else if (factor == RENT_FACTOR) Crash_rent_deadline(ch, receptionist, totalcost); } return (totalcost); }
int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, int display, int factor) { char buf[MAX_INPUT_LENGTH]; int i; long totalcost = 0, numitems = 0, norent; norent = Crash_report_unrentables(ch, receptionist, ch->carrying); for (i = 0; i < NUM_WEARS; i++) norent += Crash_report_unrentables(ch, receptionist, GET_EQ(ch, i)); if (norent) return (0); totalcost = min_rent_cost * factor; Crash_report_rent(ch, receptionist, ch->carrying, &totalcost, &numitems, display, factor); for (i = 0; i < NUM_WEARS; i++) Crash_report_rent(ch, receptionist, GET_EQ(ch, i), &totalcost, &numitems, display, factor); if (!numitems) { act("$n tells you, 'But you are not carrying anything! Just quit!'", FALSE, receptionist, 0, ch, TO_VICT); return (0); } if (numitems > max_obj_save) { sprintf(buf, "$n tells you, 'Sorry, but I cannot store more than %d items.'", max_obj_save); act(buf, FALSE, receptionist, 0, ch, TO_VICT); return (0); } if (display) { sprintf(buf, "$n tells you, 'Plus, my %d coin fee..'", min_rent_cost * factor); act(buf, FALSE, receptionist, 0, ch, TO_VICT); sprintf(buf, "$n tells you, 'For a total of %ld coins%s.'", totalcost, (factor == RENT_FACTOR ? " per day" : "")); act(buf, FALSE, receptionist, 0, ch, TO_VICT); if (totalcost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { act("$n tells you, '...which I see you can't afford.'", FALSE, receptionist, 0, ch, TO_VICT); return (0); } else if (factor == RENT_FACTOR) Crash_rent_deadline(ch, receptionist, totalcost); } return (totalcost); }
void Crash_report_rent(struct char_data * ch, struct char_data * recep, struct obj_data * obj, long *cost, long *nitems, int display, int factor) { static char buf[256]; if (obj) { if (!Crash_is_unrentable(obj)) { (*nitems)++; *cost += MAX(0, (int)(GET_OBJ_RENT(obj) * factor)); if (display) { sprintf(buf, "%s %5d coins for %s..", GET_NAME(ch), (GET_OBJ_RENT(obj) * factor), OBJS(obj, ch)); do_tell(recep, buf, 0, 0); } } Crash_report_rent(ch, recep, obj->contains, cost, nitems, display, factor); Crash_report_rent(ch, recep, obj->next_content, cost, nitems, display, factor); } }
void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct obj_data *obj, long *cost, long *nitems, int display, int factor) { static char buf[256]; if (obj) { if (!Crash_is_unrentable(obj)) { (*nitems)++; *cost += MAX(0, (GET_OBJ_RENT(obj) * factor)); if (display) { sprintf(buf, "$n tells you, '%5d coins for %s..'", (GET_OBJ_RENT(obj) * factor), OBJS(obj, ch)); act(buf, FALSE, recep, 0, ch, TO_VICT); } } Crash_report_rent(ch, recep, obj->contains, cost, nitems, display, factor); Crash_report_rent(ch, recep, obj->next_content, cost, nitems, display, factor); } }