Please disclose if your mod was created primarily 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 JimbacalaItems v0.0.4
JimbacalaItems.dll
Decompiled 5 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using JimbacalaItems.Behaviours; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("JimbacalaItems")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JimbacalaItems")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("55cfc195-6941-4ccf-b996-fb75058f1546")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace JimbacalaItems { [BepInPlugin("Jimbacala.JimbacalaItems", "Jimbacala Items", "0.0.4")] public class Plugin : BaseUnityPlugin { public static readonly List<string> ItemAssetNames = new List<string> { "MarrBall", "SKRoll", "MarrHead", "GabePill", "DinglePainting", "WhenSheTouchYoDingaling", "12Biscuit", "HotDog" }; public static ConfigEntry<int> marrBallEntityDamage; public static ConfigEntry<int> marrBallEmployeeDamage; public static ConfigEntry<int> marrBallExplosionChance; public static ConfigEntry<int> hotDogEntityDamage; public static ConfigEntry<int> hotDogEmployeeDamage; private AssetBundle bundle; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("jimbacala.hotdog").PatchAll(); marrBallEntityDamage = ((BaseUnityPlugin)this).Config.Bind<int>("MarrBall", "MarrBall Entity Damage", 5, "The shovel does 1 damage to entities"); marrBallEmployeeDamage = ((BaseUnityPlugin)this).Config.Bind<int>("MarrBall", "MarrBall Employee Damage", 35, "The shovel does 20 damage to employees"); marrBallExplosionChance = ((BaseUnityPlugin)this).Config.Bind<int>("MarrBall", "MarrBall Explosion Chance", 30, "There is a one in __ chance this will exlpode when dropped"); hotDogEntityDamage = ((BaseUnityPlugin)this).Config.Bind<int>("HotDog", "Hot Dog Entity Damage", 2, "The shovel does 1 damage to entities"); hotDogEmployeeDamage = ((BaseUnityPlugin)this).Config.Bind<int>("HotDog", "Hot Dog Entity Damage", 20, "The shovel does 20 damage to employees"); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemmod"); bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)bundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[Jimbacala Items] Failed to load bundle!"); return; } foreach (string itemAssetName in ItemAssetNames) { RegisterItem(itemAssetName); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Jimbacala Items] Jimbacala items are Jimbacaloaded!"); } private void RegisterItem(string assetName) { //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Invalid comparison between Unknown and I4 //IL_054c: Unknown result type (might be due to invalid IL or missing references) Item val = bundle.LoadAsset<Item>(assetName); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("[Jimbacala Items] Could not find " + assetName + " in bundle!")); return; } string text = assetName + " Spawn"; ConfigEntry<string> val2 = ((BaseUnityPlugin)this).Config.Bind<string>(text, "MoonRarities", assetName switch { "DinglePainting" => "experimentation:0,assurance:0,vow:0,offense:0,march:0,adamance:0,rend:38,dine:38,titan:45,embrion:30,artifice:30", "MarrBall" => "experimentation:1,assurance:1,vow:1,offense:1,march:25,adamance:1,rend:12,dine:11,titan:15,embrion:5,artifice:25", "SKRoll" => "experimentation:20,assurance:20,vow:25,offense:15,march:10,adamance:5,rend:5,dine:5,titan:5,embrion:0,artifice:0", "MarrHead" => "experimentation:15,assurance:5,vow:5,offense:5,march:35,adamance:5,rend:5,dine:5,titan:5,embrion:5,artifice:15", "GabePill" => "experimentation:15,assurance:15,vow:15,offense:25,march:15,adamance:15,rend:15,dine:15,titan:15,embrion:15,artifice:15", "WhenSheTouchYoDingaling" => "experimentation:10,assurance:12,vow:13,offense:15,march:5,adamance:15,rend:38,dine:38,titan:45,embrion:30,artifice:30", "12Biscuit" => "experimentation:20,assurance:20,vow:25,offense:15,march:10,adamance:5,rend:5,dine:5,titan:5,embrion:0,artifice:0", "HotDog" => "experimentation:20,assurance:25,vow:20,offense:25,march:20,adamance:35,rend:5,dine:5,titan:5,embrion:12,artifice:10", _ => "experimentation:0,assurance:0,vow:0,offense:0,march:0,adamance:0,rend:0,dine:0,titan:0,embrion:0,artifice:0", }, "Per-moon rarities for " + assetName + ". Format: MOON:RARITY"); Dictionary<string, int> dictionary = ParseMoonRarities(val2.Value); int num = 0; int num2 = 0; switch (assetName) { case "DinglePainting": num = 100; num2 = 120; break; case "MarrBall": num = 70; num2 = 90; break; case "SKRoll": num = 25; num2 = 35; break; case "MarrHead": num = 64; num2 = 75; break; case "GabePill": num = 34; num2 = 40; break; case "WhenSheTouchYoDingaling": num = 90; num2 = 100; break; case "12Biscuit": num = 25; num2 = 35; break; case "HotDog": num = 25; num2 = 35; break; default: num = 0; num2 = 0; break; } ConfigEntry<int> val3 = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Minimum Price Value", num, "Minimum Scrap Value for " + assetName); ConfigEntry<int> val4 = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Maximum Price Value", num2, "Maximum Scrap Value for " + assetName); switch (assetName) { case "WhenSheTouchYoDingaling": { GameObject spawnPrefab = val.spawnPrefab; if ((Object)(object)spawnPrefab == (Object)null) { return; } UVAnimator uVAnimator = spawnPrefab.GetComponent<UVAnimator>() ?? spawnPrefab.AddComponent<UVAnimator>(); uVAnimator.columns = 2; uVAnimator.rows = 2; uVAnimator.fps = 1f; uVAnimator.materialIndex = 1; break; } } if (dictionary.Count == 0) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[Jimbacala Items] " + assetName + " has no MoonRarities, disabled everywhere")); return; } foreach (KeyValuePair<string, int> item in dictionary) { string key = item.Key; int value = item.Value; LevelTypes levelTypeFromName = GetLevelTypeFromName(key); if ((int)levelTypeFromName == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Jimbacala Items] Unknown moon '" + key + "' for " + assetName)); } else if (value > 0) { Item val5 = Object.Instantiate<Item>(val); ((Object)val5).name = ((Object)val).name + "_On_" + key; val.minValue = (int)((float)val3.Value / 0.4f); val.maxValue = (int)((float)val4.Value / 0.4f); Utilities.FixMixerGroups(val5.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab); Items.RegisterScrap(val5, value, levelTypeFromName); } } } private Dictionary<string, int> ParseMoonRarities(string configStr) { Dictionary<string, int> dictionary = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); if (string.IsNullOrWhiteSpace(configStr)) { return dictionary; } string[] array = configStr.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { ':' }); if (array3.Length == 2 && int.TryParse(array3[1].Trim(), out var result)) { string text2 = array3[0].Trim().ToLowerInvariant(); if (text2.EndsWith("level")) { text2 = text2.Substring(0, text2.Length - 5); } dictionary[text2] = Mathf.Max(0, result); } } return dictionary; } private LevelTypes GetLevelTypeFromName(string moonName) { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) return (LevelTypes)(moonName.ToLowerInvariant() switch { "experimentation" => 4, "assurance" => 8, "vow" => 16, "offense" => 32, "march" => 64, "rend" => 128, "dine" => 256, "titan" => 512, "adamance" => 2048, "embrion" => 8192, "artifice" => 4096, _ => 0, }); } } } namespace JimbacalaItems.Behaviours { public class HotDogAttack : PhysicsProp { public int enemyDamage = 8; public int playerDamage = 25; public void InitializeFromConfig() { enemyDamage = Plugin.hotDogEntityDamage.Value; playerDamage = Plugin.hotDogEmployeeDamage.Value; } public override void Start() { ((GrabbableObject)this).Start(); } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTipMultiple(new string[1] { "Swing: [LMB]" }, true, ((GrabbableObject)this).itemProperties); } } } public class MarrBall : GrabbableObject { [Header("MarrBall Settings")] public float kickForce = 0.5f; public AnimationCurve fallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f); public AnimationCurve verticalCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); public AudioClip[] kickSounds; public AudioSource ballAudio; private float fallTime = 0f; private Vector3 startFallPos; private Vector3 targetFallPos; private bool isFalling = false; private int lastKickedBy = -1; private void Awake() { base.grabbable = true; base.grabbableToEnemies = true; base.itemProperties = ((Component)this).GetComponent<Item>(); } public override void ActivatePhysicsTrigger(Collider other) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!base.isHeld && !isFalling && (((Component)other).CompareTag("Player") || ((Component)other).CompareTag("Enemy")) && !Physics.Linecast(((Component)other).transform.position + Vector3.up, ((Component)this).transform.position + Vector3.up * 0.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Vector3 fromPos = ((Component)other).transform.position + Vector3.up; BeginKick(fromPos); } } private void BeginKick(Vector3 fromPos) { //IL_0011: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_003a: 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_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { Vector3 val = CalculateKickDestination(fromPos); if (!(val == Vector3.zero)) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; bool flag = ((Bounds)(ref bounds)).Contains(val); Transform val2 = (flag ? StartOfRound.Instance.elevatorTransform : StartOfRound.Instance.propsContainer); val = val2.InverseTransformPoint(val); KickBallClientRpc(val, flag); } } } private Vector3 CalculateKickDestination(Vector3 fromPos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //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_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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - fromPos; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = kickForce; Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(((Component)this).transform.position + Vector3.up * 0.22f, normalized * 12f); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, 12f, ~LayerMask.GetMask(new string[2] { "Player", "Enemy" }))) { return ((RaycastHit)(ref val3)).point + ((RaycastHit)(ref val3)).normal * 0.1f; } return ((Component)this).transform.position + normalized * 10f; } [ClientRpc] private void KickBallClientRpc(Vector3 localDest, bool inShip) { //IL_0044: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) if (!base.isHeld) { PlayKickSound(); Transform val = (inShip ? StartOfRound.Instance.elevatorTransform : StartOfRound.Instance.propsContainer); ((Component)this).transform.SetParent(val, true); startFallPos = val.InverseTransformPoint(((Component)this).transform.position); targetFallPos = localDest; fallTime = 0f; isFalling = true; base.hasHitGround = false; ((MonoBehaviour)this).StartCoroutine(KickCoroutine()); } } private IEnumerator KickCoroutine() { while (fallTime < 1f) { fallTime += Time.deltaTime * 3f; float t = fallCurve.Evaluate(fallTime); Vector3 pos = Vector3.Lerp(startFallPos, targetFallPos, t); pos.y += verticalCurve.Evaluate(fallTime) * 2f; ((Component)this).transform.localPosition = pos; yield return null; } ((Component)this).transform.localPosition = targetFallPos; isFalling = false; ((GrabbableObject)this).PlayDropSFX(); } public override void PlayDropSFX() { if (Object.op_Implicit((Object)(object)ballAudio) && kickSounds.Length != 0) { ballAudio.PlayOneShot(kickSounds[Random.Range(0, kickSounds.Length)]); } ((GrabbableObject)this).PlayDropSFX(); } private void PlayKickSound() { if (Object.op_Implicit((Object)(object)ballAudio) && kickSounds.Length != 0) { ballAudio.pitch = Random.Range(0.9f, 1.1f); ballAudio.PlayOneShot(kickSounds[Random.Range(0, kickSounds.Length)]); } } } public class UVAnimator : MonoBehaviour { [Header("Animation Settings")] public int columns = 2; public int rows = 2; public float fps = 1f; [Header("Which Material Slot? (0 = first, 1 = second, etc.)")] public int materialIndex = 1; private Renderer targetRenderer; private Material targetMaterial; private int currentFrame = 0; private float timer = 0f; private void Start() { targetRenderer = ((Component)this).GetComponentInChildren<Renderer>(); if ((Object)(object)targetRenderer == (Object)null) { Debug.LogError((object)("[UVAnimator] No Renderer found on " + ((Object)((Component)this).gameObject).name)); } else if (materialIndex >= targetRenderer.sharedMaterials.Length) { Debug.LogError((object)$"[UVAnimator] Material index {materialIndex} out of range on {((Object)((Component)this).gameObject).name} (has {targetRenderer.sharedMaterials.Length} materials)"); } else { targetMaterial = targetRenderer.materials[materialIndex]; } } private void Update() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) timer += Time.deltaTime * fps; if (timer >= 1f) { timer = 0f; currentFrame = (currentFrame + 1) % (columns * rows); } int num = currentFrame % columns; int num2 = currentFrame / columns; targetMaterial.mainTextureOffset = new Vector2((float)num / (float)columns, (float)num2 / (float)rows); targetMaterial.mainTextureScale = new Vector2(1f / (float)columns, 1f / (float)rows); } } }