## XIIIMP
Class MarioMutator

source: C:\XIII\XIIIMP\Classes\MarioMutator.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--Engine.Mutator
                |
                +--XIIIMP.XIIIMPMutator
                   |
                   +--XIIIMP.MarioMutator

Direct Known Subclasses:None

class MarioMutator
extends XIIIMP.XIIIMPMutator

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`class` | `ArmorAndMedKitInventoryType[7]`
`int` | `ArmorAndMedKitNumber,SmallWeaponNumber,HeavyWeaponNumber`
`string` | `ArmorAndMedKitPickupMessage[7]`
`string` | `ArmorAndMedKitPickupName`
`sound` | `ArmorAndMedKitPickupSound[7]`
`class` | `HeavyWeaponInventoryType[7]`
`string` | `HeavyWeaponPickupMessage[7]`
`string` | `HeavyWeaponPickupName`
`sound` | `HeavyWeaponPickupSound[7]`
`string` | `MarioSuperBonusName`
`class` | `SmallWeaponInventoryType[7]`
`string` | `SmallWeaponPickupMessage[7]`
`string` | `SmallWeaponPickupName`
`sound` | `SmallWeaponPickupSound[7]`

Function Summary
`bool` | `CheckReplacement(Actor Other, out byte)`
    //______________________________________________________________________________
`void` | `InitItemsLists()`
    //______________________________________________________________________________
