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 XyphireLethalWonderworld v0.0.2
plugins/XyphireLethalWonderworld.dll
Decompiled a year agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("XyphireLethalWonderworld")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+52100b9b9fc644ad94deff663d2c666c2a2a28f3")] [assembly: AssemblyProduct("XyphireLethalWonderworld")] [assembly: AssemblyTitle("XyphireLethalWonderworld")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace XyphireLethalWonderworld { internal class Config { public readonly ConfigEntry<int> dogtoyRarity; public readonly ConfigEntry<string> dogtoyValue; public readonly ConfigEntry<float> dogtoyInterestTime; public (int, int) dogtoyValueParsed; public Config(ConfigFile cfg) { cfg.SaveOnConfigSet = false; dogtoyRarity = cfg.Bind<int>("Dog Toy", "Rarity", 25, "The spawn chance of the Dog Toy item."); dogtoyValue = cfg.Bind<string>("Dog Toy", "Scrap value", "10,40", "The min,max scrap value of the Dog Toy item. (the final value will be randomized between these 2 numbers)"); dogtoyInterestTime = cfg.Bind<float>("Dog Toy", "Interest time", 20f, "The time in seconds the Dog Toy will keep the interest of Eyeless Dogs when thrown on the ground."); cfg.Save(); cfg.SaveOnConfigSet = true; } public void SetupCustomConfigs() { ParseValues(); } private void ParseValues() { if (dogtoyValue.Value == "") { dogtoyValueParsed = (-1, -1); return; } string[] array = (from s in dogtoyValue.Value.Split(',') select s.Trim()).ToArray(); int result; int result2; if (array.Count() != 2) { dogtoyValueParsed = (-1, -1); } else if (!int.TryParse(array[0], out result) || !int.TryParse(array[1], out result2)) { dogtoyValueParsed = (-1, -1); } else if (result > result2) { dogtoyValueParsed = (-1, -1); } else { dogtoyValueParsed = (result, result2); } } } internal class DogToy : ThrowableItem { private bool isPlaying = false; private float playTimer = 0f; private float maxPlayTimer = 10f; private float noiseTimer = 0f; private readonly float maxNoiseTimer = 0.2f; private bool changedMoon = false; private SpawnableEnemyWithRarity? enemySaved; private int enemiesSpawned = 0; private readonly int enemiesToSpawn = 2; public override void ItemActivate(bool used, bool buttonDown = true) { ((Component)((Component)this).transform).gameObject.GetComponent<Animator>().SetTrigger("Squish"); base.ItemActivate(used, buttonDown); isPlaying = true; } public override void Start() { ((NoisemakerProp)this).Start(); maxPlayTimer = Plugin.config.dogtoyInterestTime.Value; if (!((NetworkBehaviour)this).IsServer || StartOfRound.Instance.inShipPhase) { return; } foreach (SpawnableEnemyWithRarity outsideEnemy in RoundManager.Instance.currentLevel.OutsideEnemies) { if (outsideEnemy.enemyType.enemyName == "MouthDog") { enemySaved = outsideEnemy; EnemyType enemyType = outsideEnemy.enemyType; enemyType.MaxCount += 3; SelectableLevel currentLevel = RoundManager.Instance.currentLevel; currentLevel.maxOutsideEnemyPowerCount *= 2; outsideEnemy.rarity *= 10; changedMoon = true; break; } } if (enemySaved != null) { return; } SelectableLevel[] moonsCatalogueList = Object.FindObjectOfType<Terminal>().moonsCatalogueList; foreach (SelectableLevel val in moonsCatalogueList) { foreach (SpawnableEnemyWithRarity outsideEnemy2 in val.OutsideEnemies) { if (outsideEnemy2.enemyType.enemyName == "MouthDog") { enemySaved = outsideEnemy2; break; } } if (enemySaved != null) { break; } } } public static NetworkObjectReference Spawn(SpawnableEnemyWithRarity enemy, Vector3 position, float yRot = 0f) { //IL_000c: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0054: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, yRot, 0f))); val.GetComponentInChildren<NetworkObject>().Spawn(true); RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>()); return new NetworkObjectReference(val); } public override void Update() { //IL_0150: 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_00a7: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (isPlaying) { playTimer += Time.deltaTime; if (playTimer > maxPlayTimer || (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { isPlaying = false; playTimer = 0f; noiseTimer = 0f; return; } noiseTimer += Time.deltaTime; if (noiseTimer > maxNoiseTimer) { noiseTimer = 0f; RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, ((NoisemakerProp)this).noiseRange, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } if (((NetworkBehaviour)this).IsServer && enemySaved != null && TimeOfDay.Instance.currentDayTime > 720f && enemiesSpawned < enemiesToSpawn && Random.Range(0, 100) <= ((!changedMoon) ? 5 : 0)) { Spawn(enemySaved, RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position); enemiesSpawned++; } if (((NetworkBehaviour)this).IsServer && enemySaved != null && changedMoon && StartOfRound.Instance.shipIsLeaving) { EnemyType enemyType = enemySaved.enemyType; enemyType.MaxCount -= 3; SelectableLevel currentLevel = RoundManager.Instance.currentLevel; currentLevel.maxOutsideEnemyPowerCount /= 2; SpawnableEnemyWithRarity? obj = enemySaved; obj.rarity /= 10; changedMoon = false; } } public override void OnHitGround() { ((Component)((Component)this).transform).gameObject.GetComponent<Animator>().SetTrigger("Squish"); ((GrabbableObject)this).OnHitGround(); base.ItemActivate(used: true, buttonDown: true); isPlaying = true; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right && ((NetworkBehaviour)this).IsOwner) { DiscardHeld(); } } public override void PocketItem() { if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !((GrabbableObject)this).isPocketed) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).DiscardItem(); } public override void OnNetworkDespawn() { if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !((GrabbableObject)this).isPocketed) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } ((NetworkBehaviour)this).OnNetworkDespawn(); } } [BepInPlugin("Xyphire.XyphireLethalWonderworld", "Xyphire Lethal Wonderworld", "0.1.1")] public class Plugin : BaseUnityPlugin { private const string GUID = "Xyphire.XyphireLethalWonderworld"; private const string NAME = "Xyphire Lethal Wonderworld"; private const string VERSION = "0.1.1"; public static Plugin instance; public static ManualLogSource logger; internal static Config config { get; private set; } private void Awake() { instance = this; logger = ((BaseUnityPlugin)this).Logger; config = new Config(((BaseUnityPlugin)this).Config); config.SetupCustomConfigs(); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "xyphirelethalwonderworld"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MyItems/Baton/SO_Baton.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); if (config.dogtoyValueParsed.Item1 != -1) { val2.minValue = (int)((float)config.dogtoyValueParsed.Item1 * 2.5f); val2.maxValue = (int)((float)config.dogtoyValueParsed.Item2 * 2.5f); } Items.RegisterScrap(val2, config.dogtoyRarity.Value, (LevelTypes)(-1)); logger.LogInfo((object)"Xyphire Lethal Wonderworld loaded."); } } public class ThrowableItem : NoisemakerProp { public AnimationCurve itemFallCurve; public AnimationCurve itemVerticalFallCurve; public AnimationCurve itemVerticalFallCurveNoBounce; public RaycastHit itemHit; public Ray itemThrowRay; public float throwForce = 2f; public override void ItemActivate(bool used, bool buttonDown = true) { ((NoisemakerProp)this).ItemActivate(used, buttonDown); } public void DiscardHeld() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, GetItemThrowDestination(((GrabbableObject)this).playerHeldBy, throwForce), true); } } public override void FallWithCurve() { ItemFall((GrabbableObject)(object)this, itemFallCurve, itemVerticalFallCurve, itemVerticalFallCurveNoBounce); } public static void ItemFall(GrabbableObject item, AnimationCurve? itemFallCurve = null, AnimationCurve? itemVerticalFallCurve = null, AnimationCurve? itemVerticalFallCurveNoBounce = null) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00c6: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) AnimationCurve val = (AnimationCurve)(((object)itemFallCurve) ?? ((object)new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0f), new Keyframe(0.5f, 0.75f), new Keyframe(1f, 1f) }))); AnimationCurve val2 = (AnimationCurve)(((object)itemVerticalFallCurve) ?? ((object)new AnimationCurve((Keyframe[])(object)new Keyframe[6] { new Keyframe(0f, 0f), new Keyframe(0.5f, 1f), new Keyframe(0.6f, 0.9f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 0.95f), new Keyframe(1f, 1f) }))); AnimationCurve val3 = (AnimationCurve)(((object)itemVerticalFallCurveNoBounce) ?? ((object)new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0f), new Keyframe(0.5f, 1f), new Keyframe(1f, 1f) }))); Vector3 val4 = item.startFallingPosition - item.targetFloorPosition; float magnitude = ((Vector3)(ref val4)).magnitude; ((Component)item).transform.rotation = Quaternion.Lerp(((Component)item).transform.rotation, Quaternion.Euler(item.itemProperties.restingRotation.x, ((Component)item).transform.eulerAngles.y, item.itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude); ((Component)item).transform.localPosition = Vector3.Lerp(item.startFallingPosition, item.targetFloorPosition, val.Evaluate(item.fallTime)); if (magnitude > 5f) { ((Component)item).transform.localPosition = Vector3.Lerp(new Vector3(((Component)item).transform.localPosition.x, item.startFallingPosition.y, ((Component)item).transform.localPosition.z), new Vector3(((Component)item).transform.localPosition.x, item.targetFloorPosition.y, ((Component)item).transform.localPosition.z), val3.Evaluate(item.fallTime)); } else { ((Component)item).transform.localPosition = Vector3.Lerp(new Vector3(((Component)item).transform.localPosition.x, item.startFallingPosition.y, ((Component)item).transform.localPosition.z), new Vector3(((Component)item).transform.localPosition.x, item.targetFloorPosition.y, ((Component)item).transform.localPosition.z), val2.Evaluate(item.fallTime)); } item.fallTime += Mathf.Abs(Time.deltaTime * 12f / magnitude); } public static Vector3 GetItemThrowDestination(PlayerControllerB player, float throwForce = 1f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0053: 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) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00be: 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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward); RaycastHit val2 = default(RaycastHit); Vector3 val3 = ((!Physics.Raycast(val, ref val2, 12f * throwForce, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) ? ((Ray)(ref val)).GetPoint(10f * throwForce) : ((Ray)(ref val)).GetPoint(((RaycastHit)(ref val2)).distance - 0.05f)); ((Ray)(ref val))..ctor(val3, Vector3.down); if (Physics.Raycast(val, ref val2, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point + Vector3.up * 0.05f; } return ((Ray)(ref val)).GetPoint(30f); } } }