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 UrbanKarma v1.0.0
UrbanKarmaMod.dll
Decompiled 4 hours 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 Microsoft.CodeAnalysis; using R2API; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [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("UrbanKarmaMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("UrbanKarmaMod")] [assembly: AssemblyTitle("UrbanKarmaMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 UrbanKarma { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.score.UrbanKarma", "UrbanKarma", "1.0.0")] public class UrbanKarmaPlugin : BaseUnityPlugin { public const string PluginGUID = "com.score.UrbanKarma"; public const string PluginAuthor = "score"; public const string PluginName = "UrbanKarma"; public const string PluginVersion = "1.0.0"; private CustomItem timbsCustomItem; private ItemDef timbsItem; private ItemDisplayRuleDict timbsItemDisplayRules; private GameObject timbsDisplayLeft; private GameObject timbsDisplayRight; private Material timbsMat; public static UrbanKarmaPlugin instance { get; private set; } public void Awake() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown instance = this; Log.Init(((BaseUnityPlugin)this).Logger); LoadAssets(); InitDef(); InitDisplayRules(); timbsCustomItem = new CustomItem(timbsItem, timbsItemDisplayRules); ItemAPI.Add(timbsCustomItem); CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_007f: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance) && Run.instance.lastCachedKarma >= 1 && (body.bodyIndex == BodyPrefabs.BrotherBody.bodyIndex || body.bodyIndex == BodyPrefabs.BrotherHurtBody.bodyIndex || body.bodyIndex == BodyPrefabs.BrotherThroneBody.bodyIndex || body.bodyIndex == BodyPrefabs.ITBrotherBody.bodyIndex) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCountPermanent(timbsItem) == 0) { body.inventory.GiveItemPermanent(timbsItem, 1); } } private void LoadAssets() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "urbankarma"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Failed to load AssetBundle at path: " + text); } timbsDisplayLeft = val.LoadAsset<GameObject>("TimbsDisplayLeft"); timbsDisplayRight = val.LoadAsset<GameObject>("TimbsDisplayRight"); timbsMat = val.LoadAsset<Material>("matTimbs"); if ((Object)(object)timbsDisplayLeft == (Object)null || (Object)(object)timbsDisplayRight == (Object)null || (Object)(object)timbsMat == (Object)null) { throw new InvalidOperationException("Failed to load item displays from AssetBundle."); } TrySwapShader(timbsMat); SwapAllShaders(timbsDisplayLeft); SwapAllShaders(timbsDisplayRight); } private void SwapAllShaders(GameObject prefab) { ItemDisplay component = prefab.GetComponent<ItemDisplay>(); component.rendererInfos[0].defaultMaterial = timbsMat; component.rendererInfos[0].renderer.material = timbsMat; } internal void TrySwapShader(Material material) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) string name = ((Object)material.shader).name; if (name.Contains("Stubbed")) { name = name.Replace("Stubbed", string.Empty) + ".shader"; Shader val = Addressables.LoadAssetAsync<Shader>((object)name).WaitForCompletion(); if ((Object)(object)val != (Object)null) { material.shader = val; } else { Log.Error("Failed to load shader " + name); } } else if (name == "Standard") { Texture texture = material.GetTexture("_BumpMap"); float num = material.GetFloat("_BumpScale"); Texture texture2 = material.GetTexture("_EmissionMap"); material.shader = Resources.Load<Shader>("Shaders/Deferred/HGStandard"); material.SetTexture("_NormalMap", texture); material.SetFloat("_NormalStrength", num); material.SetTexture("_EmTex", texture2); material.SetColor("_EmColor", new Color(0.2f, 0.2f, 0.2f)); material.SetFloat("_EmPower", 0.15f); } } private void InitDef() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) timbsItem = ScriptableObject.CreateInstance<ItemDef>(); ((Object)timbsItem).name = "TIMBS_ITEMDEF"; timbsItem.nameToken = "TIMBS_ITEMDEF_NAME"; timbsItem.descriptionToken = "TIMBS_ITEMDEF_DESCRIPTION"; timbsItem.loreToken = "TIMBS_ITEMDEF_LORE"; timbsItem.hidden = true; timbsItem.deprecatedTier = (ItemTier)5; timbsItem.canRemove = false; } private void InitDisplayRules() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: 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_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Expected O, but got Unknown //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Expected O, but got Unknown //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Expected O, but got Unknown //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) timbsItemDisplayRules = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); timbsItemDisplayRules.Add("BrotherBody", (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayLeft, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootL", localPos = new Vector3(-0.02117f, -0.02679f, 0.00808f), localAngles = new Vector3(272.9624f, 202.3929f, 67.7466f), localScale = new Vector3(1f, 1f, 1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayRight, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootR", localPos = new Vector3(0.00667f, -0.05313f, -0.00189f), localAngles = new Vector3(271.4802f, 26.32492f, 63.41698f), localScale = new Vector3(1f, 1f, 1f) } }); timbsItemDisplayRules.Add("BrotherHurtBody", (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayLeft, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootL", localPos = new Vector3(-0.02117f, -0.02679f, 0.00808f), localAngles = new Vector3(272.9624f, 202.3929f, 67.7466f), localScale = new Vector3(1f, 1f, 1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayRight, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootR", localPos = new Vector3(0.00667f, -0.05313f, -0.00189f), localAngles = new Vector3(271.4802f, 26.32492f, 63.41698f), localScale = new Vector3(1f, 1f, 1f) } }); timbsItemDisplayRules.Add("BrotherThroneBody", (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayLeft, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootL", localPos = new Vector3(-0.0294f, -0.02679f, 0.00792f), localAngles = new Vector3(288.9983f, 101.6923f, 178.1803f), localScale = new Vector3(1f, 1f, 1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayRight, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootR", localPos = new Vector3(0.00667f, -0.05313f, -0.00189f), localAngles = new Vector3(271.4783f, 26.32446f, 63.41711f), localScale = new Vector3(1f, 1f, 1f) } }); timbsItemDisplayRules.Add("ITBrotherBody", (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayLeft, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootL", localPos = new Vector3(-0.02117f, -0.02679f, 0.00808f), localAngles = new Vector3(272.9624f, 202.3929f, 67.7466f), localScale = new Vector3(1f, 1f, 1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = timbsDisplayRight, followerPrefabAddress = new AssetReferenceGameObject(""), childName = "FootR", localPos = new Vector3(0.00667f, -0.05313f, -0.00189f), localAngles = new Vector3(271.4802f, 26.32492f, 63.41698f), localScale = new Vector3(1f, 1f, 1f) } }); } } }