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 TurboEdition v0.1.10
plugins/TurboEdition.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using AK.Wwise; using BepInEx; using BepInEx.Logging; using EntityStates; using EntityStates.AI; using EntityStates.AI.Walker; using EntityStates.TitanMonster; using HG; using HG.Reflection; using IL.RoR2; using IL.RoR2.UI; using IL.RoR2.UI.LogBook; using JetBrains.Annotations; using KinematicCharacterController; using LeTai.Asset.TranslucentImage; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On.RoR2; using On.RoR2.UI; using RoR2; using RoR2.Achievements; using RoR2.Artifacts; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.EntityLogic; using RoR2.ExpansionManagement; using RoR2.HudOverlay; using RoR2.Items; using RoR2.Navigation; using RoR2.Networking; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.Stats; using RoR2.UI; using RoR2.UI.LogBook; using RoR2.UI.MainMenu; using TMPro; using TurboEdition.Buffs; using TurboEdition.Components; using TurboEdition.Components.UI; using TurboEdition.EntityStates.AI.Walker; using TurboEdition.EntityStates.Grenadier; using TurboEdition.EntityStates.ImpBomber.Weapon; using TurboEdition.Equipments; using TurboEdition.Items; using TurboEdition.ScriptableObjects; using TurboEdition.TempVFX; using TurboEdition.UI; using TurboEdition.Utils; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Turbo Edition")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Turbo Edition")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("0.1.10")] [assembly: OptIn] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.10.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } } namespace TurboEdition { public static class Assets { private const string assetBundleFolderName = "assetbundles"; internal static string mainAssetBundleName = "assetTurbo"; public static ReadOnlyCollection<AssetBundle> loadedAssetBundles; public static AssetBundle mainAssetBundle => loadedAssetBundles[0]; internal static string assemblyDir => Path.GetDirectoryName(TurboUnityPlugin.pluginInfo.Location); internal static string languageRoot => Path.Combine(assemblyDir, "language"); public static List<Material> MaterialsWithSwappedShaders { get; private set; } = new List<Material>(); [SystemInitializer(new Type[] { })] public static void Init() { if (Application.isBatchMode) { return; } foreach (AssetBundle loadedAssetBundle in loadedAssetBundles) { MapMaterials(loadedAssetBundle); } } public static string[] GetAssetBundlePaths() { return (from filePath in Directory.GetFiles(Path.Combine(assemblyDir, "assetbundles")) where !filePath.EndsWith(".manifest") select filePath into path orderby Path.GetFileName(path).Equals(mainAssetBundleName) descending select path).ToArray(); } internal static void MapMaterials(AssetBundle assetBundle) { if (assetBundle.isStreamedSceneAssetBundle) { return; } Material[] array = assetBundle.LoadAllAssets<Material>(); for (int i = 0; i < array.Length; i++) { if (((Object)array[i].shader).name.Contains("Stubbed")) { try { SwapShader(array[i]); } catch (Exception arg) { TELog.LogE($"Failed to swap shader of material {array[i]}: {arg}", alwaysLog: true, 61, "MapMaterials"); } } } } private static async void SwapShader(Material material) { material.shader = await Addressables.LoadAssetAsync<Shader>((object)(((Object)material.shader).name.Substring("Stubbed".Length) + ".shader")).Task; MaterialsWithSwappedShaders.Add(material); } } public interface IStatBuffBehavior { void RecalculateStatsEnd(); void RecalculateStatsStart(ref CharacterBody characterBody); } internal static class InitBuffs { public static Dictionary<BuffDef, Buff> buffList = new Dictionary<BuffDef, Buff>(); public static void Init() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown InitializeBuffs(); CharacterBody.onBodyStartGlobal += AddBuffManager; CharacterBody.OnClientBuffsChanged += new hook_OnClientBuffsChanged(OnClientBuffsChanged); } public static void InitializeBuffs() { foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(Buff)) select type) { Buff buff = (Buff)Activator.CreateInstance(item); if (!Object.op_Implicit((Object)(object)buff.buffDef)) { Debug.LogError((object)string.Concat("Buff ", buff, " is missing the buffDef or it couldn't be found. Check the Unity project. Skipping.")); continue; } buff.Initialize(); buffList.Add(buff.buffDef, buff); } } private static void AddBuffManager(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Util.HasEffectiveAuthority(body.networkIdentity)) { ((Component)body).gameObject.AddComponent<TurboBuffManager>().CheckForBuffs(); } } private static void OnClientBuffsChanged(orig_OnClientBuffsChanged orig, CharacterBody self) { orig.Invoke(self); if (Util.HasEffectiveAuthority(self.networkIdentity)) { ((Component)self).GetComponent<TurboBuffManager>()?.CheckForBuffs(); } } } internal class TurboBuffManager : MonoBehaviour { public IStatBuffBehavior[] statBuffBehaviors = new IStatBuffBehavior[0]; private BuffDef[] activeBuffsList = (BuffDef[])(object)new BuffDef[InitBuffs.buffList.Count]; private CharacterBody body; private void Awake() { body = ((Component)this).gameObject.GetComponent<CharacterBody>(); } public void CheckForBuffs() { int num = 0; foreach (KeyValuePair<BuffDef, Buff> buff in InitBuffs.buffList) { int buffCount = body.GetBuffCount(buff.Key); if (buffCount > 0 && (Object)(object)activeBuffsList[num] == (Object)null) { activeBuffsList[num] = buff.Value.buffDef; buff.Value.OnBuffFirstStackGained(ref body); } else if (Object.op_Implicit((Object)(object)activeBuffsList[num]) && buffCount < 1) { buff.Value.OnBuffLastStackLost(ref body); activeBuffsList[num] = null; } buff.Value.AddBehavior(ref body, buffCount); buff.Value.BuffStep(ref body, buffCount); num++; } statBuffBehaviors = ((Component)this).GetComponents<IStatBuffBehavior>(); } public void RunStatRecalculationsStart(CharacterBody self) { IStatBuffBehavior[] array = statBuffBehaviors; for (int i = 0; i < array.Length; i++) { array[i].RecalculateStatsStart(ref self); } foreach (KeyValuePair<BuffDef, Buff> buff in InitBuffs.buffList) { if (body.HasBuff(buff.Key)) { buff.Value.RecalcStatsStart(ref self); } } } public void RunStatRecalculationsEnd() { IStatBuffBehavior[] array = statBuffBehaviors; for (int i = 0; i < array.Length; i++) { array[i].RecalculateStatsEnd(); } foreach (KeyValuePair<BuffDef, Buff> buff in InitBuffs.buffList) { if (body.HasBuff(buff.Key)) { buff.Value.RecalcStatsEnd(ref body); } } } } [RequireComponent(typeof(CharacterBody))] public class TurboItemManager : MonoBehaviour { public IStatItemBehavior[] statItemBehaviors = new IStatItemBehavior[0]; private CharacterBody body; private void Awake() { body = ((Component)this).gameObject.GetComponent<CharacterBody>(); body.onInventoryChanged += CheckForTEItems; } public void CheckForTEItems() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00ba: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<ItemDef, Item> itemBehaviour in InitPickups.itemBehaviourList) { itemBehaviour.Value.AddBehavior(ref body, body.inventory.GetItemCount(itemBehaviour.Key)); } foreach (KeyValuePair<EquipmentDef, Equipment> equipment in InitPickups.equipmentList) { Equipment value = equipment.Value; ref CharacterBody reference = ref body; EquipmentSlot equipmentSlot = body.equipmentSlot; value.AddBehavior(ref reference, Convert.ToInt32(((equipmentSlot != null) ? new EquipmentIndex?(equipmentSlot.equipmentIndex) : null) == (EquipmentIndex?)equipment.Value.equipmentDef.equipmentIndex)); } ((MonoBehaviour)this).StartCoroutine(GetInterfaces()); } public void CheckEqp(EquipmentDef equipmentDef, bool gainOrLoss) { if (InitPickups.equipmentList.TryGetValue(equipmentDef, out var value)) { value.AddBehavior(ref body, Convert.ToInt32(gainOrLoss)); ((MonoBehaviour)this).StartCoroutine(GetInterfaces()); } } private IEnumerator GetInterfaces() { yield return (object)new WaitForEndOfFrame(); statItemBehaviors = ((Component)this).GetComponents<IStatItemBehavior>(); body.healthComponent.onIncomingDamageReceivers = ((Component)this).GetComponents<IOnIncomingDamageServerReceiver>(); body.healthComponent.onTakeDamageReceivers = ((Component)this).GetComponents<IOnTakeDamageServerReceiver>(); } public void RunStatRecalculationsStart() { IStatItemBehavior[] array = statItemBehaviors; for (int i = 0; i < array.Length; i++) { array[i].RecalculateStatsStart(); } foreach (KeyValuePair<ItemDef, Item> itemBehaviour in InitPickups.itemBehaviourList) { itemBehaviour.Value.RecalcStatsStart(ref body, body.inventory.GetItemCount(itemBehaviour.Key)); } } public void RunStatRecalculationsEnd() { IStatItemBehavior[] array = statItemBehaviors; for (int i = 0; i < array.Length; i++) { array[i].RecalculateStatsEnd(); } foreach (KeyValuePair<ItemDef, Item> itemBehaviour in InitPickups.itemBehaviourList) { itemBehaviour.Value.RecalcStatsEnd(ref body, body.inventory.GetItemCount(itemBehaviour.Key)); } } } internal class TurboVFXManager : MonoBehaviour { private TemporaryVisualEffect[] tempVisualEffects = (TemporaryVisualEffect[])(object)new TemporaryVisualEffect[InitVFX.temporaryVfx.Count]; private CharacterBody body; private CharacterModel model; private void Awake() { body = ((Component)this).gameObject.GetComponent<CharacterBody>(); model = ((Component)((Component)this).gameObject.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>(); } private void OnEnable() { InstanceTracker.Add<TurboVFXManager>(this); } private void Update() { if (Object.op_Implicit((Object)(object)body)) { UpdateAllTemporaryVFX(); } } private void OnDisable() { InstanceTracker.Remove<TurboVFXManager>(this); } public void UpdateForCamera(CameraRigController cameraRigController) { UpdateOverlays(); } private void UpdateOverlays() { } private void UpdateAllTemporaryVFX() { for (int i = 0; i < tempVisualEffects.Length; i++) { TemporaryVFX temporaryVFX = InitVFX.temporaryVfx.Keys.ElementAt(i); TELog.LogW("Updating " + temporaryVFX, alwaysLog: false, 60, "UpdateAllTemporaryVFX"); UpdateSingleTemporaryVisualEffect(ref tempVisualEffects[i], InitVFX.temporaryVfx.Values.ElementAt(i), temporaryVFX.GetEffectRadius(ref body), temporaryVFX.IsEnabled(ref body), temporaryVFX.GetChildOverride(ref body)); TELog.LogW(string.Concat("Updated ", tempVisualEffects[i], " ", InitVFX.temporaryVfx.Values.ElementAt(i), " ", temporaryVFX.GetEffectRadius(ref body), " ", temporaryVFX.IsEnabled(ref body).ToString(), " ", temporaryVFX.GetChildOverride(ref body), " "), alwaysLog: false, 62, "UpdateAllTemporaryVFX"); } } private void AddOverlay(Material overlayMaterial, bool active) { if (model.activeOverlayCount < CharacterModel.maxOverlays && Object.op_Implicit((Object)(object)overlayMaterial) && active) { Material[] currentOverlays = model.currentOverlays; CharacterModel obj = model; int activeOverlayCount = obj.activeOverlayCount; obj.activeOverlayCount = activeOverlayCount + 1; int num = activeOverlayCount; model.activeOverlayCount = num + 1; currentOverlays[num] = overlayMaterial; } } private void UpdateSingleTemporaryVisualEffect(ref TemporaryVisualEffect tempEffect, GameObject prefab, float effectRadius, bool active, string childLocatorOverride = "") { //IL_0194: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) TELog.LogW(string.Concat(tempEffect, " = tempEffect; ", prefab, " = Prefab; ", effectRadius, " = Radius; ", active.ToString(), " = active; ", childLocatorOverride), alwaysLog: false, 83, "UpdateSingleTemporaryVisualEffect"); bool flag = (Object)(object)tempEffect != (Object)null; if (flag == active) { return; } TELog.LogW("Passed check 1", alwaysLog: false, 87, "UpdateSingleTemporaryVisualEffect"); if (active) { TELog.LogW("Passed check 2", alwaysLog: false, 90, "UpdateSingleTemporaryVisualEffect"); if (flag) { return; } TELog.LogW("Passed check 3", alwaysLog: false, 93, "UpdateSingleTemporaryVisualEffect"); GameObject val = Object.Instantiate<GameObject>(prefab, body.corePosition, Quaternion.identity); tempEffect = val.GetComponent<TemporaryVisualEffect>(); tempEffect.parentTransform = body.coreTransform; tempEffect.visualState = (VisualState)0; tempEffect.healthComponent = body.healthComponent; tempEffect.radius = effectRadius; LocalCameraEffect component = val.GetComponent<LocalCameraEffect>(); if (Object.op_Implicit((Object)(object)component)) { component.targetCharacter = ((Component)this).gameObject; } if (string.IsNullOrEmpty(childLocatorOverride)) { return; } ModelLocator modelLocator = body.modelLocator; ChildLocator val2; if ((Object)(object)modelLocator == (Object)null) { val2 = null; } else { Transform modelTransform = modelLocator.modelTransform; val2 = (((Object)(object)modelTransform != (Object)null) ? ((Component)modelTransform).GetComponent<ChildLocator>() : null); } ChildLocator val3 = val2; if (Object.op_Implicit((Object)(object)val3)) { Transform val4 = val3.FindChild(childLocatorOverride); if (Object.op_Implicit((Object)(object)val4)) { tempEffect.parentTransform = val4; } } } else if (Object.op_Implicit((Object)(object)tempEffect)) { tempEffect.visualState = (VisualState)1; } } } public interface IStatItemBehavior { void RecalculateStatsEnd(); void RecalculateStatsStart(); } public class InitPickups { public static Dictionary<ItemDef, Item> itemBehaviourList = new Dictionary<ItemDef, Item>(); public static Dictionary<EquipmentDef, Equipment> equipmentList = new Dictionary<EquipmentDef, Equipment>(); [SystemInitializer(new Type[] { typeof(PickupCatalog) })] public static void HookInit() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown InitializeEquipments(); InitializeItems(); TELog.LogI("Subscribing to delegates related to Items and Equipments.", alwaysLog: true, 22, "HookInit"); CharacterBody.onBodyStartGlobal += AddItemManager; CharacterBody.RecalculateStats += new hook_RecalculateStats(OnRecalculateStats); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(FireTurboEqp); } public static IEnumerable<Item> InitializeItems() { TELog.LogD($"Getting Legacy Items found inside {Assembly.GetExecutingAssembly()}...", alwaysLog: true, 31, "InitializeItems"); (from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(Item)) select type into itemType select (Item)Activator.CreateInstance(itemType)).ToList().ForEach(delegate(Item item) { TrackItem(item); }); return null; } public static void TrackItem(Item item, Dictionary<ItemDef, Item> itemDictionary = null) { item.Initialize(); itemBehaviourList.Add(item.itemDef, item); itemDictionary?.Add(item.itemDef, item); } public static IEnumerable<Equipment> InitializeEquipments() { TELog.LogD($"Getting the Equipments found inside {Assembly.GetExecutingAssembly()}...", alwaysLog: false, 48, "InitializeEquipments"); (from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(Equipment)) select type into eqpType select (Equipment)Activator.CreateInstance(eqpType)).ToList().ForEach(delegate(Equipment eqp) { TrackEquipment(eqp); }); return null; } public static void TrackEquipment(Equipment equip, Dictionary<EquipmentDef, Equipment> equipDictionary = null) { equip.Initialize(); equipmentList.Add(equip.equipmentDef, equip); equipDictionary?.Add(equip.equipmentDef, equip); } private static void AddItemManager(CharacterBody body) { if (Object.op_Implicit((Object)(object)body.inventory)) { ((Component)body).gameObject.AddComponent<TurboItemManager>().CheckForTEItems(); } } private static void OnRecalculateStats(orig_RecalculateStats orig, CharacterBody self) { TurboItemManager component = ((Component)self).GetComponent<TurboItemManager>(); TurboBuffManager component2 = ((Component)self).GetComponent<TurboBuffManager>(); component?.RunStatRecalculationsStart(); component2?.RunStatRecalculationsStart(self); orig.Invoke(self); component?.RunStatRecalculationsEnd(); component2?.RunStatRecalculationsEnd(); } private static bool FireTurboEqp(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { if (equipmentList.TryGetValue(equipmentDef, out var value)) { return value.FireAction(self); } return orig.Invoke(self, equipmentDef); } } [CreateAssetMenu(menuName = "TurboEdition/SerializableContentPackExpanded")] internal class SerializableContentPackExpanded : SerializableContentPack { public ItemTierDef[] itemTierDefs = Array.Empty<ItemTierDef>(); public ItemRelationshipProvider[] itemRelationshipProviders = Array.Empty<ItemRelationshipProvider>(); public ItemRelationshipType[] itemRelationshipTypes = Array.Empty<ItemRelationshipType>(); public ExpansionDef[] expansionDefs = Array.Empty<ExpansionDef>(); public EntitlementDef[] entitlementDefs = Array.Empty<EntitlementDef>(); public MiscPickupDef[] miscPickupDefs = Array.Empty<MiscPickupDef>(); public ContentPack CreateV1_2_1_0_ContentPack() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown ContentPack val = new ContentPack(); val.bodyPrefabs.Add(base.bodyPrefabs); val.masterPrefabs.Add(base.masterPrefabs); val.projectilePrefabs.Add(base.projectilePrefabs); val.gameModePrefabs.Add(base.gameModePrefabs); val.networkedObjectPrefabs.Add(base.networkedObjectPrefabs); val.skillDefs.Add(base.skillDefs); val.skillFamilies.Add(base.skillFamilies); val.sceneDefs.Add(base.sceneDefs); val.itemDefs.Add(base.itemDefs); val.equipmentDefs.Add(base.equipmentDefs); val.buffDefs.Add(base.buffDefs); val.eliteDefs.Add(base.eliteDefs); val.unlockableDefs.Add(base.unlockableDefs); val.survivorDefs.Add(base.survivorDefs); val.artifactDefs.Add(base.artifactDefs); val.effectDefs.Add(((IEnumerable<GameObject>)base.effectDefs).Select((Func<GameObject, EffectDef>)((GameObject asset) => new EffectDef(asset))).ToArray()); val.surfaceDefs.Add(base.surfaceDefs); val.networkSoundEventDefs.Add(base.networkSoundEventDefs); val.musicTrackDefs.Add(base.musicTrackDefs); val.gameEndingDefs.Add(base.gameEndingDefs); val.entityStateConfigurations.Add(base.entityStateConfigurations); (from type in ((object)this).GetType().Assembly.GetTypes() where typeof(EntityState).IsAssignableFrom(type) select type).ToList().ForEach(delegate(Type state) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ref SerializableEntityStateType[] entityStateTypes = ref base.entityStateTypes; SerializableEntityStateType val2 = new SerializableEntityStateType(state); ArrayUtils.ArrayAppend<SerializableEntityStateType>(ref entityStateTypes, ref val2); }); List<Type> list = new List<Type>(); for (int i = 0; i < base.entityStateTypes.Length; i++) { Type stateType = ((SerializableEntityStateType)(ref base.entityStateTypes[i])).stateType; if (stateType != null) { list.Add(stateType); continue; } Debug.LogWarning((object)("SerializableContentPack \"" + ((Object)this).name + "\" could not resolve type with name \"" + ((SerializableEntityStateType)(ref base.entityStateTypes[i])).typeName + "\". The type will not be available in the content pack.")); } val.entityStateTypes.Add(list.ToArray()); val.itemTierDefs.Add(itemTierDefs); val.itemRelationshipProviders.Add(itemRelationshipProviders); val.itemRelationshipTypes.Add(itemRelationshipTypes); val.expansionDefs.Add(expansionDefs); val.entitlementDefs.Add(entitlementDefs); val.miscPickupDefs.Add(miscPickupDefs); return val; } public override ContentPack CreateContentPack() { return CreateV1_2_1_0_ContentPack(); } } public class TEContent : IContentPackProvider { public delegate IEnumerator LoadStaticContentAsyncDelegate(LoadStaticContentAsyncArgs args); public delegate IEnumerator GenerateContentPackAsyncDelegate(GetContentPackAsyncArgs args); public delegate IEnumerator FinalizeAsyncDelegate(FinalizeAsyncArgs args); public static class Artifacts { public static ArtifactDef MeltdownArtifact; public static ArtifactDef PainArtifact; public static ArtifactDef Spite2Artifact; public static ArtifactDef WormsArtifact; } public static class ItemTiers { public static ItemTierDef CurseItemTier; public static ItemTierDef DualItemTier; } public static class Items { public static ItemDef AddTeleporterRadius; public static ItemDef AirborneBonus; public static ItemDef AirborneDash; public static ItemDef BaneMask; public static ItemDef BloodEconomy; public static ItemDef DropletDupe; public static ItemDef GracePeriod; public static ItemDef Hitlag; public static ItemDef ItemDeployer; public static ItemDef KnifeFan; public static ItemDef MeleeArmor; public static ItemDef MoneyBank; public static ItemDef PackDuplicator; public static ItemDef PackMagnet; public static ItemDef RadioSearch; public static ItemDef RadioSearchVoid; public static ItemDef SoulDevourer; public static ItemDef StandBonus; public static ItemDef SuperStickies; public static ItemDef Typewriter; public static ItemDef WardOnLevelVoid; } public static class Equipment { public static EquipmentDef CursedScythe; public static EquipmentDef Hellchain; public static EquipmentDef LeaveStage; public static EquipmentDef VoidSquad; } public static class Buffs { public static BuffDef CannotSprint; public static BuffDef ElectroStatic; public static BuffDef HellLinked; public static BuffDef MeleeArmor; public static BuffDef Panic; public static BuffDef WardOnLevelVoid; } public static class Expansions { public static ExpansionDef TurboExpansion; } public static class Survivors { public static SurvivorDef Grenadier; public static SurvivorDef StaffMage; } public static class Scenes { public static SceneDef observatory; } private static bool alreadyLoadedBaseGame; public SerializableContentPack serializableContentPack; public ContentPack tempPackFromSerializablePack = new ContentPack(); public static LoadStaticContentAsyncDelegate onLoadStaticContent { get; set; } public static GenerateContentPackAsyncDelegate onGenerateContentPack { get; set; } public static FinalizeAsyncDelegate onFinalizeAsync { get; set; } public string identifier => "TurboEdition"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { List<AssetBundle> loadedBundles = new List<AssetBundle>(); string[] bundlePaths = Assets.GetAssetBundlePaths(); int i = 0; while (i < bundlePaths.Length) { AssetBundleCreateRequest bundleLoadRequest = AssetBundle.LoadFromFileAsync(bundlePaths[i]); while (!((AsyncOperation)bundleLoadRequest).isDone) { args.ReportProgress(Util.Remap(((AsyncOperation)bundleLoadRequest).progress + (float)i, 0f, (float)bundlePaths.Length, 0f, 0.8f)); yield return null; } int num = i + 1; loadedBundles.Add(bundleLoadRequest.assetBundle); i = num; } Assets.loadedAssetBundles = new ReadOnlyCollection<AssetBundle>(loadedBundles); serializableContentPack = Assets.mainAssetBundle.LoadAsset<SerializableContentPack>("ContentPackV2"); tempPackFromSerializablePack = serializableContentPack.CreateContentPack(); tempPackFromSerializablePack.identifier = identifier; ContentLoadHelper.PopulateTypeFields<ArtifactDef>(typeof(Artifacts), tempPackFromSerializablePack.artifactDefs, (Func<string, string>)null); ContentLoadHelper.PopulateTypeFields<ItemTierDef>(typeof(ItemTiers), tempPackFromSerializablePack.itemTierDefs, (Func<string, string>)null); ContentLoadHelper.PopulateTypeFields<ItemDef>(typeof(Items), tempPackFromSerializablePack.itemDefs, (Func<string, string>)null); ContentLoadHelper.PopulateTypeFields<EquipmentDef>(typeof(Equipment), tempPackFromSerializablePack.equipmentDefs, (Func<string, string>)null); ContentLoadHelper.PopulateTypeFields<BuffDef>(typeof(Buffs), tempPackFromSerializablePack.buffDefs, (Func<string, string>)((string fieldName) => "bd" + fieldName)); ContentLoadHelper.PopulateTypeFields<SurvivorDef>(typeof(Survivors), tempPackFromSerializablePack.survivorDefs, (Func<string, string>)null); ContentLoadHelper.PopulateTypeFields<ExpansionDef>(typeof(Expansions), tempPackFromSerializablePack.expansionDefs, (Func<string, string>)null); ContentLoadHelper.PopulateTypeFields<SceneDef>(typeof(Scenes), tempPackFromSerializablePack.sceneDefs, (Func<string, string>)null); InitBuffs.Init(); InitVFX.Init(); if (onLoadStaticContent != null) { yield return onLoadStaticContent(args); } args.ReportProgress(1f); } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(tempPackFromSerializablePack, args.output); bool flag = false; bool flag2 = false; Enumerator<ContentPackLoadInfo> enumerator = args.peerLoadInfos.GetEnumerator(); try { while (enumerator.MoveNext()) { ContentPackLoadInfo current = enumerator.Current; if (((ReadOnlyContentPack)(ref current.previousContentPack)).identifier == "RoR2.BaseContent") { flag = true; } if (((ReadOnlyContentPack)(ref current.previousContentPack)).identifier == "RoR2.DLC1") { flag2 = true; } } } finally { ((IDisposable)enumerator).Dispose(); } if (flag && flag2 && !alreadyLoadedBaseGame) { alreadyLoadedBaseGame = true; args.output.itemRelationshipProviders[0].relationshipType = ItemRelationshipTypes.ContagiousItem; args.output.itemRelationshipProviders[0].relationships[0].itemDef1 = Items.WardOnLevel; Scenes.observatory.destinationsGroup = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage1.asset").WaitForCompletion(); } if (onGenerateContentPack != null) { yield return onGenerateContentPack(args); } args.ReportProgress(1f); } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { if (Directory.Exists(Assets.languageRoot)) { Language.collectLanguageRootFolders += delegate(List<string> stringList) { stringList.Add(Assets.languageRoot); }; MiscLanguage.AddDeathMessages(); } CostAndStatExtras.Init(); RoR2Application.isModded = true; NetworkModCompatibilityHelper.networkModList = NetworkModCompatibilityHelper.networkModList.Append("com.Anreol.TurboEdition;0.1.10"); if (onFinalizeAsync != null) { yield return onFinalizeAsync(args); } args.ReportProgress(1f); } } public class TELog { public static ManualLogSource logger; public static bool outputAlways; public TELog(ManualLogSource logger_) { logger = logger_; } public static void LogD(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { if (logger != null && (outputAlways || alwaysLog)) { logger.LogDebug((object)logString(data, i, member)); } } public static void LogE(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { if (logger != null && (outputAlways || alwaysLog)) { logger.LogError((object)logString(data, i, member)); } } public static void LogF(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { if (logger != null && (outputAlways || alwaysLog)) { logger.LogFatal((object)logString(data, i, member)); } } public static void LogI(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { if (logger != null && (outputAlways || alwaysLog)) { logger.LogInfo((object)logString(data, i, member)); } } public static void LogM(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { if (logger != null && (outputAlways || alwaysLog)) { logger.LogMessage((object)logString(data, i, member)); } } public static void LogW(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { if (logger != null && (outputAlways || alwaysLog)) { logger.LogWarning((object)logString(data, i, member)); } } private static string logString(object data, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "") { return $"{data} :: Line: {i}, Method {member}"; } } internal class InitVFX { public static Dictionary<TemporaryVFX, GameObject> temporaryVfx = new Dictionary<TemporaryVFX, GameObject>(); public static void Init() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (!Application.isBatchMode) { InitializeVfx(); CharacterBody.onBodyStartGlobal += AddVFXManager; SceneCamera.onSceneCameraPreRender += new SceneCameraDelegate(SceneCamera_onSceneCameraPreRender); } } private static void SceneCamera_onSceneCameraPreRender(SceneCamera sceneCamera) { if (!Object.op_Implicit((Object)(object)sceneCamera.cameraRigController)) { return; } foreach (TurboVFXManager instances in InstanceTracker.GetInstancesList<TurboVFXManager>()) { instances.UpdateForCamera(sceneCamera.cameraRigController); } } private static void InitializeVfx() { foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(TemporaryVFX)) select type) { TemporaryVFX temporaryVFX = (TemporaryVFX)Activator.CreateInstance(item); if (!Object.op_Implicit((Object)(object)temporaryVFX.tempVfxRootGO)) { TELog.LogE(string.Concat("TempVFX ", temporaryVFX, " is missing the visual effect root GameObject. Check Unity Project. Skipping."), alwaysLog: true, 46, "InitializeVfx"); continue; } temporaryVFX.Initialize(); temporaryVfx.Add(temporaryVFX, temporaryVFX.tempVfxRootGO); } } private static void AddVFXManager(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.modelLocator)) { ((Component)body).gameObject.AddComponent<TurboVFXManager>(); } } } public static class WwiseSoundbanks { public static string soundBankDirectory => Path.Combine(Assets.assemblyDir, "soundbanks"); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) AkSoundEngine.AddBasePath(soundBankDirectory); uint num = default(uint); AkSoundEngine.LoadBank("TurboInit", ref num); AkSoundEngine.LoadBank("TurboBank", ref num); AkBankManager.LoadBank("TurboMusicBank", false, false); } } [BepInPlugin("com.Anreol.TurboEdition", "TurboEdition", "0.1.10")] public class TurboUnityPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CollectContentPackProvidersDelegate <>9__6_0; internal void <Awake>b__6_0(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new TEContent()); } } internal const string ModVer = "0.1.10"; internal const string ModIdentifier = "TurboEdition"; public const string ModGuid = "com.Anreol.TurboEdition"; public static TurboUnityPlugin instance; public static PluginInfo pluginInfo; public static uint playMusicSystemID; public void Awake() { //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_003b: Expected O, but got Unknown TELog.logger = ((BaseUnityPlugin)this).Logger; pluginInfo = ((BaseUnityPlugin)this).Info; instance = this; object obj = <>c.<>9__6_0; if (obj == null) { CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new TEContent()); }; <>c.<>9__6_0 = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; } private void FeedbackLog(Run arg1, RunReport arg2) { TELog.LogW("That was a good run, right? If you used Turbo Edition content, please fill up this form below!", alwaysLog: true, 52, "FeedbackLog"); TELog.LogW("https://forms.gle/6kEEJdguHPrKzHNo9", alwaysLog: true, 53, "FeedbackLog"); } private void activeSceneChanged(Scene current, Scene next) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_0125: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) if (!((Scene)(ref next)).isLoaded || !(((Scene)(ref next)).name == "renderitem")) { return; } GameObject val = GameObject.Find("ITEM GOES HERE (can offset from here)"); GameObject val2 = null; GameObject[] rootGameObjects = ((Scene)(ref next)).GetRootGameObjects(); foreach (GameObject val3 in rootGameObjects) { if (((Object)val3).name == "move me for pleasant local lighting details") { val2 = val3; } } if ((Object)(object)val2 != (Object)null) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); obj.transform.localScale = new Vector3(0.02f, 0.02f, 0.02f); obj.transform.SetParent(val2.transform); } FieldInfo[] fields = typeof(TEContent.Items).GetFields(); for (int i = 0; i < fields.Length; i++) { ItemDef val4 = (ItemDef)fields[i].GetValue(null); if (Object.op_Implicit((Object)(object)val4.pickupModelPrefab) && !((Object)val4.pickupModelPrefab).name.Contains("Placeholder")) { if (Object.op_Implicit((Object)(object)val)) { Object.Instantiate<GameObject>(val4.pickupModelPrefab, val.transform).SetActive(false); } else { Object.Instantiate<GameObject>(val4.pickupModelPrefab, new Vector3(-0.06f, 0.04f, 2.07f), Quaternion.Euler(0f, 210.6264f, 0f)).SetActive(false); } } } fields = typeof(TEContent.Survivors).GetFields(); for (int i = 0; i < fields.Length; i++) { SurvivorDef val5 = (SurvivorDef)fields[i].GetValue(null); if (Object.op_Implicit((Object)(object)val5.displayPrefab)) { Object.Instantiate<GameObject>(val5.displayPrefab, new Vector3(0.04f, -0.09f, 2.17f), Quaternion.Euler(0f, 210.6264f, 0f)).SetActive(false); } } } private void onFixedUpdate() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)284)) { Addressables.LoadSceneAsync((object)"RoR2/Dev/renderitem/renderitem.unity", (LoadSceneMode)0, true, 100); } } } } namespace TurboEdition.TempVFX { internal class vfxDeathCards : TemporaryVFX { public override GameObject tempVfxRootGO { get; set; } = Assets.mainAssetBundle.LoadAsset<GameObject>("FX_Death_Cards"); public override bool IsEnabled(ref CharacterBody body) { if (!Object.op_Implicit((Object)(object)body.inventory)) { return false; } if (body.inventory.GetItemCount(TEContent.Items.DropletDupe) > 0) { DropletDupeBodyBehavior component = ((Component)body).GetComponent<DropletDupeBodyBehavior>(); if (Object.op_Implicit((Object)(object)component) && component.suicideReady) { TELog.LogW("Started spewing cards... or should.", alwaysLog: false, 21, "IsEnabled"); return true; } } return false; } } internal class vfxDummy1 : TemporaryVFX { public override GameObject tempVfxRootGO { get; set; } = Assets.mainAssetBundle.LoadAsset<GameObject>("vfxTonicTest"); public override bool IsEnabled(ref CharacterBody body) { return false; } } internal class VfxHellLinkedBuffIndicator : TemporaryVFX { public override GameObject tempVfxRootGO { get; set; } = Assets.mainAssetBundle.LoadAsset<GameObject>("FX_HellLinked_Buff_Effect"); public override bool IsEnabled(ref CharacterBody body) { if (body.GetBuffCount(TEContent.Buffs.HellLinked) > 0) { return true; } return false; } } internal class vfxPanicDrops : TemporaryVFX { public override GameObject tempVfxRootGO { get; set; } = Assets.mainAssetBundle.LoadAsset<GameObject>("FX_Panic_Buff_Effect"); public override string GetChildOverride(ref CharacterBody body) { return "Head"; } public override bool IsEnabled(ref CharacterBody body) { if (Object.op_Implicit((Object)(object)body.master)) { BaseAI[] aiComponents = body.master.aiComponents; for (int i = 0; i < aiComponents.Length; i++) { if (aiComponents[i].stateMachine.state is ForceFlee) { return true; } } } return false; } } internal class VfxVoidWarbannerBuffIndicator : TemporaryVFX { public override GameObject tempVfxRootGO { get; set; } = Assets.mainAssetBundle.LoadAsset<GameObject>("FX_VoidWarbanner_Buff_Effect"); public override bool IsEnabled(ref CharacterBody body) { if (body.GetBuffCount(TEContent.Buffs.WardOnLevelVoid) > 0) { return true; } return false; } } public abstract class TemporaryVFX { public abstract GameObject tempVfxRootGO { get; set; } public virtual void Initialize() { } public virtual float GetEffectRadius(ref CharacterBody body) { return body.radius; } public virtual string GetChildOverride(ref CharacterBody body) { return ""; } public virtual bool IsEnabled(ref CharacterBody body) { return false; } } } namespace TurboEdition.ScriptableObjects { internal class EnergyPairedSteppedSkillDef { } [CreateAssetMenu(menuName = "TurboEdition/SkillDef/GrenadierSpecialSkillDef")] internal class GrenadierSpecialSkillDef : SkillDef { public class InstanceData : BaseSkillInstanceData, IDisposable { public bool hasFullyUnloadedPrimary; public int maxSkillStockExtra; public int skillStocksExtra; public int previousSkillStocks; internal GameObject notification; internal GameObject flashPanel; internal GameObject highlightPanel; internal OverlayController overlayController; internal ImageFillController fillBarController; internal HGTextMeshProUGUI currentExtraStockText; public InstanceData(int maxStockFromReloading) { maxSkillStockExtra = maxStockFromReloading; skillStocksExtra = 0; previousSkillStocks = 0; } public void AssignOverlay(OverlayController newOverlay) { if (overlayController != null) { overlayController.onInstanceAdded -= onOverlayAdded; overlayController.onInstanceRemove -= onOverlayRemoved; HudOverlayManager.RemoveOverlay(overlayController); } overlayController = newOverlay; overlayController.onInstanceAdded += onOverlayAdded; overlayController.onInstanceRemove += onOverlayRemoved; } private void onOverlayRemoved(OverlayController controller, GameObject instance) { notification = null; flashPanel = null; highlightPanel = null; fillBarController = null; currentExtraStockText = null; } private void onOverlayAdded(OverlayController controller, GameObject instance) { ChildLocator component = instance.GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)component)) { notification = ((Component)component.FindChild("NotificationPanel")).gameObject; flashPanel = ((Component)component.FindChild("FlashPanel")).gameObject; highlightPanel = ((Component)component.FindChild("HighlightPanel")).gameObject; fillBarController = ((Component)component.FindChild("FillBar")).GetComponent<ImageFillController>(); currentExtraStockText = ((Component)component.FindChild("CurrentExtraStockText")).GetComponent<HGTextMeshProUGUI>(); } } public void Dispose() { hasFullyUnloadedPrimary = false; maxSkillStockExtra = 0; skillStocksExtra = 0; previousSkillStocks = 0; if (overlayController != null) { HudOverlayManager.RemoveOverlay(overlayController); overlayController.onInstanceAdded -= onOverlayAdded; overlayController.onInstanceRemove -= onOverlayRemoved; } } public void FixedUpdate(GenericSkill runningGS, string sfxToPlayOnExtraStockGained) { previousSkillStocks = runningGS.stock; if (runningGS.characterBody.skillLocator.primary.stock == 0) { hasFullyUnloadedPrimary = true; } if (runningGS.characterBody.skillLocator.primary.stock == runningGS.characterBody.skillLocator.primary.maxStock && hasFullyUnloadedPrimary) { hasFullyUnloadedPrimary = false; if (skillStocksExtra < maxSkillStockExtra) { skillStocksExtra++; runningGS.RecalculateValues(); if (runningGS.CanApplyAmmoPack()) { notification.SetActive(true); highlightPanel.SetActive(true); flashPanel.SetActive(true); runningGS.ApplyAmmoPack(); Util.PlaySound(sfxToPlayOnExtraStockGained, ((Component)runningGS).gameObject); } } } if (overlayController != null) { UpdateUI(); } } private void UpdateUI() { //IL_005e: 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) if (Object.op_Implicit((Object)(object)fillBarController)) { fillBarController.SetTValue((float)skillStocksExtra / (float)maxSkillStockExtra); Image[] images = fillBarController.images; for (int i = 0; i < images.Length; i++) { ((Graphic)images[i]).color = (Color)((skillStocksExtra == maxSkillStockExtra) ? new Color(0.9987254f, 1f, 0.4575472f) : Color.white); } } if (Object.op_Implicit((Object)(object)currentExtraStockText)) { ((TMP_Text)currentExtraStockText).SetText(Language.GetStringFormatted("GRENADIER_UI_SKILLDEF_FORMAT", new object[1] { skillStocksExtra }), true); } } } [Header("Grenadier Parameters")] public int maxExtraStocksFromReloading; [Tooltip("Description Token used whenever the user has its extra stocks full.")] public string holdingFullStocksDescriptionToken; [Tooltip("Wwise sound event string to play when a stock is gained.")] public string stockGainedSoundEffectString; public GameObject hudSkillOverlayPrefab; public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData(maxExtraStocksFromReloading); } public override string GetCurrentDescriptionToken(GenericSkill skillSlot) { InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; if (instanceData != null && instanceData.skillStocksExtra == instanceData.maxSkillStockExtra) { return holdingFullStocksDescriptionToken; } return ((SkillDef)this).GetCurrentDescriptionToken(skillSlot); } public override void OnUnassigned(GenericSkill skillSlot) { if ((InstanceData)(object)skillSlot.skillInstanceData != null) { ((InstanceData)(object)skillSlot.skillInstanceData).Dispose(); } ((SkillDef)this).OnUnassigned(skillSlot); } public override void OnFixedUpdate(GenericSkill skillSlot) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) ((SkillDef)this).OnFixedUpdate(skillSlot); InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; if (instanceData == null) { return; } if (instanceData.overlayController == null && Object.op_Implicit((Object)(object)((IEnumerable<HUD>)HUD.instancesList).FirstOrDefault((Func<HUD, bool>)((HUD x) => (Object)(object)x.targetBodyObject == (Object)(object)((Component)skillSlot.characterBody).gameObject)))) { string text = ""; if ((Object)(object)skillSlot == (Object)(object)skillSlot.characterBody.skillLocator.primary) { text = "Skill1Root"; } if ((Object)(object)skillSlot == (Object)(object)skillSlot.characterBody.skillLocator.secondary) { text = "Skill2Root"; } if ((Object)(object)skillSlot == (Object)(object)skillSlot.characterBody.skillLocator.utility) { text = "Skill3Root"; } if ((Object)(object)skillSlot == (Object)(object)skillSlot.characterBody.skillLocator.special) { text = "Skill4Root"; } if (text.Length > 0) { OverlayCreationParams val = default(OverlayCreationParams); val.prefab = hudSkillOverlayPrefab; val.childLocatorEntry = text; OverlayCreationParams val2 = val; instanceData.AssignOverlay(HudOverlayManager.AddOverlay(((Component)skillSlot).gameObject, val2)); } } instanceData.FixedUpdate(skillSlot, stockGainedSoundEffectString); } public override void OnExecute([NotNull] GenericSkill skillSlot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) skillSlot.stateMachine.SetInterruptState(((SkillDef)this).InstantiateNextState(skillSlot), base.interruptPriority); if (base.cancelSprintingOnActivation) { skillSlot.characterBody.isSprinting = false; } if (base.resetCooldownTimerOnUse) { skillSlot.rechargeStopwatch = 0f; } } public override int GetMaxStock([NotNull] GenericSkill skillSlot) { InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; if (instanceData != null) { return base.baseMaxStock + instanceData.skillStocksExtra; } return base.baseMaxStock; } } [CreateAssetMenu(menuName = "TurboEdition/MusicTrackSafeDef")] public class MusicTrackSafeDef : MusicTrackDef { public override void Preload() { Bank soundBank = base.soundBank; if (soundBank == null) { TELog.LogE($"Failed to load soundbank! Tried to load: {base.soundBank} in {((MusicTrackDef)this).cachedName}", alwaysLog: true, 15, "Preload"); return; } soundBank.Load(false, false); if (TurboUnityPlugin.playMusicSystemID == 0) { TurboUnityPlugin.playMusicSystemID = AkSoundEngine.PostEvent("Play_Music_System_TurboEditon", ((Component)TurboUnityPlugin.instance).gameObject); } } public override void Play() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 ((MusicTrackDef)this).Preload(); State[] states = base.states; foreach (State val in states) { if ((int)AkSoundEngine.SetState(((BaseGroupType)val).GroupId, ((BaseType)val).Id) > 1) { TELog.LogE($"ERROR setting state: {((BaseType)val).Name} with State GroupId {((BaseGroupType)val).GroupId} and State Id {((BaseType)val).Id} in {((MusicTrackDef)this).cachedName}", alwaysLog: true, 35, "Play"); } else { TELog.LogI($"Successfully set: {((BaseType)val).Name} with State GroupId {((BaseGroupType)val).GroupId} and State Id {((BaseType)val).Id} in {((MusicTrackDef)this).cachedName}", alwaysLog: true, 39, "Play"); } } } } internal class SteppedSkillPairedSkillDef { } [CreateAssetMenu(menuName = "TurboEdition/UI/HealthBarStyle")] public class SerializableBarStyle : ScriptableObject { public BarStyle style; } [CreateAssetMenu(menuName = "TurboEdition/SpawnCards/SerializableDirectorCard")] internal class SerializableDirectorCard : ScriptableObject { public SpawnCard spawnCard; [Tooltip("Name of scenes to spawn in.")] public string[] sceneNamesToBeUsedIn; [Tooltip("The enemy category or interactable category to add itself to.")] public string categoryName; [Tooltip("For reference, Chance Shrines has a weight of 4.")] public int selectionWeight; [Tooltip("Only used by monster spawns, how far should it spawn from players.")] public MonsterSpawnDistance spawnDistance; [Tooltip("Should it prevent spawning under terrain.")] public bool preventOverhead; [Tooltip("The minimum (inclusive) number of stages COMPLETED (not reached) before this card becomes available.")] public int minimumStageCompletions; public UnlockableDef requiredUnlockableDef; public UnlockableDef forbiddenUnlockableDef; public DirectorCard CreateDirectorCard() { //IL_0000: 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_0011: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0041: 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) //IL_005a: Expected O, but got Unknown return new DirectorCard { spawnCard = spawnCard, selectionWeight = selectionWeight, spawnDistance = spawnDistance, preventOverhead = preventOverhead, minimumStageCompletions = minimumStageCompletions, requiredUnlockableDef = requiredUnlockableDef, forbiddenUnlockableDef = forbiddenUnlockableDef }; } } } namespace TurboEdition.Items { public abstract class Item { public abstract ItemDef itemDef { get; set; } public virtual void Initialize() { } public virtual void AddBehavior(ref CharacterBody body, int stack) { } public virtual void RecalcStatsStart(ref CharacterBody body, int stack) { } public virtual void RecalcStatsEnd(ref CharacterBody body, int stack) { } } internal class AirborneBonus : Item { public override ItemDef itemDef { get; set; } = TEContent.Items.AirborneBonus; public override void RecalcStatsEnd(ref CharacterBody body, int stack) { if (Object.op_Implicit((Object)(object)body.characterMotor) && !body.characterMotor.isGrounded && stack > 0) { CharacterBody obj = body; obj.damage += body.baseDamage * 0.1f + body.baseDamage * 0.1f * (float)(stack - 1); } } } internal class AirborneDashBehavior : BaseItemBodyBehavior { private const float curveDuration = 0.5f; private const float graceDuration = 0.75f; private const float coneAngle = 10f; private const float accumulationTime = 0.35f; private AnimationCurveAsset animationCurveAsset = Assets.mainAssetBundle.LoadAsset<AnimationCurveAsset>("AirborneDashEvaluationCurve"); private Vector3 firstTapDirection; private bool firstTapReleased; private float stopwatch; private float graceStopwatch; private float accumulationAge; [ItemDefAssociation(useOnServer = false, useOnClient = true)] private static ItemDef GetItemDef() { return TEContent.Items.AirborneDash; } public void FixedUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)((BaseItemBodyBehavior)this).body).hasAuthority) { return; } if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.inputBank)) { if (!firstTapReleased) { if (((BaseItemBodyBehavior)this).body.inputBank.moveVector != Vector3.zero && graceStopwatch <= 0f) { firstTapDirection = ((BaseItemBodyBehavior)this).body.inputBank.moveVector; graceStopwatch = 0.75f; } firstTapReleased = ((BaseItemBodyBehavior)this).body.inputBank.moveVector == Vector3.zero; } firstTapReleased = firstTapReleased && graceStopwatch > 0f && stopwatch <= 0f; } if (stopwatch <= 0f) { ProcessEvasion(); } if (graceStopwatch > 0f) { graceStopwatch -= Time.fixedDeltaTime; if (((BaseItemBodyBehavior)this).body.inputBank.moveVector == Vector3.zero && !firstTapReleased) { graceStopwatch = 0f; } } if (accumulationAge > 0f) { accumulationAge -= Time.fixedDeltaTime / 4f; } if (stopwatch > 0f) { stopwatch -= Time.fixedDeltaTime; if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.characterDirection) && Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.characterMotor)) { Vector3 forward = ((BaseItemBodyBehavior)this).body.characterDirection.forward; float num = ((BaseItemBodyBehavior)this).body.acceleration * ((BaseItemBodyBehavior)this).body.characterMotor.airControl; float num2 = Mathf.Sqrt((10f + 10f * ((float)base.stack - 1f)) / num); float num3 = ((BaseItemBodyBehavior)this).body.moveSpeed / num; ((BaseItemBodyBehavior)this).body.characterDirection.moveVector = ((BaseItemBodyBehavior)this).body.inputBank.moveVector; CharacterMotor characterMotor = ((BaseItemBodyBehavior)this).body.characterMotor; characterMotor.rootMotion += (num2 + num3) / num3 * animationCurveAsset.value.Evaluate(stopwatch / 0.5f) * ((BaseItemBodyBehavior)this).body.moveSpeed * forward * Time.fixedDeltaTime; } } } private void ProcessEvasion() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0106: Unknown result type (might be due to invalid IL or missing references) if (firstTapReleased && ((BaseItemBodyBehavior)this).body.inputBank.moveVector != Vector3.zero && Vector3.Dot(firstTapDirection, ((BaseItemBodyBehavior)this).body.inputBank.moveVector) >= Mathf.Cos(0.17453292f)) { EffectManager.SpawnEffect(Assets.mainAssetBundle.LoadAsset<GameObject>("Prefabs/Effects/BoostJumpEffect"), new EffectData { origin = ((BaseItemBodyBehavior)this).body.footPosition, rotation = Util.QuaternionSafeLookRotation(((BaseItemBodyBehavior)this).body.characterMotor.velocity) }, true); CharacterDirection characterDirection = ((BaseItemBodyBehavior)this).body.characterDirection; Vector3 val = ((((BaseItemBodyBehavior)this).body.inputBank.moveVector == Vector3.zero) ? ((BaseItemBodyBehavior)this).body.characterDirection.forward : ((BaseItemBodyBehavior)this).body.inputBank.moveVector); characterDirection.forward = ((Vector3)(ref val)).normalized; stopwatch = 0.5f; ((BaseItemBodyBehavior)this).body.AddTimedBuffAuthority(Buffs.HiddenInvincibility.buffIndex, Mathf.Clamp01(animationCurveAsset.value.Evaluate(accumulationAge))); accumulationAge = Mathf.Clamp(0.25f, accumulationAge + 0.35f, 10f); } } } public class BaneMaskBodyBehavior : BaseItemBodyBehavior, IOnTakeDamageServerReceiver { private static GameObject pulsePrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("Net_BaneMask_Pulse"); private static GameObject pulseRechargePrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("FX_BaneMask_Recharge"); private bool alreadyOut = true; private bool percentTriggered; private SphereSearch sphereSearch; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return TEContent.Items.BaneMask; } private void Start() { if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.healthComponent)) { ref IOnTakeDamageServerReceiver[] onTakeDamageReceivers = ref ((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers; IOnTakeDamageServerReceiver val = (IOnTakeDamageServerReceiver)(object)this; ArrayUtils.ArrayAppend<IOnTakeDamageServerReceiver>(ref onTakeDamageReceivers, ref val); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.healthComponent)) { int num = Array.IndexOf(((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers, (IOnTakeDamageServerReceiver)(object)this); if (num > -1) { ArrayUtils.ArrayRemoveAtAndResize<IOnTakeDamageServerReceiver>(ref ((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers, ((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers.Length, num); } } } private void FixedUpdate() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown if (NetworkServer.active) { if (!((BaseItemBodyBehavior)this).body.outOfDanger && alreadyOut) { GeneratePulse(); alreadyOut = false; } else if (((BaseItemBodyBehavior)this).body.outOfDanger && !alreadyOut) { alreadyOut = true; percentTriggered = false; EffectManager.SpawnEffect(pulseRechargePrefab, new EffectData { origin = ((Component)this).transform.position, scale = 1f }, true); } } } private void GeneratePulse() { //IL_0010: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003d: 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_0048: 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) //IL_0059: 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_0068: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown GameObject obj = Object.Instantiate<GameObject>(pulsePrefab, ((BaseItemBodyBehavior)this).body.transform.position, ((BaseItemBodyBehavior)this).body.transform.rotation); PulseController component = obj.GetComponent<PulseController>(); sphereSearch = new SphereSearch { queryTriggerInteraction = (QueryTriggerInteraction)2, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, origin = ((BaseItemBodyBehavior)this).body.transform.position }; component.finalRadius = 8f + (float)(base.stack - 1) * 8f; component.duration = Mathf.Min(base.stack, 3); component.performSearch += new PerformSearchDelegate(Component_performSearch); component.onPulseHit += new OnPulseHitDelegate(Component_onPulseHit); component.StartPulseServer(); NetworkServer.Spawn(obj); } private void Component_performSearch(PulseController pulseController, Vector3 origin, float radius, List<PulseSearchResult> dest) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00b7: Unknown result type (might be due to invalid IL or missing references) sphereSearch.origin = origin; sphereSearch.radius = radius; if (sphereSearch.radius <= 0f) { return; } List<HurtBox> list = CollectionPool<HurtBox, List<HurtBox>>.RentCollection(); sphereSearch.RefreshCandidates().FilterCandidatesByDistinctHurtBoxEntities().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(((BaseItemBodyBehavior)this).body.teamComponent.teamIndex)) .GetHurtBoxes(list); for (int i = 0; i < list.Count; i++) { if (Object.op_Implicit((Object)(object)list[i].healthComponent)) { PulseSearchResult item = default(PulseSearchResult); item.hitObject = (Object)(object)list[i].healthComponent; item.hitPos = list[i].healthComponent.body.transform.position; dest.Add(item); } } CollectionPool<HurtBox, List<HurtBox>>.ReturnCollection(list); } private void Component_onPulseHit(PulseController pulseController, PulseHit hitInfo) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) if (Object.op_Implicit(hitInfo.hitObject)) { HealthComponent val = (HealthComponent)hitInfo.hitObject; if (TeamManager.IsTeamEnemy(val.body.teamComponent.teamIndex, ((BaseItemBodyBehavior)this).body.teamComponent.teamIndex) && !val.body.isChampion && !val.body.isBoss) { val.body.AddTimedBuff(TEContent.Buffs.Panic, 5f * hitInfo.hitSeverity); } } } public void OnTakeDamageServer(DamageReport damageReport) { if (!damageReport.damageInfo.rejected && Util.CheckRoll(damageReport.damageDealt / ((BaseItemBodyBehavior)this).body.healthComponent.fullCombinedHealth, ((BaseItemBodyBehavior)this).body.master) && !percentTriggered) { GeneratePulse(); percentTriggered = true; } } } [Obsolete] public class BloodEconomyBodyBehavior : BaseItemBodyBehavior { private PurchaseInteraction[] localPurchaseList = (PurchaseInteraction[])(object)new PurchaseInteraction[0]; private int[] purchaseTimes = new int[0]; private InteractionDriver interactionDriver; private float interactableCooldown; private bool inputReceived; private static ItemDef GetItemDef() { return TEContent.Items.BloodEconomy; } private void Start() { interactionDriver = ((Component)((BaseItemBodyBehavior)this).body).GetComponent<InteractionDriver>(); if (Object.op_Implicit((Object)(object)interactionDriver)) { interactableCooldown = interactionDriver.interactableCooldown; } } private void FixedUpdate() { //IL_00e0: 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_0101: Invalid comparison between Unknown and I4 //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)interactionDriver)) { interactableCooldown -= Time.fixedDeltaTime; inputReceived = ((ButtonState)(ref ((BaseItemBodyBehavior)this).body.inputBank.interact)).justPressed || (((BaseItemBodyBehavior)this).body.inputBank.interact.down && interactableCooldown <= 0f); if (((ButtonState)(ref ((BaseItemBodyBehavior)this).body.inputBank.interact)).justReleased) { inputReceived = false; interactableCooldown = 0f; } } if ((double)((BaseItemBodyBehavior)this).body.healthComponent.combinedHealthFraction < 0.35 || !inputReceived) { return; } GameObject val = interactionDriver.FindBestInteractableObject(); if (!Object.op_Implicit((Object)(object)val)) { return; } IInteractable component = val.GetComponent<IInteractable>(); if (component == null || !((Behaviour)(MonoBehaviour)component).isActiveAndEnabled || (int)component.GetInteractability(interactionDriver.interactor) != 1) { return; } PurchaseInteraction component2 = val.GetComponent<PurchaseInteraction>(); if (!Object.op_Implicit((Object)(object)component2) || (int)component2.costType != 1 || component2.cost <= 5 || component2.cost < ((BaseItemBodyBehavior)this).body.master.money) { return; } for (int i = 0; i < localPurchaseList.Length; i++) { if ((Object)(object)localPurchaseList[i] == (Object)(object)component2) { if (purchaseTimes[i] < base.stack) { DecreasePriceOfPurchaseInteractor(component2); purchaseTimes[i]++; } return; } } ArrayUtils.ArrayAppend<PurchaseInteraction>(ref localPurchaseList, ref component2); ref int[] reference = ref purchaseTimes; int num = 1; ArrayUtils.ArrayAppend<int>(ref reference, ref num); DecreasePriceOfPurchaseInteractor(component2); } public void DecreasePriceOfPurchaseInteractor(PurchaseInteraction purchaseInteraction) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown float damage = 20f; ((BaseItemBodyBehavior)this).body.healthComponent.TakeDamage(new DamageInfo { damage = damage, attacker = ((Component)purchaseInteraction).gameObject, position = ((Component)purchaseInteraction).gameObject.transform.position, damageType = (DamageType)3 }); if (!((BaseItemBodyBehavior)this).body.healthComponent.isHealthLow) { DotController.InflictDot(((Component)((BaseItemBodyBehavior)this).body).gameObject, ((Component)((BaseItemBodyBehavior)this).body).gameObject, (DotIndex)0, 3f, 1E-06f, (uint?)1u); } purchaseInteraction.cost = Mathf.Max(5, purchaseInteraction.cost -= Run.instance.GetDifficultyScaledCost(2)); } } public static class BloodEconomyManager { private static Dictionary<CharacterBody, UnsafeZoneDamageManager> _bodyAndUnsafeZoneManagerPairs = new Dictionary<CharacterBody, UnsafeZoneDamageManager>(); private static Dictionary<IZone, PurchaseInteraction> _zonesAndPurchaseInteractorsPairs = new Dictionary<IZone, PurchaseInteraction>(); private static List<PurchaseInteraction> _purchaseInteractionsToIgnore = new List<PurchaseInteraction>(); private static GameObject discountEffectPrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("FX_BloodEconomy_Discount"); private static GameObject _cachedZonePrefab; public static GameObject LoadedZonePrefab { get { if ((Object)(object)_cachedZonePrefab == (Object)null) { _cachedZonePrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("Net_BloodEconomy_Zone"); return _cachedZonePrefab; } return _cachedZonePrefab; } } [SystemInitializer(new Type[] { typeof(PickupCatalog) })] public static void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Interactor.PerformInteraction += new hook_PerformInteraction(OnInteractionPerformed); Stage.onServerStageBegin += FlushData; RoR2Application.onFixedUpdate += ProcessManagers; } private static void ProcessManagers() { if (!NetworkServer.active || _bodyAndUnsafeZoneManagerPairs == null) { return; } foreach (KeyValuePair<CharacterBody, UnsafeZoneDamageManager> bodyAndUnsafeZoneManagerPair in _bodyAndUnsafeZoneManagerPairs) { bodyAndUnsafeZoneManagerPair.Value.ServerFixedUpdate(Time.fixedDeltaTime); } } private static void FlushData(Stage obj) { _bodyAndUnsafeZoneManagerPairs.Clear(); _zonesAndPurchaseInteractorsPairs.Clear(); _purchaseInteractionsToIgnore.Clear(); } private static void OnInteractionPerformed(orig_PerformInteraction orig, Interactor interactor, GameObject interactableObject) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(interactor, interactableObject); if (!NetworkServer.active || !Object.op_Implicit((Object)(object)interactableObject)) { return; } PurchaseInteraction[] components = interactableObject.GetComponents<PurchaseInteraction>(); if (components.Length == 0 || !Object.op_Implicit((Object)(object)components[0]) || (int)components[0].GetInteractability(interactor) != 1 || CostTypeCatalog.GetCostTypeDef(components[0].costType) != CostTypeCatalog.GetCostTypeDef((CostTypeIndex)1)) { return; } CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); int itemCount = component.inventory.GetItemCount(TEContent.Items.BloodEconomy); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory) || itemCount <= 0) { return; } if (_bodyAndUnsafeZoneManagerPairs.ContainsKey(component)) { bool flag = components.Any((PurchaseInteraction pi) => _zonesAndPurchaseInteractorsPairs.ContainsValue(pi)); if (_bodyAndUnsafeZoneManagerPairs[component].UnsafeZones.Count < 3 && !flag) { GameObject obj = CreateZoneForPurchaseInteractionAndZoneManager(components[0], _bodyAndUnsafeZoneManagerPairs[component]); IZone component2 = obj.GetComponent<IZone>(); _zonesAndPurchaseInteractorsPairs.Add(component2, components[0]); _bodyAndUnsafeZoneManagerPairs[component].AddUnsafeZone(component2); _bodyAndUnsafeZoneManagerPairs[component].flatDamageEachSecond = component.damage * (float)itemCount * 0.25f; CheckForOtherTerminals(component2, components[0]); NetworkServer.Spawn(obj); } } else { UnsafeZoneDamageManager unsafeZoneDamageManager = new UnsafeZoneDamageManager { attacker = ((Component)component).gameObject, flatDamageEachSecond = component.damage * (float)itemCount * 0.5f, damageType = (DamageType)1024, damageColorIndex = (DamageColorIndex)2, tickPeriodSeconds = 0.5f, teamMask = (((Object)(object)component.teamComponent != (Object)null) ? TeamMask.GetEnemyTeams(component.teamComponent.teamIndex) : TeamMask.all) }; unsafeZoneDamageManager.OnDamageDealtAnywhere += OnDamageDealt; GameObject obj2 = CreateZoneForPurchaseInteractionAndZoneManager(components[0], unsafeZoneDamageManager); IZone component3 = obj2.GetComponent<IZone>(); _zonesAndPurchaseInteractorsPairs.Add(component3, components[0]); _bodyAndUnsafeZoneManagerPairs.Add(component, unsafeZoneDamageManager); unsafeZoneDamageManager.AddUnsafeZone(component3); CheckForOtherTerminals(component3, components[0]); NetworkServer.Spawn(obj2); } } private static void OnDamageDealt(DamageInfo obj, HealthComponent healthComponent) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (obj == null || obj.rejected) { return; } DotController.InflictDot(((Component)healthComponent).gameObject, obj.attacker, (DotIndex)0, 3f, 0.5f, (uint?)null); foreach (KeyValuePair<IZone, PurchaseInteraction> zonesAndPurchaseInteractorsPair in _zonesAndPurchaseInteractorsPairs) { if (!zonesAndPurchaseInteractorsPair.Key.IsInBounds(obj.position)) { continue; } PurchaseInteraction value = zonesAndPurchaseInteractorsPair.Value; int num = (value.cost -= Mathf.Max(Mathf.FloorToInt(obj.damage * 0.1f), 1)); if (num <= 0) { EffectManager.SpawnEffect(discountEffectPrefab, new EffectData { origin = ((Component)zonesAndPurchaseInteractorsPair.Value).transform.position, scale = 3f }, true); zonesAndPurchaseInteractorsPair.Value.cost = 0; if (zonesAndPurchaseInteractorsPair.Value.available) { obj.attacker.GetComponent<Interactor>().AttemptInteraction(((Component)zonesAndPurchaseInteractorsPair.Value).gameObject); break; } NetworkServer.Destroy(((Component)(BaseZoneBehavior)zonesAndPurchaseInteractorsPair.Key).gameObject); _zonesAndPurchaseInteractorsPairs.Remove(zonesAndPurchaseInteractorsPair.Key); } EffectManager.SpawnEffect(discountEffectPrefab, new EffectData { origin = ((Component)zonesAndPurchaseInteractorsPair.Value).transform.position, scale = 1f }, true); zonesAndPurchaseInteractorsPair.Value.cost = num; } } private static void CheckForOtherTerminals(IZone zoneBeingCreated, PurchaseInteraction purchaseInteraction) { ShopTerminalBehavior val = (((Object)(object)purchaseInteraction != (Object)null) ? ((Component)purchaseInteraction).GetComponent<ShopTerminalBehavior>() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.serverMultiShopController)) { return; } GameObject[] terminalGameObjects = val.serverMultiShopController._terminalGameObjects; for (int i = 0; i < terminalGameObjects.Length; i++) { PurchaseInteraction component = terminalGameObjects[i].GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component)) { _purchaseInteractionsToIgnore.Add(component); } } } private static GameObject CreateZoneForPurchaseInteractionAndZoneManager(PurchaseInteraction purchaseInteraction, UnsafeZoneDamageManager unsafeZoneDamageManager) { GameObject val = Object.Instantiate<GameObject>(LoadedZonePrefab, ((Component)purchaseInteraction).gameObject.transform); IZone zone = val.GetComponent<IZone>(); ((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && unsafeZoneDamageManager != null && zone != null && unsafeZoneDamageManager.UnsafeZones.Contains(zone)) { unsafeZoneDamageManager.RemoveUnsafeZone(zone); NetworkServer.Destroy(((Component)(BaseZoneBehavior)zone).gameObject); _zonesAndPurchaseInteractorsPairs.Remove(zone); } }); return val; } } public class DropletDupeBodyBehavior : BaseItemBodyBehavior, IOnTakeDamageServerReceiver { private static GameObject effectPrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("DropletDupeProcEffect"); private const float dropUpStrength = 30f; private const float baseDupeDelay = 15f; private float dupeDelay; private float dropForwardStrength = 2f; internal bool suicideReady; private MasterSuicideOnTimer masterSuicideOnTimer; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return TEContent.Items.DropletDupe; } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PickupDropletController.onDropletHitGroundServer += new PickupDropletHitGroundDelegate(onDropletHitGround); PurchaseInteraction.onItemSpentOnPurchase += onItemSpentOnPurchase; if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.healthComponent)) { ref IOnTakeDamageServerReceiver[] onTakeDamageReceivers = ref ((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers; IOnTakeDamageServerReceiver val = (IOnTakeDamageServerReceiver)(object)this; ArrayUtils.ArrayAppend<IOnTakeDamageServerReceiver>(ref onTakeDamageReceivers, ref val); } } private void onItemSpentOnPurchase(PurchaseInteraction arg1, Interactor arg2) { DisableDupingFor(2.5f, additive: true); } private void FixedUpdate() { dupeDelay -= Time.fixedDeltaTime; } public void OnTakeDamageServer(DamageReport damageReport) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 if (NetworkServer.active && !((Object)(object)damageReport.attacker == (Object)null) && !damageReport.isFallDamage && (int)damageReport.dotType == -1 && Util.CheckRoll(3f * (float)base.stack, 0f - ((BaseItemBodyBehavior)this).body.master.luck, (CharacterMaster)null) && Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.healthComponent) && !suicideReady) { TELog.LogW("Rolled for death", alwaysLog: false, 48, "OnTakeDamageServer"); suicideReady = true; if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.master) && (Object)(object)masterSuicideOnTimer == (Object)null) { masterSuicideOnTimer = ((Component)((BaseItemBodyBehavior)this).body.master).gameObject.AddComponent<MasterSuicideOnTimer>(); masterSuicideOnTimer.lifeTimer = 10f + Random.Range(0f, 10f); } else { ((BaseItemBodyBehavior)this).body.healthComponent.Suicide(damageReport.attacker, damageReport.attacker, (DamageType)0); } } } private void onDropletHitGround(ref CreatePickupInfo createPickupInfo, ref bool shouldSpawn) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a3: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //IL_011b: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_013a: 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_0145: 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_0155: 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_0164: Unknown result type (might be due to invalid IL or missing references) if (dupeDelay >= 0f) { return; } PickupIndex pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (!((PickupIndex)(ref pickupIndex)).isValid || !shouldSpawn) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (((PickupIndex)(ref pickupIndex)).pickupDef.itemIndex == Items.ScrapWhite.itemIndex) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (((PickupIndex)(ref pickupIndex)).pickupDef.itemIndex == Items.ScrapGreen.itemIndex) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (((PickupIndex)(ref pickupIndex)).pickupDef.itemIndex == Items.ScrapRed.itemIndex) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (((PickupIndex)(ref pickupIndex)).pickupDef.itemIndex == Items.ScrapYellow.itemIndex) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (((PickupIndex)(ref pickupIndex)).pickupDef.isBoss) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if (((PickupIndex)(ref pickupIndex)).pickupDef.isLunar) { return; } pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if ((int)((PickupIndex)(ref pickupIndex)).pickupDef.artifactIndex == -1) { pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; if ((int)((PickupIndex)(ref pickupIndex)).pickupDef.equipmentIndex == -1 && Util.CheckRoll(8f + (float)(base.stack - 1) * 2.5f, 0f, (CharacterMaster)null)) { EffectData val = new EffectData { origin = createPickupInfo.position }; EffectManager.SpawnEffect(effectPrefab, val, true); PickupDropletController.CreatePickupDroplet(((CreatePickupInfo)(ref createPickupInfo)).pickupIndex, createPickupInfo.position + Vector3.up * dropForwardStrength, Vector3.up * 30f); dupeDelay = 15f; } } } public void DisableDupingFor(float time, bool additive = false) { if (time > 0f) { if (additive) { dupeDelay += time; } else { dupeDelay = time; } } } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PickupDropletController.onDropletHitGroundServer -= new PickupDropletHitGroundDelegate(onDropletHitGround); PurchaseInteraction.onItemSpentOnPurchase -= onItemSpentOnPurchase; if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body) && Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.master) && Object.op_Implicit((Object)(object)masterSuicideOnTimer)) { Object.Destroy((Object)(object)masterSuicideOnTimer); } if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.healthComponent)) { int num = Array.IndexOf(((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers, (IOnTakeDamageServerReceiver)(object)this); if (num > -1) { ArrayUtils.ArrayRemoveAtAndResize<IOnTakeDamageServerReceiver>(ref ((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers, ((BaseItemBodyBehavior)this).body.healthComponent.onTakeDamageReceivers.Length, num); } } } } internal class GetDamageFromHurtVictimBodyBehavior : BaseItemBodyBehavior, IStatItemBehavior, IStatBarProvider { internal class ServerListener : MonoBehaviour, IOnDamageDealtServerReceiver, IOnTakeDamageServerReceiver { public GetDamageFromHurtVictimBodyAttachment attachment; public void onServerCharacterExecuted(DamageReport arg1, float executionHealthLost) { if (Object.op_Implicit((Object)(object)attachment)) { if ((Object)(object)arg1.attackerBody == (Object)(object)attachment.nba.attachedBody && attachment.currentDamage < (float)(10 + (attachment.stack - 1) * 10)) { GetDamageFromHurtVictimBodyAttachment getDamageFromHurtVictimBodyAttachment = attachment; getDamageFromHurtVictimBodyAttachment.NetworkcurrentDamage = getDamageFromHurtVictimBodyAttachment.currentDamage + 15f; } attachment.NetworkcurrentDamage = Mathf.Min(attachment.currentDamage, (float)(10 + (attachment.stack - 1) * 10)); } } public void OnDamageDealtServer(DamageReport damageReport) { if (Object.op_Implicit((Object)(object)attachment) && !(attachment.currentDamage >= (float)(10 + (attachment.stack - 1) * 10)) && damageReport.victim.isHealthLow) { if (damageReport.combinedHealthBeforeDamage >= damageReport.victim.fullCombinedHealth && !damageReport.victim.alive) { GetDamageFromHurtVictimBodyAttachment getDamageFromHurtVictimBodyAttachment = attachment; getDamageFromHurtVictimBodyAttachment.NetworkcurrentDamage = getDamageFromHurtVictimBodyAttachment.currentDamage + 15f; } if (damageReport.victim.alive) { GetDamageFromHurtVictimBodyAttachment getDamageFromHurtVictimBodyAttachment2 = attachment; getDamageFromHurtVictimBodyAttachment2.NetworkcurrentDamage = getDamageFromHurtVictimBodyAttachment2.currentDamage + damageReport.damageInfo.procCoefficient; } attachment.NetworkcurrentDamage = Mathf.Min(attachment.currentDamage, (float)(10 + (attachment.stack - 1) * 10)); } } public void OnTakeDamageServer(DamageReport damageReport) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)attachment) && (!damageReport.damageInfo.rejected || !damageReport.isFallDamage || (int)damageReport.dotType == -1)) { attachment.NetworkcurrentDamage = 0f; } } } private NetworkedBodyAttachment attachment; public GetDamageFromHurtVictimBodyAttachment getDamageFromHurtVictimBodyAttachment; internal const int stackFirst = 10; internal const int stackLater = 10; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return TEContent.Items.SoulDevourer; } [SystemInitializer(new Type[] { typeof(PickupCatalog) })] public static void Initialize() { GlobalEventManager.onServerCharacterExecuted += onServerCharacterExecuted; } private static void onServerCharacterExecuted(DamageReport arg1, float arg2) { if (arg1.attackerBody.inventory.GetItemCount(TEContent.Items.SoulDevourer) > 0) { ((Component)arg1.attackerBody).GetComponent<ServerListener>()?.onServerCharacterExecuted(arg1, arg2); } } private void Start() { if (NetworkServer.active) { attachment = Object.Instantiate<GameObject>(Assets.mainAssetBundle.LoadAsset<GameObject>("SoulDevourerBodyAttachment")).GetComponent<NetworkedBodyAttachment>(); attachment.AttachToGameObjectAndSpawn(((Component)((BaseItemBodyBehavior)this).body).gameObject, (string)null); getDamageFromHurtVictimBodyAttachment = ((Component)attachment).GetComponent<GetDamageFromHurtVictimBodyAttachment>(); } } private void FixedUpdate() { if (NetworkServer.active && !((BaseItemBodyBehavior)this).body.healthComponent.alive) { Object.Destroy((Object)(object)this); } if (Object.op_Implicit((Object)(object)getDamageFromHurtVictimBodyAttachment)) { getDamageFromHurtVictimBodyAttachment.stack = base.stack; } } private void OnDestroy() { if (NetworkServer.active && Object.op_Implicit((Object)(object)attachment)) { Object.Destroy((Object)(object)((Component)attachment).gameObject); attachment = null; } } public void RecalculateStatsEnd() { if (Object.op_Implicit((Object)(object)getDamageFromHurtVictimBodyAttachment)) { getDamageFromHurtVictimBodyAttachment.RecalculateStatsEnd(); } } public void RecalculateStatsStart() { } public StatBarData GetStatBarData() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00c2: 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) if (Object.op_Implicit((Object)(object)getDamageFromHurtVictimBodyAttachment)) { return getDamageFromHurtVictimBodyAttachment.GetStatBarData(); } StatBarData result = default(StatBarData); result.fillBarColor = new Color(0.3f, 1f, 0.8f, 1f); result.maxData = 0f; result.currentData = 0f; result.offData = "TOOLTIP_ITEM_INIT"; result.sprite = TEContent.Items.SoulDevourer.pickupIconSprite; result.tooltipContent = new TooltipContent { titleColor = Color32.op_Implicit(ColorCatalog.GetColor(ItemTierCatalog.GetItemTierDef(TEContent.Items.SoulDevourer.tier).darkColorIndex)), titleToken = TEContent.Items.SoulDevourer.nameToken, bodyToken = "TOOLTIP_ITEM_INIT" }; return result; } } public class GracePeriodBodyBehavior : BaseItemBodyBehavior { public class GraceBufferHit { public float duration; public DamageReport storedReport; public CharacterBody storedBody; public GraceBufferHit(CharacterBody body, DamageReport damageDealt, float l) { storedBody = body; storedReport = damageDealt; duration = l; } } private List<GraceBufferHit> hitList = new List<GraceBufferHit>(); private List<GraceBufferHit> buffer = new List<GraceBufferHit>(); [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return TEContent.Items.GracePeriod; } private void OnEnable() { GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private void OnDisable() { GlobalEventManager.onServerDamageDealt -= onServerDamageDealt; } private void onServerDamageDealt(DamageReport obj) { bool flag = false; foreach (GraceBufferHit hit in hitList) { if ((Object)(object)hit.storedBody == (Object)(object)obj.victimBody && hit.duration > 0f) { flag = true; if (ShouldAdd(obj)) { hit.duration = base.stack; hit.storedReport = obj; } else if (!obj.victim.alive && (Object)(object)obj.attackerBody != (Object)(object)((BaseItemBodyBehavior)this).body) { SimulateDeathMethods(hit); } } } if (!flag && ShouldAdd(obj)) { GraceBufferHit item = new GraceBufferHit(((BaseItemBodyBehavior)this).body, obj, base.stack); hitList.Add(item); } } public void FixedUpdate() { foreach (GraceBufferHit hit in hitList) { hit.duration -= Time.fixedDeltaTime; if (hit.duration <= 0f) { buffer.Add(hit); } } foreach (GraceBufferHit item in buffer) { hitList.Remove(item); } buffer.Clear(); } private bool ShouldAdd(DamageReport obj) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 if ((Object)(object)obj.attackerBody != (Object)(object)((BaseItemBodyBehavior)this).body) { return false; } if (obj.isFallDamage || (int)obj.dotType != -1 || obj.damageInfo.rejected || ((ProcChainMask)(ref obj.damageInfo.procChainMask)).HasProc((ProcType)7) || ((ProcChainMask)(ref obj.damageInfo.procChainMask)).HasProc((ProcType)1)) { return false; } if (Util.CheckRoll(100f, ((BaseItemBodyBehavior)this).body.master.luck, (CharacterMaster)null) && obj.victim.alive) { return true; } return false; } private void SimulateDeathMethods(GraceBufferHit graceBufferHit) { if (graceBufferHit.storedReport.victim.alive) { return; } IOnKilledServerReceiver[] co