[Circle] ASTAT (See stats on auction)

From: BlackWind (BlackWind@multiplex.com)
Date: 11/17/96


Well, I've decided I've done enough begging for code, and that I should
contribute something to all those that have helped me.  This is for the
circle auction code, for those of you who don't have the time, or can't
figure out how to convert the merc auction.  This code will show the
stats on the current item being auctioned....and it's really easy to
add.

In auction.c, right before;

void auction_reset(void)
{
  auction.bidder = NULL;
  auction.seller = NULL;
  auction.obj = NULL;
  auction.ticks = AUC_NONE;
  auction.bid = 0;
}

Put this (this is just about all the code needed);

ACMD(do_astat)
{
    struct obj_data *obj;
    int i, virtual, found;
    struct extra_descr_data *desc;
    extern char arg1[MAX_INPUT_LENGTH];
    extern char buf[MAX_STRING_LENGTH];
    extern char *item_types[];
    extern char *extra_bits[];
    extern char *apply_types[];
    extern char *affected_bits[];
    extern char *spells[];

    argument = one_argument (argument, buf1);

        if (IS_NPC(ch)) /* NPC can be extracted at any time and thus
can't auction! */
                return;

        if (auction.obj != NULL)
        {
            /* show item data here */
            if (auction.bid > 0)
                sprintf (buf, "Current bet on this item is %d
gold.\n\r", auction.bid);
            else
                sprintf (buf, "No bets on this item have been
received.\n\r");
            send_to_char (buf, ch);
if (obj) {
    send_to_char("You feel informed:\r\n", ch);
    sprintf(buf, "Object '%s', Item type: ",
auction.obj->short_description);
    sprinttype(GET_OBJ_TYPE(auction.obj), item_types, buf2);
    strcat(buf, buf2);
    strcat(buf, "\r\n");
    send_to_char(buf, ch);

    if (auction.obj->obj_flags.bitvector) {
      send_to_char("Item will give you following abilities:  ", ch);
      sprintbit(auction.obj->obj_flags.bitvector, affected_bits, buf);
      strcat(buf, "\r\n");
      send_to_char(buf, ch);
    }
    send_to_char("Item is: ", ch);
    sprintbit(GET_OBJ_EXTRA(auction.obj), extra_bits, buf);
    strcat(buf, "\r\n");
    send_to_char(buf, ch);

    sprintf(buf, "Weight: %d, Value: %d, Rent: %d\r\n",
	    GET_OBJ_WEIGHT(auction.obj), GET_OBJ_COST(auction.obj),
GET_OBJ_RENT(auction.obj));
    send_to_char(buf, ch);

    switch (GET_OBJ_TYPE(auction.obj)) {
    case ITEM_SCROLL:
    case ITEM_POTION:
      sprintf(buf, "This %s casts: ", item_types[(int)
GET_OBJ_TYPE(auction.obj)]);

      if (GET_OBJ_VAL(auction.obj, 1) >= 1)
	sprintf(buf, "%s %s", buf, spells[GET_OBJ_VAL(auction.obj, 1)]);
      if (GET_OBJ_VAL(auction.obj, 2) >= 1)
	sprintf(buf, "%s %s", buf, spells[GET_OBJ_VAL(auction.obj, 2)]);
      if (GET_OBJ_VAL(auction.obj, 3) >= 1)
	sprintf(buf, "%s %s", buf, spells[GET_OBJ_VAL(auction.obj, 3)]);
      sprintf(buf, "%s\r\n", buf);
      send_to_char(buf, ch);
      break;
    case ITEM_WAND:
    case ITEM_STAFF:
      sprintf(buf, "This %s casts: ", item_types[(int)
GET_OBJ_TYPE(auction.obj)]);
      sprintf(buf, "%s %s\r\n", buf, spells[GET_OBJ_VAL(auction.obj,
3)]);
      sprintf(buf, "%sIt has %d maximum charge%s and %d remaining.\r\n",
buf,
	      GET_OBJ_VAL(auction.obj, 1), GET_OBJ_VAL(auction.obj, 1) == 1 ?
"" : "s",
	      GET_OBJ_VAL(auction.obj, 2));
      send_to_char(buf, ch);
      break;
    case ITEM_WEAPON:
      sprintf(buf, "Damage Dice is '%dD%d'", GET_OBJ_VAL(auction.obj,
1),
	      GET_OBJ_VAL(auction.obj, 2));
      sprintf(buf, "%s for an average per-round damage of %.1f.\r\n",
buf,
	      (((GET_OBJ_VAL(auction.obj, 2) + 1) / 2.0) *
GET_OBJ_VAL(auction.obj, 1)));
      send_to_char(buf, ch);
      break;
    case ITEM_ARMOR:
      sprintf(buf, "AC-apply is %d\r\n", GET_OBJ_VAL(auction.obj, 0));
      send_to_char(buf, ch);
      break;
    }
    found = FALSE;
    for (i = 0; i < MAX_OBJ_AFFECT; i++) {
      if ((auction.obj->affected[i].location != APPLY_NONE) &&
	  (auction.obj->affected[i].modifier != 0)) {
	if (!found) {
	  send_to_char("Can affect you as :\r\n", ch);
	  found = TRUE;
	}
	sprinttype(auction.obj->affected[i].location, apply_types, buf2);
	sprintf(buf, "   Affects: %s By %d\r\n", buf2,
auction.obj->affected[i].modifier);
	send_to_char(buf, ch);
      }
    }
  }
        return;
        }
      }

Then, in interpreter.c right after;

ACMD(do_advance);
ACMD(do_alias);
ACMD(do_assist);
ACMD(do_at);
ACMD(do_auction);

Put this;

ACMD(do_astat);

Also, in interpreter.c right after;

  { "accuse"   , POS_SITTING , do_action   , 0, 0 },
  { "applaud"  , POS_RESTING , do_action   , 0, 0 },
  { "assist"   , POS_FIGHTING, do_assist   , 1, 0 },
  { "ask"      , POS_RESTING , do_spec_comm, 0, SCMD_ASK },
  { "auction"  , POS_DEAD    , do_auction  , 1, 0 },

Put this;

  { "astat"    , POS_DEAD    , do_astat    , 0, 0 },


Now compile, and it should work...although something you should know is
that this is for the circlemud version of auction.c, and won't work with
any other version.  And that it OBVIOSLY won't work, unless you got
auction working fine.  Known bugs: none :) I made it.

	Good luck,
		Blackwind
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST