//=============================================================================
// BookClosed.
//=============================================================================
class BookMMRPG extends ElectronicDevices;

var() bool bOpened;
var int howMuch;
var _MMRPGPlayer player;
var() class<Skill> BookSkill;	

function BeginPlay()
{
	Super.BeginPlay();

	if (bOpened)
	{
		Mesh = LodMesh'DeusExDeco.BookOpen';
	}
	else
	{
		Mesh = LodMesh'DeusExDeco.BookClosed';
	}
}


function Frob(Actor Frobber, Inventory frobWith)
{
	if(howMuch != 0)
	{
		DeusExPlayer(Frobber).ClientMessage("Someone else is reading this book!");
		return;
	}
	player = _MMRPGPlayer(Frobber);
	howMuch = 0;
	SetTimer(1,False);
	Player.Clientmessage("Now reading...");
	Player.bInConv = True;
}

Function Timer()
{
	if (howMuch == 0)
	{
		howMuch = 1;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 1)
	{
		howMuch = 2;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 2)
	{
		howMuch = 3;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 3)
	{
		howMuch = 4;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 4)
	{
		howMuch = 5;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 5)
	{
		howMuch = 6;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 6)
	{
		howMuch = 7;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 7)
	{
		howMuch = 8;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 8)
	{
		howMuch = 9;
		Player.Clientmessage("Reading...");
		SetTimer(1,False);
		return;
	}
	if (howMuch == 9)
	{
		Player.Clientmessage("You have read the book!");
		howMuch = 0;
		Player.bInConv = False;
	}
}

defaultproperties
{
     bInvincible=True
     bOpened=False
     bCanBeBase=True
     ItemName="Book"
     Mesh=LodMesh'DeusExDeco.BookClosed'
     CollisionRadius=10.000000
     CollisionHeight=1.700000
     Mass=10.000000
     Buoyancy=11.000000
}
