//=============================================================================
// Doctor.
//=============================================================================
class RPGDoctor extends HumanCivilian;

var int talked;
var _MMRPGPlayer talkto;

function TakeDamageBase(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType,
                        bool bPlayAnim)
{}

function Frob(Actor Frobber, Inventory frobWith)
{
	local _MMRPGPlayer Player;
	local MedKitMMRPG med;

	If (Frobber.IsA('DeusExPlayer'))
	{
		If(talked != 0)
		{
			_MMRPGPlayer(Frobber).ReceiveMessage("Someone is already talking to this person!");
			return;
		}
	}

//	Super.Frob(Frobber, frobWith);
	Player = _MMRPGPlayer(Frobber);
	talkto = Player;

	Player.bInConv = True;
		LookAtActor(Frobber, True, True, False);
	
	if (player.medkit == 1)
	{
		Player.ReceiveMessage(""$Player.PlayerReplicationInfo.PlayerName$": Are you the medkit guy?");
		player.medkit = 2;
		talked = 1;
		SetTimer(2.4,False);
		return;
	}

	else if (player.medkit == 2)
	{
		foreach AllActors(class'MedKitMMRPG', med)
		{
			//if (!Med.IsA('MedPack'))
			//{
				if (Med.Owner == talkto)
				{
					Player.ReceiveMessage(""$Player.PlayerReplicationInfo.PlayerName$": I have a medkit for you.");
					talked = 2;
					SetTimer(1.7,False);
					return;
				}
			//}
		}

		if (med == None)
		{
			Player.ReceiveMessage(""$Player.PlayerReplicationInfo.PlayerName$": Sorry I don't have any medkits at the moment.");
			Player.bInConv = False;
			talked = 0;
		}
	}
}

function Timer()
{
	local MedKitMMRPG med;
	local MMRPGCreditCard Cred;

	Cred = talkto.CreditCard;


	if (talked == 1)
	{
		talkto.ReceiveMessage("DOCTOR: Yeah, If you have any spare medkits, I'll buy them from you for 5c. each.");
		talkto.bInConv = False;
		talked = 0;
		return;
	}

	else if (talked == 2)
	{
		foreach AllActors(class'MedKitMMRPG', med)
		{
			if (Med.Owner == talkto)
			{
				//if (!Med.IsA('MedPack'))
				//{
					Med.Numcopies -= 1;
					Med.UpdateBeltText();
					talkto.ReceiveMessage("|p2Traded in a medkit for 5c.");
					Cred.Creditamount += 5;

					if (Med.Numcopies == 0)
						Med.Destroy();
				//}
			}
		}
		talkto.bInConv = False;
		talked = 0;
		return;
	}
}


defaultproperties
{
     bfearAlarm=False
     bFearCarcass=False
     bFearDistress=False
     bFearShot=False
     bFearIndirectInjury=False
     Orders=Sitting
     bInvincible=True
     bHateShot=False
     bHateInjury=False
     bReactPresence=False
     bEmitDistress=False
     CarcassType=Class'DeusEx.DoctorCarcass'
     WalkingSpeed=0.213333
     BaseAssHeight=-23.000000
     GroundSpeed=180.000000
     Mesh=LodMesh'DeusExCharacters.GM_Trench'
     MultiSkins(0)=Texture'DeusExCharacters.Skins.DoctorTex0'
     MultiSkins(1)=Texture'DeusExCharacters.Skins.LabCoatTex1'
     MultiSkins(2)=Texture'DeusExCharacters.Skins.PantsTex1'
     MultiSkins(3)=Texture'DeusExCharacters.Skins.DoctorTex0'
     MultiSkins(4)=Texture'DeusExCharacters.Skins.DoctorTex1'
     MultiSkins(5)=Texture'DeusExCharacters.Skins.LabCoatTex1'
     MultiSkins(6)=Texture'DeusExCharacters.Skins.FramesTex1'
     MultiSkins(7)=Texture'DeusExCharacters.Skins.LensesTex2'
     CollisionRadius=20.000000
     CollisionHeight=47.500000
     BindName="Doctor"
     FamiliarName="Doctor"
     UnfamiliarName="Doctor"
}
