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 KawummPack v1.0.2
KawummPack.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace KawummPack; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("ThomasPlays.KawummPack", "KawummPack", "1.0.2")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static string Dir; internal static AudioClip Hiss; internal static AudioClip[] Booms = (AudioClip[])(object)new AudioClip[3]; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Dir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Hiss = WavLoader.Load("fuse_hiss.wav"); Booms[0] = WavLoader.Load("explode_50.wav"); Booms[1] = WavLoader.Load("explode_250.wav"); Booms[2] = WavLoader.Load("explode_5000.wav"); ((Component)this).gameObject.AddComponent<KawummBootstrap>(); Log.LogInfo((object)("KawummPack 1.0.2 geladen (Hiss: " + ((Object)(object)Hiss != (Object)null) + ", Booms: " + ((Object)(object)Booms[0] != (Object)null) + "/" + ((Object)(object)Booms[1] != (Object)null) + "/" + ((Object)(object)Booms[2] != (Object)null) + ")")); } internal static byte[] LoadBytes(string file) { try { string path = Path.Combine(Dir, Path.Combine("assets", file)); if (File.Exists(path)) { return File.ReadAllBytes(path); } string path2 = Path.Combine(Dir, file); if (File.Exists(path2)) { return File.ReadAllBytes(path2); } Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(file); if (manifestResourceStream == null) { Log.LogWarning((object)("Asset fehlt (Datei + Resource): " + file)); return null; } using MemoryStream memoryStream = new MemoryStream(); byte[] array = new byte[81920]; int count; while ((count = manifestResourceStream.Read(array, 0, array.Length)) > 0) { memoryStream.Write(array, 0, count); } return memoryStream.ToArray(); } catch (Exception ex) { Log.LogError((object)("Asset-Fehler " + file + ": " + ex.Message)); return null; } } } public class KawummTier { public string Name; public string Label; public string Icon; public int Price; public float Scale; public float Size; public int Damage; public int EnemyDamage; public float Force; public float Shake; public float Investigate; public int ClipIndex; public float Mass; } public class KawummBootstrap : MonoBehaviour { private bool done; private float retryTimer; private static readonly List<Object> keep = new List<Object>(); private static readonly string[] TexProps = new string[4] { "_MainTex", "_BaseMap", "_BaseColorMap", "_AlbedoTex" }; private static readonly string[] ColProps = new string[3] { "_Color", "_BaseColor", "_Tint" }; private static readonly string[] FallbackShaders = new string[7] { "Standard", "Universal Render Pipeline/Lit", "Universal Render Pipeline/Simple Lit", "Universal Render Pipeline/Unlit", "Unlit/Texture", "Sprites/Default", "UI/Default" }; private static KawummTier[] Tiers() { KawummTier kawummTier = new KawummTier(); kawummTier.Name = "Kawumm 50"; kawummTier.Label = "label_50.png"; kawummTier.Icon = "icon_50.png"; kawummTier.Price = 150; kawummTier.Scale = 1f; kawummTier.Size = 2f; kawummTier.Damage = 40; kawummTier.EnemyDamage = 150; kawummTier.Force = 2f; kawummTier.Shake = 1f; kawummTier.Investigate = 15f; kawummTier.ClipIndex = 0; kawummTier.Mass = 0.5f; KawummTier kawummTier2 = new KawummTier(); kawummTier2.Name = "Kawumm 250"; kawummTier2.Label = "label_250.png"; kawummTier2.Icon = "icon_250.png"; kawummTier2.Price = 500; kawummTier2.Scale = 1.5f; kawummTier2.Size = 4f; kawummTier2.Damage = 70; kawummTier2.EnemyDamage = 400; kawummTier2.Force = 3.5f; kawummTier2.Shake = 2f; kawummTier2.Investigate = 30f; kawummTier2.ClipIndex = 1; kawummTier2.Mass = 1.6f; KawummTier kawummTier3 = new KawummTier(); kawummTier3.Name = "Kawumm 5000"; kawummTier3.Label = "label_5000.png"; kawummTier3.Icon = "icon_5000.png"; kawummTier3.Price = 1800; kawummTier3.Scale = 2.5f; kawummTier3.Size = 8f; kawummTier3.Damage = 100; kawummTier3.EnemyDamage = 9999; kawummTier3.Force = 6f; kawummTier3.Shake = 4f; kawummTier3.Investigate = 60f; kawummTier3.ClipIndex = 2; kawummTier3.Mass = 4f; return new KawummTier[3] { kawummTier, kawummTier2, kawummTier3 }; } private void Update() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 if (done) { return; } retryTimer -= Time.deltaTime; if (retryTimer > 0f) { return; } retryTimer = 1f; StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null || instance.itemDictionary == null || instance.itemDictionary.Count == 0) { return; } Item val = null; int num = -1; foreach (KeyValuePair<string, Item> item in instance.itemDictionary) { Item value = item.Value; if (!((Object)(object)value == (Object)null) && (int)value.itemType == 6) { string text = ((value.itemName != null) ? value.itemName.ToLower() : ""); int num2 = 0; if (!text.Contains("duct") && !text.Contains("human") && !text.Contains("stun")) { num2 = 1; } if (text.Contains("explosive")) { num2 = 2; } if (num2 > num) { num = num2; val = value; } } } if ((Object)(object)val == (Object)null) { return; } GameObject val2 = null; try { if (val.prefab != null) { val2 = ((PrefabRef<GameObject>)(object)val.prefab).Prefab; } } catch (Exception) { return; } if ((Object)(object)val2 == (Object)null) { return; } try { KawummTier[] array = Tiers(); for (int i = 0; i < array.Length; i++) { BuildOne(val, val2, array[i]); } Plugin.Log.LogInfo((object)("KawummPack: 3 Items registriert (Quelle: " + val.itemName + ")")); } catch (Exception ex2) { Plugin.Log.LogError((object)("KawummPack Build-Fehler: " + ex2)); } done = true; } private static void BuildOne(Item src, GameObject srcPrefab, KawummTier t) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) Item val = Object.Instantiate<Item>(src); ((Object)val).name = "Item " + t.Name; val.itemName = t.Name; val.itemNameLocalized = null; val.value = Object.Instantiate<Value>(src.value); val.value.valueMin = t.Price; val.value.valueMax = t.Price; val.maxAmount = 10; val.maxAmountInShop = 4; val.maxPurchase = false; val.disabled = false; keep.Add((Object)(object)val); GameObject val2 = Object.Instantiate<GameObject>(srcPrefab); ((Object)val2).name = "Item " + t.Name; val2.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val2); val2.transform.localScale = val2.transform.localScale * t.Scale; keep.Add((Object)(object)val2); ItemAttributes component = val2.GetComponent<ItemAttributes>(); component.item = val; Texture2D val3 = LoadTex(t.Icon); if ((Object)(object)val3 != (Object)null) { component.icon = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 100f); } ItemGrenade componentInChildren = val2.GetComponentInChildren<ItemGrenade>(true); if ((Object)(object)componentInChildren != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren); } Material val4 = null; MeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<MeshRenderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)val4 == (Object)null && (Object)(object)((Renderer)componentsInChildren[i]).sharedMaterial != (Object)null) { val4 = ((Renderer)componentsInChildren[i]).sharedMaterial; } ((Renderer)componentsInChildren[i]).enabled = false; } if ((Object)(object)val4 != (Object)null && t.ClipIndex == 0) { Plugin.Log.LogInfo((object)("KawummPack Basis-Shader: " + ((Object)val4.shader).name)); } BuildVisual(val2, t, val4); Rigidbody component2 = val2.GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null && t.Mass > 0f) { component2.mass = t.Mass; component2.angularDrag = 0.4f; } KawummFuse kawummFuse = val2.AddComponent<KawummFuse>(); kawummFuse.size = t.Size; kawummFuse.damage = t.Damage; kawummFuse.enemyDamage = t.EnemyDamage; kawummFuse.force = t.Force; kawummFuse.shake = t.Shake; kawummFuse.investigate = t.Investigate; kawummFuse.clipIndex = t.ClipIndex; Items.RegisterItem(component); } private static void BuildVisual(GameObject p, KawummTier t, Material baseMat) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("KawummVisual"); val.transform.SetParent(p.transform, false); float num = 0.28f; float num2 = 0.055f; Material mat = MakeMat(baseMat, new Color(0.05f, 0.05f, 0.05f, 1f), null); Material mat2 = MakeMat(baseMat, Color.white, LoadTex(t.Label)); Material mat3 = MakeMat(baseMat, new Color(0.72f, 0.69f, 0.62f, 1f), null); Material sharedMaterial = MakeMat(baseMat, new Color(0.05f, 0.35f, 0.12f, 1f), null); AddMesh(val, CylMesh(num2, (0f - num) / 2f, num / 2f, 24, caps: true), mat, "Body"); AddMesh(val, CylMesh(num2 * 1.012f, (0f - num) * 0.36f, num * 0.36f, 24, caps: false), mat2, "Banderole"); AddMesh(val, CylMesh(num2 * 0.8f, num / 2f - 0.008f, num / 2f + 0.004f, 16, caps: true), mat3, "Plug"); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, num / 2f, 0f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0.02f, num / 2f + 0.07f, 0f); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0.06f, num / 2f + 0.1f, 0f); Vector3 val5 = val2; for (int i = 1; i <= 4; i++) { float num3 = (float)i / 4f; Vector3 val6 = Vector3.Lerp(Vector3.Lerp(val2, val3, num3), Vector3.Lerp(val3, val4, num3), num3); GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)2); Collider component = val7.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } ((Object)val7).name = "Fuse" + i; val7.transform.SetParent(val.transform, false); val7.transform.localPosition = (val5 + val6) / 2f; Transform transform = val7.transform; Vector3 up = Vector3.up; Vector3 val8 = val6 - val5; transform.localRotation = Quaternion.FromToRotation(up, ((Vector3)(ref val8)).normalized); Transform transform2 = val7.transform; Vector3 val9 = val6 - val5; transform2.localScale = new Vector3(0.012f, ((Vector3)(ref val9)).magnitude / 2f, 0.012f); ((Renderer)val7.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; val5 = val6; } GameObject val10 = new GameObject("FuseTip"); val10.transform.SetParent(val.transform, false); val10.transform.localPosition = val4; } private static Material MakeMat(Material baseMat, Color c, Texture2D tex) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0080: 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) Material val = ((!((Object)(object)baseMat != (Object)null)) ? ((Material)null) : new Material(baseMat)); bool flag = (Object)(object)tex == (Object)null; bool flag2 = false; if ((Object)(object)val != (Object)null) { if ((Object)(object)tex != (Object)null) { for (int i = 0; i < TexProps.Length; i++) { if (val.HasProperty(TexProps[i])) { val.SetTexture(TexProps[i], (Texture)(object)tex); flag = true; break; } } } for (int j = 0; j < ColProps.Length; j++) { if (val.HasProperty(ColProps[j])) { val.SetColor(ColProps[j], c); flag2 = true; break; } } } if ((Object)(object)val == (Object)null || !flag || !flag2) { Shader val2 = null; for (int k = 0; k < FallbackShaders.Length; k++) { if (!((Object)(object)val2 == (Object)null)) { break; } val2 = Shader.Find(FallbackShaders[k]); } if ((Object)(object)val2 != (Object)null) { val = new Material(val2); if ((Object)(object)tex != (Object)null) { val.mainTexture = (Texture)(object)tex; } for (int l = 0; l < ColProps.Length; l++) { if (val.HasProperty(ColProps[l])) { val.SetColor(ColProps[l], c); break; } } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.15f); } Plugin.Log.LogInfo((object)("KawummPack Fallback-Shader: " + ((Object)val2).name)); } } return val; } private static Mesh CylMesh(float r, float y0, float y1, int segs, bool caps) { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0061: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); List<int> list2 = new List<int>(); List<Vector2> list3 = new List<Vector2>(); for (int i = 0; i < 2; i++) { float num = ((i == 0) ? y0 : y1); for (int j = 0; j <= segs; j++) { float num2 = (float)j / (float)segs * (float)Math.PI * 2f; list.Add(new Vector3(Mathf.Sin(num2) * r, num, (0f - Mathf.Cos(num2)) * r)); list3.Add(new Vector2((float)j / (float)segs, (float)i)); } } int num3 = segs + 1; for (int k = 0; k < segs; k++) { list2.Add(k); list2.Add(k + num3); list2.Add(k + 1); list2.Add(k + 1); list2.Add(k + num3); list2.Add(k + num3 + 1); } if (caps) { int count = list.Count; list.Add(new Vector3(0f, y0, 0f)); list3.Add(new Vector2(0.5f, 0.5f)); int count2 = list.Count; list.Add(new Vector3(0f, y1, 0f)); list3.Add(new Vector2(0.5f, 0.5f)); for (int l = 0; l < segs; l++) { list2.Add(count); list2.Add(l + 1); list2.Add(l); list2.Add(count2); list2.Add(num3 + l); list2.Add(num3 + l + 1); } } Mesh val = new Mesh(); val.SetVertices(list); val.SetTriangles(list2, 0); val.SetUVs(0, list3); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static void AddMesh(GameObject parent, Mesh m, Material mat, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); MeshFilter val2 = val.AddComponent<MeshFilter>(); val2.sharedMesh = m; MeshRenderer val3 = val.AddComponent<MeshRenderer>(); ((Renderer)val3).sharedMaterial = mat; } private static Texture2D LoadTex(string file) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown byte[] array = Plugin.LoadBytes(file); if (array == null) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); return val; } } public class KawummFuse : MonoBehaviourPun { public float size = 2f; public int damage = 40; public int enemyDamage = 150; public float force = 2f; public float shake = 1f; public float investigate = 15f; public int clipIndex; public float fuseMin = 5f; public float fuseMax = 7.5f; private ItemToggle toggle; private bool lit; private bool exploded; private float timer; private ParticleSystem spark; private Light sparkLight; private AudioSource hiss; private AudioMixerGroup mixerGroup; private void Start() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) toggle = ((Component)this).GetComponent<ItemToggle>(); AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren<AudioSource>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i].outputAudioMixerGroup != (Object)null) { mixerGroup = componentsInChildren[i].outputAudioMixerGroup; break; } } Transform val = ((Component)this).transform.Find("KawummVisual/FuseTip"); GameObject val2 = new GameObject("KawummSparkFX"); val2.transform.SetParent(((Object)(object)val != (Object)null) ? val : ((Component)this).transform, false); sparkLight = val2.AddComponent<Light>(); sparkLight.type = (LightType)2; sparkLight.color = new Color(1f, 0.7f, 0.3f); sparkLight.range = 1.5f; sparkLight.intensity = 0f; ((Behaviour)sparkLight).enabled = false; hiss = val2.AddComponent<AudioSource>(); hiss.clip = Plugin.Hiss; hiss.loop = true; hiss.spatialBlend = 1f; hiss.outputAudioMixerGroup = mixerGroup; hiss.rolloffMode = (AudioRolloffMode)1; hiss.minDistance = 1f; hiss.maxDistance = 25f; hiss.playOnAwake = false; hiss.volume = 0.9f; spark = BuildSpark(val2); } private static ParticleSystem BuildSpark(GameObject fx) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0025: 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) //IL_0032: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown GameObject val = new GameObject("Sparks"); val.transform.SetParent(fx.transform, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.35f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.6f, 1.6f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.008f, 0.02f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(1f, 0.85f, 0.4f), new Color(1f, 0.45f, 0.1f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.6f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).playOnAwake = false; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(60f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.01f; ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); Shader val3 = Shader.Find("Sprites/Default"); if ((Object)(object)val3 != (Object)null) { ((Renderer)component).material = new Material(val3); } val2.Stop(); return val2; } private void Update() { if (exploded) { return; } if (!lit) { if ((Object)(object)toggle != (Object)null && toggle.toggleState && SemiFunc.IsMasterClientOrSingleplayer()) { float num = Random.Range(fuseMin, fuseMax); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("IgniteRPC", (RpcTarget)0, new object[1] { num }); } else { IgniteRPC(num); } } return; } timer -= Time.deltaTime; if ((Object)(object)sparkLight != (Object)null) { sparkLight.intensity = 1.5f + Random.value * 2.5f; } if (timer <= 0f && SemiFunc.IsMasterClientOrSingleplayer()) { exploded = true; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("ExplodeRPC", (RpcTarget)0, new object[0]); } else { ExplodeRPC(); } } } [PunRPC] public void IgniteRPC(float duration) { if (!lit) { lit = true; timer = duration; if ((Object)(object)spark != (Object)null) { spark.Play(); } if ((Object)(object)sparkLight != (Object)null) { ((Behaviour)sparkLight).enabled = true; } if ((Object)(object)hiss != (Object)null && (Object)(object)hiss.clip != (Object)null) { hiss.Play(); } } } [PunRPC] public void ExplodeRPC() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hiss != (Object)null) { hiss.Stop(); } if ((Object)(object)spark != (Object)null) { spark.Stop(); } Vector3 position = ((Component)this).transform.position; ParticleScriptExplosion val = ((Component)this).GetComponent<ParticleScriptExplosion>(); if ((Object)(object)val == (Object)null) { val = ((Component)this).GetComponentInChildren<ParticleScriptExplosion>(true); } if ((Object)(object)val != (Object)null) { val.Spawn(position, size, damage, enemyDamage, force, false, true, shake, investigate); } AudioClip val2 = ((clipIndex >= 0 && clipIndex < Plugin.Booms.Length) ? Plugin.Booms[clipIndex] : null); if ((Object)(object)val2 != (Object)null) { GameObject val3 = new GameObject("KawummBoom"); val3.transform.position = position; AudioSource val4 = val3.AddComponent<AudioSource>(); val4.outputAudioMixerGroup = mixerGroup; val4.clip = val2; val4.spatialBlend = 1f; val4.volume = 1f; val4.rolloffMode = (AudioRolloffMode)1; val4.minDistance = 5f; val4.maxDistance = 80f; val4.Play(); Object.Destroy((Object)(object)val3, val2.length + 0.5f); } exploded = true; if (SemiFunc.IsMasterClientOrSingleplayer()) { PhysGrabObject component = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)component != (Object)null) { component.DestroyPhysGrabObject(); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public static class WavLoader { public static AudioClip Load(string file) { try { byte[] array = Plugin.LoadBytes(file); if (array == null) { return null; } int num = BitConverter.ToInt16(array, 22); int num2 = BitConverter.ToInt32(array, 24); int i = 12; int num3 = 0; int num4; for (; i < array.Length - 8; i += 8 + num4) { num4 = BitConverter.ToInt32(array, i + 4); if (array[i] == 100 && array[i + 1] == 97 && array[i + 2] == 116 && array[i + 3] == 97) { i += 8; num3 = num4; break; } } if (num3 <= 0 || i + num3 > array.Length) { num3 = array.Length - i; } int num5 = num3 / 2; float[] array2 = new float[num5]; for (int j = 0; j < num5; j++) { array2[j] = (float)BitConverter.ToInt16(array, i + j * 2) / 32768f; } AudioClip val = AudioClip.Create(file, num5 / num, num, num2, false); val.SetData(array2, 0); return val; } catch (Exception ex) { Plugin.Log.LogError((object)("WAV-Fehler " + file + ": " + ex.Message)); return null; } } }