using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MTFO.Managers;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("StrikerMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StrikerMode")]
[assembly: AssemblyTitle("StrikerMode")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace StrikerMode
{
internal class CustomVanity
{
public string Name { get; set; }
public ClothesType VanityItemType { get; set; }
public string Icon { get; set; }
public string VanityPrefab { get; set; }
public bool InternalEnabled { get; set; }
public CustomVanity()
{
Name = "";
Icon = "";
VanityPrefab = "";
}
}
internal class FacePatch
{
public static DefaultCharacterLayouts? m_instance;
public static DefaultCharacterLayouts GetNewDefaultCosmetics()
{
if ((Object)(object)m_instance == (Object)null)
{
m_instance = AssetAPI.GetLoadedAsset<DefaultCharacterLayouts>("Assets/CustomGear/CustomCharacterLayouts.asset");
}
return m_instance;
}
[HarmonyPatch(typeof(DefaultCharacterLayouts), "GetDefaultVanityItems")]
[HarmonyPrefix]
public static bool NewDefaultCosmetics(int characterIndex, ref Layout __result)
{
__result = ((Il2CppArrayBase<Layout>)(object)GetNewDefaultCosmetics().m_layout)[characterIndex];
return false;
}
}
[BepInPlugin("com.Brandont.StrikerMode", "StrikerMode", "1.0.0")]
public class Loader : BasePlugin
{
public const string MODNAME = "StrikerMode";
public const string AUTHOR = "Brandont";
public const string GUID = "com.Brandont.StrikerMode";
public const string VERSION = "1.0.0";
public static ManualLogSource Logger;
public static bool CustomVanityLoadedDone;
public override void Load()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
((BasePlugin)this).Log.LogMessage((object)"Loading StrikerMode");
Harmony val = new Harmony("StrikerMode");
val.PatchAll(typeof(FacePatch));
AssetAPI.OnAssetBundlesLoaded += delegate
{
CreateCustomVanities();
};
((BasePlugin)this).Log.LogMessage((object)"Loaded StrikerMode");
}
public static void CreateCustomVanities()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
VanitySerializer.Initialize();
foreach (CustomVanity item in VanitySerializer.VanityConfig)
{
if (item.InternalEnabled)
{
Debug.Log(Object.op_Implicit("Creating Custom Vanity for " + item.Name));
string vanityPrefab = item.VanityPrefab;
Debug.Log(Object.op_Implicit(vanityPrefab));
GenerateVanityItemDBEntry(item.Name, vanityPrefab, item.VanityItemType, item.Icon);
}
}
AssetAPI.OnAssetBundlesLoaded -= delegate
{
CreateCustomVanities();
};
CustomVanityLoadedDone = true;
}
public static void GenerateVanityItemDBEntry(string name, string prefab, ClothesType clothesType, string icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png")
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0037: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
VanityItemsTemplateDataBlock val = new VanityItemsTemplateDataBlock();
((GameDataBlockBase<VanityItemsTemplateDataBlock>)val).name = name;
val.publicName = name;
val.prefab = prefab;
val.type = clothesType;
val.icon = icon;
((GameDataBlockBase<VanityItemsTemplateDataBlock>)val).internalEnabled = true;
VanityItemsTemplateDataBlock val2 = val;
GameDataBlockBase<VanityItemsTemplateDataBlock>.AddBlock(val2, -1);
VanityItem val3 = new VanityItem
{
id = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)val2).persistentID,
prefab = prefab,
type = clothesType,
publicName = name,
flags = (VanityItemFlags)1
};
if (!PersistentInventoryManager.Current.GetVanityItemInventory().m_allItems.Contains(val3))
{
Debug.LogWarning(Object.op_Implicit(name + " didn't exist! Adding"));
PersistentInventoryManager.Current.GetVanityItemInventory().m_allItems.Add(val3);
}
Debug.Log(Object.op_Implicit("Added " + name + " to the datablocks"));
}
}
internal class VanitySerializer
{
public static string RootFilepath;
public static List<CustomVanity> VanityConfig;
public static JsonSerializerOptions Options = new JsonSerializerOptions
{
WriteIndented = true,
AllowTrailingCommas = true
};
public static void Initialize()
{
RootFilepath = Path.Combine(ConfigManager.CustomPath, "CustomVanity");
if (!Directory.Exists(RootFilepath))
{
Directory.CreateDirectory(RootFilepath);
}
SetupCustomDB("CustomVanity.json", FirstTimeSetupVanity(), out List<CustomVanity> dbContent);
VanityConfig = dbContent;
}
public static void SetupCustomDB(string fileName, List<CustomVanity> fileDefaults, out List<CustomVanity> dbContent)
{
string path = Path.Combine(RootFilepath, fileName);
if (File.Exists(path))
{
string json = File.ReadAllText(path);
dbContent = JsonSerializer.Deserialize<List<CustomVanity>>(json, Options);
}
else
{
dbContent = fileDefaults;
File.WriteAllText(path, JsonSerializer.Serialize(dbContent, Options));
}
}
public static List<CustomVanity> FirstTimeSetupVanity()
{
List<CustomVanity> list = new List<CustomVanity>();
CustomVanity item = new CustomVanity
{
Name = "Blank Helmet",
VanityItemType = (ClothesType)0,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/BlankPart.prefab"
};
CustomVanity item2 = new CustomVanity
{
Name = "Blank Legs",
VanityItemType = (ClothesType)2,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/BlankPart.prefab"
};
CustomVanity item3 = new CustomVanity
{
Name = "Blank Backpack",
VanityItemType = (ClothesType)3,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/BlankPart.prefab"
};
CustomVanity item4 = new CustomVanity
{
Name = "Striker Wave",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/StrikerBody.prefab"
};
CustomVanity item5 = new CustomVanity
{
Name = "Striker Hibernate",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/StrikerBodyHibernate.prefab"
};
CustomVanity item6 = new CustomVanity
{
Name = "Shooter Wave",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/ShooterBody.prefab"
};
CustomVanity item7 = new CustomVanity
{
Name = "Shooter Hibernate",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/ShooterBodyHibernate.prefab"
};
CustomVanity item8 = new CustomVanity
{
Name = "Charger",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/ChargerBody.prefab"
};
CustomVanity item9 = new CustomVanity
{
Name = "Hybrid",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/HybridBody.prefab"
};
CustomVanity item10 = new CustomVanity
{
Name = "Tank",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomGear/TankBody.prefab"
};
CustomVanity item11 = new CustomVanity
{
Name = "Hallowed Striker",
VanityItemType = (ClothesType)1,
Icon = "Assets/Source/UI/VanityItemIcons/Headgear001.png",
InternalEnabled = true,
VanityPrefab = "Assets/CustomZaero/HallowedStriker.prefab"
};
list.Add(item);
list.Add(item2);
list.Add(item3);
list.Add(item4);
list.Add(item5);
list.Add(item6);
list.Add(item7);
list.Add(item8);
list.Add(item9);
list.Add(item10);
list.Add(item11);
return list;
}
}
}