`bool` | `IsItemInTheList(int ListId, Pickup Test)`
    //______________________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class MarioMutator extends XIIIMPMutator;
    00005
    00006	var class<Inventory> HeavyWeaponInventoryType[7];
    00007	var localized string HeavyWeaponPickupMessage[7];
    00008	var sound HeavyWeaponPickupSound[7];
    00009
    00010	var class<Inventory> SmallWeaponInventoryType[7];
    00011	var localized string SmallWeaponPickupMessage[7];
    00012	var sound SmallWeaponPickupSound[7];
    00013
    00014	var class<Inventory> ArmorAndMedKitInventoryType[7];
    00015	var localized string ArmorAndMedKitPickupMessage[7];
    00016	var sound ArmorAndMedKitPickupSound[7];
    00017
    00018	var int ArmorAndMedKitNumber,SmallWeaponNumber,HeavyWeaponNumber;
    00019
    00020	var string HeavyWeaponPickupName;
    00021	var string SmallWeaponPickupName;
    00022	var string ArmorAndMedKitPickupName;
    00023	var string MarioSuperBonusName;
    00024
    00025	//______________________________________________________________________________
    00026	function bool IsItemInTheList( int ListId, PickUp Test )
    00027	{
    00028	    local int Loop;
    00029	    local bool Result;
    00030
    00031	    Result = false;
    00032
    00033	    switch( ListId )
    00034	    {
    00035	        case 0 : //Heavy Weapon
    00036	            for( Loop = 0; Loop<HeavyWeaponNumber;Loop++)
    00037	            {
    00038	                if( HeavyWeaponInventoryType[ Loop ] == Test.InventoryType )
    00039	                {
    00040	                    Result = true;
    00041	                    break;
    00042	                }
    00043	            }
    00044
    00045	            break;
    00046	        case 1 : //Small Weapon
    00047	            for( Loop = 0; Loop<SmallWeaponNumber;Loop++)
    00048	            {
    00049	                if( SmallWeaponInventoryType[ Loop ] == Test.InventoryType )
    00050	                {
    00051	                    Result = true;
    00052	                    break;
    00053	                }
    00054	            }
    00055
    00056	            break;
    00057	        case 2 : //Armor And MedKit
    00058	            for( Loop = 0; Loop<ArmorAndMedKitNumber;Loop++)
    00059	            {
    00060	                if( ArmorAndMedKitInventoryType[ Loop ] == Test.InventoryType )
    00061	                {
    00062	                    Result = true;
    00063	                    break;
    00064	                }
    00065	            }
    00066
    00067	            break;
    00068	    }
    00069
    00070	    return Result;
    00071	}
    00072
    00073	//______________________________________________________________________________
    00074
    00075	function InitItemsLists()
    00076	{
    00077	    local PickUp A;
    00078
    00079	    foreach DynamicActors(class'PickUp', A)
    00080	    {
    00081	        if( XIIIWeaponPickUp(A) != none )
    00082	        {
    00083	            if( XIIIWeaponPickUp(A).MaxDesireability != 10 ) // Fusil de Chasse present pour les dynamic loading
    00084	            {
    00085	                if( XIIIWeaponPickUp(A).MaxDesireability < 3 )
    00086	                {
    00087	                    if( ! IsItemInTheList( 0 , A ) )
    00088	                    {
    00089	                        HeavyWeaponInventoryType[ HeavyWeaponNumber ] = A.InventoryType;
    00090	                        HeavyWeaponPickupMessage[ HeavyWeaponNumber ] = A.PickupMessage;
    00091	                        HeavyWeaponPickupSound[ HeavyWeaponNumber ] = A.PickupSound;
    00092	                        HeavyWeaponNumber++;
    00093	                    }
    00094	                }
    00095	                else
    00096	                {
    00097	                    if( ! IsItemInTheList( 1 , A ) )
    00098	                    {
    00099	                        SmallWeaponInventoryType[ SmallWeaponNumber ] = A.InventoryType;
    00100	                        SmallWeaponPickupMessage[ SmallWeaponNumber ] = A.PickupMessage;
    00101	                        SmallWeaponPickupSound[ SmallWeaponNumber ] = A.PickupSound;
    00102	                        SmallWeaponNumber++;
    00103	                    }
    00104	                }
    00105	            }
    00106	        }
    00107	        else if( ( XIIIArmorPickUp(A) != none ) || ( MultiPlayerMedPickUp(A) != none ) )
    00108	        {
    00109	            if( ! IsItemInTheList( 2 , A ) )
    00110	            {
    00111	                ArmorAndMedKitInventoryType[ ArmorAndMedKitNumber ] = A.InventoryType;
    00112	                ArmorAndMedKitPickupMessage[ ArmorAndMedKitNumber ] = A.PickupMessage;
    00113	                ArmorAndMedKitPickupSound[ ArmorAndMedKitNumber ] = A.PickupSound;
    00114	                ArmorAndMedKitNumber++;
    00115	            }
    00116	        }
    00117	    }
    00118	}
    00119
    00120	//______________________________________________________________________________
    00121
    00122	event PreBeginPlay()
    00123	{
    00124	    local int Loop;
    00125
    00126	    InitItemsLists();
    00127	}
    00128
    00129	//______________________________________________________________________________
    00130
    00131	function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    00132	{
    00133	    if ( DBMutator ) Log("MUTATOR CheckReplacement for"@Other);
    00134
    00135	    if ( (Level.Game != none) && Level.Game.bWaitingToStartMatch )
    00136	    {
    00137	      if ( XIIIWeaponPickup(Other) != none )
    00138	      {
    00139	        if( XIIIWeaponPickUp(Other).MaxDesireability > 2 )
    00140	          ReplaceWith(Other, SmallWeaponPickupName);
    00141	        else
    00142	          ReplaceWith(Other, HeavyWeaponPickupName);
    00143	      }
    00144	      else if( XIIIArmorPickUp(Other) != none )
    00145	      {
    00146	        ReplaceWith(Other, ArmorAndMedKitPickupName);
    00147	      }
    00148	      else if( MultiPlayerMedPickUp(Other) != none )
    00149	      {
    00150	        ReplaceWith(Other, MarioSuperBonusName);
    00151	      }
    00152	      else if( XIIIAmmoPick(Other) != none )
    00153	      {
    00154	        Other.Destroy();
    00155	      }
    00156	    }
    00157
    00158	    return true;
    00159	}
    00160
    00161	//______________________________________________________________________________
    00162
    00163
    00164
    00165	defaultproperties
    00166	{
    00167	     HeavyWeaponPickupName="XIIIMP.MarioHeavyWeaponPickUp"
    00168	     SmallWeaponPickupName="XIIIMP.MarioSmallWeaponPickUp"
    00169	     ArmorAndMedKitPickupName="XIIIMP.MarioArmorAndMedKitPickUp"
    00170	     MarioSuperBonusName="XIIIMP.MarioSuperBonusPickUp"
    00171	}

End Source Code