circlemud_squared_0.5.153/cnf/
circlemud_squared_0.5.153/etc/
circlemud_squared_0.5.153/etc/etc/
circlemud_squared_0.5.153/etc/house/
circlemud_squared_0.5.153/etc/misc/
circlemud_squared_0.5.153/etc/plralias/A-E/
circlemud_squared_0.5.153/etc/plralias/F-J/
circlemud_squared_0.5.153/etc/plralias/K-O/
circlemud_squared_0.5.153/etc/plralias/P-T/
circlemud_squared_0.5.153/etc/plralias/U-Z/
circlemud_squared_0.5.153/etc/plralias/ZZZ/
circlemud_squared_0.5.153/etc/plrobjs/
circlemud_squared_0.5.153/etc/plrobjs/A-E/
circlemud_squared_0.5.153/etc/plrobjs/F-J/
circlemud_squared_0.5.153/etc/plrobjs/K-O/
circlemud_squared_0.5.153/etc/plrobjs/P-T/
circlemud_squared_0.5.153/etc/plrobjs/U-Z/
circlemud_squared_0.5.153/etc/plrobjs/ZZZ/
circlemud_squared_0.5.153/etc/text/
circlemud_squared_0.5.153/etc/text/help/
circlemud_squared_0.5.153/src/util/
circlemud_squared_0.5.153/src/util/worldconv/
/**
 * @file shop.h
 * @ingroup common
 *
 * Shop code
 *
 *   This shop system is a completely re-coded one for CircleMUD^2, but was
 * based around the system originally created for CircleMUD by Jeff Fink.
 *
 * @author Greg Buxton
 *
 * @par Copyright:
 *   Copyright (C) 2006 Geoff Davis <geoff@circlemudsquared.org><br>
 *                      Greg Buxton <greg@circlemudsquared.org>
 *
 * @par
 *   Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University<br>
 *   CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
 *
 * @par
 *   All rights reserved.  See license.doc for complete information.
 *
 * @package cs
 * @version 1.0
 */

#ifndef __SHOP_H__
#define __SHOP_H__

#include "base.h"
#include "structs.h"
#include "dao.h"

/**
 * @ingroup Shop
 * @defgroup ShopSalesTypes
 * Stores what item types shop trades in
 * @{
 */
struct _shopBuyData_t {
  int            type;                  /**< Type of item                    */
  shopBuyData_t *next;                  /**< Next item in list               */
};
/**
 * @}
 */

/**
 * @ingroup Shop
 * @defgroup ShopInventory
 * Stores what items the shop has in inventory
 * @{
 */
struct _shopInventory_t {
  itemData_t      *item;                /**< Item in inventory               */
  int              count;               /**< Number of item in inventory     */
  shopInventory_t *next;                /**< Next item in list               */
};
/**
 * @}
 */

/**
 * @ingroup Shop
 * @defgroup ShopItems
 * Stores what items the shop produces
 * @{
 */
struct _shopItems_t {
  itemData_t  *item;                    /**< Pointer to object prototype     */
  char        *sItem;                   /**< ID (zone:number) for item       */
  shopItems_t *next;                    /**< Next item in list               */
};
/**
 * @}
 */

/**
 * @ingroup Shop
 * @defgroup ShopRooms
 * Stores what room the shop is in
 * @{
 */
struct _shopRooms_t {
  roomData_t  *room;                    /**< Pointer to room                 */
  char        *sRoom;                   /**< ID (zone:number) for room       */
  shopRooms_t *next;                    /**< Next room in list               */
};
/**
 * @}
 */

/**
 * @ingroup Shop
 * @defgroup shopData_t
 * Shop structure
 * @{
 */
struct _shopData_t {
  int              vnum;                /**< Number of the shop              */
  zoneData_t      *zone;                /**< Zone Shop is in                 */
  shopItems_t     *producing;           /**< Items the shop sells            */
  shopInventory_t *inventory;           /**< Items in shop inventory         */
  float            profitForSale;       /**< Factor to multiply cost with    */
  float            profitForPurchase;   /**< Factor to multiply cost with    */
  shopBuyData_t   *type;                /**< Which items to trade            */
  char            *shopMissingItem;     /**< Keeper hasn't got an item       */
  char            *buyerMissingItem;    /**< Player hasn't got an item       */
  char            *shopCantAfford;      /**< Keeper hasn't got cash          */
  char            *playerCantAfford;    /**< Player hasn't got cash          */
  char            *noBuy;               /**< Keeper dosn't buy such things   */
  char            *itemSold;            /**< Player buys item                */
  char            *itemBought;          /**< Player sells item               */
  char            *sKeeper;             /**< ID (zone:number) for keeper     */
  charData_t      *keeper;              /**< Mobile who owns the shop        */
  int              flags;               /**< Who does the shop trade with?   */
  shopRooms_t     *inRoom;              /**< Rooms shop is in                */
  int              open1;               /**< Shop opening hours 1            */
  int              open2;               /**< Shop opening hours 2            */
  int              close1;              /**< Shop closing hours 1            */
  int              close2;              /**< Shop closing hours 2            */
};
/**
 * @}
 */

/**
 * Bits for who shop trades with 
 * @{
 */
#define TRADE_NOGOOD            BIT_00	
#define TRADE_NOEVIL            BIT_01
#define TRADE_NONEUTRAL         BIT_02
#define TRADE_NOMAGIC_USER      BIT_03
#define TRADE_NOCLERIC          BIT_04
#define TRADE_NOTHIEF           BIT_05
#define TRADE_NOWARRIOR         BIT_06
/**
 * @}
 */

/* Location of bitvectors */
#define SHOP_TRADE(shop)	((shop->flags))

/* Macros to check bit settings */
#define SHOP_TRADES(shop, t)	(IS_SET(SHOP_TRADE(shop), (t)))

#define MSG_NOT_OPEN_YET	"Come back later!"

/*
 * Function prototypes
 */

void shopData_loadShopsInZone(zoneData_t *zone, daoData_t *parentDao);
void shop_addProducingItem(shopData_t *shop, itemData_t *item);
void shopData_resolveInZone(zoneData_t *zone);
void shopData_toDao(daoData_t *parentDao, shopData_t *shop);
void shops_listInZone(char *buf, zoneData_t *zone);

ACMD(do_list);
ACMD(do_sell);
ACMD(do_appraise);

#endif /* __SHOP_H__ */