using System;
using System.Collections;
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 BepInEx.Configuration;
using HedgehogUtils.Forms;
using HedgehogUtils.Forms.SuperForm;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour.HookGen;
using On.RoR2;
using On.RoR2.UI;
using RoR2;
using RoR2.ContentManagement;
using RoR2.UI;
using ShaderSwapper;
using SonicTheHedgehog.SkillStates;
using UnityEngine;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AdventurousSkinForSonicTheHedgehog")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6b86163d135c8c08f2b6027868140f1c67a4fe8b")]
[assembly: AssemblyProduct("AdventurousSkinForSonicTheHedgehog")]
[assembly: AssemblyTitle("AdventurousSkinForSonicTheHedgehog")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace AdventurousSkinForSonicTheHedgehog
{
public class AdventurousSkinForSonicTheHedgehogContent : IContentPackProvider
{
[CompilerGenerated]
private sealed class <FinalizeAsync>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AdventurousSkinForSonicTheHedgehogContent <>4__this;
public FinalizeAsyncArgs args;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FinalizeAsync>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AdventurousSkinForSonicTheHedgehogContent adventurousSkinForSonicTheHedgehogContent = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
ShaderSwapping.SwapShaders();
adventurousSkinForSonicTheHedgehogContent.PopulateLoadedAssets();
((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)adventurousSkinForSonicTheHedgehogContent.BodyCatalogInit);
SoundReplacements.SetUpHooks();
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <GenerateContentPackAsync>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GetContentPackAsyncArgs args;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GenerateContentPackAsync>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
ContentPack.Copy(AdventurousSkinForSonicTheHedgehogContentPack, args.output);
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadStaticContentAsync>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LoadStaticContentAsyncArgs args;
private AssetBundleCreateRequest <asyncOperation>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadStaticContentAsync>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<asyncOperation>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<asyncOperation>5__2 = AssetBundle.LoadFromFileAsync(AdventurousSkinForSonicTheHedgehogMain.AssetBundleDir);
break;
case 1:
<>1__state = -1;
break;
}
if (!((AsyncOperation)<asyncOperation>5__2).isDone)
{
args.ReportProgress(((AsyncOperation)<asyncOperation>5__2).progress);
<>2__current = null;
<>1__state = 1;
return true;
}
Bundle = <asyncOperation>5__2.assetBundle;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static AssetBundle Bundle;
internal static Dictionary<AssetID, Object> LoadedAssets = new Dictionary<AssetID, Object>();
internal static ContentPack AdventurousSkinForSonicTheHedgehogContentPack { get; } = new ContentPack();
public static ReadOnlyContentPack ReadOnlyContentPack => new ReadOnlyContentPack(AdventurousSkinForSonicTheHedgehogContentPack);
public string identifier => "com.MushroomMerchant.AdventurousSkinforSonicTheHedgehog";
[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__9))]
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadStaticContentAsync>d__9(0)
{
args = args
};
}
[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__10))]
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GenerateContentPackAsync>d__10(0)
{
args = args
};
}
[IteratorStateMachine(typeof(<FinalizeAsync>d__11))]
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FinalizeAsync>d__11(0)
{
<>4__this = this,
args = args
};
}
internal static T GetLoadedAsset<T>(AssetID assetID) where T : Object
{
return (T)(object)LoadedAssets[assetID];
}
private void PopulateLoadedAssets()
{
LoadedAssets.Add(AssetID.AnimatorOverrideController, (Object)(object)Bundle.LoadAsset<AnimatorOverrideController>("Assets/Animation/SonicAdventurousAnimatorOverrideController.overrideController"));
LoadedAssets.Add(AssetID.PortraitIcon, (Object)(object)Bundle.LoadAsset<Texture2D>("Assets/Icons/texSASonicIcon.png"));
LoadedAssets.Add(AssetID.SkinIcon, (Object)(object)Bundle.LoadAsset<Sprite>("Assets/Icons/FromColors/texSonicAdventureSkinIcon.png"));
LoadedAssets.Add(AssetID.SonicMesh, (Object)(object)Bundle.LoadAsset<Mesh>("Assets/Imports/SASonicMesh.mesh"));
LoadedAssets.Add(AssetID.SonicMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASonic.mat"));
LoadedAssets.Add(AssetID.SonicBallMesh, (Object)(object)Bundle.LoadAsset<Mesh>("Assets/Imports/SASonicBallMesh.mesh"));
LoadedAssets.Add(AssetID.SonicBallMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASonicBall.mat"));
LoadedAssets.Add(AssetID.SonicBallVFXPrefab, (Object)(object)Bundle.LoadAsset<GameObject>("Assets/Imports/SASonicBallVFX.prefab"));
LoadedAssets.Add(AssetID.SonicBallVFXMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASonicBallVFX.mat"));
LoadedAssets.Add(AssetID.SonicBallParticleMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASonicBallParticle.mat"));
LoadedAssets.Add(AssetID.SuperSonicMesh, (Object)(object)Bundle.LoadAsset<Mesh>("Assets/Imports/SASuperSonicMesh2.mesh"));
LoadedAssets.Add(AssetID.SuperSonicMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASuperSonic.mat"));
LoadedAssets.Add(AssetID.SuperSonicBallMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASuperSonicBall.mat"));
LoadedAssets.Add(AssetID.SuperSonicBallVFXPrefab, (Object)(object)Bundle.LoadAsset<GameObject>("Assets/Materials/matSASuperSonicBallVFX.mat"));
LoadedAssets.Add(AssetID.SuperSonicBallVFXMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASuperSonicBallParticle.mat"));
LoadedAssets.Add(AssetID.SuperSonicBallParticleMaterial, (Object)(object)Bundle.LoadAsset<Material>("Assets/Materials/matSASuperSonicBallParticle.mat"));
}
private void BodyCatalogInit()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex = BodyCatalog.FindBodyIndex("SonicTheHedgehog");
SkinManagement.BodyCatalogInit();
AnimationChanges.BodyCatalogInit();
PortraitChanges.BodyCatalogInit();
}
private void AddSelf(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)this);
}
internal AdventurousSkinForSonicTheHedgehogContent()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddSelf);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.MushroomMerchant.AdventurousSkinforSonicTheHedgehog", "AdventurousSkinforSonicTheHedgehog", "1.0.1")]
public class AdventurousSkinForSonicTheHedgehogMain : BaseUnityPlugin
{
public const string GUID = "com.MushroomMerchant.AdventurousSkinforSonicTheHedgehog";
public const string AUTHOR = "MushroomMerchant";
public const string MOD_NAME = "AdventurousSkinforSonicTheHedgehog";
public const string VERSION = "1.0.1";
public const string BODY_NAME = "SonicTheHedgehog";
public const string BODY_NAME_TOKEN = "DS_GAMING_SONIC_THE_HEDGEHOG_BODY_NAME";
internal static BodyIndex SonicBodyIndex;
public static PluginInfo PluginInfo { get; private set; }
public static AdventurousSkinForSonicTheHedgehogMain Instance { get; private set; }
public static ConfigEntry<bool> ReplaceHomingImpactSoundConfig { get; set; }
public static ConfigEntry<BasicConfigConditionSetting> ApplyCustomPortraitForSkin { get; set; }
public static ConfigEntry<bool> BallFormForGrandSlamConfig { get; set; }
public static ConfigEntry<bool> BallFormForHomingAttackConfig { get; set; }
public static ConfigEntry<bool> BallFormForJumpConfig { get; set; }
public static ConfigEntry<bool> CurlVFXConfig { get; set; }
internal static AssetBundle AssetBundle { get; private set; }
internal static string AssetBundleDir => Path.Combine(Path.GetDirectoryName(PluginInfo.Location), "adventurousskinforsonicthehedgehogassets");
private void Awake()
{
Instance = this;
PluginInfo = ((BaseUnityPlugin)this).Info;
BindConfig();
new AdventurousSkinForSonicTheHedgehogContent();
}
private void Start()
{
LanguageSettings.AddLoadStringsHook();
}
private void OnGUI()
{
if (!((Object)(object)AdventurousSkinForSonicTheHedgehogContent.Bundle == (Object)null))
{
PortraitChanges.OnGUI();
}
}
private void BindConfig()
{
ReplaceHomingImpactSoundConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound Replacements: Homing Attack Impact", "ReplaceHomingImpactSound", true, "Replaces the metallic impact sound from landing a homing attack with a cartoony slap sound.\r\nThis replaces the sound for all skins.");
ApplyCustomPortraitForSkin = ((BaseUnityPlugin)this).Config.Bind<BasicConfigConditionSetting>("Texture Replacements: Custom Portrait", "ApplyCustomPortraitForSkin", BasicConfigConditionSetting.Depends, "Replaces Sonic's portrait with a custom one whenever the Adventurous skin is active.\r\nA value of \"Default\" means that under certain circumstances (e.g. portrait-replacing mods are installed) the portrait will not be replaced; otherwise it will be.\r\nThis replaces the texture for the Adventurous skin.");
BallFormForGrandSlamConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Mesh Replacements: Ball Form", "BallFormForGrandSlam", true, "Replaces Sonic's mesh with a sphere when performing the spindash at the beginning of his Grand Slam.\r\nThis replaces the mesh for the Adventurous skin.");
BallFormForHomingAttackConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Mesh Replacements: Ball Form", "BallFormForHomingAttack", true, "Replaces Sonic's mesh with a sphere when performing his Homing Attack.\r\nThis replaces the mesh for the Adventurous skin.");
BallFormForJumpConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Mesh Replacements: Ball Form", "BallFormForJump", false, "Replaces Sonic's mesh with a sphere when jumping.\r\nThis replaces the mesh for the Adventurous skin.");
CurlVFXConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("VFX: Curled Up (Jump, Homing Attack, Grand Slam)", "CurlVFX", true, "Adds a blue aura around Sonic when jumping and when performing a Homing Attack or a Grand Slam.\r\nThe aura also leaves a trail behind Sonic.\r\nThis adds the visual effect for the Adventurous skin.");
}
internal static void LogFatal(object data)
{
((BaseUnityPlugin)Instance).Logger.LogFatal(data);
}
internal static void LogError(object data)
{
((BaseUnityPlugin)Instance).Logger.LogError(data);
}
internal static void LogWarning(object data)
{
((BaseUnityPlugin)Instance).Logger.LogWarning(data);
}
internal static void LogMessage(object data)
{
((BaseUnityPlugin)Instance).Logger.LogMessage(data);
}
internal static void LogInfo(object data)
{
((BaseUnityPlugin)Instance).Logger.LogInfo(data);
}
internal static void LogDebug(object data)
{
((BaseUnityPlugin)Instance).Logger.LogDebug(data);
}
}
public class AnimationChanges
{
private enum AnimatorOverrideInPlace
{
Yes,
No
}
[CompilerGenerated]
private static class <>O
{
public static hook_Update <0>__Run_Update;
public static hook_Start <1>__ModelSkinController_Start;
}
private static readonly Dictionary<Animator, AnimatorOverrideInPlace> AdventurousSonicAnimators = new Dictionary<Animator, AnimatorOverrideInPlace>();
private static readonly Dictionary<Animator, ModelSkinController> AdventurousSonicAnimatorsToSkinControllers = new Dictionary<Animator, ModelSkinController>();
private static readonly Dictionary<ModelSkinController, Mesh> PreviousMeshesForSkinControllers = new Dictionary<ModelSkinController, Mesh>();
private static readonly Dictionary<ModelSkinController, Material> PreviousMaterialsForSkinControllers = new Dictionary<ModelSkinController, Material>();
private static readonly Dictionary<ModelSkinController, GameObject> PreviousVFXForSkinControllers = new Dictionary<ModelSkinController, GameObject>();
internal static void BodyCatalogInit()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
object obj = <>O.<0>__Run_Update;
if (obj == null)
{
hook_Update val = Run_Update;
<>O.<0>__Run_Update = val;
obj = (object)val;
}
Run.Update += (hook_Update)obj;
object obj2 = <>O.<1>__ModelSkinController_Start;
if (obj2 == null)
{
hook_Start val2 = ModelSkinController_Start;
<>O.<1>__ModelSkinController_Start = val2;
obj2 = (object)val2;
}
ModelSkinController.Start += (hook_Start)obj2;
}
private static void Run_Update(orig_Update orig, Run self)
{
ApplyAnimatorOverrideController();
ReplaceMeshWithBall();
ApplyVFX();
orig.Invoke(self);
}
private static void ModelSkinController_Start(orig_Start orig, ModelSkinController self)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (((ResourceAvailability)(ref BodyCatalog.availability)).available && !((Object)(object)self.characterModel == (Object)null) && !((Object)(object)self.characterModel.body == (Object)null) && self.characterModel.body.bodyIndex == AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex && (Object)(object)self.animator != (Object)null)
{
AdventurousSonicAnimators.Add(self.animator, AnimatorOverrideInPlace.No);
AdventurousSonicAnimatorsToSkinControllers.Add(self.animator, self);
}
}
internal static void ApplyAnimatorOverrideController()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
if ((Object)(object)AdventurousSkinForSonicTheHedgehogContent.Bundle == (Object)null)
{
return;
}
AnimatorOverrideController loadedAsset = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<AnimatorOverrideController>(AssetID.AnimatorOverrideController);
Dictionary<Animator, AnimatorOverrideInPlace> dictionary = new Dictionary<Animator, AnimatorOverrideInPlace>();
foreach (KeyValuePair<Animator, AnimatorOverrideInPlace> adventurousSonicAnimator in AdventurousSonicAnimators)
{
Animator key = adventurousSonicAnimator.Key;
AnimatorOverrideInPlace value = adventurousSonicAnimator.Value;
if (!((Object)(object)key == (Object)null) && value != 0 && AdventurousSonicAnimatorsToSkinControllers[key].currentSkinIndex == SkinManagement.AdventurousSkinIndex)
{
AnimatorOverrideController val = new AnimatorOverrideController(key.runtimeAnimatorController);
AnimationClip[] animationClips = ((RuntimeAnimatorController)loadedAsset).animationClips;
foreach (AnimationClip val2 in animationClips)
{
val[((Object)val2).name] = loadedAsset[((Object)val2).name];
}
key.runtimeAnimatorController = (RuntimeAnimatorController)(object)val;
dictionary.Add(key, AnimatorOverrideInPlace.Yes);
}
}
dictionary.ToList().ForEach(delegate(KeyValuePair<Animator, AnimatorOverrideInPlace> update)
{
AdventurousSonicAnimators[update.Key] = update.Value;
});
}
internal static void ApplyVFX()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<Animator, ModelSkinController> adventurousSonicAnimatorsToSkinController in AdventurousSonicAnimatorsToSkinControllers)
{
Animator key = adventurousSonicAnimatorsToSkinController.Key;
ModelSkinController value = adventurousSonicAnimatorsToSkinController.Value;
if (AdventurousSonicAnimators[key] != 0 || (Object)(object)key == (Object)null || !((Behaviour)key).isActiveAndEnabled)
{
continue;
}
AnimatorStateInfo currentAnimatorStateInfo = key.GetCurrentAnimatorStateInfo(0);
AnimatorStateInfo currentAnimatorStateInfo2 = key.GetCurrentAnimatorStateInfo(1);
bool flag = typeof(HomingAttack).IsAssignableFrom(((object)EntityStateMachine.FindByCustomName(((Component)value.characterModel.body).gameObject, "Body").state).GetType());
if ((((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).IsName("Ball") || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Jump") || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("BonusJump") || flag) && AdventurousSkinForSonicTheHedgehogMain.CurlVFXConfig.Value)
{
GameObject loadedAsset = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<GameObject>(AssetID.SonicBallVFXPrefab);
if (!PreviousVFXForSkinControllers.ContainsKey(value))
{
PreviousVFXForSkinControllers[value] = Object.Instantiate<GameObject>(loadedAsset, value.characterModel.coreTransform);
}
if (flag)
{
PreviousVFXForSkinControllers[value].GetComponent<TrailRenderer>().emitting = true;
}
else if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Jump") || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Ball") || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("BonusJump"))
{
PreviousVFXForSkinControllers[value].GetComponent<TrailRenderer>().emitting = false;
}
else
{
PreviousVFXForSkinControllers[value].GetComponent<TrailRenderer>().emitting = true;
}
ParticleSystem component = PreviousVFXForSkinControllers[value].GetComponent<ParticleSystem>();
MainModule main = component.main;
Particle[] array = (Particle[])(object)new Particle[((MainModule)(ref main)).maxParticles];
int particles = component.GetParticles(array);
for (int i = 0; i < particles; i++)
{
((Particle)(ref array[i])).position = new Vector3(0f, 0.01f, 0f);
}
component.SetParticles(array, particles);
}
else if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Ball") && PreviousVFXForSkinControllers.ContainsKey(value))
{
GameObject obj = PreviousVFXForSkinControllers[value];
PreviousVFXForSkinControllers.Remove(value);
Object.Destroy((Object)(object)obj);
}
if (PreviousVFXForSkinControllers.ContainsKey(value))
{
if (key.GetFloat("isSuperFloat") == 1f)
{
((Renderer)PreviousVFXForSkinControllers[value].GetComponent<TrailRenderer>()).material = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SuperSonicBallVFXMaterial);
((Renderer)((Component)PreviousVFXForSkinControllers[value].GetComponent<ParticleSystem>()).GetComponent<ParticleSystemRenderer>()).material = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SuperSonicBallParticleMaterial);
}
else
{
((Renderer)PreviousVFXForSkinControllers[value].GetComponent<TrailRenderer>()).material = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SonicBallVFXMaterial);
((Renderer)((Component)PreviousVFXForSkinControllers[value].GetComponent<ParticleSystem>()).GetComponent<ParticleSystemRenderer>()).material = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SonicBallParticleMaterial);
}
}
}
}
internal static void ReplaceMeshWithBall()
{
//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_005e: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<Animator, ModelSkinController> adventurousSonicAnimatorsToSkinController in AdventurousSonicAnimatorsToSkinControllers)
{
Animator key = adventurousSonicAnimatorsToSkinController.Key;
ModelSkinController value = adventurousSonicAnimatorsToSkinController.Value;
if (AdventurousSonicAnimators[key] != 0 || (Object)(object)key == (Object)null || !((Behaviour)key).isActiveAndEnabled)
{
continue;
}
key.GetCurrentAnimatorStateInfo(0);
AnimatorStateInfo currentAnimatorStateInfo = key.GetCurrentAnimatorStateInfo(1);
Type type = ((object)EntityStateMachine.FindByCustomName(((Component)value.characterModel.body).gameObject, "Body").state).GetType();
bool flag = typeof(HomingAttack).IsAssignableFrom(type) && ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Ball");
bool num = typeof(GrandSlamSpin).IsAssignableFrom(type) || typeof(GrandSlamDash).IsAssignableFrom(type);
bool @bool = key.GetBool("isBall");
bool flag2 = flag && AdventurousSkinForSonicTheHedgehogMain.BallFormForHomingAttackConfig.Value;
bool flag3 = @bool && AdventurousSkinForSonicTheHedgehogMain.BallFormForJumpConfig.Value;
bool flag4 = num && AdventurousSkinForSonicTheHedgehogMain.BallFormForGrandSlamConfig.Value;
if (flag2 || flag3 || flag4)
{
Mesh loadedAsset = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Mesh>(AssetID.SonicBallMesh);
Material val = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SonicBallMaterial);
Material loadedAsset2 = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SuperSonicBallMaterial);
if (key.GetFloat("isSuperFloat") == 1f)
{
val = loadedAsset2;
}
if ((Object)(object)value.characterModel.mainSkinnedMeshRenderer.sharedMesh != (Object)(object)loadedAsset)
{
PreviousMeshesForSkinControllers[value] = value.characterModel.mainSkinnedMeshRenderer.sharedMesh;
value.characterModel.mainSkinnedMeshRenderer.sharedMesh = loadedAsset;
PreviousMaterialsForSkinControllers[value] = value.characterModel.baseRendererInfos[0].defaultMaterial;
}
((Renderer)value.characterModel.mainSkinnedMeshRenderer).material = val;
value.characterModel.baseRendererInfos[0].defaultMaterial = val;
}
else if (PreviousMeshesForSkinControllers.ContainsKey(value) && PreviousMaterialsForSkinControllers.ContainsKey(value))
{
Mesh loadedAsset3 = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Mesh>(AssetID.SonicBallMesh);
if ((Object)(object)value.characterModel.mainSkinnedMeshRenderer.sharedMesh == (Object)(object)loadedAsset3)
{
value.characterModel.mainSkinnedMeshRenderer.sharedMesh = PreviousMeshesForSkinControllers[value];
}
if (key.GetFloat("isSuperFloat") < 1f && (Object)(object)PreviousMaterialsForSkinControllers[value] == (Object)(object)AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SuperSonicMaterial))
{
PreviousMaterialsForSkinControllers[value] = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SonicMaterial);
}
else if (key.GetFloat("isSuperFloat") == 1f && (Object)(object)PreviousMaterialsForSkinControllers[value] == (Object)(object)AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SonicMaterial))
{
PreviousMaterialsForSkinControllers[value] = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SuperSonicMaterial);
}
((Renderer)value.characterModel.mainSkinnedMeshRenderer).material = PreviousMaterialsForSkinControllers[value];
value.characterModel.baseRendererInfos[0].defaultMaterial = PreviousMaterialsForSkinControllers[value];
}
}
}
}
public enum AssetID
{
AnimatorOverrideController,
SkinIcon,
PortraitIcon,
SonicMaterial,
SonicMesh,
SonicBallMaterial,
SonicBallMesh,
SonicBallVFXPrefab,
SonicBallVFXMaterial,
SonicBallParticleMaterial,
SuperSonicMaterial,
SuperSonicMesh,
SuperSonicBallMaterial,
SuperSonicBallVFXPrefab,
SuperSonicBallVFXMaterial,
SuperSonicBallParticleMaterial
}
public enum BasicConfigConditionSetting
{
Never,
Depends,
Always
}
public class LanguageSettings
{
internal const string SKIN_NAME_TOKEN = "MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_NAME";
internal const string SKIN_FLAVOUR_TEXT_TOKEN = "MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_DESC";
internal static void AddLoadStringsHook()
{
HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action<Action<Language>, Language>(LoadStrings));
}
private static void LoadStrings(Action<Language> orig, Language self)
{
orig(self);
self.SetStringByToken("MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_NAME", "Adventurous");
self.SetStringByToken("MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_DESC", "Restless by nature, this hedgehog has an intense glint in his eye and an insatiable curiosity. As distinctive as his curved, deep-blue quills are, you'll still miss him if you blink.");
}
}
public class PortraitChanges
{
[CompilerGenerated]
private static class <>O
{
public static hook_GetSurvivorPortrait <0>__SurvivorCatalog_GetSurvivorPortrait;
public static hook_Awake <1>__SurvivorIconController_Awake;
public static hook_SetDisplayData <2>__GameEndReportPanelController_SetDisplayData;
public static hook_Awake <3>__CharacterBody_Awake;
}
private static Texture2D SonicSASurvivorIcon;
private static Texture2D SonicDefaultSurvivorIcon;
private static readonly List<SurvivorIconController> SurvivorIconControllers = new List<SurvivorIconController>();
private static readonly List<CharacterBody> CharacterBodies = new List<CharacterBody>();
private static readonly Dictionary<string, string> PlayerSonicSkinSelected = new Dictionary<string, string>();
internal static bool ApplyingCustomIcon()
{
if (AdventurousSkinForSonicTheHedgehogMain.ApplyCustomPortraitForSkin.Value == BasicConfigConditionSetting.Never)
{
return false;
}
if (Chainloader.PluginInfos.ContainsKey("DTEE.Icons") && AdventurousSkinForSonicTheHedgehogMain.ApplyCustomPortraitForSkin.Value == BasicConfigConditionSetting.Depends)
{
return false;
}
return true;
}
internal static void BodyCatalogInit()
{
LoadIcons();
IconReplacementHooks();
}
internal static void LoadIcons()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
if ((Object)(object)SonicSASurvivorIcon == (Object)null && (Object)(object)AdventurousSkinForSonicTheHedgehogContent.Bundle != (Object)null)
{
SonicSASurvivorIcon = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Texture2D>(AssetID.PortraitIcon);
}
if ((Object)(object)SonicDefaultSurvivorIcon == (Object)null && (Object)(object)BodyCatalog.FindBodyPrefab("SonicTheHedgehog") != (Object)null && (Object)(object)BodyCatalog.FindBodyPrefab("SonicTheHedgehog").GetComponent<CharacterBody>() != (Object)null)
{
SonicDefaultSurvivorIcon = (Texture2D)BodyCatalog.FindBodyPrefab("SonicTheHedgehog").GetComponent<CharacterBody>().portraitIcon;
}
}
internal static void IconReplacementHooks()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
object obj = <>O.<0>__SurvivorCatalog_GetSurvivorPortrait;
if (obj == null)
{
hook_GetSurvivorPortrait val = SurvivorCatalog_GetSurvivorPortrait;
<>O.<0>__SurvivorCatalog_GetSurvivorPortrait = val;
obj = (object)val;
}
SurvivorCatalog.GetSurvivorPortrait += (hook_GetSurvivorPortrait)obj;
object obj2 = <>O.<1>__SurvivorIconController_Awake;
if (obj2 == null)
{
hook_Awake val2 = SurvivorIconController_Awake;
<>O.<1>__SurvivorIconController_Awake = val2;
obj2 = (object)val2;
}
SurvivorIconController.Awake += (hook_Awake)obj2;
object obj3 = <>O.<2>__GameEndReportPanelController_SetDisplayData;
if (obj3 == null)
{
hook_SetDisplayData val3 = GameEndReportPanelController_SetDisplayData;
<>O.<2>__GameEndReportPanelController_SetDisplayData = val3;
obj3 = (object)val3;
}
GameEndReportPanelController.SetDisplayData += (hook_SetDisplayData)obj3;
object obj4 = <>O.<3>__CharacterBody_Awake;
if (obj4 == null)
{
hook_Awake val4 = CharacterBody_Awake;
<>O.<3>__CharacterBody_Awake = val4;
obj4 = (object)val4;
}
CharacterBody.Awake += (hook_Awake)obj4;
}
private static Texture SurvivorCatalog_GetSurvivorPortrait(orig_GetSurvivorPortrait orig, SurvivorIndex survivorIndex)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (ApplyingCustomIcon() && SkinCatalog.GetSkinDef((SkinIndex)LocalUserManager.GetFirstLocalUser().userProfile.loadout.bodyLoadoutManager.GetSkinIndex(AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex)).nameToken == "MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_NAME")
{
return (Texture)(object)SonicSASurvivorIcon;
}
return orig.Invoke(survivorIndex);
}
private static void SurvivorIconController_Awake(orig_Awake orig, SurvivorIconController self)
{
orig.Invoke(self);
if (ApplyingCustomIcon())
{
SurvivorIconControllers.Add(self);
}
}
private static void GameEndReportPanelController_SetDisplayData(orig_SetDisplayData orig, GameEndReportPanelController self, DisplayData newDisplayData)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, newDisplayData);
if (ApplyingCustomIcon())
{
PlayerInfo val = newDisplayData.runReport.playerInfos[newDisplayData.playerIndex];
if (val.bodyName == "SonicTheHedgehog" && PlayerSonicSkinSelected.ContainsKey(val.name) && PlayerSonicSkinSelected[val.name] == "MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_NAME")
{
self.playerBodyPortraitImage.texture = (Texture)(object)SonicSASurvivorIcon;
}
}
}
private static void CharacterBody_Awake(orig_Awake orig, CharacterBody self)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (ApplyingCustomIcon() && self.bodyIndex == AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex)
{
CharacterBodies.Add(self);
}
}
internal static void OnGUI()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Invalid comparison between Unknown and I4
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)SonicSASurvivorIcon == (Object)null || !ApplyingCustomIcon())
{
return;
}
SkinDef[] array = SkinCatalog.FindSkinsForBody(AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex);
int num = -1;
for (int i = 0; i < array.Length; i++)
{
if (array[i].nameToken == "MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_NAME")
{
num = i;
}
}
CharacterBodies.RemoveAll((CharacterBody characterBody) => (Object)(object)characterBody == (Object)null);
foreach (CharacterBody characterBody in CharacterBodies)
{
if (characterBody.skinIndex == num)
{
characterBody.portraitIcon = (Texture)(object)SonicSASurvivorIcon;
}
}
if ((Object)(object)Run.instance != (Object)null && Run.instance.isRunning && Run.instance.livingPlayerCount > 0)
{
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if ((Object)(object)instance == (Object)null || (Object)(object)instance.body == (Object)null || (Object)(object)instance.body.modelLocator == (Object)null || (Object)(object)instance.body.modelLocator.modelTransform == (Object)null || (Object)(object)((Component)instance.body.modelLocator.modelTransform).gameObject == (Object)null)
{
continue;
}
ModelSkinController component = ((Component)instance.body.modelLocator.modelTransform).gameObject.GetComponent<ModelSkinController>();
if ((Object)(object)component == (Object)null || (Object)(object)component.characterModel == (Object)null || (Object)(object)component.characterModel.body == (Object)null)
{
continue;
}
BodyIndex bodyIndex = component.characterModel.body.bodyIndex;
int currentSkinIndex = component.currentSkinIndex;
if (currentSkinIndex >= 0)
{
string nameToken = component.skins[currentSkinIndex].nameToken;
string displayName = instance.GetDisplayName();
if (bodyIndex == AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex)
{
PlayerSonicSkinSelected[displayName] = nameToken;
}
}
}
}
SurvivorIconControllers.RemoveAll((SurvivorIconController survivorIconController) => (Object)(object)survivorIconController == (Object)null || (Object)(object)survivorIconController.survivorIcon == (Object)null);
foreach (SurvivorIconController survivorIconController in SurvivorIconControllers)
{
if ((int)survivorIconController.survivorIndex != (int)SurvivorCatalog.bodyIndexToSurvivorIndex[AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex])
{
continue;
}
Texture texture = survivorIconController.survivorIcon.texture;
foreach (LocalUser localUsers in LocalUserManager.localUsersList)
{
texture = (Texture)(object)((localUsers.userProfile.loadout.bodyLoadoutManager.GetSkinIndex(AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex) != num) ? SonicDefaultSurvivorIcon : SonicSASurvivorIcon);
}
foreach (NetworkUser instances in NetworkUser.instancesList)
{
CharacterBody currentBody = instances.GetCurrentBody();
if (!((Object)(object)currentBody == (Object)null) && instances.networkLoadout.loadout.bodyLoadoutManager.GetSkinIndex(AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex) == num && currentBody.bodyIndex == AdventurousSkinForSonicTheHedgehogMain.SonicBodyIndex)
{
texture = (Texture)(object)SonicSASurvivorIcon;
}
}
survivorIconController.survivorIcon.texture = texture;
}
}
}
public class ShaderSwapping
{
public static void SwapShaders()
{
((MonoBehaviour)AdventurousSkinForSonicTheHedgehogMain.Instance).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(AdventurousSkinForSonicTheHedgehogContent.Bundle));
}
}
public class SkinManagement
{
internal static int AdventurousSkinIndex;
internal static void BodyCatalogInit()
{
AddAdventurousSkin();
}
private static void AddAdventurousSkin()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
string name = "Sonic Adventurous Skin";
GameObject gameObject = ((Component)BodyCatalog.FindBodyPrefab("SonicTheHedgehog").GetComponent<ModelLocator>().modelTransform).gameObject;
ModelSkinController component = gameObject.GetComponent<ModelSkinController>();
Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
gameObject.GetComponentsInChildren<Light>(true);
SkinDef val = ScriptableObject.CreateInstance<SkinDef>();
SkinDefParams val2 = ScriptableObject.CreateInstance<SkinDefParams>();
((Object)val).name = name;
val.nameToken = "MUSHROOMMERCHANT_SONIC_THE_HEDGEHOG_ADVENTUROUS_SKIN_NAME";
val.icon = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Sprite>(AssetID.SkinIcon);
val.rootObject = gameObject;
val.baseSkins = (SkinDef[])(object)new SkinDef[1] { ((IEnumerable<SkinDef>)component.skins).FirstOrDefault((Func<SkinDef, bool>)((SkinDef skin) => ((Object)skin).name == "DS_GAMING_SONIC_THE_HEDGEHOG_BODY_NAME")) };
val2.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]
{
new RendererInfo
{
defaultMaterial = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SonicMaterial),
defaultShadowCastingMode = (ShadowCastingMode)1,
ignoreOverlays = false,
renderer = ((IEnumerable<Renderer>)componentsInChildren).FirstOrDefault((Func<Renderer, bool>)((Renderer renderer) => ((Object)renderer).name == "SonicMesh"))
}
};
val2.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]
{
new MeshReplacement
{
mesh = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Mesh>(AssetID.SonicMesh),
renderer = ((IEnumerable<Renderer>)componentsInChildren).FirstOrDefault((Func<Renderer, bool>)((Renderer renderer) => ((Object)renderer).name == "SonicMesh"))
}
};
val.skinDefParams = val2;
Array.Resize(ref component.skins, component.skins.Length + 1);
component.skins[component.skins.Length - 1] = val;
AdventurousSkinIndex = component.skins.Length - 1;
AddAdventurousSuperFormSkin(val);
}
private static void AddAdventurousSuperFormSkin(SkinDef skinDef)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
Forms.AddSkinForForm(skinDef.nameToken, new RenderReplacements
{
material = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Material>(AssetID.SuperSonicMaterial),
mesh = AdventurousSkinForSonicTheHedgehogContent.GetLoadedAsset<Mesh>(AssetID.SuperSonicMesh)
}, ref SuperFormDef.superFormDef);
}
}
public class SoundReplacements : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static hook_PlaySound_string_GameObject <0>__Util_PlaySound_string_GameObject;
}
internal static void SetUpHooks()
{
//IL_0021: 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_002c: Expected O, but got Unknown
if (Chainloader.PluginInfos.ContainsKey("com.bepis.r2api.sound"))
{
object obj = <>O.<0>__Util_PlaySound_string_GameObject;
if (obj == null)
{
hook_PlaySound_string_GameObject val = Util_PlaySound_string_GameObject;
<>O.<0>__Util_PlaySound_string_GameObject = val;
obj = (object)val;
}
Util.PlaySound_string_GameObject += (hook_PlaySound_string_GameObject)obj;
}
}
private static uint Util_PlaySound_string_GameObject(orig_PlaySound_string_GameObject orig, string soundString, GameObject gameObject)
{
if ((Object)(object)gameObject != (Object)null && (Object)(object)gameObject.GetComponent<CharacterBody>() != (Object)null && gameObject.GetComponent<CharacterBody>().baseNameToken == "DS_GAMING_SONIC_THE_HEDGEHOG_BODY_NAME" && gameObject.GetComponent<CharacterBody>().skinIndex == SkinManagement.AdventurousSkinIndex)
{
switch (soundString)
{
case "Play_hedgehogutils_jump_ball":
soundString = "Play_sonicadventurous_jump_ball";
break;
case "Play_sonicthehedgehog_homing_attack":
soundString = "Play_sonicadventurous_homing_attack";
break;
case "Play_sonicthehedgehog_spindash_charge":
soundString = "Play_sonicadventurous_spindash_charge";
break;
case "Play_sonicthehedgehog_spindash_release":
soundString = "Play_sonicadventurous_spindash_release";
break;
case "Play_char_land":
soundString = "Play_sonicadventurous_land";
break;
case "Play_player_footstep":
soundString = "Play_sonicadventurous_footstep";
break;
case "Play_hedgehogutils_brake":
soundString = "Play_sonicadventurous_brake";
break;
case "Play_hedgehogutils_boost":
soundString = "Play_sonicadventurous_boost";
if (gameObject.GetComponent<CharacterBody>().HasBuff(SuperFormDef.superFormDef.buff))
{
soundString = "Play_sonicadventurous_super_boost";
}
break;
case "Play_sonicthehedgehog_swing":
soundString = "Play_sonicadventurous_swing";
break;
case "Play_sonicthehedgehog_swing_low":
soundString = "Play_sonicadventurous_swing_low";
break;
case "Play_sonicthehedgehog_swing_strong":
soundString = "Play_sonicadventurous_swing_strong";
break;
case "Play_hedgehogutils_emerald":
soundString = "Play_sonicadventurous_emerald";
break;
case "Play_hedgehogutils_super_transform":
soundString = "Play_sonicadventurous_super_transform";
break;
}
}
return orig.Invoke(soundString, gameObject);
}
}
}