Пример #1
0
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);
}
Пример #2
0
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);
}
Пример #3
0
int Crash_report_unrentables(struct char_data * ch, struct char_data * recep,
				 struct obj_data * obj)
{
  char buf[128];
  int has_norents = 0;

  if (obj) {
    if (Crash_is_unrentable(obj)) {
      has_norents = 1;
      sprintf(buf, "%s You cannot store %s.", GET_NAME(ch), OBJS(obj, ch));
      do_tell(recep, buf, 0, 0);
    }
    has_norents += Crash_report_unrentables(ch, recep, obj->contains);
    has_norents += Crash_report_unrentables(ch, recep, obj->next_content);
  }
  return (has_norents);
}
Пример #4
0
int Crash_report_unrentables(struct char_data *ch, struct char_data *recep,
                             struct obj_data *obj)
{
  char buf[128];
  int has_norents = 0;

  if (obj) {
    if (Crash_is_unrentable(obj)) {
      has_norents = 1;
      sprintf(buf, "$n tells you, 'You cannot store %s.'", OBJS(obj, ch));
      act(buf, FALSE, recep, 0, ch, TO_VICT);
    }
    has_norents += Crash_report_unrentables(ch, recep, obj->contains);
    has_norents += Crash_report_unrentables(ch, recep, obj->next_content);
  }
  return (has_norents);
}