Ejemplo n.º 1
0
 /// <summary>
 /// Clear inventory cheat enabled
 /// </summary>
 static void ClearInventoryEnabled(MyGameplayCheat cheat)
 {
     if (MySession.PlayerShip != null)
     {
         MySession.PlayerShip.Inventory.ClearInventoryItems(true);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Remove all blueprints cheat implementation
 /// </summary>
 static void RemoveAllBluePrintsEnabled(MyGameplayCheat cheat)
 {
     if (MyGuiScreenGamePlay.Static != null)
     {
         MyGuiScreenGamePlay.Static.RemoveAllBlueprints();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Kill all cheat implementation
        /// </summary>
        static void KillAllEnabled(MyGameplayCheat cheat)
        {
            // We need player ship to recognize friends
            if (MySession.PlayerShip == null)
            {
                return;
            }

            foreach (var entity in MyEntities.GetEntities().ToArray())
            {
                MySmallShip smallShip = entity as MySmallShip;
                if (smallShip != null &&
                    smallShip.Visible &&
                    smallShip != MySession.PlayerShip &&
                    MyFactions.GetFactionsRelation(MySession.PlayerShip, smallShip) == MyFactionRelationEnum.Enemy)
                {
                    entity.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null);
                }

                MyPrefabContainer container = entity as MyPrefabContainer;
                if (container != null &&
                    MyFactions.GetFactionsRelation(MySession.PlayerShip, container) == MyFactionRelationEnum.Enemy)
                {
                    foreach (var prefab in container.GetPrefabs().ToArray())
                    {
                        MyPrefabLargeWeapon largeWeapon = prefab as MyPrefabLargeWeapon;
                        if (largeWeapon != null)
                        {
                            prefab.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Extra money cheat implementation
 /// </summary>
 static void ExtraMoneyEnabled(MyGameplayCheat cheat)
 {
     if (MySession.Static != null && MySession.Static.Player != null)
     {
         MySession.Static.Player.Money += 1000000;
     }
 }
Ejemplo n.º 5
0
        public static void EnableCheat(MyGameplayCheatsEnum cheat, bool enable)
        {
            MyGameplayCheat?foundedCheatItem = GetCheat(cheat);

            Debug.Assert(foundedCheatItem != null);
            MyGameplayCheat cheatItem = foundedCheatItem.Value;

            if (enable)
            {
                m_enabledCheats |= cheat;

                if (cheatItem.OnCheatEnabled != null)
                {
                    cheatItem.OnCheatEnabled(cheatItem);
                }
            }
            else
            {
                m_enabledCheats &= ~cheat;

                if (cheatItem.OnCheatDisabled != null)
                {
                    cheatItem.OnCheatDisabled(cheatItem);
                }
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Clear inventory cheat enabled
 /// </summary>
 static void FFInInventoryEnabled(MyGameplayCheat cheat)
 {
     if (MySession.PlayerShip != null)
     {
         if (!MySession.PlayerShip.Inventory.Contains(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT))
         {
             MySession.PlayerShip.Inventory.AddInventoryItem(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT, 1.0f, true);
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Disabled increase cargo capacity cheat implementation
        /// </summary>
        /// <param name="cheat"></param>
        static void IncreaseCargoCapacityDisabled(MyGameplayCheat cheat)
        {
            if (MySession.PlayerShip == null)
            {
                return;
            }

            MySession.PlayerShip.Inventory.MaxItems = MySession.PlayerShip.ShipTypeProperties.GamePlay.CargoCapacity;
            //MySession.PlayerShip.Inventory.UnlimitedCapacity = false;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Enable increase cargo capacity cheat implementation
        /// </summary>
        /// <param name="cheat"></param>
        static void IncreaseCargoCapacityEnabled(MyGameplayCheat cheat)
        {
            if (MySession.PlayerShip == null)
            {
                return;
            }

            //MySession.PlayerShip.Inventory.UnlimitedCapacity = true;
            MySession.PlayerShip.Inventory.MaxItems = MyGamePlayCheatsConstants.CHEAT_INCREASE_CARGO_CAPACITY_MAX_ITEMS;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// All weapons cheat implementation
        /// </summary>
        static void AllWeaponsEnabled(MyGameplayCheat cheat)
        {
            if (MySession.PlayerShip == null)
            {
                return;
            }

            List <MyMwcObjectBuilder_SmallShip_Weapon> weapons        = new List <MyMwcObjectBuilder_SmallShip_Weapon>();
            List <MyMwcObjectBuilder_AssignmentOfAmmo> ammoAssignment = new List <MyMwcObjectBuilder_AssignmentOfAmmo>();
            List <MyMwcObjectBuilder_InventoryItem>    inventoryItems = new List <MyMwcObjectBuilder_InventoryItem>();

            // weapons
            foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum)))
            {
                weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon));
                // we want have 2x autocanon
                if (weapon == MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon)
                {
                    weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon));
                }
            }

            // ammo assignment
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic));



            MySession.PlayerShip.Weapons.Init(weapons, ammoAssignment);

            foreach (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum)))
            {
                MyMwcObjectBuilder_InventoryItem item = new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(ammo), MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)ammo, MySession.PlayerShip.Faction).MaxAmount);
                if (!MySession.PlayerShip.Inventory.IsFull)
                {
                    MySession.PlayerShip.Inventory.AddInventoryItem(MyInventory.CreateInventoryItemFromInventoryItemObjectBuilder(item));
                }
            }
        }
Ejemplo n.º 10
0
        void AddCheat(MyGameplayCheat cheat)
        {
            bool enabled = MyGuiScreenGamePlay.Static.CheatsEnabled() && cheat.IsImplemented;
            MyGuiControlBase control;
            if (cheat.IsButton)
            {
                if (!m_lastWasButton) m_currentPosition.Y += 0.005f * m_scale;
                m_lastWasButton = true;
                control = AddButton(MyTextsWrapper.Get(cheat.CheatName), onCheatButtonClick, textColor: Vector4.One, size: new Vector2(0.20f, 0.04f));
            }
            else
            {
                if (m_lastWasButton) m_currentPosition.Y += 0.005f * m_scale;
                m_lastWasButton = false;
                control = AddCheckBox(cheat.CheatName, MyGameplayCheats.IsCheatEnabled(cheat.CheatEnum), OnCheatCheckedChanged, enabled, color: Vector4.One);
            }

            control.UserData = cheat;

            control.Enabled = enabled;
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Clear inventory cheat enabled
 /// </summary>
 static void FFInInventoryEnabled(MyGameplayCheat cheat)
 {
     if (MySession.PlayerShip != null)
     {
         if (!MySession.PlayerShip.Inventory.Contains(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT))
         {
             MySession.PlayerShip.Inventory.AddInventoryItem(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT, 1.0f, true);
         }
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Kill all cheat implementation
        /// </summary>
        static void KillAllEnabled(MyGameplayCheat cheat)
        {
            // We need player ship to recognize friends
            if (MySession.PlayerShip == null)
            {
                return;
            }

            foreach (var entity in MyEntities.GetEntities().ToArray())
            {
                MySmallShip smallShip = entity as MySmallShip;
                if (smallShip != null &&
                    smallShip.Visible &&
                    smallShip != MySession.PlayerShip &&
                    MyFactions.GetFactionsRelation(MySession.PlayerShip, smallShip) == MyFactionRelationEnum.Enemy)
                {
                    entity.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null);
                }

                MyPrefabContainer container = entity as MyPrefabContainer;
                if (container != null &&
                    MyFactions.GetFactionsRelation(MySession.PlayerShip, container) == MyFactionRelationEnum.Enemy)
                {
                    foreach (var prefab in container.GetPrefabs().ToArray())
                    {
                        MyPrefabLargeWeapon largeWeapon = prefab as MyPrefabLargeWeapon;
                        if (largeWeapon != null)
                        {
                            prefab.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null);
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Clear inventory cheat enabled
 /// </summary>
 static void ClearInventoryEnabled(MyGameplayCheat cheat)
 {
     if (MySession.PlayerShip != null)
     {
         MySession.PlayerShip.Inventory.ClearInventoryItems(true);
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Remove all blueprints cheat implementation
 /// </summary>
 static void RemoveAllBluePrintsEnabled(MyGameplayCheat cheat)
 {
     if (MyGuiScreenGamePlay.Static != null)
     {
         MyGuiScreenGamePlay.Static.RemoveAllBlueprints();
     }
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Extra money cheat implementation
 /// </summary>
 static void ExtraMoneyEnabled(MyGameplayCheat cheat)
 {
     if (MySession.Static != null && MySession.Static.Player != null)
     {
         MySession.Static.Player.Money += 1000000;
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// All weapons cheat implementation
        /// </summary>
        static void AllWeaponsEnabled(MyGameplayCheat cheat)
        {
            if (MySession.PlayerShip == null)
                return;

            List<MyMwcObjectBuilder_SmallShip_Weapon> weapons = new List<MyMwcObjectBuilder_SmallShip_Weapon>();
            List<MyMwcObjectBuilder_AssignmentOfAmmo> ammoAssignment = new List<MyMwcObjectBuilder_AssignmentOfAmmo>();
            List<MyMwcObjectBuilder_InventoryItem> inventoryItems = new List<MyMwcObjectBuilder_InventoryItem>();

            // weapons
            foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum)))
            {
                weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon));
                // we want have 2x autocanon
                if (weapon == MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon)
                {
                    weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon));
                }
            }

            // ammo assignment
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart));
            ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic));



            MySession.PlayerShip.Weapons.Init(weapons, ammoAssignment);
            
            foreach (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum)))
            {
                MyMwcObjectBuilder_InventoryItem item = new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(ammo), MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)ammo, MySession.PlayerShip.Faction).MaxAmount);
                if(!MySession.PlayerShip.Inventory.IsFull)
                    MySession.PlayerShip.Inventory.AddInventoryItem(MyInventory.CreateInventoryItemFromInventoryItemObjectBuilder(item));
            }

        }
Ejemplo n.º 17
0
        /// <summary>
        /// Disabled increase cargo capacity cheat implementation
        /// </summary>
        /// <param name="cheat"></param>
        static void IncreaseCargoCapacityDisabled(MyGameplayCheat cheat) 
        {
            if (MySession.PlayerShip == null)
                return;

            MySession.PlayerShip.Inventory.MaxItems = MySession.PlayerShip.ShipTypeProperties.GamePlay.CargoCapacity;
            //MySession.PlayerShip.Inventory.UnlimitedCapacity = false;            
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Enable increase cargo capacity cheat implementation
        /// </summary>
        /// <param name="cheat"></param>
        static void IncreaseCargoCapacityEnabled(MyGameplayCheat cheat) 
        {
            if (MySession.PlayerShip == null)
                return;

            //MySession.PlayerShip.Inventory.UnlimitedCapacity = true;
            MySession.PlayerShip.Inventory.MaxItems = MyGamePlayCheatsConstants.CHEAT_INCREASE_CARGO_CAPACITY_MAX_ITEMS;
        }