//=============================================================================
// Male2.
//=============================================================================
class RPGContMan extends HumanCivilian;


var int talked;
var _MMRPGPlayer talkto;
var bool bTrade;

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

function bool CheckBomb()
{
	local MissionBomb too;
	foreach allactors(class'MissionBomb', too)
	{
		if (too.Owner == talkto)
		{
			return true;
		}
	}
	return false;
}


function Frob(Actor Frobber, Inventory frobWith)
{
	local _MMRPGPlayer Player;
	local Medkit med;
	local KeyDummy hmm2;


	If (Frobber.IsA('DeusExPlayer'))
	{
		If(talked != 0)
		{
			if(bTrade)
			{
				Super(Actor).Frob(Frobber, Frobwith);
			}
			if(!bTrade)
			{
				_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.contmission == 1)
	{
		Player.ReceiveMessage("MAN: Hey, you there, can you help me out?");
		talked = 1;
		SetTimer(2.4,False);
		return;
	}

	else if (player.contmission == 2)
	{
		if(CheckBomb() == True)
		{
			Player.ReceiveMessage("MAN: Go sabotage the weapons dealer in Fox Pointe apartments");
			talked = 0;
			Player.bInConv = False;
			return;
		}

		talked = 99;
		SetTimer(0.1,False);
		return;
	}

	else if (player.contmission == 3)
	{
		Player.ReceiveMessage(""$Player.PlayerReplicationInfo.PlayerName$": It's done.");
		talked = 20;
		SetTimer(2.4,False);
		return;
	}

	else if (player.contmission == 4)
	{
		Player.ReceiveMessage("MAN: Cheers for helping.");
		talked = 0;
		Player.bInConv = False;
		return;
	}
}

function Timer()
{
	local Medkit med;
	local MMRPGCreditCard Cred;
	local keydummy hmm2;

	Cred = talkto.CreditCard;


	if (talked == 1)
	{
		talkto.ReceiveMessage(""$talkto.PlayerReplicationInfo.PlayerName$": What do you want me to do?");
		talked = 2;
		SetTimer(2.7,False);
		return;
	}

	else if (talked == 2)
	{
		talkto.ReceiveMessage("MAN: I need you to sabotage a weapons dealer's apartment");
		talked = 3;
		SetTimer(3.3,False);
		return;
	}

	else if (talked == 3)
	{
		talkto.ReceiveMessage("MAN: He lives at the Fox Pointe apartments");
		talked = 4;
		SetTimer(3.3,False);
		return;
	}
	else if (talked == 4)
	{
		talkto.ReceiveMessage(""$talkto.PlayerReplicationInfo.PlayerName$": How exactly will I sabotage it?");
		talked = 5;
		SetTimer(3.5,False);
		return;
	}
	else if (talked == 5)
	{
		talkto.ReceiveMessage("MAN: Take this timed bomb and place it anywhere on the wall in his apartment");
		talked = 6;
		SetTimer(3.1,False);
		return;
	}
	else if (talked == 6)
	{
		foreach AllActors(class'keydummy', hmm2)
		{
			if (talkto.HandleItemPickup(hmm2, True) == False)
			{
				talkto.ReceiveMessage("MAN: Make room in your inventory for the bomb.");
				talkto.bInConv = False;
				talkto.contmission = 1;
				talked = 0;
				return;
			}
		}
		foreach AllActors(class'keydummy', hmm2)
		{
			if (talkto.HandleItemPickup(hmm2, True) == True)
			{
				talkto.ReceiveMessage(""$talkto.PlayerReplicationInfo.PlayerName$": So how do I go about this?");
				bTrade=True;
				talkto.SpawnItemz(Class'MissionBomb');
				bTrade=False;
				talked = 7;
				SetTimer(3.9,False);
				return;
			}
		}
	}
	else if (talked == 7)
	{
		talkto.ReceiveMessage("MAN: Knock on his door and tell him that you want to buy some weapons.");
		talked = 8;
		SetTimer(3.3,False);
		return;
	}
	else if (talked == 8)
	{
		talkto.ReceiveMessage(""$talkto.PlayerReplicationInfo.PlayerName$": Okay.");
		talked = 0;
		talkto.bInConv = False;
		talkto.contmission = 2;
		talkto.ClientMessage("Goal Received (Press F2 for details)");
		return;
	}


	else if (talked == 20)
	{
		talkto.ReceiveMessage("MAN: Awesome, cheers.");
		talked = 21;
		SetTimer(2.3,False);
		return;
	}
	else if (talked == 21)
	{
		talkto.ReceiveMessage(""$talkto.PlayerReplicationInfo.PlayerName$": I had trouble from some thugs, but I handled the situation.");
		talked = 22;
		SetTimer(4.3,False);
		return;
	}
	else if (talked == 22)
	{
		talkto.contmission = 4;
		talkto.ReceiveMessage("MAN: Well thanks again for doing this - I really appreciate it. Have this (90c).");
		talkto.SkillPointsAdd(1100);
		Cred.CreditAmount +=90;
		talkto.ClientMessage("|p2Goal Completed! 1100 Skill Points and 90c awarded!");
		talkto.bInConv = False;
		talked = 0;
		return;
	}
	else if (talked == 99)
	{
		foreach AllActors(class'keydummy', hmm2)
		{
			if (talkto.HandleItemPickup(hmm2, True) == False)
			{
				talkto.ReceiveMessage("MAN: Make room in your inventory for the bomb.");
				talkto.bInConv = False;
				talked = 0;
				return;
			}
		}
		foreach AllActors(class'keydummy', hmm2)
		{
			if (talkto.HandleItemPickup(hmm2, True) == True)
			{
				talkto.ReceiveMessage("MAN: Need another bomb? Here");
				bTrade=True;
				talkto.SpawnItemz(Class'MissionBomb');
				bTrade=False;
				talked = 98;
				SetTimer(0.1,False);
				return;


			}
		}
	}
	else if (talked == 98)
	{
		talkto.bInConv = False;
		talked = 0;
		return;
	}
}


defaultproperties
{
     bfearAlarm=False
     bFearCarcass=False
     bFearDistress=False
     bFearShot=False
     bFearIndirectInjury=False
     Orders=Standing
     bInvincible=True
     bHateShot=False
     bHateInjury=False
     bReactPresence=False
     bEmitDistress=False
     CarcassType=Class'DeusEx.Male2Carcass'
     WalkingSpeed=0.296000
     walkAnimMult=0.750000
     GroundSpeed=200.000000
     Mesh=LodMesh'DeusExCharacters.GM_DressShirt'
     MultiSkins(0)=Texture'DeusExCharacters.Skins.JoeGreeneTex0'
     MultiSkins(1)=Texture'DeusExItems.Skins.PinkMaskTex'
     MultiSkins(2)=Texture'DeusExItems.Skins.PinkMaskTex'
     MultiSkins(3)=Texture'DeusExCharacters.Skins.NathanMadisonTex2'
     MultiSkins(4)=Texture'DeusExCharacters.Skins.JoeGreeneTex0'
     MultiSkins(5)=Texture'DeusExCharacters.Skins.MorganEverettTex1'
     MultiSkins(6)=Texture'DeusExItems.Skins.GrayMaskTex'
     MultiSkins(7)=Texture'DeusExItems.Skins.PinkMaskTex'
     CollisionRadius=20.000000
     CollisionHeight=47.500000
     BindName="Male2"
     FamiliarName="Male"
     UnfamiliarName="Male"
}
