[comp.sources.games] v02i078: umoria - single player dungeon simulation, Part13/16

games-request@tekred.TEK.COM (11/05/87)

Submitted by: "James E. Wilson" <wilson@ji.berkeley.edu>
Comp.sources.games: Volume 2, Issue 78
Archive-name: umoria/Part13




#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 13 (of 16)."
# Contents:  store2.c treasure2.c
# Wrapped by billr@tekred on Wed Nov  4 10:00:11 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f store2.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"store2.c\"
else
echo shar: Extracting \"store2.c\" \(24653 characters\)
sed "s/^X//" >store2.c <<'END_OF_store2.c'
X#include <stdio.h>
X#ifdef USG
X#include <string.h>
X#else
X#include <strings.h>
X#endif
X
X#include "constants.h"
X#include "types.h"
X#include "externs.h"
X
X#ifdef sun   /* correct SUN stupidity in the stdio.h file */
Xchar *sprintf();
X#endif
X
Xdouble chr_adj();
X
X/* Comments vary...					-RAK-	*/
X/* Comment one : Finished haggling				*/
Xprt_comment1()
X{
X  msg_flag = FALSE;
X  switch(randint(14))
X    {
X    case 1: msg_print("Done!"); break;
X    case 2: msg_print("Accepted!"); break;
X    case 3: msg_print("Fine..."); break;
X    case 4: msg_print("Agreed!"); break;
X    case 5: msg_print("Ok..."); break;
X    case 6: msg_print("Taken!"); break;
X    case 7: msg_print("You drive a hard bargain, but taken..."); break;
X    case 8: msg_print("You'll force me bankrupt, but it's a deal..."); break;
X    case 9: msg_print("Sigh...  I'll take it..."); break;
X    case 10: msg_print("My poor sick children may starve, but done!"); break;
X    case 11: msg_print("Finally!  I accept..."); break;
X    case 12: msg_print("Robbed again..."); break;
X    case 13: msg_print("A pleasure to do business with you!"); break;
X    case 14: msg_print("My spouse shall skin me, but accepted."); break;
X    }
X}
X
X
X/* %A1 is offer, %A2 is asking...		*/
Xprt_comment2(offer, asking, final)
Xint offer, asking, final;
X{
X  vtype comment;
X
X  if (final > 0) 
X    switch(randint(3))
X      {
X      case 1: 
X	(void) strcpy(comment,"%A2 is my final offer; take it or leave it...");
X	break;
X      case 2:
X	(void) strcpy(comment, "I'll give you no more than %A2.");
X	break;
X      case 3:
X	(void) strcpy(comment, "My patience grows thin...  %A2 is final.");
X	break;
X      }
X  else
X    switch(randint(16))
X      {
X      case 1:
X	(void) strcpy(comment,
X		      "%A1 for such a fine item?  HA!  No less than %A2.");
X	break;
X      case 2:
X	(void) strcpy(comment, "%A1 is an insult!  Try %A2 gold pieces...");
X	break;
X      case 3:
X	(void) strcpy(comment, 
X		      "%A1???  Thou would rob my poor starving children?");
X	break;
X      case 4:
X	(void) strcpy(comment, "Why I'll take no less than %A2 gold pieces.");
X	break;
X      case 5:
X	(void) strcpy(comment, "Ha!  No less than %A2 gold pieces.");
X	break;
X      case 6:
X	(void) strcpy(comment, 
X		      "Thou blackheart!  No less than %A2 gold pieces.");
X	break;
X      case 7:
X	(void) strcpy(comment, "%A1 is far too little, how about %A2?");
X	break;
X      case 8:
X	(void) strcpy(comment, "I paid more than %A1 for it myself, try %A2.");
X	break;
X      case 9:
X	(void) strcpy(comment, 
X		      "%A1?  Are you mad???  How about %A2 gold pieces?");
X	break;
X      case 10:
X	(void) strcpy(comment,
X		      "As scrap this would bring %A1.  Try %A2 in gold.");
X	break;
X      case 11: 
X	(void) strcpy(comment,
X		      "May fleas of a 1000 orcs molest you.  I want %A2.");
X	break;
X      case 12:
X	(void) strcpy(comment,
X		      "My mother you can get for %A1, this costs %A2.");
X	break;
X      case 13: 
X	(void) strcpy(comment,
X		      "May your chickens grow lips.  I want %A2 in gold!");
X	break;
X      case 14:
X	(void) strcpy(comment,
X		      "Sell this for such a pittance.  Give me %A2 gold.");
X	break;
X      case 15:
X	(void) strcpy(comment,
X		      "May the Balrog find you tasty!  %A2 gold pieces?");
X	break;
X      case 16:
X	(void) strcpy(comment,"Your mother was a Troll!  %A2 or I'll tell...");
X	break;
X      }
X  insert_num(comment, "%A1", offer, FALSE);
X  insert_num(comment, "%A2", asking, FALSE);
X  msg_print(comment);
X}
X
X
Xprt_comment3(offer, asking, final)
X     int offer, asking, final;
X{
X  vtype comment;
X
X  if (final > 0) 
X    switch(randint(3))
X      {
X      case 1:
X	(void) strcpy(comment,
X		      "I'll pay no more than %A1; take it or leave it.");
X	break;
X      case 2:
X	(void) strcpy(comment, "You'll get no more than %A1 from me...");
X	break;
X      case 3:
X	(void) strcpy(comment, "%A1 and that's final.");
X	break;
X      }
X  else
X    switch(randint(15))
X      {
X      case 1:
X	(void) strcpy(comment,"%A2 for that piece of junk?  No more than %A1");
X	break;
X      case 2:
X	(void) strcpy(comment, "For %A2 I could own ten of those.  Try %A1.");
X	break;
X      case 3:
X	(void) strcpy(comment, "%A2?  NEVER!  %A1 is more like it...");
X	break;
X      case 4:
X	(void) strcpy(comment,
X		      "Let's be reasonable... How about %A1 gold pieces?");
X	break;
X      case 5:
X	(void) strcpy(comment, "%A1 gold for that junk, no more...");
X	break;
X      case 6:
X	(void) strcpy(comment, "%A1 gold pieces and be thankful for it!");
X	break;
X      case 7:
X	(void) strcpy(comment, "%A1 gold pieces and not a copper more...");
X	break;
X      case 8:
X	(void) strcpy(comment, "%A2 gold?  HA!  %A1 is more like it...");
X	break;
X      case 9:
X	(void) strcpy(comment, "Try about %A1 gold...");
X	break;
X      case 10:
X	(void) strcpy(comment,
X		      "I wouldn't pay %A2 for your children, try %A1.");
X	break;
X      case 11:
X	(void) strcpy(comment, "*CHOKE* For that!?  Let's say %A1.");
X	break;
X      case 12:
X	(void) strcpy(comment, "How about %A1.");
X	break;
X      case 13:
X	(void) strcpy(comment, "That looks war surplus!  Say %A1 gold.");
X	break;
X      case 14:
X	(void) strcpy(comment, "I'll buy it as scrap for %A1.");
X	break;
X      case 15:
X	(void) strcpy(comment, "%A2 is too much, let us say %A1 gold.");
X	break;
X      }
X  insert_num(comment, "%A1", offer, FALSE);
X  insert_num(comment, "%A2", asking, FALSE);
X  msg_print(comment);
X}
X
X
X/* Kick 'da bum out...					-RAK-	*/
Xprt_comment4()
X{
X  msg_flag = FALSE;
X  switch(randint(5))
X    {
X    case 1:
X      msg_print("ENOUGH!  Thou hath abused me once too often!");
X      msg_print("Out of my place!");
X      msg_print(" ");
X      break;
X    case 2:
X      msg_print("THAT DOES IT!  You shall waste my time no more!");
X      msg_print("out... Out... OUT!!!");
X      msg_print(" ");
X      break;
X    case 3:
X      msg_print("This is getting no where...  I'm going home!");
X      msg_print("Come back tomorrow...");
X      msg_print(" ");
X      break;
X    case 4:
X      msg_print("BAH!  No more shall you insult me!");
X      msg_print("Leave my place...  Begone!");
X      msg_print(" ");
X      break;
X    case 5:
X      msg_print("Begone!  I have had enough abuse for one day.");
X      msg_print("Come back when thou art richer...");
X      msg_print(" ");
X      break;
X    }
X  msg_flag = FALSE;
X}
X
X
Xprt_comment5()
X{
X  switch(randint(10))
X    {
X    case 1: msg_print("You will have to do better than that!"); break;
X    case 2: msg_print("That's an insult!"); break;
X    case 3: msg_print("Do you wish to do business or not?"); break;
X    case 4: msg_print("Hah!  Try again..."); break;
X    case 5: msg_print("Ridiculous!"); break;
X    case 6: msg_print("You've got to be kidding!"); break;
X    case 7: msg_print("You better be kidding!!"); break;
X    case 8: msg_print("You try my patience."); break;
X    case 9: msg_print("I don't hear you."); break;
X    case 10: msg_print("Hmmm, nice weather we're having..."); break;
X    }
X}
X
X
Xprt_comment6()
X{
X  switch(randint(5))
X    {
X    case 1: msg_print("I must of heard you wrong..."); break;
X    case 2: msg_print("What was that?"); break;
X    case 3: msg_print("I'm sorry, say that again..."); break;
X    case 4: msg_print("What did you say?"); break;
X    case 5: msg_print("Sorry, what was that again?"); break;
X    }
X}
X
X
X/* Displays the set of commands				-RAK-	*/
Xdisplay_commands()
X{
X  prt("You may:", 20, 0);
X  prt(" p) Purchase an item.           b) Browse store's inventory.", 21, 0);
X  prt(" s) Sell an item.               i) Inventory and Equipment Lists.",
X      22, 0);
X  prt("ESC) Exit from Building.       ^R) Redraw the screen.", 23, 0);
X}
X
X
X/* Displays the set of commands				-RAK-	*/
Xhaggle_commands(typ)
Xint typ;
X{
X  if (typ == -1) 
X    prt("Specify an asking-price in gold pieces.", 21, 0);
X  else
X    prt("Specify an offer in gold pieces.", 21, 0);
X  prt("ESC) Quit Haggling.", 22, 0);
X  prt("", 23, 0);
X}
X
X
X/* Displays a store's inventory				-RAK-	*/
Xdisplay_inventory(store_num, start)
Xint store_num, start;
X{
X  int i, j, stop;
X  vtype out_val1, out_val2;
X  store_type *s_ptr;
X  treasure_type *i_ptr;
X
X  s_ptr = &store[store_num];
X  i = (start % 12);
X  stop = ((start / 12) + 1) * 12;
X  if (stop > s_ptr->store_ctr)  stop = s_ptr->store_ctr;
X  while (start < stop)
X    {
X      inventory[INVEN_MAX] = s_ptr->store_inven[start].sitem;
X      i_ptr = &inventory[INVEN_MAX];
X      if ((i_ptr->subval > 255) && (i_ptr->subval < 512)) 
X	i_ptr->number = 1;
X      objdes(out_val1, INVEN_MAX, TRUE);
X      (void) sprintf(out_val2, "%c) %s", 97+i, out_val1);
X      prt(out_val2, i+6, 0);
X      if (s_ptr->store_inven[start].scost <= 0) 
X	{
X	  j = abs(s_ptr->store_inven[start].scost);
X	  j += (j * chr_adj());
X	  if (j <= 0)
X	    j = 1;
X	  (void) sprintf(out_val2, "%9d", j);
X	}
X      else
X	(void) sprintf(out_val2,"%9d [Fixed]",s_ptr->store_inven[start].scost);
X      prt(out_val2, i+6, 59);
X      i++;
X      start++;
X    }
X  if (i < 12)
X    for (j = 0; j < (11 - i + 1); j++)
X      prt("", j+i+6, 0);
X}
X
X
X/* Re-displays only a single cost			-RAK-	*/
Xdisplay_cost(store_num, pos)
Xint store_num, pos;
X{
X  int i, j;
X  vtype out_val;
X  store_type *s_ptr;
X
X  s_ptr = &store[store_num];
X  i = (pos % 12);
X  if (s_ptr->store_inven[pos].scost < 0) 
X    {
X      j = abs(s_ptr->store_inven[pos].scost);
X      j += (j*chr_adj());
X      (void) sprintf(out_val, "%d", j);
X    }
X  else
X    (void) sprintf(out_val, "%9d [Fixed]", s_ptr->store_inven[pos].scost);
X  prt(out_val, i+6, 59);
X}
X
X
X/* Displays players gold					-RAK-	*/
Xstore_prt_gold()
X{
X  vtype out_val;
X
X  (void) sprintf(out_val, "Gold Remaining : %d", py.misc.au);
X  prt(out_val, 18, 17);
X}
X
X
X/* Displays store					-RAK-	*/
Xdisplay_store(store_num, cur_top)
Xint store_num, cur_top;
X{
X  store_type *s_ptr;
X
X  s_ptr = &store[store_num];
X  really_clear_screen();
X  prt(owners[s_ptr->owner].owner_name, 3, 9);
X  prt("   Item", 4, 0);
X  prt("Asking Price", 4, 60);
X  store_prt_gold();
X  display_commands();
X  display_inventory(store_num, cur_top);
X}
X
X
X/* Get the ID of a store item and return it's value	-RAK-	*/
Xint get_store_item(com_val, pmt, i, j)
Xint *com_val;
Xchar *pmt;
Xint i, j;
X{
X  char command;
X  vtype out_val;
X  int flag;
X
X  *com_val = -1;
X  flag = TRUE;
X  (void) sprintf(out_val, "(Items %c-%c, ESC to exit) %s", i+97, j+97, pmt);
X  while (((*com_val < i) || (*com_val > j)) && (flag))
X    {
X      prt(out_val, 0, 0);
X      inkey(&command);
X      *com_val = (command);
X      switch(*com_val)
X	{
X	case 0: case 27: flag = FALSE; break;
X	default: *com_val = *com_val - 97; break;
X	}
X    }
X  msg_flag = FALSE;
X  erase_line(msg_line, msg_line);
X  return(flag);
X}
X
X
X/* Increase the insult counter and get pissed if too many -RAK-	*/
Xint increase_insults(store_num)
Xint store_num;
X{
X  int increase;
X  store_type *s_ptr;
X
X  increase = FALSE;
X  s_ptr = &store[store_num];
X  s_ptr->insult_cur++;
X  if (s_ptr->insult_cur > owners[s_ptr->owner].insult_max) 
X    {
X      prt_comment4();
X      s_ptr->insult_cur = 0;
X      s_ptr->store_open = turn + 2500 + randint(2500);
X      increase = TRUE;
X    }
X  return(increase);
X}
X
X
X/* Decrease insults					-RAK-	*/
Xdecrease_insults(store_num)
Xint store_num;
X{
X  store_type *s_ptr;
X
X  s_ptr = &store[store_num];
X  s_ptr->insult_cur -= 2;
X  if (s_ptr->insult_cur < 0)  s_ptr->insult_cur = 0;
X}
X
X
X/* Have insulted while haggling				-RAK-	*/
Xint haggle_insults(store_num)
Xint store_num;
X{
X  int haggle;
X
X  haggle = FALSE;
X  if (increase_insults(store_num)) 
X    haggle = TRUE;
X  else
X    prt_comment5();
X  return(haggle);
X}
X
X
Xint get_haggle(comment, num)
Xchar *comment;
Xint *num;
X{
X  int i, clen;
X  vtype out_val;
X  int flag;
X
X  flag = TRUE;
X  i = 0;
X  clen = strlen(comment);
X  do
X    {
X      msg_print(comment);
X      msg_flag = FALSE;
X      if (!get_string(out_val, 0, clen, 40)) 
X	{
X	  flag = FALSE;
X	  erase_line(msg_line, msg_line);
X	}
X      (void) sscanf(out_val, "%d", &i);
X    }
X  while ((i <= 0) && (flag));
X  if (flag)  *num = i;
X  return(flag);
X}
X
X
Xint receive_offer(store_num, comment, new_offer, last_offer, factor)
Xint store_num;
Xchar *comment;
Xint *new_offer;
Xint last_offer, factor;
X{
X  int flag;
X  int receive;
X
X  receive = 0;
X  flag = FALSE;
X  do
X    {
X      if (get_haggle(comment, new_offer)) 
X	{
X	  if (*new_offer*factor >= last_offer*factor)  
X	    flag = TRUE;
X	  else if (haggle_insults(store_num)) 
X	    {
X	      receive = 2;
X	      flag = TRUE;
X	    }
X	}
X      else
X	{
X	  receive = 1;
X	  flag = TRUE;
X	}
X    }
X  while (!flag);
X  return(receive);
X}
X
X
X/* Haggling routine					-RAK-	*/
Xint purchase_haggle(store_num, price, item)
Xint store_num;
Xint *price;
Xtreasure_type item;
X{
X  int max_sell, min_sell, max_buy;
X  int cost, cur_ask, final_ask, min_offer;
X  int last_offer, new_offer, final_flag, x3;
X  double x1, x2;
X  double min_per, max_per;
X  int flag, loop_flag;
X  vtype out_val, comment;
X  int purchase;
X  store_type *s_ptr;
X  owner_type *o_ptr;
X
X  flag = FALSE;
X  purchase = 0;
X  *price = 0;
X  final_flag = 0;
X  msg_flag = FALSE;
X  s_ptr = &store[store_num];
X  o_ptr = &owners[s_ptr->owner];
X  cost = sell_price(store_num, &max_sell, &min_sell, item);
X  max_sell = max_sell + (max_sell*chr_adj());
X  if (max_sell <= 0)  max_sell = 1;
X  min_sell = min_sell + (min_sell*chr_adj());
X  if (min_sell <= 0)  min_sell = 1;
X  max_buy  = (cost*(1-o_ptr->max_inflate));
X  min_per  = o_ptr->haggle_per;
X  max_per  = min_per*3.0;
X  haggle_commands(1);
X  cur_ask   = max_sell;
X  final_ask = min_sell;
X  min_offer = max_buy;
X  last_offer = min_offer;
X  (void) strcpy(comment, "Asking : ");
X  do
X    {
X      do
X	{
X	  loop_flag = TRUE;
X	  (void) sprintf(out_val, "%s %d", comment, cur_ask);
X	  put_buffer(out_val, 1, 0);
X	  switch(receive_offer(store_num, "What do you offer? ", 
X			     &new_offer, last_offer, 1))
X	    {
X	    case 1:
X	      purchase = 1;
X	      flag   = TRUE;
X	      break;
X	    case 2:
X	      purchase = 2;
X	      flag   = TRUE;
X	      break;
X	    default:
X	      if (new_offer > cur_ask) 
X		{
X		  prt_comment6();
X		}
X	      else if (new_offer == cur_ask) 
X		{
X		  flag = TRUE;
X		  *price = new_offer;
X		}
X	      else
X		loop_flag = FALSE;
X	    }
X	}
X      while (!flag && loop_flag);
X      if (!flag) 
X	{
X	  x1 = (double)(new_offer - last_offer)/(double)(cur_ask - last_offer);
X	  if (x1 < min_per) 
X	    {
X	      flag = haggle_insults(store_num);
X	      if (flag)  purchase = 2;
X	    }
X	  else
X	    {
X	      if (x1 > max_per)  
X		{
X		  x1 = x1*0.75;
X		  if (x1 < max_per)  x1 = max_per;
X		}
X	    }
X	  x2 = (x1 + (randint(5) - 3)/100.0);
X	  x3 = ((cur_ask-new_offer)*x2) + 1;
X	  cur_ask -= x3;
X	  if (cur_ask < final_ask) 
X	    {
X	      cur_ask = final_ask;
X	      (void) strcpy(comment, "Final Offer : ");
X	      final_flag++;
X	      if (final_flag > 3) 
X		{
X		  if (increase_insults(store_num)) 
X		    purchase = 2;
X		  else
X		    purchase = 1;
X		  flag = TRUE;
X		}
X	    }
X	  else if (new_offer >= cur_ask) 
X	    {
X	      flag = TRUE;
X	      *price = new_offer;
X	    }
X	  if (!flag) 
X	    {
X	      last_offer = new_offer;
X	      prt("", 1, 0);
X	      (void) sprintf(out_val, "Your last offer : %d", last_offer);
X	      put_buffer(out_val, 1, 39);
X	      prt_comment2(last_offer, cur_ask, final_flag);
X	    }
X	}
X    }
X  while (!flag);
X  prt("", 1, 0);
X  display_commands();
X  return(purchase);
X}
X
X
X/* Haggling routine					-RAK-	*/
Xint sell_haggle(store_num, price, item)
Xint store_num;
Xint *price;
Xtreasure_type item;
X{
X  int max_sell, max_buy, min_buy;
X  int cost, cur_ask, final_ask, min_offer;
X  int last_offer, new_offer, final_flag, x3;
X  int max_gold;
X  double x1, x2;
X  double min_per, max_per;
X  int flag, loop_flag;
X  vtype comment, out_val;
X  store_type *s_ptr;
X  owner_type *o_ptr;
X  int sell;
X
X  flag = FALSE;
X  sell = 0;
X  *price = 0;
X  final_flag = 0;
X  msg_flag = FALSE;
X  s_ptr = &store[store_num];
X  cost = item_value(item);
X  if (cost < 1) 
X    {
X      sell = 3;
X      flag = TRUE;
X    }
X  else
X    {
X      o_ptr = &owners[s_ptr->owner];
X      cost += -(cost*chr_adj()) -
X	       (cost*rgold_adj[o_ptr->owner_race][py.misc.prace]);
X      if (cost < 1)  cost = 1;
X      max_sell = (cost*(1+o_ptr->max_inflate));
X      max_buy  = (cost*(1-o_ptr->max_inflate));
X      min_buy  = (cost*(1-o_ptr->min_inflate));
X      if (min_buy < 1) min_buy = 1;
X      if (max_buy < 1) max_buy = 1;
X      if (min_buy < max_buy)  min_buy = max_buy;
X      min_per  = o_ptr->haggle_per;
X      max_per  = min_per*3.0;
X      max_gold = o_ptr->max_cost;
X    }
X  if (!flag) 
X    {
X      haggle_commands(-1);
X      if (max_buy > max_gold) 
X	{
X	  final_flag= 1;
X	  (void) strcpy(comment, "Final offer : ");
X	  cur_ask   = max_gold;
X	  final_ask = max_gold;
X msg_print("I am sorry, but I have not the money to afford such a fine item.");
X	  msg_print(" ");
X	}
X      else
X	{
X	  cur_ask   = max_buy;
X	  final_ask = min_buy;
X	  if (final_ask > max_gold) 
X	    final_ask = max_gold;
X	  (void) strcpy(comment, "Offer : ");
X	}
X      min_offer = max_sell;
X      last_offer = min_offer;
X      if (cur_ask < 1)  cur_ask = 1;
X      do
X	{
X	  do
X	    {
X	      loop_flag = TRUE;
X	      (void) sprintf(out_val, "%s %d", comment, cur_ask);
X	      put_buffer(out_val, 1, 0);
X	      switch(receive_offer(store_num, "What price do you ask? ", 
X				 &new_offer, last_offer, -1))
X		{
X		case 1:
X		  sell = 1;
X		  flag   = TRUE;
X		  break;
X		case 2:
X		  sell = 2;
X		  flag   = TRUE;
X		  break;
X		default:
X		  if (new_offer < cur_ask) 
X		    {
X		      prt_comment6();
X		    }
X		  else if (new_offer == cur_ask) 
X		    {
X		      flag = TRUE;
X		      *price = new_offer;
X		    }
X		  else
X		    loop_flag = FALSE;
X	        }
X	    }
X	  while (!flag && loop_flag);
X	  if (!flag) 
X	    {
X	      msg_flag = FALSE;
X	      x1 = (double)(last_offer - new_offer)/
X		(double)(last_offer - cur_ask);
X	      if (x1 < min_per) 
X		{
X		  flag = haggle_insults(store_num);
X		  if (flag)  sell = 2;
X		}
X	      else
X		{
X		  if (x1 > max_per)  
X		    {
X		      x1 *= 0.75;
X		      if (x1 < max_per)  x1 = max_per;
X		    }
X		}
X	      x2 = (x1 + (randint(5) - 3)/100.0);
X	      x3 = ((new_offer-cur_ask)*x2) + 1;
X	      cur_ask += x3;
X	      if (cur_ask > final_ask) 
X		{
X		  cur_ask = final_ask;
X		  (void) strcpy(comment, "Final Offer : ");
X		  final_flag++;
X		  if (final_flag > 3) 
X		    {
X		      if (increase_insults(store_num)) 
X			sell = 2;
X		      else
X			sell = 1;
X		      flag = TRUE;
X		    }
X		}
X	      else if (new_offer <= cur_ask) 
X		{
X		  flag = TRUE;
X		  *price = new_offer;
X		}
X	      if (!flag) 
X		{
X		  last_offer = new_offer;
X		  prt("", 1, 0);
X		  (void) sprintf(out_val, "Your last bid %d", last_offer);
X		  put_buffer(out_val, 1, 39);
X		  prt_comment3(cur_ask, last_offer, final_flag);
X		}
X	    }
X	}
X      while (!flag);
X      prt("", 1, 0);
X      display_commands();
X    }
X  return(sell);
X}
X
X
X/* Buy an item from a store				-RAK-	*/
Xint store_purchase(store_num, cur_top)
Xint store_num;
Xint *cur_top;
X{
X  int i, item_val, price;
X  int item_new, choice;
X  int save_number;
X  vtype out_val, tmp_str;
X  store_type *s_ptr;
X  treasure_type *i_ptr;
X  inven_record *r_ptr;
X  int purchase;
X  
X  purchase = FALSE;
X  s_ptr = &store[store_num];
X  /* i == number of objects shown on screen	*/
X  if (*cur_top == 12) 
X    i = s_ptr->store_ctr - 1 - 12;
X  else if (s_ptr->store_ctr > 11) 
X    i = 12;
X  else
X    i = s_ptr->store_ctr - 1;
X  if (s_ptr->store_ctr < 1) 
X    msg_print("I am currently out of stock.");
X      /* Get the item number to be bought		*/
X  else if (get_store_item(&item_val, 
X			  "Which item are you interested in? ", 0, i)) 
X    {
X      item_val = item_val + *cur_top;	/* TRUE item_val	*/
X      inventory[INVEN_MAX] = s_ptr->store_inven[item_val].sitem;
X      i_ptr = &inventory[INVEN_MAX];
X      if ((i_ptr->subval > 255) && (i_ptr->subval < 512)) 
X	{
X	  save_number = i_ptr->number;
X	  i_ptr->number = 1;
X	}
X      else
X	save_number = 1;
X      if (inven_check_weight()) 
X	if (inven_check_num()) 
X	  {
X	    if (s_ptr->store_inven[item_val].scost > 0) 
X	      {
X		price = s_ptr->store_inven[item_val].scost;
X		choice = 0;
X	      }
X	    else
X	      choice = purchase_haggle(store_num, &price,
X				       inventory[INVEN_MAX]);
X	    switch(choice)
X	      {
X	      case 0:
X		if (py.misc.au >= price) 
X		  {
X		    prt_comment1();
X		    decrease_insults(store_num);
X		    py.misc.au -= price;
X		    store_destroy(store_num, item_val, TRUE);
X		    inven_carry(&item_new);
X		    objdes(tmp_str, item_new, TRUE);
X		    (void) sprintf(out_val, "You have %s (%c)",
X				   tmp_str, item_new+97);
X		    msg_print(out_val);
X		    if (*cur_top >= s_ptr->store_ctr) 
X		      {
X			*cur_top = 0;
X			display_inventory(store_num, *cur_top);
X		      }
X		    else
X		      {
X			r_ptr = &s_ptr->store_inven[item_val];
X			if (save_number > 1) 
X			  {
X			    if (r_ptr->scost < 0) 
X			      {
X				r_ptr->scost = price;
X				display_cost(store_num, item_val);
X			      }
X			  }
X			else
X			  display_inventory(store_num, item_val);
X			store_prt_gold();
X		      }
X		  }
X		else
X		  {
X		    if (increase_insults(store_num)) 
X		      purchase = TRUE;
X		    else
X		      {
X			prt_comment1();
X			msg_print("Liar!  You have not the gold!");
X		      }
X		  }
X		break;
X	      case 2:
X		purchase = TRUE;
X		break;
X	      default:
X		break;
X	      }
X	    prt("", 1, 0);
X	  }
X	else
X	  prt("You cannot carry that many different items.", 0, 0);
X      else
X	prt("You can not carry that much weight.", 0, 0);
X    }
X  return(purchase);
X}
X
X
X/* Sell an item to the store				-RAK-	*/
Xint store_sell(store_num, cur_top)
Xint store_num, cur_top;
X{
X  int item_val;
X  int item_pos, price;
X  int redraw;
X  vtype out_val, tmp_str;
X  treasure_type *i_ptr;
X  int sell;
X
X  sell = FALSE;
X  redraw = FALSE;
X  if (get_item(&item_val, "Which one? ", &redraw, 0, inven_ctr-1)) 
X    {
X      if (redraw)  display_store(store_num, cur_top);
X      inventory[INVEN_MAX] = inventory[item_val];
X      i_ptr = &inventory[INVEN_MAX];
X      if ((i_ptr->subval > 255) && (i_ptr->subval < 512)) 
X	i_ptr->number = 1;
X      objdes(tmp_str, INVEN_MAX, TRUE);
X      (void) sprintf(out_val, "Selling %s (%c)", tmp_str, item_val+97);
X      msg_print(out_val);
X      msg_print(" ");
X      if ((store_buy[store_num])(inventory[INVEN_MAX].tval))
X	if (store_check_num(store_num)) 
X	  switch(sell_haggle(store_num, &price, inventory[INVEN_MAX]))
X	    {
X	    case 0:
X	      prt_comment1();
X	      py.misc.au += price;
X	      inven_destroy(item_val);
X	      store_carry(store_num, &item_pos);
X	      if (item_pos >= 0) 
X		if (item_pos < 12) 
X		  if (cur_top < 12) 
X		    display_inventory(store_num, item_pos);
X		  else
X		    display_inventory(store_num, cur_top);
X		else if (cur_top > 11) 
X		  display_inventory(store_num, item_pos);
X	      store_prt_gold();
X	      break;
X	    case 2:
X	      sell = TRUE;
X	      break;
X	    case 3:
X	      msg_print("How dare you!");
X	      msg_print("I will not buy that!");
X	      sell = increase_insults(store_num);
X	      break;
X	    default:
X	      break;
X	    }
X	else
X	  prt("I have not the room in my store to keep it...", 0, 0);
X      else
X	prt("I do not buy such items.", 0, 0);
X    }
X  else if (redraw) 
X    display_store(store_num, cur_top);
X  return(sell);
X}
X
X
X/* Entering a store					-RAK-	*/
Xenter_store(store_num)
Xint store_num;
X{
X  int com_val, cur_top;
X  char command;
X  int exit_flag;
X  store_type *s_ptr;
X
X  s_ptr = &store[store_num];
X  if (s_ptr->store_open < turn) 
X    {
X      exit_flag = FALSE;
X      cur_top = 0;
X      display_store(store_num, cur_top);
X      do
X	{
X	  if (get_com("", &command)) 
X	    {
X	      msg_flag = FALSE;
X	      com_val = (command);
X	      switch(com_val)
X		{
X		case 18:
X		  display_store(store_num, cur_top);
X		  break;
X		case 98:
X		  if (cur_top == 0) 
X		    if (s_ptr->store_ctr > 12) 
X		      {
X			cur_top = 12;
X			display_inventory(store_num, cur_top);
X		      }
X		    else
X		      prt("Entire inventory is shown.", 0, 0);
X		  else
X		    {
X		      cur_top = 0;
X		      display_inventory(store_num, cur_top);
X		    }
X		  break;
X		case 101:      /* Equipment List	*/
X		  if (inven_command('e', 0, 0)) 
X		    display_store(store_num, cur_top);
X		  break;
X		case 105:      /* Inventory		*/
X		  if (inven_command('i', 0, 0)) 
X		    display_store(store_num, cur_top);
X		  break;
X		case 116:      /* Take off		*/
X		  if (inven_command('t', 0, 0)) 
X		    display_store(store_num, cur_top);
X		  break;
X		case 119:	/* Wear			*/
X		  if (inven_command('w', 0, 0)) 
X		    display_store(store_num, cur_top);
X		  break;
X		case 120:     /* Switch weapon		*/
X		  if (inven_command('x', 0, 0)) 
X		    display_store(store_num, cur_top);
X		  break;
X		case 112:
X		  exit_flag = store_purchase(store_num, &cur_top);
X		  break;
X		case 115:
X		  exit_flag = store_sell(store_num, cur_top);
X		  break;
X		default:
X		  prt("Invalid Command.", 0, 0);
X		  break;
X		}
X	    }
X	  else
X	    exit_flag = TRUE;
X	}
X      while (!exit_flag);
X      draw_cave();
X    }
X  else
X    msg_print("The doors are locked.");
X}
END_OF_store2.c
if test 24653 -ne `wc -c <store2.c`; then
    echo shar: \"store2.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f treasure2.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"treasure2.c\"
