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 DawnUltrasItems v1.3.0
DawnUltrasItems.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using DawnUltrasItems.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using YourThunderstoreTeam.patch; using YourThunderstoreTeam.patch.Items; using YourThunderstoreTeam.patch.Other; using YourThunderstoreTeam.patch.enemies; using YourThunderstoreTeam.service; using YourThunderstoreTeam.util; [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: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("DawnUltrasItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3-alpha.0.90")] [assembly: AssemblyProduct("DawnUltrasItems")] [assembly: AssemblyTitle("DawnUltrasItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 YourThunderstoreTeam { [BepInPlugin("DawnUltrasItems", "DawnUltrasItems", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("DawnUltrasItems"); public TemplateService Service; public static AssetBundle DawnUltrasItemsAssets; public static Plugin Instance { get; set; } public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger; public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Instance = this; } private void Awake() { Service = new TemplateService(); Log.LogInfo((object)"Applying patches..."); ApplyPluginPatch(); Log.LogInfo((object)"Patches applied"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); DawnUltrasItemsAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "dawnultrasitemsbundle")); if ((Object)(object)DawnUltrasItemsAssets == (Object)null) { Log.LogError((object)"Failed to load custom assets"); return; } Log.LogInfo((object)"Adding Dawn Ultra's items..."); AddItems(); Log.LogInfo((object)"Dawn Ultra's items added"); } private void ApplyPluginPatch() { _harmony.PatchAll(typeof(EnemyAIPatch)); _harmony.PatchAll(typeof(ShipLightsPatch)); _harmony.PatchAll(typeof(PlayerControllerBPatch)); _harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); _harmony.PatchAll(typeof(ForestGiantPatch)); _harmony.PatchAll(typeof(FlowermanPatch)); _harmony.PatchAll(typeof(CaveDwellerAIPatch)); } private void AddItems() { HealthpackItem.AddAsset(DawnUltrasItemsAssets); CheezburgerItem.AddAsset(DawnUltrasItemsAssets); RizzburgerItem.AddAsset(DawnUltrasItemsAssets); SpeedCoilItem.AddAsset(DawnUltrasItemsAssets); EnergySwordItem.AddAsset(DawnUltrasItemsAssets); PizzaItem.AddAsset(DawnUltrasItemsAssets); ActiveCamoItem.AddAsset(DawnUltrasItemsAssets); GravityCoilItem.AddAsset(DawnUltrasItemsAssets); } } public static class PluginInfo { public const string PLUGIN_GUID = "DawnUltrasItems"; public const string PLUGIN_NAME = "DawnUltrasItems"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace YourThunderstoreTeam.util { public static class Utilities { public static void PrintToChat(string message) { HUDManager.Instance.AddTextToChatOnServer(message, -1); } } } namespace YourThunderstoreTeam.service { public class TemplateService { public bool ReturnTrue() { return true; } public bool ReturnFalse() { return false; } } } namespace YourThunderstoreTeam.patch { [HarmonyPatch(typeof(UnlockableSuit))] public class UnlockableSuitPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnSwitchSuitForPlayer(UnlockableSuit __instance, PlayerControllerB player) { return player != null && !PlayerControllerBPatch.IsPlayerInvisible(player); } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerBPatch { private static Material StealthMaterial; private static Dictionary<int, bool> InvinciblePlayerIDs { get; } = new Dictionary<int, bool>(); private static Dictionary<int, bool> InvisiblePlayerIDs { get; } = new Dictionary<int, bool>(); private static Dictionary<int, float> InvisiblePlayerElasped { get; } = new Dictionary<int, float>(); private static Dictionary<int, float> InvisiblePlayerDurations { get; } = new Dictionary<int, float>(); private static Dictionary<int, Renderer[]> PlayerRenderers { get; } = new Dictionary<int, Renderer[]>(); private static Dictionary<int, Material> PlayerModelMaterials { get; } = new Dictionary<int, Material>(); [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnPlayerDamage(ref PlayerControllerB __instance, bool fallDamage) { return !IsPlayerInvincible(__instance); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnPlayerDeath(ref PlayerControllerB __instance, object[] __args) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) CauseOfDeath causeOfDeath = (CauseOfDeath)__args[2]; return !CanResistCauseOfDeath(causeOfDeath) || !IsPlayerInvincible(__instance); } private static bool CanResistCauseOfDeath(CauseOfDeath causeOfDeath) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 if ((int)causeOfDeath != 9) { if ((int)causeOfDeath == 10) { return false; } return true; } return false; } public static void TogglePlayerInvincibility(PlayerControllerB player, bool isInvincible) { if (IsPlayerInvincible(player) != isInvincible) { InvinciblePlayerIDs[((Object)player).GetInstanceID()] = isInvincible; } } public static bool IsPlayerInvincible(PlayerControllerB player) { return IsPlayerInvincible(((Object)player).GetInstanceID()); } public static bool IsPlayerInvincible(int playerObjectId) { InvinciblePlayerIDs.TryGetValue(playerObjectId, out var value); if (!InvinciblePlayerIDs.ContainsKey(playerObjectId)) { InvinciblePlayerIDs.Add(playerObjectId, value: false); } return value; } public static void TogglePlayerInvisibility(PlayerControllerB player, bool isInvisible) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); Material value = ((Renderer)player.thisPlayerModelLOD1).material; if (!IsPlayerInvisible(player)) { if (PlayerModelMaterials.TryGetValue(instanceID, out var _)) { PlayerModelMaterials.Remove(instanceID); } PlayerModelMaterials.Add(instanceID, value); } if (isInvisible) { if (PlayerModelMaterials.TryGetValue(instanceID, out var value3)) { value = Object.Instantiate<Material>(StealthMaterial); value.color = new Color(1f, 1f, 1f, 0.05f); value.mainTexture = value3.mainTexture; } } else if (!PlayerModelMaterials.TryGetValue(instanceID, out value)) { Debug.LogWarning((object)$"{player.playerUsername}'s suit material has not been indexed."); } if (IsPlayerInvisible(player) != isInvisible) { InvisiblePlayerIDs[instanceID] = isInvisible; } ((Renderer)player.thisPlayerModel).material = value; ((Renderer)player.thisPlayerModelLOD1).material = value; ((Renderer)player.thisPlayerModelLOD2).material = value; ((Renderer)player.thisPlayerModelArms).material = value; ((Component)player.playerBetaBadgeMesh).gameObject.SetActive(!isInvisible); } public static void TogglePlayerInvisibility(PlayerControllerB player, float stealthDuration) { int instanceID = ((Object)player).GetInstanceID(); TogglePlayerInvisibility(player, isInvisible: true); if (InvisiblePlayerDurations.TryGetValue(instanceID, out var _)) { InvisiblePlayerDurations[instanceID] = stealthDuration; } else { InvisiblePlayerDurations.Add(instanceID, stealthDuration); } if (InvisiblePlayerElasped.TryGetValue(instanceID, out var _)) { InvisiblePlayerElasped[instanceID] = 0f; } else { InvisiblePlayerElasped.Add(instanceID, 0f); } } public static bool IsPlayerInvisible(PlayerControllerB player) { return IsPlayerInvisible(((Object)player).GetInstanceID()); } public static bool IsPlayerInvisible(int playerObjectId) { InvisiblePlayerIDs.TryGetValue(playerObjectId, out var value); if (!InvisiblePlayerIDs.ContainsKey(playerObjectId)) { InvisiblePlayerIDs.Add(playerObjectId, value: false); } return value; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnStart(ref PlayerControllerB __instance) { PlayerRenderers.Add(((Object)__instance).GetInstanceID(), ((Component)__instance).GetComponentsInChildren<Renderer>()); StealthMaterial = Plugin.DawnUltrasItemsAssets.LoadAsset<Material>("StealthMaterial"); TogglePlayerInvincibility(__instance, isInvincible: false); TogglePlayerInvisibility(__instance, isInvisible: false); return true; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnUpdate(ref PlayerControllerB __instance) { try { if (__instance != null) { int instanceID = ((Object)__instance).GetInstanceID(); if (InvisiblePlayerElasped.TryGetValue(instanceID, out var value) && InvisiblePlayerDurations.TryGetValue(instanceID, out var value2)) { if (value >= value2 || !IsPlayerInvisible(__instance)) { InvisiblePlayerElasped.Remove(instanceID); TogglePlayerInvisibility(__instance, isInvisible: false); } else { InvisiblePlayerElasped[instanceID] = value + Time.deltaTime; } } } } catch (Exception ex) { Debug.LogException(ex); } return true; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static float PostGetVisibility(float __result, ref PlayerControllerB __instance) { return (Object.op_Implicit((Object)(object)__instance) && IsPlayerInvisible(__instance)) ? 0f : __result; } } [HarmonyPatch(typeof(ShipLights))] public class ShipLightsPatch { [HarmonyPatch("ToggleShipLights")] [HarmonyPrefix] private static bool OnPowerSwitch(ref ShipLights __instance, object[] __args) { Plugin.Log.LogInfo((object)"The lights are now toggled!"); return false; } } } namespace YourThunderstoreTeam.patch.Other { public class FireSerpent : MonoBehaviour { private const int collisionLayerMask = 526592; private const int visibleThreatsMask = 524296; private float despawnTimer = 0f; private float startupTimer = 0f; private bool hitWall = true; private float currentSpeed = StartingSpeed; private EnemyAI targetEnemy = null; public static float BaseSpeed = 30f; public static float StartingSpeed = 0.6f; public static float SpeedIncrement = 0.2f; public static float MaxSpeed = 3f; public static float StartupDelay = 1f; public static float TimeUntilDespawn = 5f; public PlayerControllerB player; private void Start() { hitWall = false; } private void FixedUpdate() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00e0: 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_0112: Unknown result type (might be due to invalid IL or missing references) if (startupTimer < StartupDelay) { startupTimer += Time.deltaTime; } else { if (hitWall) { return; } if (despawnTimer < TimeUntilDespawn && player != null) { despawnTimer += Time.deltaTime; ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.forward * 2f, BaseSpeed * Time.deltaTime); if (targetEnemy != null) { ((Component)this).transform.LookAt(((Component)targetEnemy).transform.position); Console.WriteLine(((Object)targetEnemy).name); if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) <= 1f) { hitWall = true; Object.Destroy((Object)(object)((Component)this).gameObject); } if (hitWall) { } } else { targetEnemy = GetClosestEnemy(); } } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private EnemyAI? GetClosestEnemy() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) EnemyAI result = null; float num = 2000f; Collider[] tempColliderResults = RoundManager.Instance.tempColliderResults; int num2 = Physics.OverlapSphereNonAlloc(((Component)this).gameObject.transform.position, 200f, tempColliderResults, 524296, (QueryTriggerInteraction)2); for (int i = 0; i < num2; i++) { Collider val = tempColliderResults[i]; EnemyAICollisionDetect component = ((Component)((Component)val).transform).GetComponent<EnemyAICollisionDetect>(); EnemyAI val2 = ((component != null) ? component.mainScript : ((Component)((Component)val).transform).GetComponent<EnemyAI>()); if (val2 != null) { float num3 = Vector3.Distance(((Component)this).gameObject.transform.position, ((Component)val2).transform.position); if (!Physics.Linecast(((Component)this).gameObject.transform.position, ((Component)val2).transform.position, 256) && num3 < num) { num = num3; result = val2; } } } return result; } } } namespace YourThunderstoreTeam.patch.Items { public class ActiveCamoItem : GrabbableObject { private const int RARITY = 30; private const float DURATION = 60f; private float currentTime = 0f; private bool isInvis = false; public AudioSource AudioSource; public AudioClip UseSfx; public Light Light; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("ActiveCamo"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 30, (LevelTypes)(-1)); ActiveCamoItem activeCamoItem = val.spawnPrefab.AddComponent<ActiveCamoItem>(); ((GrabbableObject)activeCamoItem).grabbable = true; ((GrabbableObject)activeCamoItem).grabbableToEnemies = true; ((GrabbableObject)activeCamoItem).isInFactory = true; ((GrabbableObject)activeCamoItem).itemProperties = val; activeCamoItem.AudioSource = val.spawnPrefab.GetComponent<AudioSource>(); activeCamoItem.UseSfx = activeCamoItem.AudioSource.clip; activeCamoItem.Light = val.spawnPrefab.GetComponentInChildren<Light>(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); try { if (buttonDown && base.playerHeldBy != null && !base.itemUsedUp && !PlayerControllerBPatch.IsPlayerInvisible(base.playerHeldBy)) { base.itemUsedUp = true; isInvis = true; ((Behaviour)Light).enabled = false; AudioSource.PlayOneShot(UseSfx); PlayerControllerBPatch.TogglePlayerInvisibility(base.playerHeldBy, 60f); ((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy); } } catch (Exception ex) { Debug.LogException(ex); } } public override void Update() { ((GrabbableObject)this).Update(); try { if (isInvis) { currentTime += Time.deltaTime; if (base.playerHeldBy != null && PlayerControllerBPatch.IsPlayerInvisible(base.playerHeldBy) && (currentTime >= 60f || base.playerHeldBy.isPlayerDead)) { isInvis = false; PlayerControllerBPatch.TogglePlayerInvisibility(base.playerHeldBy, isInvisible: false); } } } catch (Exception ex) { Debug.LogException(ex); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((Behaviour)Light).enabled = true; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ((Behaviour)Light).enabled = false; } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); ((Behaviour)Light).enabled = false; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "ActiveCamoItem"; } } [HarmonyPatch(typeof(BoomboxItem))] public class BoomboxPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnStart(ref BoomboxItem __instance) { List<AudioClip> list = new List<AudioClip>(__instance.musicAudios); for (int i = 1; i <= 10; i++) { AudioClip item = Plugin.DawnUltrasItemsAssets.LoadAsset<AudioClip>($"Song{i.ToString()}"); list.Add(item); } __instance.musicAudios = list.ToArray(); return true; } } public class CheezburgerItem : GrabbableObject { private const int RARITY = 80; private bool isActive = false; public AudioSource cheezburgerAudio; public AudioClip mmmCheezburgerSfx; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("Cheezburger"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 80, (LevelTypes)(-1)); CheezburgerItem cheezburgerItem = val.spawnPrefab.AddComponent<CheezburgerItem>(); ((GrabbableObject)cheezburgerItem).grabbable = true; ((GrabbableObject)cheezburgerItem).grabbableToEnemies = true; ((GrabbableObject)cheezburgerItem).isInFactory = true; ((GrabbableObject)cheezburgerItem).itemProperties = val; cheezburgerItem.cheezburgerAudio = val.spawnPrefab.GetComponent<AudioSource>(); cheezburgerItem.mmmCheezburgerSfx = cheezburgerItem.cheezburgerAudio.clip; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0043: 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_0065: 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) //IL_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy != null && !isActive) { Vector3 positionOffset = base.itemProperties.positionOffset; Vector3 rotationOffset = base.itemProperties.rotationOffset; isActive = true; base.itemProperties.positionOffset = new Vector3(0.03f, -0.375f, -0.33f); base.itemProperties.rotationOffset = new Vector3(-90f, 9f, -90f); cheezburgerAudio.PlayOneShot(mmmCheezburgerSfx); ReturnToNormalOffsets(positionOffset, rotationOffset); } } private async void ReturnToNormalOffsets(Vector3 normalPos, Vector3 normalRot) { //IL_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) await Task.Delay(1000); base.itemProperties.positionOffset = normalPos; base.itemProperties.rotationOffset = normalRot; isActive = false; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "CheezburgerItem"; } } public class EnergySwordItem : GrabbableObject { private const int PRICE = 220; private const string DESC = "A sword with a blade made of plasma used by high-ranking Covenant Elites. Allows the user to lunge from a distance towards their target to deliver a high-damage slash.\n\n"; private const int _layerMask = 1084754248; private RaycastHit[] _scannedObjects; private List<RaycastHit> _scannedObjectsList; private IHittable _lungeHittable; private RaycastHit _lungeRayHit; private Vector3 _lungeOrigin; private bool _lunging = false; private GameObject _reticle; private GameObject _reticleTargetLocked; private bool _reticleEnabled = false; private bool _targetLocked = false; private bool _cooldownActive = false; private int _killCount = 0; private int _tempKillCount = 0; private float _lastKillTimestamp = Time.time; private Queue<AudioClip> _announcerQueue = new Queue<AudioClip>(); private bool _announcing = false; public AudioSource AnnouncerAudioSource; public AudioClip DoubleKill; public AudioClip TripleKill; public AudioClip Overkill; public AudioClip Killtacular; public AudioClip Killtrocity; public AudioClip Killamanjaro; public AudioClip Killtastrophe; public AudioClip Killpocalypse; public AudioClip Killionaire; public AudioClip Betrayal; public AudioClip KillingSpree; public AudioClip KillingFrenzy; public AudioClip RunningRiot; public AudioClip Rampage; public AudioClip Untouchable; public AudioClip Invincible; public AudioClip Inconceivable; public AudioClip Unfrigginbelievable; public AudioSource AudioSource; public AudioClip SwordHitSfx; public AudioClip SwordHitEnvSfx; public AudioClip SwordSwingSfx; public Light Light; public static int Force => 12; public static int HitId => 100501; public static float LungeMinDist => 2f; public static float LungeMaxDist => 12f; public static void AddAsset(AssetBundle assetBundle) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown Item val = assetBundle.LoadAsset<Item>("EnergySword"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, new TerminalNode { displayText = "A sword with a blade made of plasma used by high-ranking Covenant Elites. Allows the user to lunge from a distance towards their target to deliver a high-damage slash.\n\n", clearPreviousText = true }, 220); EnergySwordItem energySwordItem = val.spawnPrefab.AddComponent<EnergySwordItem>(); ((GrabbableObject)energySwordItem).grabbable = true; ((GrabbableObject)energySwordItem).isInFactory = true; ((GrabbableObject)energySwordItem).grabbableToEnemies = true; ((GrabbableObject)energySwordItem).itemProperties = val; energySwordItem.AudioSource = val.spawnPrefab.GetComponent<AudioSource>(); energySwordItem.AnnouncerAudioSource = ((Component)val.spawnPrefab.gameObject.transform.Find("Announcer")).gameObject.GetComponent<AudioSource>(); energySwordItem.SwordSwingSfx = assetBundle.LoadAsset<AudioClip>("Energy_sword_melee.wav"); energySwordItem.SwordHitSfx = assetBundle.LoadAsset<AudioClip>("Energy_sword_hit.wav"); energySwordItem.SwordHitEnvSfx = assetBundle.LoadAsset<AudioClip>("Energy_sword_hit_env.wav"); energySwordItem.Light = val.spawnPrefab.GetComponentInChildren<Light>(); energySwordItem.DoubleKill = assetBundle.LoadAsset<AudioClip>("Double_Kill.mp3"); energySwordItem.TripleKill = assetBundle.LoadAsset<AudioClip>("Triple_Kill.mp3"); energySwordItem.Overkill = assetBundle.LoadAsset<AudioClip>("Overkill.mp3"); energySwordItem.Killtacular = assetBundle.LoadAsset<AudioClip>("Killtacular.mp3"); energySwordItem.Killtrocity = assetBundle.LoadAsset<AudioClip>("Killtrocity.mp3"); energySwordItem.Killamanjaro = assetBundle.LoadAsset<AudioClip>("Killamanjaro.mp3"); energySwordItem.Killtastrophe = assetBundle.LoadAsset<AudioClip>("Killtastrophe.mp3"); energySwordItem.Killpocalypse = assetBundle.LoadAsset<AudioClip>("Killpocalypse.mp3"); energySwordItem.Killionaire = assetBundle.LoadAsset<AudioClip>("Killionaire.mp3"); energySwordItem.Betrayal = assetBundle.LoadAsset<AudioClip>("Betrayal.mp3"); energySwordItem.KillingSpree = assetBundle.LoadAsset<AudioClip>("Killing_Spree.mp3"); energySwordItem.KillingFrenzy = assetBundle.LoadAsset<AudioClip>("Killing_Frenzy.mp3"); energySwordItem.RunningRiot = assetBundle.LoadAsset<AudioClip>("Running_Riot.mp3"); energySwordItem.Rampage = assetBundle.LoadAsset<AudioClip>("Rampage.mp3"); energySwordItem.Untouchable = assetBundle.LoadAsset<AudioClip>("Untouchable.mp3"); energySwordItem.Invincible = assetBundle.LoadAsset<AudioClip>("Invincible.mp3"); energySwordItem.Inconceivable = assetBundle.LoadAsset<AudioClip>("Inconceivable.mp3"); energySwordItem.Unfrigginbelievable = assetBundle.LoadAsset<AudioClip>("Unfrigginbelievable.mp3"); } public override void Update() { //IL_0055: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) ((GrabbableObject)this).Update(); PlayFirstAudioInQueue(); float deltaTime = Time.deltaTime; try { if (base.playerHeldBy == null || base.playerHeldBy.isPlayerDead || !IsCurrentlyLocalPlayer()) { return; } if (_lunging) { if (Vector3.Distance(((Component)base.playerHeldBy).transform.position, _lungeOrigin) >= ((RaycastHit)(ref _lungeRayHit)).distance - LungeMinDist) { _lunging = false; if (_lungeHittable.Hit(Force, ((Component)base.playerHeldBy).transform.forward, base.playerHeldBy, false, HitId)) { AudioSource.PlayOneShot(SwordHitSfx); TryAddKill(_lungeRayHit); } SwingSword(); } else { ((Component)base.playerHeldBy).transform.position = Vector3.MoveTowards(((Component)base.playerHeldBy).transform.position, ((RaycastHit)(ref _lungeRayHit)).transform.position, 50f * deltaTime); } } else if (_reticle != null && _reticleTargetLocked != null) { (_targetLocked, _, _) = ScanForTarget(); _reticle.SetActive(!_targetLocked && _reticleEnabled); _reticleTargetLocked.SetActive(_targetLocked && _reticleEnabled); } } catch (Exception ex) { Debug.LogException(ex); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); LoadReticle(); ((Behaviour)Light).enabled = true; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ToggleReticle(enabled: false); ((Behaviour)Light).enabled = false; } public override void OnLostOwnership() { ((NetworkBehaviour)this).OnLostOwnership(); ToggleReticle(enabled: false); _killCount = 0; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); ToggleReticle(enabled: false); _killCount = 0; } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); Object.Destroy((Object)(object)_reticle); ((Behaviour)Light).enabled = false; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || _cooldownActive || _lunging) { return; } try { (bool, IHittable?, RaycastHit?) tuple = ScanForTarget(); bool item = tuple.Item1; IHittable item2 = tuple.Item2; RaycastHit? item3 = tuple.Item3; _cooldownActive = true; if (item && item2 != null && item3.HasValue) { _lungeHittable = item2; _lungeRayHit = item3.Value; _lungeOrigin = ((Component)base.playerHeldBy).transform.position; _lunging = true; Console.WriteLine("Lunging, dist: {0}", ((RaycastHit)(ref _lungeRayHit)).distance); } else { SwingSword(); if (item3.HasValue) { AudioSource.PlayOneShot(SwordHitEnvSfx); } } } catch (Exception ex) { Debug.LogException(ex); _lunging = false; _cooldownActive = false; } } private (bool, IHittable?, RaycastHit?) ScanForTarget() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_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_00d5: 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_0152: 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) Vector3 forward = ((Component)base.playerHeldBy.gameplayCamera).transform.forward; RaycastHit? item = null; _scannedObjects = Physics.RaycastAll(((Component)base.playerHeldBy.gameplayCamera).transform.position, forward, LungeMaxDist, 1084754248); _scannedObjectsList = _scannedObjects.OrderBy((RaycastHit hit) => ((RaycastHit)(ref hit)).distance).ToList(); IHittable item2 = default(IHittable); RaycastHit val = default(RaycastHit); EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect); PlayerControllerB val3 = default(PlayerControllerB); for (int i = 0; i < _scannedObjectsList.Count; i++) { RaycastHit value = _scannedObjectsList[i]; Collider collider = ((RaycastHit)(ref value)).collider; GameObject gameObject = ((Component)collider).gameObject; if (gameObject.TryGetComponent<IHittable>(ref item2) && (Object)(object)((RaycastHit)(ref value)).transform != (Object)(object)((Component)base.playerHeldBy).transform && !Physics.Linecast(((Component)base.playerHeldBy).transform.position, ((RaycastHit)(ref value)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { bool item3 = true; if (((Component)((RaycastHit)(ref value)).transform).TryGetComponent<EnemyAICollisionDetect>(ref val2)) { item3 = !val2.mainScript.isEnemyDead; } else if (((Component)((RaycastHit)(ref value)).transform).TryGetComponent<PlayerControllerB>(ref val3)) { item3 = !val3.isPlayerDead; } return (item3, item2, value); } if ((Object)(object)((RaycastHit)(ref value)).transform != (Object)(object)((Component)base.playerHeldBy).transform && ((RaycastHit)(ref value)).distance <= LungeMinDist) { item = value; } } return (false, null, item); } private void ToggleReticle(bool enabled) { _reticleEnabled = IsCurrentlyLocalPlayer() && enabled; if (_reticle != null) { _reticle.SetActive(IsCurrentlyLocalPlayer() && enabled); _reticleTargetLocked.SetActive(false); } } private void LoadReticle() { if (_reticle == null) { GameObject gameObject = ((Component)((Component)GameObject.Find("Systems").gameObject.transform.Find("UI")).gameObject.transform.Find("Canvas")).gameObject; Transform val = ((Component)this).gameObject.transform.Find("Reticle"); Transform val2 = ((Component)this).gameObject.transform.Find("ReticleTargetLocked"); if (val != null) { _reticle = Object.Instantiate<GameObject>(((Component)val).gameObject, gameObject.transform); _reticleTargetLocked = Object.Instantiate<GameObject>(((Component)val2).gameObject, gameObject.transform); _reticle.SetActive(false); _reticleTargetLocked.SetActive(false); RectTransform component = _reticle.GetComponent<RectTransform>(); RectTransform component2 = _reticleTargetLocked.GetComponent<RectTransform>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(30f, 30f); component.sizeDelta_Injected = ref val3; component2.sizeDelta_Injected = ref val3; } } ToggleReticle(enabled: true); } private async void SwingSword() { base.playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1"); AudioSource.PlayOneShot(SwordSwingSfx); await Task.Delay(900); _cooldownActive = false; } private async void TryAddKill(RaycastHit rayHit) { //IL_0019: 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) float currentTime = Time.time; float timeBetweenLastKill = currentTime - _lastKillTimestamp; EnemyAICollisionDetect enemyAICollision = default(EnemyAICollisionDetect); ((Component)((RaycastHit)(ref rayHit)).transform).TryGetComponent<EnemyAICollisionDetect>(ref enemyAICollision); PlayerControllerB player = default(PlayerControllerB); ((Component)((RaycastHit)(ref rayHit)).transform).TryGetComponent<PlayerControllerB>(ref player); await Task.Delay(200); bool isEnemyDead = false; bool isAlly = false; if (enemyAICollision != null) { isEnemyDead = enemyAICollision.mainScript.isEnemyDead; } else if (player != null) { isEnemyDead = player.isPlayerDead; isAlly = true; } if (isEnemyDead) { _killCount++; _tempKillCount = ((!(timeBetweenLastKill <= 5f)) ? 1 : (_tempKillCount + 1)); _lastKillTimestamp = currentTime; if (isAlly) { _announcerQueue.Enqueue(Betrayal); } switch (_tempKillCount) { case 2: _announcerQueue.Enqueue(DoubleKill); break; case 3: _announcerQueue.Enqueue(TripleKill); break; case 4: _announcerQueue.Enqueue(Overkill); break; case 5: _announcerQueue.Enqueue(Killtacular); break; case 6: _announcerQueue.Enqueue(Killtrocity); break; case 7: _announcerQueue.Enqueue(Killamanjaro); break; case 8: _announcerQueue.Enqueue(Killtastrophe); break; case 9: _announcerQueue.Enqueue(Killpocalypse); break; case 10: _announcerQueue.Enqueue(Killionaire); break; } switch (_killCount) { case 3: AnnounceMsg($"{base.playerHeldBy.playerUsername} is on a KILLING SPREE"); _announcerQueue.Enqueue(KillingSpree); break; case 5: AnnounceMsg($"{base.playerHeldBy.playerUsername} is on a KILLING FRENZY"); _announcerQueue.Enqueue(KillingFrenzy); break; case 7: AnnounceMsg($"{base.playerHeldBy.playerUsername} is a RUNNING RIOT"); _announcerQueue.Enqueue(RunningRiot); break; case 9: AnnounceMsg($"{base.playerHeldBy.playerUsername} is on a RAMPAGE"); _announcerQueue.Enqueue(Rampage); break; case 11: AnnounceMsg($"{base.playerHeldBy.playerUsername} is UNTOUCHABLE"); _announcerQueue.Enqueue(Untouchable); break; case 13: AnnounceMsg($"{base.playerHeldBy.playerUsername} is INVINCIBLE"); _announcerQueue.Enqueue(Invincible); break; case 15: AnnounceMsg($"{base.playerHeldBy.playerUsername} is INCONCEIVABLE"); _announcerQueue.Enqueue(Inconceivable); break; case 17: AnnounceMsg($"{base.playerHeldBy.playerUsername} is UNFRIGGINBELIEVABLE"); _announcerQueue.Enqueue(Unfrigginbelievable); break; case 4: case 6: case 8: case 10: case 12: case 14: case 16: break; } } } private async void PlayFirstAudioInQueue() { if (base.playerHeldBy != null && !base.playerHeldBy.isPlayerDead && base.isHeld) { if (!_announcing && _announcerQueue.Count > 0) { _announcing = true; AudioClip clipToAnnounce = _announcerQueue.Peek(); AnnouncerAudioSource.PlayOneShot(clipToAnnounce); await Task.Delay((int)(clipToAnnounce.length * 1000f)); _announcerQueue.Dequeue(); _announcing = false; } } else if (!_announcing && _announcerQueue.Count > 0) { for (int i = 0; i < _announcerQueue.Count; i++) { _announcerQueue.Dequeue(); } } } private void AnnounceMsg(string msg) { HUDManager.Instance.AddTextToChatOnServer(msg, -1); } private bool IsCurrentlyLocalPlayer() { return ((NetworkBehaviour)this).IsOwner; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "EnergySwordItem"; } } public class GravityCoilItem : GrabbableObject { private const int RARITY = 70; private const float JUMP_INCREASE = 13f; private bool isGravBoostActive = false; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("Gravity Coil"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 70, (LevelTypes)(-1)); GravityCoilItem gravityCoilItem = val.spawnPrefab.AddComponent<GravityCoilItem>(); ((GrabbableObject)gravityCoilItem).grabbable = true; ((GrabbableObject)gravityCoilItem).grabbableToEnemies = true; ((GrabbableObject)gravityCoilItem).isInFactory = true; ((GrabbableObject)gravityCoilItem).itemProperties = val; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if (base.playerHeldBy != null && !isGravBoostActive) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.jumpForce += 13f; isGravBoostActive = true; } } public override void Update() { ((GrabbableObject)this).Update(); if (base.playerHeldBy != null && isGravBoostActive) { base.playerHeldBy.takingFallDamage = false; base.playerHeldBy.fallValue = Mathf.Clamp(base.playerHeldBy.fallValue, -10f, base.playerHeldBy.jumpForce); } } public override void DestroyObjectInHand(PlayerControllerB playerHolding) { DisableGravBoost(); ((GrabbableObject)this).DestroyObjectInHand(playerHolding); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); DisableGravBoost(); } public override void DiscardItem() { DisableGravBoost(); ((GrabbableObject)this).DiscardItem(); } private void DisableGravBoost() { if (isGravBoostActive && base.playerHeldBy != null) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.jumpForce -= 13f; base.playerHeldBy.takingFallDamage = true; isGravBoostActive = false; } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "GravityCoilItem"; } } public class HealthpackItem : GrabbableObject { private const int HEALTHPACK_PRICE = 20; private const string HEALTHPACK_DESC = "A first aid kit containing the standard combat wound treatment, which is used by all UNSC combat personnel, ranging from Marines to Spartans.\n\nEach health pack contains biofoam, a stitch kit, polypseudomorphine, a sterile field generator, self-adhering antiseptic battle dressings, and other useful components.\n\nUse when you receive and injury (critical or not).\n\n"; public AudioSource healthpackAudio; public AudioClip healSfx; public static void AddAsset(AssetBundle assetBundle) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown Item val = assetBundle.LoadAsset<Item>("Healthpack"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, new TerminalNode { displayText = "A first aid kit containing the standard combat wound treatment, which is used by all UNSC combat personnel, ranging from Marines to Spartans.\n\nEach health pack contains biofoam, a stitch kit, polypseudomorphine, a sterile field generator, self-adhering antiseptic battle dressings, and other useful components.\n\nUse when you receive and injury (critical or not).\n\n", clearPreviousText = true }, 20); HealthpackItem healthpackItem = val.spawnPrefab.AddComponent<HealthpackItem>(); ((GrabbableObject)healthpackItem).grabbable = true; ((GrabbableObject)healthpackItem).isInFactory = true; ((GrabbableObject)healthpackItem).grabbableToEnemies = true; ((GrabbableObject)healthpackItem).itemProperties = val; healthpackItem.healthpackAudio = val.spawnPrefab.GetComponent<AudioSource>(); healthpackItem.healSfx = healthpackItem.healthpackAudio.clip; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0053: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy != null && base.playerHeldBy.health < 100) { healthpackAudio.PlayOneShot(healSfx); base.playerHeldBy.DamagePlayer(-100, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); if (base.playerHeldBy.criticallyInjured) { base.playerHeldBy.MakeCriticallyInjured(false); } base.itemUsedUp = true; ((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "HealthpackItem"; } } public class MessmerFlameItem : GrabbableObject { private const int RARITY = 80; public static GameObject FireSerpent; public AudioSource AudioSource; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("MessmersFlame"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 80, (LevelTypes)(-1)); MessmerFlameItem messmerFlameItem = val.spawnPrefab.AddComponent<MessmerFlameItem>(); ((GrabbableObject)messmerFlameItem).grabbable = true; ((GrabbableObject)messmerFlameItem).grabbableToEnemies = true; ((GrabbableObject)messmerFlameItem).isInFactory = true; ((GrabbableObject)messmerFlameItem).itemProperties = val; messmerFlameItem.AudioSource = val.spawnPrefab.GetComponent<AudioSource>(); FireSerpent = assetBundle.LoadAsset<GameObject>("FireSerpent"); FireSerpent.AddComponent<FireSerpent>(); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy != null) { GameObject fireSerpent = FireSerpent; Transform transform = RoundManager.Instance.mapPropsContainer.transform; GameObject val = Object.Instantiate<GameObject>(fireSerpent, ((Component)this).transform.position, ((Component)base.playerHeldBy).transform.rotation, transform); FireSerpent component = val.GetComponent<FireSerpent>(); component.player = base.playerHeldBy; } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "MessmerFlameItem"; } } public class PizzaItem : GrabbableObject { private const int RARITY = 80; private bool isActive = false; public AudioSource AudioSource; public AudioClip EatSfx; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("Pizza"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 80, (LevelTypes)(-1)); PizzaItem pizzaItem = val.spawnPrefab.AddComponent<PizzaItem>(); ((GrabbableObject)pizzaItem).grabbable = true; ((GrabbableObject)pizzaItem).grabbableToEnemies = true; ((GrabbableObject)pizzaItem).isInFactory = true; ((GrabbableObject)pizzaItem).itemProperties = val; pizzaItem.AudioSource = val.spawnPrefab.GetComponent<AudioSource>(); pizzaItem.EatSfx = pizzaItem.AudioSource.clip; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0043: 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_0065: 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) //IL_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy != null && !isActive) { Vector3 positionOffset = base.itemProperties.positionOffset; Vector3 rotationOffset = base.itemProperties.rotationOffset; isActive = true; base.itemProperties.positionOffset = new Vector3(0.11f, -0.3f, -0.35f); base.itemProperties.rotationOffset = new Vector3(90f, 0f, -100f); AudioSource.PlayOneShot(EatSfx); ReturnToNormalOffsets(positionOffset, rotationOffset); } } private async void ReturnToNormalOffsets(Vector3 normalPos, Vector3 normalRot) { //IL_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) await Task.Delay(1000); base.itemProperties.positionOffset = normalPos; base.itemProperties.rotationOffset = normalRot; isActive = false; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "PizzaItem"; } } public class RizzburgerItem : GrabbableObject { private const int RARITY = 30; private const float COOLDOWN = 10f; public AudioSource rizzburgerAudio; public AudioClip rizzSfx; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("Rizzburger"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 30, (LevelTypes)(-1)); RizzburgerItem rizzburgerItem = val.spawnPrefab.AddComponent<RizzburgerItem>(); ((GrabbableObject)rizzburgerItem).grabbable = true; ((GrabbableObject)rizzburgerItem).grabbableToEnemies = true; ((GrabbableObject)rizzburgerItem).isInFactory = true; ((GrabbableObject)rizzburgerItem).itemProperties = val; rizzburgerItem.rizzburgerAudio = val.spawnPrefab.GetComponent<AudioSource>(); rizzburgerItem.rizzSfx = rizzburgerItem.rizzburgerAudio.clip; ((GrabbableObject)rizzburgerItem).useCooldown = 10f; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy != null) { rizzburgerAudio.PlayOneShot(rizzSfx); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "RizzburgerItem"; } } public class SpeedCoilItem : GrabbableObject { private const int RARITY = 70; private const float SPEED_INCREASE = 3f; private bool isSpeedBoostActive = false; public static void AddAsset(AssetBundle assetBundle) { Item val = assetBundle.LoadAsset<Item>("Speed Coil"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 70, (LevelTypes)(-1)); SpeedCoilItem speedCoilItem = val.spawnPrefab.AddComponent<SpeedCoilItem>(); ((GrabbableObject)speedCoilItem).grabbable = true; ((GrabbableObject)speedCoilItem).grabbableToEnemies = true; ((GrabbableObject)speedCoilItem).isInFactory = true; ((GrabbableObject)speedCoilItem).itemProperties = val; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if (base.playerHeldBy != null && !isSpeedBoostActive) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.movementSpeed += 3f; isSpeedBoostActive = true; } } public override void DestroyObjectInHand(PlayerControllerB playerHolding) { DisableSpeedBoost(); ((GrabbableObject)this).DestroyObjectInHand(playerHolding); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); DisableSpeedBoost(); } public override void DiscardItem() { DisableSpeedBoost(); ((GrabbableObject)this).DiscardItem(); } private void DisableSpeedBoost() { if (isSpeedBoostActive && base.playerHeldBy != null) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.movementSpeed -= 3f; isSpeedBoostActive = false; } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "SpeedCoilItem"; } } public class NothingPersonnel : NetworkBehaviour { private const int PRICE = 0; private const string DESC = "Test"; public static UnlockableItem UnlockableItem = new UnlockableItem { unlockableName = "Sword Skill: Nothing Personnel", shopSelectionNode = new TerminalNode { displayText = "test", clearPreviousText = true }, alwaysInStock = true, IsPlaceable = false, unlockableType = -1 }; public static UnlockableItemDef ItemDef = new UnlockableItemDef { storeType = (StoreType)1, unlockable = UnlockableItem }; public static void AddAsset(AssetBundle assetBundle) { UnlockableItem.prefabObject = assetBundle.LoadAsset<GameObject>("NothingPersonnel"); Utilities.FixMixerGroups(UnlockableItem.prefabObject); NetworkPrefabs.RegisterNetworkPrefab(UnlockableItem.prefabObject); Unlockables.RegisterUnlockable(ItemDef, 0, (StoreType)1); UnlockableItem.prefabObject.AddComponent<NothingPersonnel>(); RemoveWhenPurchased(); } private static async void RemoveWhenPurchased() { while (!UnlockableItem.hasBeenUnlockedByPlayer) { await Task.Delay(100); } Console.WriteLine("Removed from shop"); Unlockables.DisableUnlockable(ItemDef); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "NothingPersonnel"; } } } namespace YourThunderstoreTeam.patch.enemies { [HarmonyPatch(typeof(CaveDwellerAI))] public class CaveDwellerAIPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnHitEnemy(ref CaveDwellerAI __instance, int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { Console.WriteLine("Hit ID: " + hitID); if (hitID == EnergySwordItem.HitId) { ((EnemyAI)__instance).KillEnemyOnOwnerClient(false); } return true; } } [HarmonyPatch(typeof(EnemyAI))] public class EnemyAIPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static PlayerControllerB PostCheckLineOfSightForPlayer(PlayerControllerB __result) { return (__result == null || PlayerControllerBPatch.IsPlayerInvisible(__result)) ? null : __result; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static PlayerControllerB PostCheckLineOfSightForClosestPlayer(PlayerControllerB __result) { return (__result == null || PlayerControllerBPatch.IsPlayerInvisible(__result)) ? null : __result; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static PlayerControllerB[] GetAllPlayersInLineOfSight(PlayerControllerB[] __result) { if (__result == null || __result.Length == 0) { return null; } List<PlayerControllerB> list = new List<PlayerControllerB>(); foreach (PlayerControllerB val in __result) { if (val != null && !val.isPlayerDead && !PlayerControllerBPatch.IsPlayerInvisible(val)) { list.Add(val); } } Console.WriteLine("Count: " + list.Count); return (list.Count > 0) ? list.ToArray() : null; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static PlayerControllerB PostGetClosestPlayer(PlayerControllerB __result) { return (__result == null || PlayerControllerBPatch.IsPlayerInvisible(__result)) ? null : __result; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static bool PostTargetClosestPlayer(bool __result, ref EnemyAI __instance) { PlayerControllerB targetPlayer = __instance.targetPlayer; if (targetPlayer != null && PlayerControllerBPatch.IsPlayerInvisible(targetPlayer)) { return false; } return __result; } } [HarmonyPatch(typeof(FlowermanAI))] public class FlowermanPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnKillPlayerAnimationServerRpc(ref FlowermanAI __instance) { PlayerControllerB targetPlayer = ((EnemyAI)__instance).targetPlayer; if (targetPlayer != null) { bool flag = PlayerControllerBPatch.IsPlayerInvincible(targetPlayer); return !flag; } return true; } } [HarmonyPatch(typeof(ForestGiantAI))] public class ForestGiantPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnGrabPlayerServerRpc(ref ForestGiantAI __instance) { PlayerControllerB targetPlayer = ((EnemyAI)__instance).targetPlayer; if (targetPlayer != null) { bool flag = PlayerControllerBPatch.IsPlayerInvincible(targetPlayer); return !flag; } return true; } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] public class MaskedPlayerEnemyPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnKillAnimation(ref MaskedPlayerEnemy __instance) { PlayerControllerB targetPlayer = ((EnemyAI)__instance).targetPlayer; if (targetPlayer != null) { bool flag = PlayerControllerBPatch.IsPlayerInvincible(targetPlayer); return !flag; } return true; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool OnKillPlayerAnimationServerRpc(ref MaskedPlayerEnemy __instance) { PlayerControllerB targetPlayer = ((EnemyAI)__instance).targetPlayer; if (targetPlayer != null) { bool flag = PlayerControllerBPatch.IsPlayerInvincible(targetPlayer); return !flag; } Utilities.PrintToChat("Returned true"); return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace DawnUltrasItems.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }