using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using HG.Reflection;
using Mordekaiser;
using R2API;
using R2API.Utils;
using RoR2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HGStyledSurvivors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HGStyledSurvivors")]
[assembly: AssemblyTitle("HGStyledSurvivors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HGStyledSurvivors;
internal class Assets
{
public static AssetBundle MainAssetBundle;
public static T Load<T>(string name) where T : Object
{
return MainAssetBundle.LoadAsset<T>(name);
}
public static void PopulateAssets()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = executingAssembly.GetManifestResourceStream("HGStyledSurvivors.AssetBundle.hgstyled"))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.HGStyledSurvivors", "HGStyledSurvivors", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
public const string MODUID = "com.Dragonyck.HGStyledSurvivors";
public const string MODNAME = "HGStyledSurvivors";
public const string VERSION = "1.0.0";
private void Awake()
{
Assets.PopulateAssets();
}
private void Start()
{
if (ModCompat.MordekaiserEnabled)
{
ModCompat.AddMordSkin();
}
}
}
public static class ModCompat
{
private static bool? mordEnabled;
public static bool MordekaiserEnabled
{
get
{
if (!mordEnabled.HasValue)
{
mordEnabled = Chainloader.PluginInfos.ContainsKey("com.Dragonyck.Mordekaiser");
}
return mordEnabled.Value;
}
}
public static void AddMordSkin()
{
//IL_0055: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
ModelSkinController componentInChildren = Assets.MainAssetBundle.LoadAsset<GameObject>("Assets/MordekaiserAssets/mordekaiser.prefab").GetComponentInChildren<ModelSkinController>();
RendererInfo[] rendererInfos = componentInChildren.skins[0].rendererInfos;
SkinDef val = componentInChildren.skins[8];
componentInChildren.skins = (SkinDef[])(object)new SkinDef[1] { val };
List<Renderer> list = new List<Renderer>();
RendererInfo[] rendererInfos2 = val.rendererInfos;
foreach (RendererInfo val2 in rendererInfos2)
{
string name = ((Object)val2.renderer).name;
if (name.Contains("skin13"))
{
list.Add(val2.renderer);
val2.defaultMaterial.SetTexture("_MainTex", (Texture)(object)Assets.Load<Texture2D>("main"));
}
}
Material[] array = (Material[])(object)new Material[2];
Renderer[] componentsInChildren = ((Component)componentInChildren).GetComponentsInChildren<Renderer>();
foreach (Renderer val3 in componentsInChildren)
{
string name2 = ((Object)val3).name;
if (name2 == "skin13BodyFX" || name2 == "skin13FX")
{
val3.sharedMaterials[0].SetTexture("_MainTex", (Texture)(object)Assets.Load<Texture2D>("fx"));
val3.sharedMaterials[0].SetColor("_Color", new Color(0f, 0.86274f, 1f, 0.2549f));
val3.sharedMaterials[0].SetFloat("_Emission", 2f);
val3.sharedMaterials[1].SetColor("_Color", new Color(0.69411f, 1f, 0.89411f));
array[0] = val3.sharedMaterials[0];
array[1] = val3.sharedMaterials[1];
}
}
Renderer renderer = rendererInfos[1].renderer;
renderer.sharedMaterials = array;
rendererInfos = rendererInfos.Where((RendererInfo x, int index) => index != 2).ToArray();
val.nameToken = "Default";
val.icon = LoadoutAPI.CreateSkinIcon(new Color(46f / 85f, 46f / 51f, 32f / 51f), new Color(0.7450981f, 37f / 51f, 0.7686275f), new Color(0.2f, 0.1647059f, 0.2235294f), new Color(0.4f, 0.3686275f, 0.4392157f));
val.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[4]
{
new MeshReplacement
{
mesh = Assets.Load<Mesh>("skin13Crown"),
renderer = renderer
},
new MeshReplacement
{
mesh = Assets.Load<Mesh>("skin13Body"),
renderer = list[0]
},
new MeshReplacement
{
mesh = Assets.Load<Mesh>("skin13Mace"),
renderer = list[1]
},
new MeshReplacement
{
mesh = Assets.Load<Mesh>("skin13Module"),
renderer = list[2]
}
};
MainPlugin.characterPrefab.GetComponent<CharacterBody>().portraitIcon = (Texture)(object)Assets.Load<Sprite>("portrait").texture;
}
}