else
echo shar: Extracting \"treasure2.c\" \(28020 characters\)
sed "s/^X//" >treasure2.c <<'END_OF_treasure2.c'
X#include "constants.h"
X#include "types.h"
X
X/* Identified objects flags					*/
Xint object_ident[MAX_OBJECTS] = {
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
X  FALSE, FALSE, FALSE, FALSE
X};
X
Xint t_level[MAX_OBJ_LEVEL];
X
X/* Gold list (All types of gold and gems are defined here)	*/
Xtreasure_type gold_list[MAX_GOLD] = {
X{"copper"                                          , 100, '$',0x00000000,
X    0,      3,   1,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"copper"                                          , 100, '$',0x00000000,
X    0,      4,   2,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"copper"                                          , 100, '$',0x00000000,
X    0,      5,   3,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"silver"                                          , 100, '$',0x00000000,
X    0,      6,   4,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"silver"                                          , 100, '$',0x00000000,
X    0,      7,   5,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"silver"                                          , 100, '$',0x00000000,
X    0,      8,   6,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"garnets"                                         , 100, '*',0x00000000,
X    0,      9,   7,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"garnets"                                         , 100, '*',0x00000000,
X    0,     10,   8,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"gold"                                            , 100, '$',0x00000000,
X    0,     12,   9,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"gold"                                            , 100, '$',0x00000000,
X    0,     14,  10,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"gold"                                            , 100, '$',0x00000000,
X    0,     16,  11,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"opals"                                           , 100, '*',0x00000000,
X    0,     18,  12,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"sapphires"                                        , 100, '*',0x00000000,
X    0,     20,  13,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"gold"                                            , 100, '$',0x00000000,
X    0,     24,  14,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"rubies"                                          , 100, '*',0x00000000,
X    0,     28,  15,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"diamonds"                                        , 100, '*',0x00000000,
X    0,     32,  16,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"emeralds"                                        , 100, '*',0x00000000,
X    0,     40,  17,   0,   0,   0,   0,   0,   0, ' '    ,  1},
X{"mithril"                                         , 100, '$',0x00000000,
X    0,     80,  18,   0,   0,   0,   0,   0,   0, ' '    ,  1}
X};
X
Xtreasure_type t_list[MAX_TALLOC];
Xtreasure_type inventory[INVEN_ARRAY_SIZE];
X
X/* Items which are sold in the stores are different from dungeon */
X/* items so that identify works properly.  Note that the players */
X/* receive their initial items from this list, so position is    */
X/* very important...                                             */
Xtreasure_type inventory_init[INVEN_INIT_MAX] = {
X{"& Ration~ of Food"                               ,  80, ',',0x00000000,
X 5000,      3, 307,  10,   5,   0,   0,   0,   0, "0d0"  ,  0}, /*  1*/
X{"& Hard Biscuit~"                                 ,  80, ',',0x00000000,
X  500,      1, 309,   2,   5,   0,   0,   0,   0, "0d0"  ,  0}, /*  2*/
X{"& Strip~ of Beef Jerky"                          ,  80, ',',0x00000000,
X 1750,      2, 310,   2,   5,   0,   0,   0,   0, "0d0"  ,  0}, /*  3*/
X{"& Pint of Fine Ale"                              ,  80, ',',0x00000000,
X  500,      1, 311,  10,   3,   0,   0,   0,   0, "0d0"  ,  0}, /*  4*/
X{"& Pint of Fine Wine"                             ,  80, ',',0x00000000,
X  400,      2, 312,  10,   1,   0,   0,   0,   0, "0d0"  ,  0}, /*  5*/
X{"& Dagger (Misercorde) (%P2,%P3)"                 ,  23, '|',0x00000000,
X    0,     10,   2,  15,   1,   0,   0,   0,   0, "1d4"  ,  0}, /*  6*/
X{"& Dagger (Stiletto) (%P2,%P3)"                   ,  23, '|',0x00000000,
X    0,     10,   3,  12,   1,   0,   0,   0,   0, "1d4"  ,  0}, /*  7*/
X{"& Bastard Sword (%P2,%P3)"                       ,  23, '|',0x00000000,
X    0,    350,   7, 140,   1,   0,   0,   0,   0, "3d4"  ,  0}, /*  8*/
X{"& Broadsword (%P2,%P3)"                          ,  23, '|',0x00000000,
X    0,    255,  10, 150,   1,   0,   0,   0,   0, "2d5"  ,  0}, /*  9*/
X{"& Longsword (%P2,%P3)"                           ,  23, '|',0x00000000,
X    0,    300,  18, 130,   1,   0,   0,   0,   0, "1d10" ,  0}, /* 10*/
X{"& Small Sword (%P2,%P3)"                         ,  23, '|',0x00000000,
X    0,     48,  22,  75,   1,   0,   0,   0,   0, "1d6"  ,  0}, /* 11*/
X{"& Broad Axe (%P2,%P3)"                           ,  21, '\\',0x00000000,
X    0,    304,   4, 160,   1,   0,   0,   0,   0, "2d5"  ,  0}, /* 12*/
X{"& Morningstar (%P2,%P3)"                         ,  21, '\\',0x00000000,
X    0,    396,   9, 150,   1,   0,   0,   0,   0, "2d6"  ,  0}, /* 13*/
X{"& Mace (%P2,%P3)"                                ,  21, '\\',0x00000000,
X    0,    130,  10, 120,   1,   0,   0,   0,   0, "2d4"  ,  0}, /* 14*/
X{"& War Hammer (%P2,%P3)"                          ,  21, '\\',0x00000000,
X    0,    225,  11, 120,   1,   0,   0,   0,   0, "3d3"  ,  0}, /* 15*/
X{"& Halberd (%P2,%P3)"                             ,  22, '/',0x00000000,
X    0,    430,   5, 190,   1,   0,   0,   0,   0, "3d4"  ,  0}, /* 16*/
X{"& Pike (%P2,%P3)"                                ,  22, '/',0x00000000,
X    0,    358,   7, 160,   1,   0,   0,   0,   0, "2d5"  ,  0}, /* 17*/
X{"& Spear (%P2,%P3)"                               ,  22, '/',0x00000000,
X    0,     36,   8,  50,   1,   0,   0,   0,   0, "1d6"  ,  0}, /* 18*/
X{"& Short Bow (%P2)"                               ,  20, '}',0x00000000,
X    2,     50,   1,  30,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 19*/
X{"& Long Bow (%P2)"                                ,  20, '}',0x00000000,
X    3,    120,   2,  40,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 20*/
X{"& Light Crossbow (%P2)"                          ,  20, '}',0x00000000,
X    5,    160,  10, 110,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 21*/
X{"& Sling (%P2)"                                   ,  20, '}',0x00000000,
X    1,      5,  20,   5,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 22*/
X{"& Arrow~ (%P2,%P3)"                              ,  12, '{',0x00000000,
X    0,      1,   1,   2,   1,   0,   0,   0,   0, "1d4"  ,  0}, /* 23*/
X{"& Bolt~ (%P2,%P3)"                               ,  11, '{',0x00000000,
X    0,      2,   1,   3,   1,   0,   0,   0,   0, "1d5"  ,  0}, /* 24*/
X{"& Iron Shot~ (%P2,%P3)"                          ,  10, '{',0x00000000,
X    0,      2,   1,   5,   1,   0,   0,   0,   0, "1d3"  ,  0}, /* 25*/
X{"& Pick (%P1) (%P2,%P3)"                          ,  25, '\\',0x20000000,
X    1,     50,   1, 150,   1,   0,   0,   0,   0, "1d3"  ,  0}, /* 26*/
X{"& Shovel (%P1) (%P2,%P3)"                        ,  25, '\\',0x20000000,
X    0,     15,   2,  60,   1,   0,   0,   0,   0, "1d2"  ,  0}, /* 27*/
X{"& Pair of Soft Leather Boots [%P6,%P4]"          ,  30, ']',0x00000000,
X    0,      7,   2,  30,   1,   0,   0,   2,   0, "1d1"  ,  0}, /* 28*/
X{"& Pair of Hard Leather Boots [%P6,%P4]"          ,  30, ']',0x00000000,
X    0,     12,   3,  40,   1,   0,   0,   3,   0, "1d1"  ,  0}, /* 29*/
X{"& Hard Leather Cap [%P6,%P4]"                    ,  33, ']',0x00000000,
X    0,     12,   2,  15,   1,   0,   0,   2,   0, "0d0"  ,  0}, /* 30*/
X{"& Metal Cap [%P6,%P4]"                           ,  33, ']',0x00000000,
X    0,     30,   3,  20,   1,   0,   0,   3,   0, "1d1"  ,  0}, /* 31*/
X{"& Iron Helm [%P6,%P4]"                           ,  33, ']',0x00000000,
X    0,     75,   4,  75,   1,   0,   0,   5,   0, "1d3"  ,  0}, /* 32*/
X{"Soft Leather Armor [%P6,%P4]"                    ,  36, '(',0x00000000,
X    0,     18,   2,  80,   1,   0,   0,   4,   0, "0d0"  ,  0}, /* 33*/
X{"Soft Studded Leather [%P6,%P4]"                  ,  36, '(',0x00000000,
X    0,     35,   3,  90,   1,   0,   0,   5,   0, "1d1"  ,  0}, /* 34*/
X{"Hard Leather Armor [%P6,%P4]"                    ,  36, '(',0x00000000,
X    0,     55,   4, 100,   1,  -1,   0,   6,   0, "1d1"  ,  0}, /* 35*/
X{"Hard Studded Leather [%P6,%P4]"                  ,  36, '(',0x00000000,
X    0,    100,   5, 110,   1,  -1,   0,   7,   0, "1d2"  ,  0}, /* 36*/
X{"Leather Scale Mail [%P6,%P4]"                    ,  36, '(',0x00000000,
X    0,    330,   9, 140,   1,  -1,   0,  11,   0, "1d1"  ,  0}, /* 37*/
X{"Metal Scale Mail [%P6,%P4]"                      ,  35, '[',0x00000000,
X    0,    430,   1, 250,   1,  -2,   0,  13,   0, "1d4"  ,  0}, /* 38*/
X{"Chain Mail [%P6,%P4]"                            ,  35, '[',0x00000000,
X    0,    530,   2, 220,   1,  -2,   0,  14,   0, "1d4"  ,  0}, /* 39*/
X{"Partial Plate Armor [%P6,%P4]"                   ,  35, '[',0x00000000,
X    0,    900,   9, 260,   1,  -3,   0,  22,   0, "1d6"  ,  0}, /* 40*/
X{"Full Plate Armor [%P6,%P4]"                      ,  35, '[',0x00000000,
X    0,   1050,  11, 380,   1,  -3,   0,  25,   0, "2d4"  ,  0}, /* 41*/
X{"& Cloak [%P6,%P4]"                               ,  32, '(',0x00000000,
X    0,      3,   1,  10,   1,   0,   0,   1,   0, "0d0"  ,  0}, /* 42*/
X{"& Set of Leather Gloves [%P6,%P4]"               ,  31, ']',0x00000000,
X    0,      3,   1,   5,   1,   0,   0,   1,   0, "0d0"  ,  0}, /* 43*/
X{"& Set of Gauntlets [%P6,%P4]"                    ,  31, ']',0x00000000,
X    0,     35,   2,  25,   1,   0,   0,   2,   0, "1d1"  ,  0}, /* 44*/
X{"& Small Leather Shield [%P6,%P4]"                ,  34, ')',0x00000000,
X    0,     30,   1,  50,   1,   0,   0,   2,   0, "1d1"  ,  0}, /* 45*/
X{"& Medium Leather Shield [%P6,%P4]"               ,  34, ')',0x00000000,
X    0,     60,   2,  75,   1,   0,   0,   3,   0, "1d2"  ,  0}, /* 46*/
X{"& Small Metal Shield [%P6,%P4]"                  ,  34, ')',0x00000000,
X    0,     50,   4,  65,   1,   0,   0,   3,   0, "1d3"  ,  0}, /* 47*/
X{"& Ring of Resist Fire"                           ,  45, '=',0x00080000,
X    0,    250,  11,   2,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 48*/
X{"& Ring of Resist Cold"                           ,  45, '=',0x00200000,
X    0,    250,  12,   2,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 49*/
X{"& Ring of Feather Falling"                       ,  45, '=',0x04000000,
X    0,    250,  13,   2,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 50*/
X{"& Ring of Protection [%P4]"                      ,  45, '=',0x00000000,
X    0,    100,  24,   2,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 51*/
X{"& Amulet of Charisma (%P1)"                      ,  40, '"',0x00000020,
X    0,    250,   6,   3,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 52*/
X{"& Amulet of Slow Digestion"                      ,  40, '"',0x00000080,
X    0,    200,   9,   3,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 53*/
X{"& Amulet of Resist Acid"                         ,  40, '"',0x00100000,
X    0,    300,  10,   3,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 54*/
X{"& Scroll~ of Enchant Weapon To-Hit"              ,  70, '?',0x00000001,
X    0,    125, 300,   5,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 55*/
X{"& Scroll~ of Enchant Weapon To-Dam"              ,  70, '?',0x00000002,
X    0,    125, 301,   5,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 56*/
X{"& Scroll~ of Enchant Armor"                      ,  70, '?',0x00000004,
X    0,    125, 302,   5,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 57*/
X{"& Scroll~ of Identify"                           ,  70, '?',0x00000008,
X    0,     50, 303,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 58*/
X{"& Scroll~ of Remove Curse"                       ,  70, '?',0x00000010,
X    0,    100, 304,   5,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 59*/
X{"& Scroll~ of Light"                              ,  70, '?',0x00000020,
X    0,     15, 305,   5,   3,   0,   0,   0,   0, "0d0"  ,  0}, /* 60*/
X{"& Scroll~ of Phase Door"                         ,  70, '?',0x00000080,
X    0,     15, 306,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 61*/
X{"& Scroll~ of Magic Mapping"                      ,  70, '?',0x00000800,
X    0,     40, 307,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 62*/
X{"& Scroll~ of Treasure Detection"                 ,  70, '?',0x00004000,
X    0,     15, 308,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 63*/
X{"& Scroll~ of Object Detection"                   ,  70, '?',0x00008000,
X    0,     15, 309,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 64*/
X{"& Scroll~ of Detect Invisible"                   ,  70, '?',0x00080000,
X    0,     15, 310,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 65*/
X{"& Scroll~ of Recharging"                         ,  70, '?',0x01000000,
X    0,    200, 311,   5,   1,   0,   0,   0,   0, "0d0"  ,  0}, /* 66*/
X{"& Book of Magic Spells [Beginners-Magik]"        ,  90, '?',0x0000007F,
X    0,     25, 257,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 67*/
X{"& Book of Magic Spells [Magik I]"                ,  90, '?',0x0000FF80,
X    0,    100, 258,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 68*/
X{"& Book of Magic Spells [Magik II]"               ,  90, '?',0x00FF0000,
X    0,    400, 259,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 69*/
X{"& Book of Magic Spells [The Mages Guide to Power]",  90, '?',0x7F000000,
X    0,    800, 261,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 70*/
X{"& Holy Book of Prayers [Beginners Handbook]"     ,  91, '?',0x000000FF,
X    0,     25, 258,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 71*/
X{"& Holy Book of Prayers [Words of Wisdom]"        ,  91, '?',0x0000FF00,
X    0,    100, 259,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 72*/
X{"& Holy Book of Prayers [Chants and Blessings]"   ,  91, '?',0x01FF0000,
X    0,    300, 260,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 73*/
X{"& Holy Book of Prayers [Exorcism and Dispelling]",  91, '?',0x7E000000,
X    0,    900, 261,  30,   1,-100,   0,   0,   0, "1d1"  ,  0}, /* 74*/
X{"& Potion~ of Restore Strength"                   ,  75, '!',0x00000004,
X    0,    300, 310,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 75*/
X{"& Potion~ of Restore Intelligence"               ,  75, '!',0x00000020,
X    0,    300, 311,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 76*/
X{"& Potion~ of Restore Wisdom"                     ,  75, '!',0x00000100,
X    0,    300, 312,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 77*/
X{"& Potion~ of Restore Charisma"                   ,  75, '!',0x00000800,
X    0,    300, 313,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 78*/
X{"& Potion~ of Cure Light Wounds"                  ,  75, '!',0x10001000,
X   50,     15, 314,   4,   2,   0,   0,   0,   0, "1d1"  ,  0}, /* 79*/
X{"& Potion~ of Cure Serious Wounds"                ,  75, '!',0x30002000,
X  100,     40, 315,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 80*/
X{"& Potion~ of Cure Critical Wounds"               ,  75, '!',0x70004000,
X  100,    100, 316,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 81*/
X{"& Potion~ of Restore Dexterity"                  ,  75, '!',0x04000000,
X    0,    300, 317,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 82*/
X{"& Potion~ of Restore Constitution"               ,  75, '!',0x68000000,
X    0,    300, 318,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 83*/
X{"& Potion~ of Heroism"                            ,  76, '!',0x00000010,
X    0,     35, 319,   4,   2,   0,   0,   0,   0, "1d1"  ,  0}, /* 84*/
X{"& Potion~ of Boldness"                         ,  76, '!',0x00000040,
X    0,     10, 320,   4,   2,   0,   0,   0,   0, "1d1"  ,  0}, /* 85*/
X{"& Wand of Light (%P1 charges)"                   ,  65, '-',0x00000001,
X    0,    200,   1,  10,   1,   0,   0,   0,   0, "1d1"  ,  2}, /* 86*/
X{"& Wand of Lightning Bolts (%P1 charges)"         ,  65, '-',0x00000002,
X    0,    600,   2,  10,   1,   0,   0,   0,   0, "1d1"  ,  6}, /* 87*/
X{"& Wand of Magic Missile (%P1 charges)"           ,  65, '-',0x00002000,
X    0,    200,  14,  10,   1,   0,   0,   0,   0, "1d1"  ,  2}, /* 88*/
X{"& Wand of Disarming (%P1 charges)"               ,  65, '-',0x00020000,
X    0,    700,  18,  10,   1,   0,   0,   0,   0, "1d1"  , 12}, /* 89*/
X{"& Wand of Lightning Balls (%P1 charges)"         ,  65, '-',0x00040000,
X    0,   1200,  19,  10,   1,   0,   0,   0,   0, "1d1"  , 20}, /* 90*/
X{"& Wand of Wonder (%P1 charges)"                  ,  65, '-',0x00800000,
X    0,    250,  24,  10,   1,   0,   0,   0,   0, "1d1"  , 10}, /* 91*/
X{"& Staff of Light (%P1 charges)"                  ,  55, '_',0x00000001,
X    0,    250,   1,  50,   1,   0,   0,   0,   0, "1d2"  ,  3}, /* 92*/
X{"& Staff of Door/Stair Location (%P1 charges)"    ,  55, '_',0x00000002,
X    0,    350,   2,  50,   1,   0,   0,   0,   0, "1d2"  ,  7}, /* 93*/
X{"& Staff of Trap Location (%P1 charges)"          ,  55, '_',0x00000004,
X    0,    350,   3,  50,   1,   0,   0,   0,   0, "1d2"  ,  7}, /* 94*/
X{"& Staff of Detect Invisible (%P1 charges)"       ,  55, '_',0x00008000,
X    0,    200,  16,  50,   1,   0,   0,   0,   0, "1d2"  ,  3}, /* 95*/
X{"& Potion~ of Restore Life Levels"                ,  76, '!',0x00000080,
X    0,    400, 321,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /* 96*/
X{"& Scroll~ of Blessing"                           ,  71, '?',0x00000020,
X    0,     15, 312,   5,   2,   0,   0,   0,   0, "0d0"  ,  0}, /* 97*/
X{"& Scroll~ of Word-of-Recall"                     ,  71, '?',0x00000100,
X    0,    150, 313,   5,   3,   0,   0,   0,   0, "0d0"  ,  0}, /* 98*/
X{"& Potion~ of Slow Poison"                        ,  76, '!',0x00000800,
X    0,     25, 322,   4,   2,   0,   0,   0,   0, "1d1"  ,  0}, /* 99*/
X{"& Potion~ of Neutralize Poison"                  ,  76, '!',0x00001000,
X    0,     75, 323,   4,   1,   0,   0,   0,   0, "1d1"  ,  0}, /*100*/
X{"& Wand of Stinking Cloud (%P1 charges)"          ,  65, '-',0x00200000,
X    0,    400,  22,  10,   1,   0,   0,   0,   0, "1d1"  ,  5}, /*101*/
X{"& Iron Spike~"                                   ,  13, '~',0x00000000,
X    0,      1,   1,  10,   1,   0,   0,   0,   0, "1d1"  ,  1}, /*102*/
X{"& Brass Lantern~ with %P5 turns of light"        ,  15, '~',0x00000000,
X 7500,     35,   2,  50,   1,   0,   0,   0,   0, "1d1"  ,  1}, /*103*/
X{"& Wooden Torch~ with %P5 turns of light"         ,  15, '~',0x00000000,
X 4000,      2, 270,  30,   5,   0,   0,   0,   0, "1d1"  ,  1}, /*104*/
X{"& Flask~ of oil"                                 ,  77, '!',0x00040000,
X 7500,      3, 257,  10,   5,   0,   0,   0,   0, "2d6"  ,  1}  /*105*/
X};
X
Xtreasure_type blank_treasure = {"nothing", 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0,
X  0, "0d0", 0};
X
X/* Treasure related values					*/
Xint inven_ctr = 0;	        /* Total different obj's	*/
Xint inven_weight = 0;   	/* Cur carried weight	*/
Xint equip_ctr = 0;  	        /* Cur equipment ctr	*/
Xint tcptr;              	/* Cur treasure heap ptr	*/
X
X/* Following are feature objects defined for dungeon		*/
X
X/* Traps are just Nasty treasures...				*/
Xtreasure_type trap_lista[MAX_TRAPA] = {
X{"an open pit"                                     , 102, ' ',0x00000000,
X    0,      0,   1,   0,   0,   0,   0,   0,   0, "2d6"  ,-50},
X{"an arrow trap"                                   , 101, '.',0x00000000,
X    0,      0,   2,   0,   0,   0,   0,   0,   0, "1d8"  ,  0},
X{"a covered pit"                                   , 101, '.',0x00000000,
X    0,      0,   3,   0,   0,   0,   0,   0,   0, "2d6"  ,  0},
X{"a trap door"                                     , 101, '.',0x00000000,
X    0,      0,   4,   0,   0,   0,   0,   0,   0, "2d8"  ,  0},
X{"a gas trap"                                      , 101, '.',0x00000000,
X    0,      0,   5,   0,   0,   0,   0,   0,   0, "1d4"  ,  0},
X{"a loose rock"                                    , 101, '.',0x00000000,
X    0,      0,   6,   0,   0,   0,   0,   0,   0, "0d0"  ,  0},
X{"a dart trap"                                     , 101, '.',0x00000000,
X    0,      0,   7,   0,   0,   0,   0,   0,   0, "1d4"  ,  0},
X{"a strange rune"                                  , 101, '.',0x00000000,
X    0,      0,   8,   0,   0,   0,   0,   0,   0, "0d0"  ,  0},
X{"some loose rock"                                 , 101, '.',0x00000000,
X    0,      0,   9,   0,   0,   0,   0,   0,   0, "2d6"  ,  0},
X{"a gas trap"                                      , 101, '.',0x00000000,
X    0,      0,  10,   0,   0,   0,   0,   0,   0, "1d4"  ,  0},
X{"a strange rune"                                  , 101, '.',0x00000000,
X    0,      0,  11,   0,   0,   0,   0,   0,   0, "0d0"  ,  0},
X{"a blackened spot"                                , 101, '.',0x00000000,
X    0,      0,  12,   0,   0,   0,   0,   0,   0, "4d6"  ,  0},
X{"some corroded rock"                              , 101, '.',0x00000000,
X    0,      0,  13,   0,   0,   0,   0,   0,   0, "4d6"  ,  0},
X{"a gas trap"                                      , 101, '.',0x00000000,
X    0,      0,  14,   0,   0,   0,   0,   0,   0, "2d6"  ,  0},
X{"a gas trap"                                      , 101, '.',0x00000000,
X    5,      0,  15,   0,   0,   0,   0,   0,   0, "1d4"  , 10},
X{"a gas trap"                                      , 101, '.',0x00000000,
X    5,      0,  16,   0,   0,   0,   0,   0,   0, "1d8"  ,  5},
X{"a dart trap"                                     , 101, '.',0x00000000,
X    5,      0,  17,   0,   0,   0,   0,   0,   0, "1d8"  , 10},
X{"a dart trap"                                     , 101, '.',0x00000000,
X    5,      0,  18,   0,   0,   0,   0,   0,   0, "1d8"  , 10}
X};
X
X/* Traps: Level represents the difficulty of disarming;	*/
X/* and P1 represents the experienced gained when disarmed*/
Xtreasure_type trap_listb[MAX_TRAPB] = {
X{"an open pit"                                     , 102, ' ',0x00000000,
X    1,      0,   1,   0,   0,   0,   0,   0,   0, "2d6"  ,-50},
X{"an arrow trap"                                   , 102, '^',0x00000000,
X    3,      0,   2,   0,   0,   0,   0,   0,   0, "1d8"  ,-10},
X{"a covered pit"                                   , 102, '^',0x00000000,
X    2,      0,   3,   0,   0,   0,   0,   0,   0, "2d6"  ,-40},
X{"a trap door"                                     , 102, '^',0x00000000,
X    5,      0,   4,   0,   0,   0,   0,   0,   0, "2d8"  ,-25},
X{"a gas trap"                                      , 102, '^',0x00000000,
X    3,      0,   5,   0,   0,   0,   0,   0,   0, "1d4"  ,  5},
X{"a loose rock"                                    , 102, ';',0x00000000,
X    0,      0,   6,   0,   0,   0,   0,   0,   0, "0d0"  ,-90},
X{"a dart trap"                                     , 102, '^',0x00000000,
X    5,      0,   7,   0,   0,   0,   0,   0,   0, "1d4"  , 10},
X{"a strange rune"                                  , 102, '^',0x00000000,
X    5,      0,   8,   0,   0,   0,   0,   0,   0, "0d0"  ,-10},
X{"some loose rock"                                 , 102, '^',0x00000000,
X    5,      0,   9,   0,   0,   0,   0,   0,   0, "2d6"  ,-10},
X{"a gas trap"                                      , 102, '^',0x00000000,
X   10,      0,  10,   0,   0,   0,   0,   0,   0, "1d4"  ,  5},
X{"a strange rune"                                  , 102, '^',0x00000000,
X    5,      0,  11,   0,   0,   0,   0,   0,   0, "0d0"  ,-10},
X{"a blackened spot"                                , 102, '^',0x00000000,
X   10,      0,  12,   0,   0,   0,   0,   0,   0, "4d6"  , 10},
X{"some corroded rock"                              , 102, '^',0x00000000,
X   10,      0,  13,   0,   0,   0,   0,   0,   0, "4d6"  , 10},
X{"a gas trap"                                      , 102, '^',0x00000000,
X    5,      0,  14,   0,   0,   0,   0,   0,   0, "2d6"  ,  5},
X{"a gas trap"                                      , 102, '^',0x00000000,
X    5,      0,  15,   0,   0,   0,   0,   0,   0, "1d4"  , 10},
X{"a gas trap"                                      , 102, '^',0x00000000,
X    5,      0,  16,   0,   0,   0,   0,   0,   0, "1d8"  ,  5},
X{"a dart trap"                                     , 102, '^',0x00000000,
X    5,      0,  17,   0,   0,   0,   0,   0,   0, "1d8"  , 10},
X{"a dart trap"                                     , 102, '^',0x00000000,
X    5,      0,  18,   0,   0,   0,   0,   0,   0, "1d8"  , 10},
X	/* Special case, see DOOR_LIST below (subvals must agree)        */
X{"a closed door"                                   , 105, '+',0x00000000,
X    0,      0,  19,   0,   0,   0,   0,   0,   0, "1d1"  ,  0}
X};
X
X/* Special trap	*/
Xtreasure_type scare_monster = 
X{"a strange rune"                                  , 102, '^',0x00000000,
X    0,      0,  99,   0,   0,   0,   0,   0,   0, "0d0"  ,-90};
X
Xtreasure_type rubble = 
X{"some rubble"                                     , 103, ':',0x00000000,
X    0,      0,   1,   0,   0,   0,   0,   0,   0, "0d0"  ,  0};
X
X/* Secret door must have same subval as closed door in	*/
X/* TRAP_LISTB.  See CHANGE_TRAP                          */
Xtreasure_type door_list[3] = {
X{"an open door"                                    , 104,'\'',0x00000000,
X    0,      0,   1,   0,   0,   0,   0,   0,   0, "1d1"  ,  0},
X{"a closed door"                                   , 105, '+',0x00000000,
X    0,      0,  19,   0,   0,   0,   0,   0,   0, "1d1"  ,  0},
X{"a secret door"                                   , 109, '#',0x00000000,
X    0,      0,  19,   0,   0,   0,   0,   0,   0, "1d1"  ,  0}
X};
X
Xtreasure_type up_stair = 
X{"an up staircase "                                , 107, '<',0x00000000,
X    0,      0,   1,   0,   0,   0,   0,   0,   0, "1d1"  ,  0};
X
Xtreasure_type down_stair = 
X{"a down staircase"                                , 108, '>',0x00000000,
X    0,      0,   1,   0,   0,   0,   0,   0,   0, "1d1"  ,  0};
X
END_OF_treasure2.c
if test 28020 -ne `wc -c <treasure2.c`; then
    echo shar: \"treasure2.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 13 \(of 16\).
cp /dev/null ark13isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 16 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0