Exemplo n.º 1
0
static void sedit_setup_new(struct descriptor_data *d)
{
  struct shop_data *shop;

  /* Allocate a scratch shop structure. */
  CREATE(shop, struct shop_data, 1);

  /* Fill in some default values. */
  S_KEEPER(shop) = NOBODY;
  S_CLOSE1(shop) = 28;
  S_BUYPROFIT(shop) = 1.0;
  S_SELLPROFIT(shop) = 1.0;
  S_NOTRADE(shop) = 0;
  /* Add a spice of default strings. */
  S_NOITEM1(shop) = strdup("%s Sorry, I don't stock that item.");
  S_NOITEM2(shop) = strdup("%s You don't seem to have that.");
  S_NOCASH1(shop) = strdup("%s I can't afford that!");
  S_NOCASH2(shop) = strdup("%s You are too poor!");
  S_NOBUY(shop) = strdup("%s I don't trade in such items.");
  S_BUY(shop) = strdup("%s That'll be %d coins, thanks.");
  S_SELL(shop) = strdup("%s I'll give you %d coins for that.");
  /* Stir the lists lightly. */
  CREATE(S_PRODUCTS(shop), obj_vnum, 1);

  S_PRODUCT(shop, 0) = NOTHING;
  CREATE(S_ROOMS(shop), room_rnum, 1);

  S_ROOM(shop, 0) = NOWHERE;
  CREATE(S_NAMELISTS(shop), struct shop_buy_data, 1);

  S_BUYTYPE(shop, 0) = NOTHING;

   /* Presto! A shop. */
  OLC_SHOP(d) = shop;
}
Exemplo n.º 2
0
void sedit_setup_new(struct descriptor_data *d)
{
  struct shop_data *shop;

  /*
   * Allocate a scratch shop structure.
   */
  CREATE(shop, struct shop_data, 1);

  /*
   * Fill in some default values.
   */
  S_KEEPER(shop) = -1;
  S_CLOSE1(shop) = 28;
  S_BUYPROFIT(shop) = 1.0;
  S_SELLPROFIT(shop) = 1.0;
  S_PROPRIETARIO(shop) = 0;
  S_CLAN(shop) = -1;
  S_VALORE(shop) = 0;
  S_VALORE1(shop) = -1;
  S_VALORE2(shop) = -1;
  S_VALORE3(shop) = -1;
  S_VALORE4(shop) = -1;
  S_VALORE5(shop) = -1;

  /*
   * Add a spice of default strings.
   */
  S_NOITEM1(shop) = str_dup("%s Mi dispiace, non ho quell'oggetto in assortimento.");
  S_NOITEM2(shop) = str_dup("%s Non sembra che tu lo abbia.");
  S_NOCASH1(shop) = str_dup("%s Non me lo posso permettere!");
  S_NOCASH2(shop) = str_dup("%s Sei troppo povero!");
  S_NOBUY(shop) = str_dup("%s Non tratto quel genere di cose.");
  S_BUY(shop) = str_dup("%s Sono %d monete, grazie.");
  S_SELL(shop) = str_dup("%s Ti potrei dare %d monete per quello.");
  /*
   * Stir the lists lightly.
   */
  CREATE(S_PRODUCTS(shop), int, 1);

  S_PRODUCT(shop, 0) = -1;
  CREATE(S_ROOMS(shop), int, 1);

  S_ROOM(shop, 0) = -1;
  CREATE(S_NAMELISTS(shop), struct shop_buy_data, 1);

  S_BUYTYPE(shop, 0) = -1;

  /*
   * Presto! A shop.
   */
  OLC_SHOP(d) = shop;
  sedit_disp_menu(d);
}
Exemplo n.º 3
0
void sedit_namelist_menu(struct descriptor_data *d)
{
  struct shop_data *shop;
  int i;

  shop = OLC_SHOP(d);
  get_char_colors(d->character);

  clear_screen(d);
  write_to_output(d, "##              Type   Namelist\r\n\r\n");
  for (i = 0; S_BUYTYPE(shop, i) != NOTHING; i++) {
    write_to_output(d, "%2d - %s%15s%s - %s%s%s\r\n", i, cyn,
		item_types[S_BUYTYPE(shop, i)], nrm, yel,
		S_BUYWORD(shop, i) ? S_BUYWORD(shop, i) : "<None>", nrm);
  }
  write_to_output(d, "\r\n"
	  "%sA%s) Add a new entry.\r\n"
	  "%sD%s) Delete an entry.\r\n"
	  "%sQ%s) Quit\r\n"
	  "Enter choice : ", grn, nrm, grn, nrm, grn, nrm);

  OLC_MODE(d) = SEDIT_NAMELIST_MENU;
}
Exemplo n.º 4
0
int save_shops(zone_rnum zone_num)
{
  int i, j, rshop, vzone, top;
  FILE *shop_file;
  char fname[64];
  struct shop_data *shop;

  if (zone_num < 0 || zone_num > top_of_zone_table) {
    log("SYSERR: GenOLC: save_mobiles: Invalid real zone number %d. (0-%d)", zone_num, top_of_zone_table);
    return FALSE;
  }

  vzone = zone_table[zone_num].number;
  top = zone_table[zone_num].top;

 
  sprintf(fname, "%s/%d.new", SHP_PREFIX, vzone);
  if (!(shop_file = fopen(fname, "w"))) {
    mudlog("SYSERR: OLC: Cannot open shop file!", BRF, LVL_GOD, TRUE);
    return FALSE;
  } else if (fprintf(shop_file, "CircleMUD v3.0 Shop File~\n") < 0) {
    mudlog("SYSERR: OLC: Cannot write to shop file!", BRF, LVL_GOD, TRUE);
    fclose(shop_file);
    return FALSE;
  }
  /*
   * Search database for shops in this zone.
   */
  for (i = vzone * 100; i <= top; i++) {
    if ((rshop = real_shop(i)) != -1) {
      fprintf(shop_file, "#%d~\n", i);
      shop = shop_index + rshop;

      /*
       * Save the products.
       */
      for (j = 0; S_PRODUCT(shop, j) != -1; j++)
	fprintf(shop_file, "%d\n", obj_index[S_PRODUCT(shop, j)].vnum);

      /*
       * Save the rates.
       */
      fprintf(shop_file, "-1\n%1.2f\n%1.2f\n", S_BUYPROFIT(shop), S_SELLPROFIT(shop));

      /*
       * Save the buy types and namelists.
       */
      j = -1;
      do {
	j++;
	fprintf(shop_file, "%d%s\n", S_BUYTYPE(shop, j),
		S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
      } while (S_BUYTYPE(shop, j) != -1);

      /*
       * Save messages'n'stuff.
       * Added some small'n'silly defaults as sanity checks.
       */
      fprintf(shop_file,
	      "%s~\n%s~\n%s~\n%s~\n%s~\n%s~\n%s~\n"
	      "%d\n%ld\n%d\n%d\n",
	      S_NOITEM1(shop) ? S_NOITEM1(shop) : "%s Ke?!",
	      S_NOITEM2(shop) ? S_NOITEM2(shop) : "%s Ke?!",
	      S_NOBUY(shop) ? S_NOBUY(shop) : "%s Ke?!",
	      S_NOCASH1(shop) ? S_NOCASH1(shop) : "%s Ke?!",
	      S_NOCASH2(shop) ? S_NOCASH2(shop) : "%s Ke?!",
	      S_BUY(shop) ? S_BUY(shop) : "%s Ke?! %d?",
	      S_SELL(shop) ? S_SELL(shop) : "%s Ke?! %d?",
	      S_BROKE_TEMPER(shop),
	      S_BITVECTOR(shop),
	      mob_index[S_KEEPER(shop)].vnum,
	      S_NOTRADE(shop)
	      );

      /*
       * Save the rooms.
       */
      j = -1;
      do {
	j++;
	fprintf(shop_file, "%d\n", S_ROOM(shop, j));
      } while (S_ROOM(shop, j) != -1);

      /*
       * Save open/closing times 
       */
      fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
		S_OPEN2(shop), S_CLOSE2(shop));
    }
  }
  fprintf(shop_file, "$~\n");
  fclose(shop_file);
  sprintf(buf2, "%s/%d.shp", SHP_PREFIX, vzone);
  remove(buf2);
  rename(fname, buf2);

  remove_from_save_list(vzone, SL_SHP);
  return TRUE;
}