/
roa/
roa/lib/boards/
roa/lib/config/
roa/lib/edits/
roa/lib/help/
roa/lib/misc/
roa/lib/plrobjs/
roa/lib/quests/
roa/lib/socials/
roa/lib/www/
roa/lib/www/LEDSign/
roa/lib/www/LEDSign/fonts/
roa/lib/www/LEDSign/scripts/
roa/src/s_inc/
roa/src/sclient/
roa/src/sclient/binary/
roa/src/sclient/text/
roa/src/util/
/************************************************************************
	Realms of Aurealis 		James Rhone aka Vall of RoA

plshop.h				Header file for plshop.c.  Most
					stucture and define definitions
					related to Online Player Shop
					Creation (OLPSC).

		******** 100% Completely Original Code ********
		*** BE AWARE OF ALL RIGHTS AND RESERVATIONS ***
		******** 100% Completely Original Code ********
		        All rights reserved henceforth. 

    Please note that no guarantees are associated with any code from
Realms of Aurealis.  All code which has been released to the general
public has been done so with an 'as is' pretense.  RoA is based on both
Diku and CircleMUD and ALL licenses from both *MUST* be adhered to as well
as the RoA license.   *** Read, Learn, Understand, Improve ***
*************************************************************************/
#ifndef ROA_PLSHOP_H
#define ROA_PLSHOP_H

#define MAX_PLSHOPS	100
#define TOP_PLSHOPS	20
#define MAX_SIMUL	50

#define PLSHOP_DIR	"plshops"

// for plshop types
#define PLSHOP_NORMAL		0
#define PLSHOP_PUB		1

// for plshop flags
#define PLS_OPEN		(1 << 0)
#define PLS_LANDTAX		(1 << 1)
#define PLS_ITEMTAX		(1 << 2)
#define PLS_LANDTAX_OWED	(1 << 3)

#define PERDAY		0
#define PERWEEK		1
#define PERMONTH	2
#define PERYEAR		3

// race/class flags for race_class bitvector
#define PLS_NO_HUMAN        (1 << 0)
#define PLS_NO_ELF          (1 << 1)
#define PLS_NO_HALF_ELF     (1 << 2)
#define PLS_NO_ORC          (1 << 3)
#define PLS_NO_OGRE         (1 << 4)
#define PLS_NO_DROW         (1 << 5)
#define PLS_NO_DWARF        (1 << 6)
#define PLS_NO_PIXIE        (1 << 7)
#define PLS_NO_NIXIE        (1 << 8)
#define PLS_NO_DRAGON       (1 << 9)
// now for classes
#define PLS_NO_MAGE        (1 << 10)
#define PLS_NO_BARD        (1 << 11)
#define PLS_NO_RANGER      (1 << 12)
#define PLS_NO_WARRIOR     (1 << 13)
#define PLS_NO_CLERIC      (1 << 14)
#define PLS_NO_SHAMAN      (1 << 15)
#define PLS_NO_THIEF       (1 << 16)
#define PLS_NO_WARLOCK     (1 << 17)
#define PLS_NO_MONK        (1 << 18)
#define PLS_NO_MADEPT      (1 << 19)
#define PLS_NO_DRUID       (1 << 20)


typedef struct plshop_data {
  int owner_idnum;			// need owner's id for lookups
  chdata *owner;			// maintain ptr to owner while logged in

  int shopkeep_vnum;			// to load shopkeep
  chdata *shopkeep;			// maintain ptr to shopkeep

  int shop_rvnum;			// vnum of main shop room (shortcut perhaps)
  rmdata *location;			// maintain ptr to location (shortcut perhaps)

  int plshop_id;			// unique idnum of this shop;
  
  int gold;				// how much gold do it have now mon

  int type;				// PLSHOP_NORMAL, PLSHOP_PUB, etc
  int bitv;				// PS_LANDTAX, PS_ITEMTAX, etc
  int rc_bitv;				// anti race/class bitvector

  int minlevel;				// minlevel can sell to
  int maxlevel;				// maxlevel can sell to

  int max_sell;				// max # of items can sell @ 1 time
  int markup;				// profit per object for owner
  int item_tax;				// sales tax rate per item
  int land_tax;				// property tax charge per month
  int keeper_cut;			// what percentage does keeper keep

  // shop statistics
  int days_open;			// mud days since grand opening
  int gold_today;			// how much sales today

  int averages[4];			// averages[PERDAY], averages[PERWEEK], etc

  int item_tax_paid;			// accum of item taxes paid
  int land_tax_paid;			// accum of land tax paid
  int keeper_paid;			// accum of keeper's cut
  int gross_income;			// gross income
  int net_income;			// net income, actual profit

  struct plshop_data *global_next;	// next in global LL of plshops
  struct plshop_data *next;		// next in character's LL of plshops
} plshop;

// merely for showing top shops by gross income
typedef struct shoplist {
  int shop_id;
  int gross_income;
} shlist;

#define PLS_TYPE(ptr)		((ptr)->type)

#define PLS_FLAGS(ptr)		((ptr)->bitv)
#define PLS_FLAGGED(i, f)	(IS_SET(PLS_FLAGS((i)), (f)))

#define PLS_RCFLAGS(ptr)	((ptr)->rc_bitv)
#define PLS_RCFLAGGED(i, f)	(IS_SET(PLS_RCFLAGS((i)), (f)))

#define PLS_PERDAY(ptr)		((ptr)->averages[PERDAY])
#define PLS_PERWEEK(ptr)	((ptr)->averages[PERWEEK])
#define PLS_PERMONTH(ptr)	((ptr)->averages[PERMONTH])
#define PLS_PERYEAR(ptr)	((ptr)->averages[PERYEAR])

// function prototypes
void save_plshops(void);
void remove_char_plshops(chdata *ch);
plshop *in_own_shop(chdata *ch);
BOOL load_plshopkeep_objs(chdata *mob);
void save_plshopkeep_objs(chdata *mob);
void daily_plshop_update(void);
void monthly_plshop_update(void);
void yearly_plshop_update(void);
plshop *get_shopkeeps_plshop(int mvnum);
BOOL check_plshop_rcflags(chdata *ch, plshop *s);

#endif /* ROA_PLSHOP_H */