mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/
/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project.  All 
................................................ contributions are welcome. 
....Copyright(C).1995.Melvin.Smith.............. Enjoy. 
------------------------------------------------------------------------------
Melvin Smith (aka Fusion)         msmith@hom.net 
MUD++ development mailing list    mudpp@van.ml.org
------------------------------------------------------------------------------
shop.h
*/

#ifndef _SHOP_H
#define _SHOP_H

#include "io.h"
#include "llist.h"
#include "index.h"
#include "npc.h"

const int SHOPKEEPER_NOT_TRADING	= -1;
const int SHOPKEEPER_HAS_IDENTICAL	= -2;
const int SHOPKEEPER_HAS_TYPE		= -3;

class ShopTrade
{
	private:
		short type;
		short buy_profit;		// How much % shopkeeper give for something
		short sell_profit;		// How much % shopkeeper wants for something
		short max_identical;	// How much 'short sword' will he want
		short max_type;			// How much 'weapon' type will he want
	public:
		ShopTrade()
		: type(0), buy_profit(90), sell_profit(110), max_identical(3),
		max_type(5)
		{
		}

		ShopTrade(short the_type, short the_buy, short the_sell, short max_i,
		short max_t)
		: type(the_type), buy_profit(the_buy), sell_profit(the_sell), 
			max_identical(max_i), max_type(max_t)
		{
		}

		int getType() { return type; }
		int getBuyProfit() {return buy_profit; }
		int getSellProfit() {return sell_profit; }
		int getMaxIdentical() {return max_identical; }
		int getMaxType() {return max_type; }


};


class ShopKeeper : public NPC
{
	protected:
		Index shop;		// Room index
		Index warehouse;
		String owners;
		short shop_open;
		short shop_close;
		LList<ShopTrade> tradeList;

	public:
		ShopKeeper()
		:	shop_open( 6 ), shop_close( 18 )
		{
		}

		ShopKeeper( const NPC & npc )
		:	NPC( npc ),
			shop_open( 6 ), shop_close( 18 )
		{
		}

		ShopKeeper( const ShopKeeper & sk )
		:	NPC( sk ),
			shop_open( 6 ), shop_close( 18 )
		{
			tradeList.copy( sk.tradeList );
		}
		virtual vmtype getVMType() { return VMT_SHOPKEEPER; }

		int buyValue( Object * );
		int sellValue( Object * );
		bool isTrading(int);
		bool isNPC() const { return true; }
		bool isShopKeeper() const { return true; }
		int readFrom_shopblock(StaticInput &);
		int readFrom( StaticInput & );
		void writeTo_shopblock( Output & ) const;
		int writeTo( Output & ) const;
		bool isOwnedBy( Char * );
		void addOwner(String &);
		void removeOwner(String &);
};
#endif