//=============================================================================
// XReplacer.
//=============================================================================
class XReplacer expands Keypoint config (XPickups);

var() config bool bAddAllChargers;

function PostBeginPlay()
{
local Inventory Inv, NewInv;
local Pawn P;

			
	if (class'XReplacer'.default.bAddAllChargers)
	{
		Level.Game.BaseMutator.AddMutator(Spawn(Class'XPickInternalMut'));
		return;
	}

	ForEach AllActors(Class'Inventory', Inv)
	{
		If (Inv.IsA('ImpactHammer') && !Inv.IsA('UBersImpactHammer'))
		{
			NewInv = Spawn(Class'UBersImpactHammer',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('ChainSaw') && !Inv.IsA('BersChainSaw'))
		{
			NewInv = Spawn(Class'BersChainSaw',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('Enforcer') && !Inv.IsA('UBersEnforcer'))
		{
			NewInv = Spawn(Class'UBersEnforcer',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UT_BioRifle') && !Inv.IsA('UBersUT_BioRifle'))
		{
			NewInv = Spawn(Class'UBersUT_BioRifle',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('ShockRifle') && !Inv.IsA('UBersShockRifle') && !Inv.IsA('SuperShockRifle'))
		{
			NewInv = Spawn(Class'UBersShockRifle',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('SuperShockRifle') && !Inv.IsA('UBersSuperShockRifle'))
		{
			NewInv = Spawn(Class'UBersSuperShockRifle',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('PulseGun') && !Inv.IsA('UBersPulseGun'))
		{
			NewInv = Spawn(Class'UBersPulseGun',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('Ripper') && !Inv.IsA('UBersRipper'))
		{
			NewInv = Spawn(Class'UBersRipper',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('minigun2') && !Inv.IsA('UBersMinigun2'))
		{
			NewInv = Spawn(Class'UBersMinigun2',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UT_FlakCannon') && !Inv.IsA('UBersUT_FlakCannon'))
		{
			NewInv = Spawn(Class'UBersUT_FlakCannon',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UT_EightBall') && !Inv.IsA('UBersUT_EightBall'))
		{
			NewInv = Spawn(Class'UBersUT_EightBall',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('SniperRifle') && !Inv.IsA('UBersSniperRifle'))
		{
			NewInv = Spawn(Class'UBersSniperRifle',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('WarHeadLauncher') && !Inv.IsA('UBersWarHeadLauncher'))
		{
			NewInv = Spawn(Class'UBersWarHeadLauncher',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('Translocator') && !Inv.IsA('UBersTranslocator'))
		{
			NewInv = Spawn(Class'UBersTranslocator',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UDamage') && !Inv.IsA('UBersUDamage'))
		{
			NewInv = Spawn(Class'UBersUDamage',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UT_Invisibility') && !Inv.IsA('UBersInvisibility'))
		{
			NewInv = Spawn(Class'UBersInvisibility',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('Armor2') && !Inv.IsA('UBersArmor'))
		{
			NewInv = Spawn(Class'UBersArmor',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UT_ShieldBelt') && !Inv.IsA('UBers_ShieldBelt'))
		{
			NewInv = Spawn(Class'UBers_ShieldBelt',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('ThighPads') && !Inv.IsA('UBersThighPads'))
		{
			NewInv = Spawn(Class'UBersThighPads',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		/*else If (Inv.IsA('HealthVial') && !Inv.IsA('NewVial'))
		{
			NewInv = Spawn(Class'NewVial',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}*/
		else If (Inv.IsA('HealthVial'))
			Inv.RespawnTime = 27.0;
		else If (Inv.IsA('MedBox') && !Inv.IsA('UBersHealthPack'))
		{
			NewInv = Spawn(Class'UBersHealthPack',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('HealthPack') && !Inv.IsA('UBersSuperHealth'))
		{
			NewInv = Spawn(Class'UBersSuperHealth',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('UT_JumpBoots') && !Inv.IsA('UBersJumpBoots'))
		{
			NewInv = Spawn(Class'UBersJumpBoots',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}

		else If (Inv.IsA('BulletBox') && !Inv.IsA('BulletBoxB') && !Inv.IsA('RifleShell'))
		{
			NewInv = Spawn(Class'BulletBoxB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('BioAmmo') && !Inv.IsA('BioAmmoB'))
		{
			NewInv = Spawn(Class'BioAmmoB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('ShockCore') && !Inv.IsA('ShockCoreB') && !Inv.IsA('SuperShockCore') && !Inv.IsA('USUSuperShockCore'))
		{
			NewInv = Spawn(Class'ShockCoreB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('PAmmo') && !Inv.IsA('PAmmoB'))
		{
			NewInv = Spawn(Class'PAmmoB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('BladeHopper') && !Inv.IsA('BladeHopperB'))
		{
			NewInv = Spawn(Class'BladeHopperB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('EClip') && !Inv.IsA('EClipB'))
		{
			NewInv = Spawn(Class'EClipB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('Miniammo') && !Inv.IsA('MiniammoB') && !Inv.IsA('EClip'))
		{
			NewInv = Spawn(Class'MiniammoB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('FlakAmmo') && !Inv.IsA('FlakAmmoB'))
		{
			NewInv = Spawn(Class'FlakAmmoB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}
		else If (Inv.IsA('RocketPack') && !Inv.IsA('RocketPackB'))
		{
			NewInv = Spawn(Class'RocketPackB',,, Inv.Location, Inv.Rotation);
			NewInv.bRotatingPickup = Inv.bRotatingPickup;
		}

		if (Inv.MyMarker != None && NewInv != None)
		{
			NewInv.MyMarker = Inv.MyMarker;
			NewInv.MyMarker.markedItem = NewInv;
			NewInv = None;
			Inv.MyMarker = None;
			Inv.Destroy();
		}

		
	}	

	Level.Game.BaseMutator.AddMutator(Spawn(Class'UBersDefault'));
}


defaultproperties
{
	bStatic=False
	bAlwaysRelevant=True
	bAddAllChargers=True
}
