Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Overwatch v1.2.0
BepInEx/plugins/Overwatch.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using ModelReplacement; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Overwatch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Overwatch")] [assembly: AssemblyTitle("Overwatch")] [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.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; } } [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 Overwatch { public class Dva : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Dva"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Dva asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Dva asset loaded successfully."); } return val; } } public class Reinhardt : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Reinhardt"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Reinhardt asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Reinhardt asset loaded successfully."); } return val; } } public class Genji : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Genji"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Genji asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Genji asset loaded successfully."); } return val; } } public class Hanzo : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Hanzo"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Hanzo asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Hanzo asset loaded successfully."); } return val; } } public class Ana : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Ana"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Ana asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Ana asset loaded successfully."); } return val; } } public class Mei : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Mei"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Mei asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Mei asset loaded successfully."); } return val; } } public class Reaper : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Reaper"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Reaper asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Reaper asset loaded successfully."); } return val; } } public class Torbjorn : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Torbjorn"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Torbjorn asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Torbjorn asset loaded successfully."); } return val; } } public class Tracer : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Tracer"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Tracer asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Tracer asset loaded successfully."); } return val; } } public class Widowmaker : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Windowmaker"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Windowmaker asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Windowmaker asset loaded successfully."); } return val; } } public class Lucio : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Lucio"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Lucio asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Lucio asset loaded successfully."); } return val; } } public class Mercy : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Mercy"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Mercy asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Mercy asset loaded successfully."); } return val; } } public class Moira : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Moira"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Moira asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Moira asset loaded successfully."); } return val; } } public class Ashe : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Ashe"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Ashe asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Ashe asset loaded successfully."); } return val; } } public class Bob : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Bob"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Bob asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Bob asset loaded successfully."); } return val; } } public class Brigitte : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Brigitte"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Brigitte asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Brigitte asset loaded successfully."); } return val; } } public class Hammond : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Hammond"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Hammond asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Hammond asset loaded successfully."); } return val; } } public class Ramattra : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Ramattra"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Ramattra asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Ramattra asset loaded successfully."); } return val; } } public class Zenyatta : BodyReplacementBase { protected override GameObject? LoadAssetsAndReturnModel() { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Zenyatta"); if ((Object)(object)val == (Object)null) { Overwatch.Logger.LogError((object)"Zenyatta asset is not found in the asset bundle."); } else { Overwatch.Logger.LogInfo((object)"Zenyatta asset loaded successfully."); } return val; } } [BepInPlugin("nordbo.Overwatch", "Overwatch", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Overwatch : BaseUnityPlugin { public static Overwatch Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; string location = Assembly.GetExecutingAssembly().Location; string directoryName = Path.GetDirectoryName(location); Assets.PopulateAssets(directoryName); if ((Object)(object)Assets.mainAssetBundle == (Object)null) { Logger.LogError((object)"Asset bundle failed to load."); return; } RegisterModels(); Patch(); Logger.LogInfo((object)"Overwatch v1.0.0 has loaded!"); } private void RegisterModels() { if ((Object)(object)Assets.mainAssetBundle != (Object)null) { ModelReplacementAPI.RegisterSuitModelReplacement("Hanzo", typeof(Hanzo)); ModelReplacementAPI.RegisterSuitModelReplacement("Genji", typeof(Genji)); ModelReplacementAPI.RegisterSuitModelReplacement("Brigitte", typeof(Brigitte)); ModelReplacementAPI.RegisterSuitModelReplacement("Hammond", typeof(Hammond)); ModelReplacementAPI.RegisterSuitModelReplacement("Dva", typeof(Dva)); ModelReplacementAPI.RegisterSuitModelReplacement("Reinhardt", typeof(Reinhardt)); ModelReplacementAPI.RegisterSuitModelReplacement("Ana", typeof(Ana)); ModelReplacementAPI.RegisterSuitModelReplacement("Mei", typeof(Mei)); ModelReplacementAPI.RegisterSuitModelReplacement("Reaper", typeof(Reaper)); ModelReplacementAPI.RegisterSuitModelReplacement("Torbjorn", typeof(Torbjorn)); ModelReplacementAPI.RegisterSuitModelReplacement("Tracer", typeof(Tracer)); ModelReplacementAPI.RegisterSuitModelReplacement("Widowmaker", typeof(Widowmaker)); ModelReplacementAPI.RegisterSuitModelReplacement("Lucio", typeof(Lucio)); ModelReplacementAPI.RegisterSuitModelReplacement("Mercy", typeof(Mercy)); ModelReplacementAPI.RegisterSuitModelReplacement("Moira", typeof(Moira)); ModelReplacementAPI.RegisterSuitModelReplacement("Ashe", typeof(Ashe)); ModelReplacementAPI.RegisterSuitModelReplacement("Bob", typeof(Bob)); ModelReplacementAPI.RegisterSuitModelReplacement("Ramattra", typeof(Ramattra)); ModelReplacementAPI.RegisterSuitModelReplacement("Zenyatta", typeof(Zenyatta)); } else { Logger.LogError((object)"Asset bundle failed to load."); } } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Overwatch"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } } public static class Assets { public static string mainAssetBundleName = "overwatch"; public static AssetBundle mainAssetBundle; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(',')[0]; } public static AudioClip? GetAudioClipFromName(string name) { Object obj = mainAssetBundle.LoadAsset(name); return (AudioClip?)(object)((obj is AudioClip) ? obj : null); } public static void PopulateAssets(string path) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and O if ((object)(Object)mainAssetBundle == null) { mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(path, mainAssetBundleName)); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Overwatch"; public const string PLUGIN_NAME = "Overwatch"; public const string PLUGIN_VERSION = "1.0.0"; } }