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 IVYL v2.0.0
Ivyl.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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using HG; using HG.Coroutines; using HG.GeneralSerializer; using HG.Reflection; using IL.RoR2; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.ScriptableObjects; using RoR2; using RoR2.Achievements; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Items; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.VanillaFixes; using ThreeEyedGames; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Ivyl")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Ivyl")] [assembly: AssemblyTitle("Ivyl")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } internal static class IsExternalInit { } } namespace IvyLibrary { public struct ArtifactCode { public (ArtifactCompound, ArtifactCompound, ArtifactCompound) topRow; public (ArtifactCompound, ArtifactCompound, ArtifactCompound) middleRow; public (ArtifactCompound, ArtifactCompound, ArtifactCompound) bottomRow; public ArtifactCode(ArtifactCompound topLeft, ArtifactCompound topCenter, ArtifactCompound topRight, ArtifactCompound middleLeft, ArtifactCompound middleCenter, ArtifactCompound middleRight, ArtifactCompound bottomLeft, ArtifactCompound bottomCenter, ArtifactCompound bottomRight) { topRow = (topLeft, topCenter, topRight); middleRow = (middleLeft, middleCenter, middleRight); bottomRow = (bottomLeft, bottomCenter, bottomRight); } public ArtifactCode((ArtifactCompound, ArtifactCompound, ArtifactCompound) topRow, (ArtifactCompound, ArtifactCompound, ArtifactCompound) middleRow, (ArtifactCompound, ArtifactCompound, ArtifactCompound) bottomRow) { this.topRow = topRow; this.middleRow = middleRow; this.bottomRow = bottomRow; } public Sha256Hash CreateCodeHash() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) using SHA256 sHA = SHA256.Create(); byte[] buffer = new byte[9] { (byte)topRow.Item3, (byte)middleRow.Item3, (byte)bottomRow.Item3, (byte)topRow.Item2, (byte)bottomRow.Item2, (byte)middleRow.Item2, (byte)topRow.Item1, (byte)middleRow.Item1, (byte)bottomRow.Item1 }; return Sha256Hash.FromBytes(sHA.ComputeHash(buffer), 0); } } public enum ArtifactCompound { Circle = 1, Triangle = 3, Diamond = 5, Square = 7, Empty = 11 } public class AssetBundleRequest<T> : IEnumerator where T : Object { private AssetBundleRequest _internalRequest; private T _asset; private T[] _allAssets; public T asset => _asset ?? (_asset = (T)(object)_internalRequest.asset); public T[] allAssets => _allAssets ?? (_allAssets = Array.ConvertAll(_internalRequest.allAssets, (Object x) => (T)(object)x)); public bool isDone => ((AsyncOperation)_internalRequest).isDone; public float progress => ((AsyncOperation)_internalRequest).progress; public int priority { get { return ((AsyncOperation)_internalRequest).priority; } set { ((AsyncOperation)_internalRequest).priority = value; } } public bool allowSceneActivation { get { return ((AsyncOperation)_internalRequest).allowSceneActivation; } set { ((AsyncOperation)_internalRequest).allowSceneActivation = value; } } object IEnumerator.Current => asset; public event Action<AssetBundleRequest<T>> completed { add { ((AsyncOperation)_internalRequest).completed += delegate { value(this); }; } remove { ((AsyncOperation)_internalRequest).completed -= delegate { value(this); }; } } public event Action<AssetBundleRequest> completedTypeless { add { ((AsyncOperation)_internalRequest).completed += delegate { value(_internalRequest); }; } remove { ((AsyncOperation)_internalRequest).completed -= delegate { value(_internalRequest); }; } } public AssetBundleRequest(AssetBundleRequest request) { _internalRequest = request; } public static implicit operator AssetBundleRequest(AssetBundleRequest<T> obj) { return obj._internalRequest; } public override bool Equals(object obj) { AssetBundleRequest val = (AssetBundleRequest)((obj is AssetBundleRequest) ? obj : null); if (val == null || _internalRequest != val) { if (obj is AssetBundleRequest<T> assetBundleRequest) { return _internalRequest == assetBundleRequest._internalRequest; } return false; } return true; } public override int GetHashCode() { return ((object)_internalRequest).GetHashCode(); } bool IEnumerator.MoveNext() { return !((AsyncOperation)_internalRequest).isDone; } void IEnumerator.Reset() { } } public abstract class BaseContentPlugin : BaseUnityPlugin, IContentPackProvider { public delegate IEnumerator LoadStaticContentAsyncDelegate(LoadStaticContentAsyncArgs args); public delegate IEnumerator GenerateContentPackAsyncDelegate(GetContentPackAsyncArgs args); public delegate IEnumerator FinalizeAsyncDelegate(FinalizeAsyncArgs args); public ContentPack Content { get; } string IContentPackProvider.identifier => ((BaseUnityPlugin)this).Info.Metadata.GUID; public event LoadStaticContentAsyncDelegate loadStaticContentAsync; public event GenerateContentPackAsyncDelegate generateContentPackAsync; public event FinalizeAsyncDelegate finalizeAsync; public BaseContentPlugin() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Content = new ContentPack { identifier = ((IContentPackProvider)this).identifier }; ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)delegate(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)this); }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] protected virtual IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { if (this.loadStaticContentAsync == null) { yield break; } ParallelProgressCoroutine parallelProgressCoroutine = new ParallelProgressCoroutine(args.progressReceiver); Delegate[] invocationList = this.loadStaticContentAsync.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { LoadStaticContentAsyncDelegate loadStaticContentAsyncDelegate = (LoadStaticContentAsyncDelegate)invocationList[i]; if (loadStaticContentAsyncDelegate != null) { ReadableProgress<float> val = new ReadableProgress<float>(); parallelProgressCoroutine.Add(loadStaticContentAsyncDelegate(new LoadStaticContentAsyncArgs((IProgress<float>)val, args.peerLoadInfos)), val); } } while (parallelProgressCoroutine.MoveNext()) { yield return parallelProgressCoroutine.Current; } this.loadStaticContentAsync = null; } [MethodImpl(MethodImplOptions.AggressiveInlining)] protected virtual IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { if (this.generateContentPackAsync != null) { ParallelProgressCoroutine parallelProgressCoroutine = new ParallelProgressCoroutine(args.progressReceiver); Delegate[] invocationList = this.generateContentPackAsync.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { GenerateContentPackAsyncDelegate generateContentPackAsyncDelegate = (GenerateContentPackAsyncDelegate)invocationList[i]; if (generateContentPackAsyncDelegate != null) { ReadableProgress<float> val = new ReadableProgress<float>(); parallelProgressCoroutine.Add(generateContentPackAsyncDelegate(new GetContentPackAsyncArgs((IProgress<float>)val, args.output, args.peerLoadInfos, args.retriesRemaining)), val); } } while (parallelProgressCoroutine.MoveNext()) { yield return parallelProgressCoroutine.Current; } } ContentPack.Copy(Content, args.output); } [MethodImpl(MethodImplOptions.AggressiveInlining)] protected virtual IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { this.generateContentPackAsync = null; if (this.finalizeAsync != null) { ParallelProgressCoroutine parallelProgressCoroutine = new ParallelProgressCoroutine(args.progressReceiver); Delegate[] invocationList = this.finalizeAsync.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { FinalizeAsyncDelegate finalizeAsyncDelegate = (FinalizeAsyncDelegate)invocationList[i]; if (finalizeAsyncDelegate != null) { ReadableProgress<float> val = new ReadableProgress<float>(); parallelProgressCoroutine.Add(finalizeAsyncDelegate(new FinalizeAsyncArgs((IProgress<float>)val, args.peerLoadInfos, args.finalContentPack)), val); } } while (parallelProgressCoroutine.MoveNext()) { yield return parallelProgressCoroutine.Current; } this.finalizeAsync = null; } Content.PopulateNetworkedObjectAssetIds(); } IEnumerator IContentPackProvider.LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { return LoadStaticContentAsync(args); } IEnumerator IContentPackProvider.GenerateContentPackAsync(GetContentPackAsyncArgs args) { return GenerateContentPackAsync(args); } IEnumerator IContentPackProvider.FinalizeAsync(FinalizeAsyncArgs args) { return FinalizeAsync(args); } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public abstract class BaseModuleAttribute : SearchableAttribute { internal static BaseModuleAttribute earlyAssignmentMetadata; public static GameObject InitializeModules<TModuleAttribute>(params object[] args) where TModuleAttribute : BaseModuleAttribute { return InitializeModules(typeof(TModuleAttribute), args); } public static void InitializeModules<TModuleAttribute>(GameObject managerObject, params object[] args) where TModuleAttribute : BaseModuleAttribute { InitializeModules(typeof(TModuleAttribute), managerObject, args); } public static GameObject InitializeModules(Type attributeType, params object[] args) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown GameObject val = new GameObject(attributeType.Name + "_Manager"); Object.DontDestroyOnLoad((Object)(object)val); Transform transform = val.transform; GameObject managerObject = Chainloader.ManagerObject; transform.SetParent((managerObject != null) ? managerObject.transform : null); InitializeModules(attributeType, val, args); return val; } public static void InitializeModules(Type attributeType, GameObject managerObject, params object[] args) { if ((Object)(object)managerObject == (Object)null) { throw new ArgumentNullException("managerObject"); } if (!attributeType.IsSubclassOf(typeof(BaseModuleAttribute))) { throw new ArgumentException("attributeType"); } if (!SearchableAttribute.instancesListsByType.TryGetValue(attributeType, out var value) || value.Count <= 0) { Debug.LogWarning((object)("BaseModuleAttribute: Attempted to InitializeModules of type " + attributeType.Name + " but no instances were found.")); return; } HashSet<object> hashSet = new HashSet<object>(); foreach (BaseModuleAttribute item in value) { if (!(((SearchableAttribute)item).target is Type type) || !type.IsSubclassOf(typeof(Behaviour))) { Debug.LogWarning((object)string.Format("{0}: Module of type {1} has an invalid target ({2}). Target must be a class inheriting from {3}.", "BaseModuleAttribute", attributeType.Name, ((SearchableAttribute)item).target ?? "null", "Behaviour")); } else if (hashSet.Add(((SearchableAttribute)item).target) && item.Initialize(args, value)) { earlyAssignmentMetadata = item; managerObject.RequireComponent(type); earlyAssignmentMetadata = null; } } } protected abstract bool Initialize(object[] args, List<SearchableAttribute> peers); } public abstract class BaseAssetAssociatedBehavior<TAssociationAttribute, TNetworkContext> : MonoBehaviour where TAssociationAttribute : SearchableAttribute where TNetworkContext : struct { protected static TNetworkContext server; protected static TNetworkContext client; protected static TNetworkContext shared; protected static void CommenceAttributeSearch<TAsset>(Type behaviourType, Action<TAssociationAttribute, MethodInfo, TAsset> onAssetFound) { List<TAssociationAttribute> list = new List<TAssociationAttribute>(); SearchableAttribute.GetInstances<TAssociationAttribute>(list); foreach (TAssociationAttribute item in list) { if (!(((SearchableAttribute)item).target is MethodInfo methodInfo)) { Debug.LogError((object)("TAssociationAttribute cannot be applied to object of type '" + ((SearchableAttribute)item).target?.GetType().Name + "'")); continue; } string text = "TAssociationAttribute cannot be applied to method " + methodInfo.DeclaringType.FullName + "." + methodInfo.Name + ": "; if (!methodInfo.IsStatic) { Debug.LogError((object)(text + "Method is not static.")); } else if (!behaviourType.IsAssignableFrom(methodInfo.DeclaringType)) { Debug.LogError((object)(text + methodInfo.DeclaringType.FullName + " does not derive from " + behaviourType.FullName + ".")); } else if (methodInfo.DeclaringType.IsAbstract) { Debug.LogError((object)(text + methodInfo.DeclaringType.FullName + " is an abstract type")); } else if (!typeof(TAsset).IsAssignableFrom(methodInfo.ReturnType)) { Debug.LogError((object)(text + methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " returns type '" + (methodInfo.ReturnType?.FullName ?? "void") + "' instead of " + typeof(TAsset).FullName + ".")); } else if (methodInfo.GetGenericArguments().Length != 0) { Debug.LogError((object)(text + methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must take no arguments.")); } else { TAsset val = (TAsset)methodInfo.Invoke(null, Array.Empty<object>()); if (val == null) { Debug.LogError((object)(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " returned null.")); } else { onAssetFound(item, methodInfo, val); } } } } protected static ref TNetworkContext GetCurrentNetworkContext() { if (NetworkServer.active) { if (NetworkClient.active) { return ref shared; } return ref server; } if (NetworkClient.active) { return ref client; } throw new InvalidOperationException("Neither server nor client is running."); } } public abstract class BaseBuffBodyBehavior : BaseAssetAssociatedBehavior<BaseBuffBodyBehavior.BuffDefAssociationAttribute, BaseBuffBodyBehavior.NetworkContext> { public struct BuffTypePair { public BuffIndex buffIndex; public Type behaviorType; public int index; } public struct NetworkContext { public Lookup<BuffIndex, BuffTypePair> buffTypePairsLookup; public FixedSizeArrayPool<BaseBuffBodyBehavior> behaviorArraysPool; public void SetBuffTypePairs(List<BuffTypePair> buffTypePairs) { buffTypePairsLookup = (Lookup<BuffIndex, BuffTypePair>)buffTypePairs.ToLookup((BuffTypePair x) => x.buffIndex); behaviorArraysPool = new FixedSizeArrayPool<BaseBuffBodyBehavior>(buffTypePairs.Count); } } [MeansImplicitUse] [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class BuffDefAssociationAttribute : SearchableAttribute { public bool useOnServer = true; public bool useOnClient = true; } private static CharacterBody earlyAssignmentBody; private static Dictionary<UnityObjectWrapperKey<CharacterBody>, BaseBuffBodyBehavior[]> bodyToBuffBehaviors; public int stack; public CharacterBody body { get; private set; } protected void Awake() { body = earlyAssignmentBody; earlyAssignmentBody = null; } [SystemInitializer(new Type[] { typeof(BuffCatalog) })] private static void Init() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown List<BuffTypePair> server = new List<BuffTypePair>(); List<BuffTypePair> client = new List<BuffTypePair>(); List<BuffTypePair> shared = new List<BuffTypePair>(); BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.CommenceAttributeSearch<BuffDef>(typeof(BaseBuffBodyBehavior), RegisterBehaviour); if (shared.Count > 0) { BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.server.SetBuffTypePairs(server); BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.client.SetBuffTypePairs(client); BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.shared.SetBuffTypePairs(shared); bodyToBuffBehaviors = new Dictionary<UnityObjectWrapperKey<CharacterBody>, BaseBuffBodyBehavior[]>(); CharacterBody.onBodyAwakeGlobal += OnBodyAwakeGlobal; CharacterBody.onBodyDestroyGlobal += OnBodyDestroyGlobal; CharacterBody.SetBuffCount += new hook_SetBuffCount(CharacterBody_SetBuffCount); } void RegisterBehaviour(BuffDefAssociationAttribute attribute, MethodInfo methodInfo, BuffDef asset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //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) if ((int)asset.buffIndex < 0) { Debug.LogError((object)$"{methodInfo.DeclaringType.FullName}.{methodInfo.Name} returned a BuffDef that's not registered in the BuffCatalog. result={asset}"); } else { BuffTypePair buffTypePair = default(BuffTypePair); buffTypePair.buffIndex = asset.buffIndex; buffTypePair.behaviorType = methodInfo.DeclaringType; BuffTypePair buffTypePair2 = buffTypePair; if (attribute.useOnServer) { List<BuffTypePair> list = server; buffTypePair = buffTypePair2; buffTypePair.index = server.Count; list.Add(buffTypePair); } if (attribute.useOnClient) { List<BuffTypePair> list2 = client; buffTypePair = buffTypePair2; buffTypePair.index = client.Count; list2.Add(buffTypePair); } if (attribute.useOnServer || attribute.useOnClient) { List<BuffTypePair> list3 = shared; buffTypePair = buffTypePair2; buffTypePair.index = shared.Count; list3.Add(buffTypePair); } } } } private static void OnBodyAwakeGlobal(CharacterBody body) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) BaseBuffBodyBehavior[] value = BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext().behaviorArraysPool.Request(); bodyToBuffBehaviors.Add(UnityObjectWrapperKey<CharacterBody>.op_Implicit(body), value); } private static void OnBodyDestroyGlobal(CharacterBody body) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) BaseBuffBodyBehavior[] array = bodyToBuffBehaviors[UnityObjectWrapperKey<CharacterBody>.op_Implicit(body)]; for (int i = 0; i < array.Length; i++) { Object.Destroy((Object)(object)array[i]); } bodyToBuffBehaviors.Remove(UnityObjectWrapperKey<CharacterBody>.op_Implicit(body)); if (NetworkServer.active || NetworkClient.active) { BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext().behaviorArraysPool.Return(array); } } private static void CharacterBody_SetBuffCount(orig_SetBuffCount orig, CharacterBody self, BuffIndex buffType, int newCount) { //IL_000c: 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_0028: 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_0016: 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) Lookup<BuffIndex, BuffTypePair> buffTypePairsLookup = BaseAssetAssociatedBehavior<BuffDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext().buffTypePairsLookup; if (!buffTypePairsLookup.Contains(buffType)) { orig.Invoke(self, buffType, newCount); return; } int buffCount = self.GetBuffCount(buffType); orig.Invoke(self, buffType, newCount); if (buffCount == (buffCount = self.GetBuffCount(buffType))) { return; } BaseBuffBodyBehavior[] array = bodyToBuffBehaviors[UnityObjectWrapperKey<CharacterBody>.op_Implicit(self)]; foreach (BuffTypePair item in buffTypePairsLookup[buffType]) { SetBuffStack(self, ref array[item.index], item.behaviorType, buffCount); } } private static void SetBuffStack(CharacterBody body, ref BaseBuffBodyBehavior behavior, Type behaviorType, int stack) { if ((Object)(object)behavior == (Object)null != stack <= 0) { if (stack <= 0) { behavior.stack = 0; Object.Destroy((Object)(object)behavior); behavior = null; } else { earlyAssignmentBody = body; behavior = (BaseBuffBodyBehavior)(object)((Component)body).gameObject.AddComponent(behaviorType); earlyAssignmentBody = null; } } if ((Object)(object)behavior != (Object)null) { behavior.stack = stack; } } } public abstract class BaseEquipmentBodyBehavior : BaseAssetAssociatedBehavior<BaseEquipmentBodyBehavior.EquipmentDefDefAssociationAttribute, BaseEquipmentBodyBehavior.NetworkContext> { public struct EquipmentTypePair { public EquipmentIndex equipmentIndex; public Type behaviorType; } public struct EquipmentBehaviorsState { public BaseEquipmentBodyBehavior[] activeBehaviorsArray; public EquipmentIndex currentEquipmentIndex; } public struct NetworkContext { public Dictionary<EquipmentIndex, EquipmentTypePair[]> equipmentTypePairsDict; public void SetEquipmentTypePairs(List<EquipmentTypePair> equipmentTypePairs) { equipmentTypePairsDict = (from x in equipmentTypePairs group x by x.equipmentIndex).ToDictionary((IGrouping<EquipmentIndex, EquipmentTypePair> x) => x.Key, (IGrouping<EquipmentIndex, EquipmentTypePair> x) => x.ToArray()); } } [MeansImplicitUse] [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class EquipmentDefDefAssociationAttribute : SearchableAttribute { public bool useOnServer = true; public bool useOnClient = true; } private static CharacterBody earlyAssignmentBody; private static Dictionary<UnityObjectWrapperKey<CharacterBody>, EquipmentBehaviorsState> bodyToEquipmentBehaviors; public EquipmentState state; public CharacterBody body { get; private set; } protected void Awake() { body = earlyAssignmentBody; earlyAssignmentBody = null; } [SystemInitializer(new Type[] { typeof(EquipmentCatalog) })] private static void Init() { List<EquipmentTypePair> server = new List<EquipmentTypePair>(); List<EquipmentTypePair> client = new List<EquipmentTypePair>(); List<EquipmentTypePair> shared = new List<EquipmentTypePair>(); BaseAssetAssociatedBehavior<EquipmentDefDefAssociationAttribute, NetworkContext>.CommenceAttributeSearch<EquipmentDef>(typeof(BaseEquipmentBodyBehavior), RegisterBehaviour); if (shared.Count > 0) { BaseAssetAssociatedBehavior<EquipmentDefDefAssociationAttribute, NetworkContext>.server.SetEquipmentTypePairs(server); BaseAssetAssociatedBehavior<EquipmentDefDefAssociationAttribute, NetworkContext>.client.SetEquipmentTypePairs(client); BaseAssetAssociatedBehavior<EquipmentDefDefAssociationAttribute, NetworkContext>.shared.SetEquipmentTypePairs(shared); bodyToEquipmentBehaviors = new Dictionary<UnityObjectWrapperKey<CharacterBody>, EquipmentBehaviorsState>(); CharacterBody.onBodyDestroyGlobal += CharacterBody_onBodyDestroyGlobal; CharacterBody.onBodyInventoryChangedGlobal += CharacterBody_onBodyInventoryChangedGlobal; } void RegisterBehaviour(EquipmentDefDefAssociationAttribute attribute, MethodInfo methodInfo, EquipmentDef asset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //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) if ((int)asset.equipmentIndex < 0) { Debug.LogError((object)$"{methodInfo.DeclaringType.FullName}.{methodInfo.Name} returned an EquipmentDef that's not registered in the EquipmentCatalog. result={asset}"); } else { EquipmentTypePair equipmentTypePair = default(EquipmentTypePair); equipmentTypePair.equipmentIndex = asset.equipmentIndex; equipmentTypePair.behaviorType = methodInfo.DeclaringType; EquipmentTypePair item = equipmentTypePair; if (attribute.useOnServer) { server.Add(item); } if (attribute.useOnClient) { client.Add(item); } if (attribute.useOnServer || attribute.useOnClient) { shared.Add(item); } } } } private static void CharacterBody_onBodyDestroyGlobal(CharacterBody body) { //IL_0006: 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) if (bodyToEquipmentBehaviors.TryGetValue(UnityObjectWrapperKey<CharacterBody>.op_Implicit(body), out var value)) { for (int i = 0; i < value.activeBehaviorsArray.Length; i++) { Object.Destroy((Object)(object)value.activeBehaviorsArray[i]); } bodyToEquipmentBehaviors.Remove(UnityObjectWrapperKey<CharacterBody>.op_Implicit(body)); } } private static void CharacterBody_onBodyInventoryChangedGlobal(CharacterBody body) { UpdateBodyEquipmentBehavior(body); } private static void UpdateBodyEquipmentBehavior(CharacterBody body) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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_00dd: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) Inventory inventory = body.inventory; if (bodyToEquipmentBehaviors.TryGetValue(UnityObjectWrapperKey<CharacterBody>.op_Implicit(body), out var value)) { if (value.currentEquipmentIndex != inventory.currentEquipmentIndex) { if (value.activeBehaviorsArray != null) { for (int i = 0; i < value.activeBehaviorsArray.Length; i++) { value.activeBehaviorsArray[i].state = EquipmentState.empty; Object.Destroy((Object)(object)value.activeBehaviorsArray[i]); } } if (BaseAssetAssociatedBehavior<EquipmentDefDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext().equipmentTypePairsDict.TryGetValue(inventory.currentEquipmentIndex, out var value2)) { SetActiveBehaviors(body, ref value.activeBehaviorsArray, value2); } else { value.activeBehaviorsArray = null; } } } else { if (!Object.op_Implicit((Object)(object)inventory) || !BaseAssetAssociatedBehavior<EquipmentDefDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext().equipmentTypePairsDict.TryGetValue(inventory.currentEquipmentIndex, out var value3)) { return; } SetActiveBehaviors(body, ref value.activeBehaviorsArray, value3); } value.currentEquipmentIndex = inventory.currentEquipmentIndex; bodyToEquipmentBehaviors[UnityObjectWrapperKey<CharacterBody>.op_Implicit(body)] = value; if (value.activeBehaviorsArray != null) { for (int j = 0; j < value.activeBehaviorsArray.Length; j++) { value.activeBehaviorsArray[j].state = inventory.currentEquipmentState; } } } private static void SetActiveBehaviors(CharacterBody body, ref BaseEquipmentBodyBehavior[] activeBehaviorsArray, EquipmentTypePair[] equipmentTypePairs) { if (activeBehaviorsArray == null || activeBehaviorsArray.Length != equipmentTypePairs.Length) { activeBehaviorsArray = new BaseEquipmentBodyBehavior[equipmentTypePairs.Length]; } for (int i = 0; i < equipmentTypePairs.Length; i++) { earlyAssignmentBody = body; activeBehaviorsArray[i] = (BaseEquipmentBodyBehavior)(object)((Component)body).gameObject.AddComponent(equipmentTypePairs[i].behaviorType); earlyAssignmentBody = null; } } } public abstract class BaseItemMasterBehavior : BaseAssetAssociatedBehavior<BaseItemMasterBehavior.ItemDefAssociationAttribute, BaseItemMasterBehavior.NetworkContext> { public struct NetworkContext { public ItemTypePair[] itemTypePairs; public FixedSizeArrayPool<BaseItemMasterBehavior> behaviorArraysPool; public void SetItemTypePairs(List<ItemTypePair> itemTypePairs) { this.itemTypePairs = itemTypePairs.ToArray(); behaviorArraysPool = new FixedSizeArrayPool<BaseItemMasterBehavior>(this.itemTypePairs.Length); } } [MeansImplicitUse] [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class ItemDefAssociationAttribute : SearchableAttribute { public bool useOnServer = true; public bool useOnClient = true; } private static CharacterMaster earlyAssignmentMaster; private static Dictionary<UnityObjectWrapperKey<CharacterMaster>, BaseItemMasterBehavior[]> masterToItemBehaviors; public int stack; public CharacterMaster master { get; private set; } protected void Awake() { master = earlyAssignmentMaster; earlyAssignmentMaster = null; } [SystemInitializer(new Type[] { typeof(ItemCatalog) })] private static void Init() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown List<ItemTypePair> server = new List<ItemTypePair>(); List<ItemTypePair> client = new List<ItemTypePair>(); List<ItemTypePair> shared = new List<ItemTypePair>(); BaseAssetAssociatedBehavior<ItemDefAssociationAttribute, NetworkContext>.CommenceAttributeSearch<ItemDef>(typeof(BaseItemMasterBehavior), RegisterBehaviour); if (shared.Count > 0) { BaseAssetAssociatedBehavior<ItemDefAssociationAttribute, NetworkContext>.server.SetItemTypePairs(server); BaseAssetAssociatedBehavior<ItemDefAssociationAttribute, NetworkContext>.client.SetItemTypePairs(client); BaseAssetAssociatedBehavior<ItemDefAssociationAttribute, NetworkContext>.shared.SetItemTypePairs(shared); masterToItemBehaviors = new Dictionary<UnityObjectWrapperKey<CharacterMaster>, BaseItemMasterBehavior[]>(); CharacterMaster.OnDestroy += new hook_OnDestroy(CharacterMaster_OnDestroy); CharacterMaster.OnInventoryChanged += new hook_OnInventoryChanged(CharacterMaster_OnInventoryChanged); } void RegisterBehaviour(ItemDefAssociationAttribute attribute, MethodInfo methodInfo, ItemDef asset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_002d: 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_003b: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_008d: Unknown result type (might be due to invalid IL or missing references) if ((int)asset.itemIndex < 0) { Debug.LogError((object)$"{methodInfo.DeclaringType.FullName}.{methodInfo.Name} returned an ItemDef that's not registered in the ItemCatalog. result={asset}"); } else { ItemTypePair val = default(ItemTypePair); val.itemIndex = asset.itemIndex; val.behaviorType = methodInfo.DeclaringType; ItemTypePair item = val; if (attribute.useOnServer) { server.Add(item); } if (attribute.useOnClient) { client.Add(item); } if (attribute.useOnServer || attribute.useOnClient) { shared.Add(item); } } } } private static void CharacterMaster_OnDestroy(orig_OnDestroy orig, CharacterMaster self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (masterToItemBehaviors.TryGetValue(UnityObjectWrapperKey<CharacterMaster>.op_Implicit(self), out var value)) { for (int i = 0; i < value.Length; i++) { Object.Destroy((Object)(object)value[i]); } masterToItemBehaviors.Remove(UnityObjectWrapperKey<CharacterMaster>.op_Implicit(self)); if (NetworkServer.active || NetworkClient.active) { BaseAssetAssociatedBehavior<ItemDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext().behaviorArraysPool.Return(value); } } } private static void CharacterMaster_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterMaster self) { orig.Invoke(self); UpdateMasterItemBehaviorStacks(self); } private static void UpdateMasterItemBehaviorStacks(CharacterMaster master) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) ref NetworkContext currentNetworkContext = ref BaseAssetAssociatedBehavior<ItemDefAssociationAttribute, NetworkContext>.GetCurrentNetworkContext(); Inventory inventory = master.inventory; if (!masterToItemBehaviors.TryGetValue(UnityObjectWrapperKey<CharacterMaster>.op_Implicit(master), out var value) && Object.op_Implicit((Object)(object)inventory) && inventory.itemAcquisitionOrder.Count > 0) { value = currentNetworkContext.behaviorArraysPool.Request(); masterToItemBehaviors.Add(UnityObjectWrapperKey<CharacterMaster>.op_Implicit(master), value); } if (value == null) { return; } ItemTypePair[] itemTypePairs = currentNetworkContext.itemTypePairs; if (Object.op_Implicit((Object)(object)inventory)) { for (int i = 0; i < itemTypePairs.Length; i++) { ItemTypePair val = itemTypePairs[i]; SetItemStack(master, ref value[i], val.behaviorType, inventory.GetItemCount(val.itemIndex)); } return; } for (int j = 0; j < itemTypePairs.Length; j++) { ref BaseItemMasterBehavior reference = ref value[j]; if ((Object)(object)reference != (Object)null) { Object.Destroy((Object)(object)reference); reference = null; } } } private static void SetItemStack(CharacterMaster master, ref BaseItemMasterBehavior behavior, Type behaviorType, int stack) { if ((Object)(object)behavior == (Object)null != stack <= 0) { if (stack <= 0) { behavior.stack = 0; Object.Destroy((Object)(object)behavior); behavior = null; } else { earlyAssignmentMaster = master; behavior = (BaseItemMasterBehavior)(object)((Component)master).gameObject.AddComponent(behaviorType); earlyAssignmentMaster = null; } } if ((Object)(object)behavior != (Object)null) { behavior.stack = stack; } } } public record AchievementWrapper : AchievementWrapper<AchievementWrapper, AchievementDef, UnlockableDef> { public AchievementWrapper(AchievementDef AchievementDef, UnlockableDef UnlockableDef) : base(AchievementDef, UnlockableDef) { } public new void Deconstruct(out AchievementDef AchievementDef, out UnlockableDef UnlockableDef) { AchievementDef = base.AchievementDef; UnlockableDef = base.UnlockableDef; } } public record AchievementWrapper<TAchievementDef, TUnlockableDef> : AchievementWrapper<AchievementWrapper<TAchievementDef, TUnlockableDef>, TAchievementDef, TUnlockableDef> where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { public AchievementWrapper(TAchievementDef AchievementDef, TUnlockableDef UnlockableDef) : base(AchievementDef, UnlockableDef) { } public new void Deconstruct(out TAchievementDef AchievementDef, out TUnlockableDef UnlockableDef) { AchievementDef = base.AchievementDef; UnlockableDef = base.UnlockableDef; } } public abstract record AchievementWrapper<TAchievementWrapper, TAchievementDef, TUnlockableDef>(TAchievementDef AchievementDef, TUnlockableDef UnlockableDef) where TAchievementWrapper : AchievementWrapper<TAchievementWrapper, TAchievementDef, TUnlockableDef> where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { public string NameToken => ((AchievementDef)AchievementDef).nameToken; public string DescriptionToken => ((AchievementDef)AchievementDef).descriptionToken; [MethodImpl(MethodImplOptions.AggressiveInlining)] public TAchievementWrapper SetIconSprite(Sprite iconSprite) { ((AchievementDef)AchievementDef).SetAchievedIcon(iconSprite); ((UnlockableDef)UnlockableDef).achievementIcon = iconSprite; return this as TAchievementWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TAchievementWrapper SetPrerequisiteAchievement(AchievementDef prerequisiteAchievement) { ((AchievementDef)AchievementDef).prerequisiteAchievementIdentifier = prerequisiteAchievement?.identifier; return this as TAchievementWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TAchievementWrapper SetPrerequisiteAchievement(string prerequisiteAchievementIdentifier) { ((AchievementDef)AchievementDef).prerequisiteAchievementIdentifier = prerequisiteAchievementIdentifier; return this as TAchievementWrapper; } public TAchievementWrapper SetTrackerTypes(Type localTrackerType, Type serverTrackerType = null) { if (localTrackerType == null) { throw new ArgumentNullException("localTrackerType"); } if (!localTrackerType.IsSubclassOf(typeof(BaseAchievement))) { throw new ArgumentException("localTrackerType"); } if (serverTrackerType != null && !serverTrackerType.IsSubclassOf(typeof(BaseServerAchievement))) { throw new ArgumentException("serverTrackerType"); } ((AchievementDef)AchievementDef).type = localTrackerType; ((AchievementDef)AchievementDef).serverTrackerType = serverTrackerType; return this as TAchievementWrapper; } } public static class ArtifactExtensions { private static Dictionary<ArtifactDef, (Action onEnabledAction, Action onDisabledAction)> artifactEnabledActions; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TArtifactDef SetIconSprites<TArtifactDef>(this TArtifactDef artifactDef, Sprite enabledIconSprite, Sprite disabledIconSprite) where TArtifactDef : ArtifactDef { ((ArtifactDef)artifactDef).smallIconSelectedSprite = enabledIconSprite; ((ArtifactDef)artifactDef).smallIconDeselectedSprite = disabledIconSprite; return artifactDef; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TArtifactDef SetPickupModelPrefab<TArtifactDef>(this TArtifactDef artifactDef, GameObject pickupModelPrefab) where TArtifactDef : ArtifactDef { ((ArtifactDef)artifactDef).pickupModelPrefab = pickupModelPrefab; return artifactDef; } public static TArtifactDef SetArtifactCode<TArtifactDef>(this TArtifactDef artifactDef, ArtifactCode? artifactCode) where TArtifactDef : ArtifactDef { //IL_0066: 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) for (int num = ArtifactCodeAPI.artifactCodes.Count - 1; num >= 0; num--) { (ArtifactDef, Sha256HashAsset) tuple = ArtifactCodeAPI.artifactCodes[num]; if ((Object)(object)tuple.Item1 == (Object)(object)artifactDef) { Object.Destroy((Object)(object)tuple.Item2); ArtifactCodeAPI.artifactCodes.RemoveAt(num); } } if (artifactCode.HasValue) { Sha256HashAsset val = ScriptableObject.CreateInstance<Sha256HashAsset>(); val.value = artifactCode.Value.CreateCodeHash(); ArtifactCodeAPI.AddCode((ArtifactDef)(object)artifactDef, val); } return artifactDef; } public static TArtifactDef SetEnabledActions<TArtifactDef>(this TArtifactDef artifactDef, Action onEnabledAction, Action onDisabledAction) where TArtifactDef : ArtifactDef { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (artifactEnabledActions == null) { artifactEnabledActions = new Dictionary<ArtifactDef, (Action, Action)>(); RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(OnArtifactEnabledGlobal); RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(OnArtifactDisabledGlobal); } artifactEnabledActions[(ArtifactDef)(object)artifactDef] = (onEnabledAction, onDisabledAction); return artifactDef; static void OnArtifactDisabledGlobal(RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { if (artifactEnabledActions.TryGetValue(artifactDef, out (Action, Action) value)) { value.Item2?.Invoke(); } } static void OnArtifactEnabledGlobal(RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { if (artifactEnabledActions.TryGetValue(artifactDef, out (Action, Action) value2)) { value2.Item1?.Invoke(); } } } } public static class BuffExtensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TBuffDef SetIconSprite<TBuffDef>(this TBuffDef buffDef, Sprite iconSprite, Color spriteColor) where TBuffDef : BuffDef { //IL_0012: 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) ((BuffDef)buffDef).iconSprite = iconSprite; ((BuffDef)buffDef).buffColor = spriteColor; return buffDef; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TBuffDef SetIconSprite<TBuffDef>(this TBuffDef buffDef, Sprite iconSprite) where TBuffDef : BuffDef { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) ((BuffDef)buffDef).iconSprite = iconSprite; ((BuffDef)buffDef).buffColor = Color.white; return buffDef; } public static TBuffDef SetFlags<TBuffDef>(this TBuffDef buffDef, BuffFlags flags) where TBuffDef : BuffDef { ((BuffDef)buffDef).canStack = (flags & BuffFlags.Stackable) > BuffFlags.None; ((BuffDef)buffDef).isDebuff = (flags & BuffFlags.Debuff) > BuffFlags.None; ((BuffDef)buffDef).isCooldown = (flags & BuffFlags.Cooldown) > BuffFlags.None; ((BuffDef)buffDef).isHidden = (flags & BuffFlags.Hidden) > BuffFlags.None; return buffDef; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TBuffDef SetStartSfx<TBuffDef>(this TBuffDef buffDef, NetworkSoundEventDef startSfx) where TBuffDef : BuffDef { ((BuffDef)buffDef).startSfx = startSfx; return buffDef; } } public static class ContentPackExtensions { public static void PopulateNetworkedObjectAssetIds(this ContentPack contentPack) { StringBuilder stringBuilder2 = new StringBuilder(32); using (MD5 hasher2 = MD5.Create()) { PopulateAssetIds(contentPack.bodyPrefabs, contentPack.identifier, "bodyPrefabs", stringBuilder2, hasher2); PopulateAssetIds(contentPack.masterPrefabs, contentPack.identifier, "masterPrefabs", stringBuilder2, hasher2); PopulateAssetIds(contentPack.projectilePrefabs, contentPack.identifier, "projectilePrefabs", stringBuilder2, hasher2); PopulateAssetIds(contentPack.networkedObjectPrefabs, contentPack.identifier, "networkedObjectPrefabs", stringBuilder2, hasher2); PopulateAssetIds(contentPack.gameModePrefabs, contentPack.identifier, "gameModePrefabs", stringBuilder2, hasher2); } static void PopulateAssetIds(NamedAssetCollection<GameObject> assets, string contentIdentifier, string collectionIdentifier, StringBuilder stringBuilder, HashAlgorithm hasher) { //IL_000e: 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_0014: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity val2 = default(NetworkIdentity); for (int i = 0; i < assets.Length; i++) { AssetInfo<GameObject> val = assets.assetInfos[i]; if (val.asset.TryGetComponent<NetworkIdentity>(ref val2)) { NetworkHash128 assetId = val2.assetId; if (!((NetworkHash128)(ref assetId)).IsValid()) { stringBuilder.Clear(); byte[] array = hasher.ComputeHash(Encoding.UTF8.GetBytes(val.assetName + contentIdentifier + collectionIdentifier)); foreach (byte b in array) { stringBuilder.Append(b.ToString("x2")); } val2.SetDynamicAssetId(NetworkHash128.Parse(stringBuilder.ToString())); } } } } } public static void AddEntityStatesFromAssembly(this ContentPack contentPack, Assembly assembly) { Type[] types = assembly.GetTypes(); for (int i = 0; i < types.Length; i++) { if (types[i].IsSubclassOf(typeof(EntityState))) { contentPack.entityStateTypes.Add(types[i]); } } } public static void AddSerializedContent(this ContentPack contentPack, R2APISerializableContentPack serializableContent) { typeof(R2APISerializableContentPack).GetMethod("EnsureNoFieldsAreNull", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(serializableContent, null); contentPack.bodyPrefabs.Add(serializableContent.bodyPrefabs); contentPack.masterPrefabs.Add(serializableContent.masterPrefabs); contentPack.projectilePrefabs.Add(serializableContent.projectilePrefabs); contentPack.gameModePrefabs.Add(serializableContent.gameModePrefabs); contentPack.effectDefs.Add(((IEnumerable<GameObject>)serializableContent.effectPrefabs).Select((Func<GameObject, EffectDef>)((GameObject x) => new EffectDef(x))).ToArray()); contentPack.networkedObjectPrefabs.Add(serializableContent.networkedObjectPrefabs); contentPack.skillDefs.Add(serializableContent.skillDefs); contentPack.skillFamilies.Add(serializableContent.skillFamilies); contentPack.sceneDefs.Add(serializableContent.sceneDefs); contentPack.itemDefs.Add(serializableContent.itemDefs); contentPack.itemTierDefs.Add(serializableContent.itemTierDefs); contentPack.itemRelationshipTypes.Add(serializableContent.itemRelationshipTypes); contentPack.equipmentDefs.Add(serializableContent.equipmentDefs); contentPack.buffDefs.Add(serializableContent.buffDefs); contentPack.eliteDefs.Add(serializableContent.eliteDefs); contentPack.unlockableDefs.Add(serializableContent.unlockableDefs); contentPack.survivorDefs.Add(serializableContent.survivorDefs); contentPack.artifactDefs.Add(serializableContent.artifactDefs); contentPack.surfaceDefs.Add(serializableContent.surfaceDefs); contentPack.networkSoundEventDefs.Add(serializableContent.networkSoundEventDefs); contentPack.musicTrackDefs.Add(serializableContent.musicTrackDefs); contentPack.gameEndingDefs.Add(serializableContent.gameEndingDefs); contentPack.entityStateConfigurations.Add(serializableContent.entityStateConfigurations); contentPack.expansionDefs.Add(serializableContent.expansionDefs); contentPack.entitlementDefs.Add(serializableContent.entitlementDefs); contentPack.miscPickupDefs.Add(serializableContent.miscPickupDefs); HashSet<Type> hashSet = new HashSet<Type>(); for (int i = 0; i < serializableContent.entityStateTypes.Length; i++) { Type stateType = ((SerializableEntityStateType)(ref serializableContent.entityStateTypes[i])).stateType; if (stateType != null) { hashSet.Add(stateType); continue; } Debug.LogWarning((object)("SerializableContentPack \"" + ((Object)serializableContent).name + "\" could not resolve type with name \"" + ((SerializableEntityStateType)(ref serializableContent.entityStateTypes[i])).typeName + "\". The type will not be available in the content pack.")); } contentPack.entityStateTypes.Add(hashSet.ToArray()); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void AddEffectPrefab(this ContentPack contentPack, GameObject effectPrefab) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown contentPack.effectDefs.Add<EffectDef>(new EffectDef(effectPrefab)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static string GetPrefix(ContentPack contentPack) { return contentPack.identifier.Substring(contentPack.identifier.LastIndexOf('.') + 1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static string FormatToken(string baseToken, string tokenPrefix) { return tokenPrefix + "_" + baseToken; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static string FormatAssetIdentifier(string baseIdentifier, string prefix) { return prefix + "." + baseIdentifier; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static string GetUnlockableIdentifier(string baseIdentifier, UnlockableType unlockableType) { if (!string.IsNullOrWhiteSpace((string)unlockableType)) { baseIdentifier = (string)unlockableType + "." + baseIdentifier; } return baseIdentifier; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void AssignRequiredExpansion(ref ExpansionDef requiredExpansion, ContentPack contentPack) { if (contentPack.expansionDefs.Length > 0) { requiredExpansion = contentPack.expansionDefs[0]; } } public static ExpansionDef DefineExpansion(this ContentPack contentPack) { return contentPack.DefineExpansion<ExpansionDef>(); } public static TExpansionDef DefineExpansion<TExpansionDef>(this ContentPack contentPack) where TExpansionDef : ExpansionDef { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) TExpansionDef expansion = ScriptableObject.CreateInstance<TExpansionDef>(); ((Object)(object)expansion).name = contentPack.identifier; string text = contentPack.identifier.ToUpperInvariant().Replace('.', '_'); ((ExpansionDef)expansion).nameToken = text + "_NAME"; ((ExpansionDef)expansion).descriptionToken = text + "_DESCRIPTION"; AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texUnlockIcon.png"); val.Completed += delegate(AsyncOperationHandle<Sprite> texUnlockIcon) { ExpansionDef val2 = (ExpansionDef)(object)expansion; if (val2.disabledIconSprite == null) { val2.disabledIconSprite = texUnlockIcon.Result; } }; contentPack.expansionDefs.Add<ExpansionDef>((ExpansionDef)(object)expansion); return expansion; } public static ItemDef DefineItem(this ContentPack contentPack, string identifier) { return contentPack.DefineItem<ItemDef>(identifier); } public static TItemDef DefineItem<TItemDef>(this ContentPack contentPack, string identifier) where TItemDef : ItemDef { TItemDef val = ScriptableObject.CreateInstance<TItemDef>(); string prefix = GetPrefix(contentPack); ((Object)(object)val).name = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((ItemDef)val).nameToken = FormatToken("ITEM_" + text + "_NAME", tokenPrefix); ((ItemDef)val).pickupToken = FormatToken("ITEM_" + text + "_PICKUP", tokenPrefix); ((ItemDef)val).descriptionToken = FormatToken("ITEM_" + text + "_DESC", tokenPrefix); ((ItemDef)val).loreToken = FormatToken("ITEM_" + text + "_LORE", tokenPrefix); AssignRequiredExpansion(ref ((ItemDef)val).requiredExpansion, contentPack); contentPack.itemDefs.Add<ItemDef>((ItemDef)(object)val); return val; } public static EquipmentDef DefineEquipment(this ContentPack contentPack, string identifier) { return contentPack.DefineEquipment<EquipmentDef>(identifier); } public static TEquipmentDef DefineEquipment<TEquipmentDef>(this ContentPack contentPack, string identifier) where TEquipmentDef : EquipmentDef { TEquipmentDef val = ScriptableObject.CreateInstance<TEquipmentDef>(); string prefix = GetPrefix(contentPack); ((Object)(object)val).name = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((EquipmentDef)val).nameToken = FormatToken("EQUIPMENT_" + text + "_NAME", tokenPrefix); ((EquipmentDef)val).pickupToken = FormatToken("EQUIPMENT_" + text + "_PICKUP", tokenPrefix); ((EquipmentDef)val).descriptionToken = FormatToken("EQUIPMENT_" + text + "_DESC", tokenPrefix); ((EquipmentDef)val).loreToken = FormatToken("EQUIPMENT_" + text + "_LORE", tokenPrefix); ((EquipmentDef)val).canDrop = true; ((EquipmentDef)val).enigmaCompatible = true; AssignRequiredExpansion(ref ((EquipmentDef)val).requiredExpansion, contentPack); contentPack.equipmentDefs.Add<EquipmentDef>((EquipmentDef)(object)val); return val; } public static BuffDef DefineBuff(this ContentPack contentPack, string identifier) { return contentPack.DefineBuff<BuffDef>(identifier); } public static TBuffDef DefineBuff<TBuffDef>(this ContentPack contentPack, string identifier) where TBuffDef : BuffDef { TBuffDef val = ScriptableObject.CreateInstance<TBuffDef>(); ((Object)(object)val).name = FormatAssetIdentifier(identifier, GetPrefix(contentPack)); contentPack.buffDefs.Add<BuffDef>((BuffDef)(object)val); return val; } public static ArtifactDef DefineArtifact(this ContentPack contentPack, string identifier) { return contentPack.DefineArtifact<ArtifactDef>(identifier); } public static TArtifactDef DefineArtifact<TArtifactDef>(this ContentPack contentPack, string identifier) where TArtifactDef : ArtifactDef { TArtifactDef val = ScriptableObject.CreateInstance<TArtifactDef>(); string prefix = GetPrefix(contentPack); ((ArtifactDef)val).cachedName = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((ArtifactDef)val).nameToken = FormatToken("ARTIFACT_" + text + "_NAME", tokenPrefix); ((ArtifactDef)val).descriptionToken = FormatToken("ARTIFACT_" + text + "_DESCRIPTION", tokenPrefix); AssignRequiredExpansion(ref ((ArtifactDef)val).requiredExpansion, contentPack); contentPack.artifactDefs.Add<ArtifactDef>((ArtifactDef)(object)val); return val; } public static SkillDef DefineSkill(this ContentPack contentPack, string identifier) { return contentPack.DefineSkill<SkillDef>(identifier); } public static TSceneDef DefineSkill<TSceneDef>(this ContentPack contentPack, string identifier) where TSceneDef : SkillDef { TSceneDef val = ScriptableObject.CreateInstance<TSceneDef>(); string prefix = GetPrefix(contentPack); ((SkillDef)val).skillName = FormatAssetIdentifier(identifier, prefix); ((Object)(object)val).name = ((SkillDef)val).skillName; string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((SkillDef)val).skillNameToken = FormatToken("SKILL_" + text + "_NAME", tokenPrefix); ((SkillDef)val).skillDescriptionToken = FormatToken("SKILL_" + text + "_DESC", tokenPrefix); contentPack.skillDefs.Add<SkillDef>((SkillDef)(object)val); return val; } public static GameEndingDef DefineGameEnding(this ContentPack contentPack, string identifier) { return contentPack.DefineGameEnding<GameEndingDef>(identifier); } public static TGameEndingDef DefineGameEnding<TGameEndingDef>(this ContentPack contentPack, string identifier) where TGameEndingDef : GameEndingDef { TGameEndingDef val = ScriptableObject.CreateInstance<TGameEndingDef>(); string prefix = GetPrefix(contentPack); ((GameEndingDef)val).cachedName = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((GameEndingDef)val).endingTextToken = FormatToken("GAME_RESULT_" + text, tokenPrefix); contentPack.gameEndingDefs.Add<GameEndingDef>((GameEndingDef)(object)val); return val; } public static SurfaceDef DefineSurfaceDef(this ContentPack contentPack, string identifier) { return contentPack.DefineSurfaceDef<SurfaceDef>(identifier); } public static TSurfaceDef DefineSurfaceDef<TSurfaceDef>(this ContentPack contentPack, string identifier) where TSurfaceDef : SurfaceDef { TSurfaceDef val = ScriptableObject.CreateInstance<TSurfaceDef>(); ((Object)(object)val).name = FormatAssetIdentifier(identifier, GetPrefix(contentPack)); contentPack.surfaceDefs.Add<SurfaceDef>((SurfaceDef)(object)val); return val; } public static SurvivorDef DefineSurvivorFromBodyPrefab(this ContentPack contentPack, string identifier, GameObject bodyPrefab) { return contentPack.DefineSurvivorFromBodyPrefab<SurvivorDef>(identifier, bodyPrefab); } public static TSurvivorDef DefineSurvivorFromBodyPrefab<TSurvivorDef>(this ContentPack contentPack, string identifier, GameObject bodyPrefab) where TSurvivorDef : SurvivorDef { //IL_0040: 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) TSurvivorDef val = DefineSurvivorImpl<TSurvivorDef>(identifier, contentPack); ((SurvivorDef)val).bodyPrefab = bodyPrefab; CharacterBody val2 = default(CharacterBody); if (((SurvivorDef)val).bodyPrefab.TryGetComponent<CharacterBody>(ref val2)) { ((SurvivorDef)val).displayNameToken = val2.baseNameToken; ((SurvivorDef)val).primaryColor = val2.bodyColor; } ExpansionDef requiredExpansion = null; AssignRequiredExpansion(ref requiredExpansion, contentPack); if ((Object)(object)requiredExpansion != (Object)null) { (((SurvivorDef)val).bodyPrefab.GetComponent<ExpansionRequirementComponent>() ?? ((SurvivorDef)val).bodyPrefab.AddComponent<ExpansionRequirementComponent>()).requiredExpansion = requiredExpansion; } return val; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static TSurvivorDef DefineSurvivorImpl<TSurvivorDef>(string identifier, ContentPack contentPack) where TSurvivorDef : SurvivorDef { TSurvivorDef val = ScriptableObject.CreateInstance<TSurvivorDef>(); string prefix = GetPrefix(contentPack); ((SurvivorDef)val).cachedName = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((SurvivorDef)val).displayNameToken = FormatToken(text + "_BODY_NAME", tokenPrefix); ((SurvivorDef)val).descriptionToken = FormatToken(text + "_DESCRIPTION", tokenPrefix); ((SurvivorDef)val).outroFlavorToken = FormatToken(text + "_OUTRO_FLAVOR", tokenPrefix); ((SurvivorDef)val).outroFlavorToken = FormatToken(text + "_MAIN_ENDING_ESCAPE_FAILURE_FLAVOR", tokenPrefix); contentPack.survivorDefs.Add<SurvivorDef>((SurvivorDef)(object)val); return val; } public static SkinDef DefineSkinForBodyPrefab(this ContentPack contentPack, string identifier, GameObject bodyPrefab) { return contentPack.DefineSkinForBodyPrefab<SkinDef>(identifier, bodyPrefab); } public static TSkinDef DefineSkinForBodyPrefab<TSkinDef>(this ContentPack contentPack, string identifier, GameObject bodyPrefab) where TSkinDef : SkinDef { ModelLocator val = default(ModelLocator); if (!bodyPrefab.TryGetComponent<ModelLocator>(ref val) || !Object.op_Implicit((Object)(object)val.modelTransform)) { throw new ArgumentException("bodyPrefab"); } TSkinDef val2 = contentPack.DefineSkin<TSkinDef>(identifier); ((SkinDef)val2).rootObject = ((Component)val.modelTransform).gameObject; ModelSkinController val3 = default(ModelSkinController); if (((Component)val.modelTransform).TryGetComponent<ModelSkinController>(ref val3) && val3.skins != null) { ref SkinDef[] skins = ref val3.skins; SkinDef val4 = (SkinDef)(object)val2; ArrayUtils.ArrayAppend<SkinDef>(ref skins, ref val4); } else { if (val3 == null) { val3 = ((Component)val.modelTransform).gameObject.AddComponent<ModelSkinController>(); } ModelSkinController obj = val3; SkinDef[] skins2 = (SkinDef[])(object)new TSkinDef[1] { val2 }; obj.skins = skins2; ((SkinDef)val2).nameToken = "DEFAULT_SKIN"; } return val2; } public static SkinDef DefineSkin(this ContentPack contentPack, string identifier) { return contentPack.DefineSkin<SkinDef>(identifier); } public static TSkinDef DefineSkin<TSkinDef>(this ContentPack contentPack, string identifier) where TSkinDef : SkinDef { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown SkinDef.Awake += new hook_Awake(_); TSkinDef val = ScriptableObject.CreateInstance<TSkinDef>(); SkinDef.Awake -= new hook_Awake(_); string prefix = GetPrefix(contentPack); ((Object)(object)val).name = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((SkinDef)val).nameToken = FormatToken("SKIN_" + text + "_NAME", tokenPrefix); return val; static void _(orig_Awake orig, SkinDef self) { } } public static ItemTierDef DefineItemTier(this ContentPack contentPack, string identifier) { return contentPack.DefineItemTier<ItemTierDef>(identifier); } public static TItemTierDef DefineItemTier<TItemTierDef>(this ContentPack contentPack, string identifier) where TItemTierDef : ItemTierDef { TItemTierDef val = ScriptableObject.CreateInstance<TItemTierDef>(); ((Object)(object)val).name = FormatAssetIdentifier(identifier, GetPrefix(contentPack)); ((ItemTierDef)val).tier = (ItemTier)10; ((ItemTierDef)val).isDroppable = true; ((ItemTierDef)val).canScrap = true; ((ItemTierDef)val).canRestack = true; contentPack.itemTierDefs.Add<ItemTierDef>((ItemTierDef)(object)val); return val; } public static NetworkSoundEventDef DefineNetworkSoundEvent(this ContentPack contentPack, string identifier) { return contentPack.DefineNetworkSoundEvent<NetworkSoundEventDef>(identifier); } public static TNetworkSoundEventDef DefineNetworkSoundEvent<TNetworkSoundEventDef>(this ContentPack contentPack, string identifier) where TNetworkSoundEventDef : NetworkSoundEventDef { TNetworkSoundEventDef val = ScriptableObject.CreateInstance<TNetworkSoundEventDef>(); ((Object)(object)val).name = FormatAssetIdentifier(identifier, GetPrefix(contentPack)); contentPack.networkSoundEventDefs.Add<NetworkSoundEventDef>((NetworkSoundEventDef)(object)val); return val; } public static TMiscPickupDef DefineMiscPickup<TMiscPickupDef>(this ContentPack contentPack, string identifier) where TMiscPickupDef : MiscPickupDef, new() { TMiscPickupDef val = ScriptableObject.CreateInstance<TMiscPickupDef>(); string prefix = GetPrefix(contentPack); ((Object)(object)val).name = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((MiscPickupDef)val).nameToken = FormatToken("PICKUP_" + text, tokenPrefix); ((MiscPickupDef)val).interactContextToken = FormatToken(text + "_PICKUP_CONTEXT", tokenPrefix); contentPack.miscPickupDefs.Add<MiscPickupDef>((MiscPickupDef)(object)val); return val; } public static SceneDef DefineScene(this ContentPack contentPack, string sceneIdentifier) { return contentPack.DefineScene<SceneDef>(sceneIdentifier); } public static TSceneDef DefineScene<TSceneDef>(this ContentPack contentPack, string sceneIdentifier) where TSceneDef : SceneDef { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) TSceneDef val = ScriptableObject.CreateInstance<TSceneDef>(); ((SceneDef)val).cachedName = sceneIdentifier; string text = sceneIdentifier.ToUpperInvariant(); string tokenPrefix = GetPrefix(contentPack).ToUpperInvariant(); ((SceneDef)val).nameToken = FormatToken("MAP_" + text + "_NAME", tokenPrefix); ((SceneDef)val).subtitleToken = FormatToken("MAP_" + text + "_SUBTITLE", tokenPrefix); ((SceneDef)val).loreToken = FormatToken("MAP_" + text + "_LORE", tokenPrefix); ((SceneDef)val).portalSelectionMessageString = FormatToken("BAZAAR_SEER_" + text, tokenPrefix); ((SceneDef)val).sceneType = (SceneType)1; AssignRequiredExpansion(ref ((SceneDef)val).requiredExpansion, contentPack); contentPack.sceneDefs.Add<SceneDef>((SceneDef)(object)val); return val; } public static ItemRelationshipType DefineItemRelationshipType(this ContentPack contentPack, string identifier) { return contentPack.DefineItemRelationshipType<ItemRelationshipType>(identifier); } public static TItemRelationshipType DefineItemRelationshipType<TItemRelationshipType>(this ContentPack contentPack, string identifier) where TItemRelationshipType : ItemRelationshipType { TItemRelationshipType val = ScriptableObject.CreateInstance<TItemRelationshipType>(); ((Object)(object)val).name = FormatAssetIdentifier(identifier, GetPrefix(contentPack)); contentPack.itemRelationshipTypes.Add<ItemRelationshipType>((ItemRelationshipType)(object)val); return val; } public static ItemRelationshipProvider DefineItemRelationshipProvider(this ContentPack contentPack, string identifier) { return contentPack.DefineItemRelationshipProvider<ItemRelationshipProvider>(identifier); } public static TItemRelationshipProvider DefineItemRelationshipProvider<TItemRelationshipProvider>(this ContentPack contentPack, string identifier) where TItemRelationshipProvider : ItemRelationshipProvider { TItemRelationshipProvider val = ScriptableObject.CreateInstance<TItemRelationshipProvider>(); ((Object)(object)val).name = FormatAssetIdentifier(identifier, GetPrefix(contentPack)); contentPack.itemRelationshipProviders.Add<ItemRelationshipProvider>((ItemRelationshipProvider)(object)val); return val; } public static DifficultyWrapper DefineDifficulty(this ContentPack contentPack, string identifier, bool preferPositiveIndex = false) { //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_0016: Unknown result type (might be due to invalid IL or missing references) var (difficultyDef, difficultyIndex) = DefineDifficultyImpl<DifficultyDef>(identifier, preferPositiveIndex, contentPack); return new DifficultyWrapper(difficultyDef, difficultyIndex); } public static DifficultyWrapper<TDifficultyDef> DefineDifficulty<TDifficultyDef>(this ContentPack contentPack, string identifier, bool preferPositiveIndex = false) where TDifficultyDef : DifficultyDef { //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_0016: Unknown result type (might be due to invalid IL or missing references) var (difficultyDef, difficultyIndex) = DefineDifficultyImpl<TDifficultyDef>(identifier, preferPositiveIndex, contentPack); return new DifficultyWrapper<TDifficultyDef>(difficultyDef, difficultyIndex); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static (TDifficultyDef, DifficultyIndex) DefineDifficultyImpl<TDifficultyDef>(string identifier, bool preferPositiveIndex, ContentPack contentPack) where TDifficultyDef : DifficultyDef { //IL_006d: Unknown result type (might be due to invalid IL or missing references) TDifficultyDef val = Activator.CreateInstance<TDifficultyDef>(); string text = identifier.ToUpperInvariant(); string tokenPrefix = GetPrefix(contentPack).ToUpperInvariant(); ((DifficultyDef)val).nameToken = FormatToken("DIFFICULTY_" + text + "_NAME", tokenPrefix); ((DifficultyDef)val).descriptionToken = FormatToken("DIFFICULTY_" + text + "_DESCRIPTION", tokenPrefix); ((DifficultyDef)val).foundIconSprite = true; return (val, DifficultyAPI.AddDifficulty((DifficultyDef)(object)val, preferPositiveIndex)); } public static EliteWrapper DefineElite(this ContentPack contentPack, string identifier) { var (eliteDef, eliteEquipmentDef, eliteBuffDef) = DefineEliteImpl<EliteDef, EquipmentDef, BuffDef>(identifier, contentPack); return new EliteWrapper(eliteDef, new List<EliteDef>(), eliteEquipmentDef, eliteBuffDef) { registerSubEliteCallback = delegate(EliteDef x) { contentPack?.eliteDefs.Add<EliteDef>(x); }, subElitePrefix = GetPrefix(contentPack) }; } public static EliteWrapper<TEliteDef, TEquipmentDef, TBuffDef> DefineElite<TEliteDef, TEquipmentDef, TBuffDef>(this ContentPack contentPack, string identifier) where TEliteDef : EliteDef where TEquipmentDef : EquipmentDef where TBuffDef : BuffDef { var (eliteDef, eliteEquipmentDef, eliteBuffDef) = DefineEliteImpl<TEliteDef, TEquipmentDef, TBuffDef>(identifier, contentPack); return new EliteWrapper<TEliteDef, TEquipmentDef, TBuffDef>(eliteDef, new List<TEliteDef>(), eliteEquipmentDef, eliteBuffDef) { registerSubEliteCallback = delegate(EliteDef x) { contentPack?.eliteDefs.Add<EliteDef>(x); }, subElitePrefix = GetPrefix(contentPack) }; } private static (TEliteDef, TEquipmentDef, TBuffDef) DefineEliteImpl<TEliteDef, TEquipmentDef, TBuffDef>(string identifier, ContentPack contentPack) where TEliteDef : EliteDef where TEquipmentDef : EquipmentDef where TBuffDef : BuffDef { TBuffDef val = contentPack.DefineBuff<TBuffDef>("Elite" + identifier); TEquipmentDef val2 = contentPack.DefineEquipment<TEquipmentDef>("Affix" + identifier).SetAvailability(EquipmentAvailability.Never).SetFlags(EquipmentFlags.NeverRandomlyTriggered | EquipmentFlags.EnigmaIncompatible) .SetPassiveBuff((BuffDef)(object)val); ((EquipmentDef)val2).dropOnDeathChance = 0.00025f; TEliteDef val3 = ScriptableObject.CreateInstance<TEliteDef>(); string prefix = GetPrefix(contentPack); ((Object)(object)val3).name = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((EliteDef)val3).modifierToken = FormatToken("ELITE_MODIFIER_" + text, tokenPrefix); ((EliteDef)val3).eliteEquipmentDef = (EquipmentDef)(object)val2; ((EliteDef)val3).shaderEliteRampIndex = 0; ((BuffDef)val).eliteDef = (EliteDef)(object)val3; contentPack.eliteDefs.Add<EliteDef>((EliteDef)(object)val3); return (val3, val2, val); } public static UnlockableDef DefineUnlockable(this ContentPack contentPack, UnlockableType unlockableType, string identifier) { return contentPack.DefineUnlockable<UnlockableDef>(unlockableType, identifier); } public static TUnlockableDef DefineUnlockable<TUnlockableDef>(this ContentPack contentPack, UnlockableType unlockableType, string identifier) where TUnlockableDef : UnlockableDef { TUnlockableDef val = ScriptableObject.CreateInstance<TUnlockableDef>(); ((UnlockableDef)val).cachedName = GetUnlockableIdentifier(identifier, unlockableType); string text = identifier.ToUpperInvariant().Replace('.', '_'); string tokenPrefix = GetPrefix(contentPack).ToUpperInvariant(); ((UnlockableDef)val).nameToken = FormatToken("UNLOCKABLE_" + ((string)unlockableType).ToUpperInvariant() + "_" + text, tokenPrefix); contentPack.unlockableDefs.Add<UnlockableDef>((UnlockableDef)(object)val); return val; } public static AchievementWrapper DefineAchievementForItem(this ContentPack contentPack, string identifier, ItemDef item) { UnlockableDef val = (item.unlockableDef = UnlockableExtensions.SetNameToken<UnlockableDef>(contentPack.DefineUnlockable(UnlockableType.Items, ((Object)item).name), item.nameToken)); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForItem<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, ItemDef item) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { TUnlockableDef val = UnlockableExtensions.SetNameToken(contentPack.DefineUnlockable<TUnlockableDef>(UnlockableType.Items, ((Object)item).name), item.nameToken); item.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForEquipment(this ContentPack contentPack, string identifier, EquipmentDef equipment) { UnlockableDef val = (equipment.unlockableDef = UnlockableExtensions.SetNameToken<UnlockableDef>(contentPack.DefineUnlockable(UnlockableType.Items, ((Object)equipment).name), equipment.nameToken)); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForEquipment<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, EquipmentDef equipment) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { TUnlockableDef val = UnlockableExtensions.SetNameToken(contentPack.DefineUnlockable<TUnlockableDef>(UnlockableType.Items, ((Object)equipment).name), equipment.nameToken); equipment.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForSurvivor(this ContentPack contentPack, string identifier, SurvivorDef survivor) { UnlockableDef val = (survivor.unlockableDef = UnlockableExtensions.SetNameToken<UnlockableDef>(contentPack.DefineUnlockable(UnlockableType.Characters, survivor.cachedName), survivor.displayNameToken)); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForSurvivor<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, SurvivorDef survivor) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { TUnlockableDef val = UnlockableExtensions.SetNameToken(contentPack.DefineUnlockable<TUnlockableDef>(UnlockableType.Characters, survivor.cachedName), survivor.displayNameToken); survivor.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForArtifact(this ContentPack contentPack, string identifier, ArtifactDef artifact) { UnlockableDef val = (artifact.unlockableDef = UnlockableExtensions.SetNameToken<UnlockableDef>(contentPack.DefineUnlockable(UnlockableType.Artifacts, artifact.cachedName), artifact.nameToken)); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForArtifact<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, ArtifactDef artifact) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { TUnlockableDef val = UnlockableExtensions.SetNameToken(contentPack.DefineUnlockable<TUnlockableDef>(UnlockableType.Artifacts, artifact.cachedName), artifact.nameToken); artifact.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForSkill(this ContentPack contentPack, string identifier, ref Variant skillVariant) { if ((Object)(object)skillVariant.skillDef == (Object)null) { throw new ArgumentException("skillVariant"); } UnlockableDef val = (skillVariant.unlockableDef = DefineUnlockableForSkillImpl<UnlockableDef>(skillVariant.skillDef, contentPack)); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForSkill<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, ref Variant skillVariant) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { if ((Object)(object)skillVariant.skillDef == (Object)null) { throw new ArgumentException("skillVariant"); } TUnlockableDef val = DefineUnlockableForSkillImpl<TUnlockableDef>(skillVariant.skillDef, contentPack); skillVariant.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForSkill(this ContentPack contentPack, string identifier, ref Variant skillVariant1, ref Variant skillVariant2) { if ((Object)(object)skillVariant1.skillDef == (Object)null) { throw new ArgumentException("skillVariant1"); } UnlockableDef val = (skillVariant2.unlockableDef = (skillVariant1.unlockableDef = DefineUnlockableForSkillImpl<UnlockableDef>(skillVariant1.skillDef, contentPack))); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForSkill<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, ref Variant skillVariant1, ref Variant skillVariant2) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { if ((Object)(object)skillVariant1.skillDef == (Object)null) { throw new ArgumentException("skillVariant1"); } TUnlockableDef val = DefineUnlockableForSkillImpl<TUnlockableDef>(skillVariant1.skillDef, contentPack); skillVariant1.unlockableDef = (UnlockableDef)(object)val; skillVariant2.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForSkill(this ContentPack contentPack, string identifier, SkillDef skill) { UnlockableDef val = DefineUnlockableForSkillImpl<UnlockableDef>(skill, contentPack); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForSkill<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, SkillDef skill) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { TUnlockableDef val = DefineUnlockableForSkillImpl<TUnlockableDef>(skill, contentPack); return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static TUnlockableDef DefineUnlockableForSkillImpl<TUnlockableDef>(SkillDef skill, ContentPack contentPack) where TUnlockableDef : UnlockableDef { return UnlockableExtensions.SetNameToken(contentPack.DefineUnlockable<TUnlockableDef>(UnlockableType.Skills, skill.skillName), skill.skillNameToken); } public static AchievementWrapper DefineAchievementForSkin(this ContentPack contentPack, string identifier, SkinDef skin) { UnlockableDef val = (skin.unlockableDef = UnlockableExtensions.SetNameToken<UnlockableDef>(contentPack.DefineUnlockable(UnlockableType.Skins, ((Object)skin).name), skin.nameToken)); return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, val, contentPack), val); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForSkin<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, SkinDef skin) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { TUnlockableDef val = UnlockableExtensions.SetNameToken(contentPack.DefineUnlockable<TUnlockableDef>(UnlockableType.Skins, ((Object)skin).name), skin.nameToken); skin.unlockableDef = (UnlockableDef)(object)val; return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)val, contentPack), val); } public static AchievementWrapper DefineAchievementForUnlockable(this ContentPack contentPack, string identifier, UnlockableDef unlockable) { return new AchievementWrapper(DefineAchievementImpl<AchievementDef>(identifier, unlockable, contentPack), unlockable); } public static AchievementWrapper<TAchievementDef, TUnlockableDef> DefineAchievementForUnlockable<TAchievementDef, TUnlockableDef>(this ContentPack contentPack, string identifier, TUnlockableDef unlockable) where TAchievementDef : AchievementDef where TUnlockableDef : UnlockableDef { return new AchievementWrapper<TAchievementDef, TUnlockableDef>(DefineAchievementImpl<TAchievementDef>(identifier, (UnlockableDef)(object)unlockable, contentPack), unlockable); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static TAchievementDef DefineAchievementImpl<TAchievementDef>(string identifier, UnlockableDef unlockable, ContentPack contentPack) where TAchievementDef : AchievementDef { TAchievementDef achievement = Activator.CreateInstance<TAchievementDef>(); string prefix = GetPrefix(contentPack); ((AchievementDef)achievement).identifier = FormatAssetIdentifier(identifier, prefix); string text = identifier.ToUpperInvariant(); string tokenPrefix = prefix.ToUpperInvariant(); ((AchievementDef)achievement).nameToken = FormatToken("ACHIEVEMENT_" + text + "_NAME", tokenPrefix); ((AchievementDef)achievement).descriptionToken = FormatToken("ACHIEVEMENT_" + text + "_DESCRIPTION", tokenPrefix); ((AchievementDef)achievement).unlockableRewardIdentifier = unlockable.cachedName; unlockable.getHowToUnlockString = () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString(((AchievementDef)achievement).nameToken), Language.GetString(((AchievementDef)achievement).descriptionToken) }); unlockable.getUnlockedString = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(((AchievementDef)achievement).nameToken), Language.GetString(((AchievementDef)achievement).descriptionToken) }); SaferAchievementManager.OnCollectAchievementDefs += OnCollectAchievementDefs; return achievement; void OnCollectAchievementDefs(List<string> identifiers, Dictionary<string, AchievementDef> identifierToAchievementDef, List<AchievementDef> achievementDefs) { if (identifierToAchievementDef.ContainsKey(((AchievementDef)achievement).identifier)) { Debug.LogError((object)("Class " + ((AchievementDef)achievement).type.FullName + " attempted to register as achievement " + ((AchievementDef)achievement).identifier + ", but class " + identifierToAchievementDef[((AchievementDef)achievement).identifier].type.FullName + " has already registered as that achievement.")); } else { identifiers.Add(((AchievementDef)achievement).identifier); identifierToAchievementDef.Add(((AchievementDef)achievement).identifier, (AchievementDef)(object)achievement); achievementDefs.Add((AchievementDef)(object)achievement); } SaferAchievementManager.OnCollectAchievementDefs -= OnCollectAchievementDefs; } } } public record DifficultyWrapper : DifficultyWrapper<DifficultyWrapper, DifficultyDef> { public DifficultyWrapper(DifficultyDef DifficultyDef, DifficultyIndex DifficultyIndex) : base(DifficultyDef, DifficultyIndex) { }//IL_0002: Unknown result type (might be due to invalid IL or missing references) public new void Deconstruct(out DifficultyDef DifficultyDef, out DifficultyIndex DifficultyIndex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected I4, but got Unknown DifficultyDef = base.DifficultyDef; DifficultyIndex = (DifficultyIndex)(int)base.DifficultyIndex; } } public record DifficultyWrapper<TDifficultyDef> : DifficultyWrapper<DifficultyWrapper<TDifficultyDef>, TDifficultyDef> where TDifficultyDef : DifficultyDef { public DifficultyWrapper(TDifficultyDef DifficultyDef, DifficultyIndex DifficultyIndex) : base(DifficultyDef, DifficultyIndex) { }//IL_0002: Unknown result type (might be due to invalid IL or missing references) public new void Deconstruct(out TDifficultyDef DifficultyDef, out DifficultyIndex DifficultyIndex) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected I4, but got Unknown DifficultyDef = base.DifficultyDef; DifficultyIndex = (DifficultyIndex)(int)base.DifficultyIndex; } } public abstract record DifficultyWrapper<TDifficultyWrapper, TDifficultyDef>(TDifficultyDef DifficultyDef, DifficultyIndex DifficultyIndex) where TDifficultyWrapper : DifficultyWrapper<TDifficultyWrapper, TDifficultyDef> where TDifficultyDef : DifficultyDef { public string NameToken => ((DifficultyDef)DifficultyDef).nameToken; public string DescriptionToken => ((DifficultyDef)DifficultyDef).descriptionToken; [MethodImpl(MethodImplOptions.AggressiveInlining)] public TDifficultyWrapper SetScalingValue(float scalingValue) { ((DifficultyDef)DifficultyDef).scalingValue = scalingValue; return this as TDifficultyWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TDifficultyWrapper SetIconSprite(Sprite iconSprite) { ((DifficultyDef)DifficultyDef).iconSprite = iconSprite; ((DifficultyDef)DifficultyDef).foundIconSprite = true; return this as TDifficultyWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TDifficultyWrapper SetColor(Color color) { //IL_000b: 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) ((DifficultyDef)DifficultyDef).color = color; return this as TDifficultyWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TDifficultyWrapper SetServerTag(string serverTag) { ((DifficultyDef)DifficultyDef).serverTag = serverTag; return this as TDifficultyWrapper; } public TDifficultyWrapper SetFlags(DifficultyFlags flags) { ((DifficultyDef)DifficultyDef).countsAsHardMode = (flags & DifficultyFlags.HardMode) > DifficultyFlags.None; if ((flags & DifficultyFlags.Hidden) > DifficultyFlags.None) { DifficultyAPI.hiddenDifficulties.Add((DifficultyDef)(object)DifficultyDef); } else { DifficultyAPI.hiddenDifficulties.Remove((DifficultyDef)(object)DifficultyDef); } return this as TDifficultyWrapper; } protected virtual bool PrintMembers(StringBuilder builder) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) builder.Append("DifficultyDef"); builder.Append(" = "); builder.Append(DifficultyDef); builder.Append(", "); builder.Append("DifficultyIndex"); builder.Append(" = "); DifficultyIndex difficultyIndex = DifficultyIndex; builder.Append(((object)(DifficultyIndex)(ref difficultyIndex)).ToString()); builder.Append(", "); builder.Append("NameToken"); builder.Append(" = "); builder.Append((object?)NameToken); builder.Append(", "); builder.Append("DescriptionToken"); builder.Append(" = "); builder.Append((object?)DescriptionToken); return true; } public void Deconstruct(out TDifficultyDef DifficultyDef, out DifficultyIndex DifficultyIndex) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected I4, but got Unknown DifficultyDef = this.DifficultyDef; DifficultyIndex = (DifficultyIndex)(int)this.DifficultyIndex; } } public record EliteWrapper : EliteWrapper<EliteWrapper, EliteDef, EquipmentDef, BuffDef> { public EliteWrapper(EliteDef EliteDef, List<EliteDef> SubEliteDefs, EquipmentDef EliteEquipmentDef, BuffDef EliteBuffDef) : base(EliteDef, SubEliteDefs, EliteEquipmentDef, EliteBuffDef) { } public new void Deconstruct(out EliteDef EliteDef, out List<EliteDef> SubEliteDefs, out EquipmentDef EliteEquipmentDef, out BuffDef EliteBuffDef) { EliteDef = base.EliteDef; SubEliteDefs = base.SubEliteDefs; EliteEquipmentDef = base.EliteEquipmentDef; EliteBuffDef = base.EliteBuffDef; } } public record EliteWrapper<TEliteDef, TEquipmentDef, TBuffDef> : EliteWrapper<EliteWrapper<TEliteDef, TEquipmentDef, TBuffDef>, TEliteDef, TEquipmentDef, TBuffDef> where TEliteDef : EliteDef where TEquipmentDef : EquipmentDef where TBuffDef : BuffDef { public EliteWrapper(TEliteDef EliteDef, List<TEliteDef> SubEliteDefs, TEquipmentDef EliteEquipmentDef, TBuffDef EliteBuffDef) : base(EliteDef, SubEliteDefs, EliteEquipmentDef, EliteBuffDef) { } public new void Deconstruct(out TEliteDef EliteDef, out List<TEliteDef> SubEliteDefs, out TEquipmentDef EliteEquipmentDef, out TBuffDef EliteBuffDef) { EliteDef = base.EliteDef; SubEliteDefs = base.SubEliteDefs; EliteEquipmentDef = base.EliteEquipmentDef; EliteBuffDef = base.EliteBuffDef; } } public abstract record EliteWrapper<TEliteWrapper, TEliteDef, TEquipmentDef, TBuffDef>(TEliteDef EliteDef, List<TEliteDef> SubEliteDefs, TEquipmentDef EliteEquipmentDef, TBuffDef EliteBuffDef) where TEliteWrapper : EliteWrapper<TEliteWrapper, TEliteDef, TEquipmentDef, TBuffDef> where TEliteDef : EliteDef where TEquipmentDef : EquipmentDef where TBuffDef : BuffDef { public string ModifierToken => ((EliteDef)EliteDef).modifierToken; public Action<EliteDef> registerSubEliteCallback; public string subElitePrefix; private Texture2D _eliteRampTexture; [MethodImpl(MethodImplOptions.AggressiveInlining)] public TEliteWrapper SetStats(EliteStats stats) { ((EliteDef)EliteDef).healthBoostCoefficient = stats.healthBoostCoefficient; ((EliteDef)EliteDef).damageBoostCoefficient = stats.damageBoostCoefficient; return this as TEliteWrapper; } public TEliteWrapper SetEliteRampTexture(Texture2D eliteRampTexture) { EliteRamp.AddRampToMultipleElites((IEnumerable<EliteDef>)SubEliteDefs.Prepend(EliteDef), eliteRampTexture); _eliteRampTexture = eliteRampTexture; return this as TEliteWrapper; } public TEliteWrapper DefineSubElite(string identifier, EliteStats stats, params EliteTierDef[] subEliteTiers) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) TEliteDef val = ScriptableObject.CreateInstance<TEliteDef>(); ((Object)(object)val).name = (string.IsNullOrEmpty(subElitePrefix) ? identifier : ContentPackExtensions.FormatAssetIdentifier(identifier, subElitePrefix)); ((EliteDef)val).modifierToken = ((EliteDef)EliteDef).modifierToken; ((EliteDef)val).eliteEquipmentDef = ((EliteDef)EliteDef).eliteEquipmentDef; ((EliteDef)val).shaderEliteRampIndex = ((EliteDef)EliteDef).shaderEliteRampIndex; ((EliteDef)val).color = ((EliteDef)EliteDef).color; if (Object.op_Implicit((Object)(object)_eliteRampTexture)) { EliteRamp.AddRamp((EliteDef)(object)val, _eliteRampTexture); } ((EliteDef)val).healthBoostCoefficient = stats.healthBoostCoefficient; ((EliteDef)val).damageBoostCoefficient = stats.damageBoostCoefficient; for (int i = 0; i < subEliteTiers.Length; i++) { subEliteTiers[i].AddElite((EliteDef)(object)val); } registerSubEliteCallback?.Invoke((EliteDef)(object)val); SubEliteDefs.Add(val); return this as TEliteWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TEliteWrapper SetEliteEquipmentIconSprite(Sprite iconSprite) { ((EquipmentDef)EliteEquipmentDef).pickupIconSprite = iconSprite; return this as TEliteWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TEliteWrapper SetEliteEquipmentPickupModelPrefab(GameObject pickupModelPrefab) { ((EquipmentDef)EliteEquipmentDef).pickupModelPrefab = pickupModelPrefab; return this as TEliteWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TEliteWrapper SetEliteBuffIconSprite(Sprite iconSprite, Color spriteColor) { //IL_001c: 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) ((BuffDef)EliteBuffDef).iconSprite = iconSprite; ((BuffDef)EliteBuffDef).buffColor = spriteColor; return this as TEliteWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TEliteWrapper SetEliteBuffIconSprite(Sprite iconSprite) { ((BuffDef)EliteBuffDef).iconSprite = iconSprite; return this as TEliteWrapper; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TEliteWrapper SetEliteBuffStartSfx(NetworkSoundEventDef startSfx) { ((BuffDef)EliteBuffDef).startSfx = startSfx; return this as TEliteWrapper; } protected virtual bool PrintMembers(StringBuilder builder) { builder.Append("EliteDef"); builder.Append(" = "); builder.Append(EliteDef); builder.Append(", "); builder.Append("SubEliteDefs"); builder.Append(" = "); builder.Append(SubEliteDefs); builder.Append(", "); builder.Append("EliteEquipmentDef"); builder.Append(" = "); builder.Append(EliteEquipmentDef); builder.Append(", "); builder.Append("EliteBuffDef"); builder.Append(" = "); builder.Append(EliteBuffDef); builder.Append(", "); builder.Append("registerSubEliteCallback"); builder.Append(" = "); builder.Append(registerSubEliteCallback); builder.Append(", "); builder.Append("subElitePrefix"); builder.Append(" = "); builder.Append((object?)subElitePrefix); builder.Append(", "); builder.Append("ModifierToken"); builder.Append(" = "); builder.Append((object?)ModifierToken); return true; } } public static class EquipmentExtensions { private static Dictionary<EquipmentDef, Func<EquipmentSlot, bool>> equipmentActivationFunctions; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TEquipmentDef SetIconSprite<TEquipmentDef>(this TEquipmentDef equipmentDef, Sprite iconSprite) where TEquipmentDef : EquipmentDef { ((EquipmentDef)equipmentDef).pickupIconSprite = iconSprite; return equipmentDef; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TEquipmentDef SetCooldown<TEquipmentDef>(this TEquipmentDef equipmentDef, float cooldown) where TEquipmentDef : EquipmentDef { ((EquipmentDef)equipmentDef).cooldown = cooldown; return equipmentDef; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TEquipmentDef SetPickupModelPrefab<TEquipmentDef>(this TEquipmentDef equipmentDef, GameObject pickupModelPrefab, ModelPanelParams logbookModelParams) where TEquipmentDef : EquipmentDef { ((EquipmentDef)equipmentDef).pickupModelPrefab = pickupModelPrefab; Ivyl.SetupModelPanelParameters(pickupModelPrefab, logbookModelParams); return equipmentDef; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TEquipmentDef SetPickupModelPrefab<TEquipmentDef>(this TEquipmentDef equipmentDef, GameObject pickupModelPrefab) where TEquipmentDef : EquipmentDef { ((EquipmentDef)equipmentDef).pickupModelPrefab = pickupModelPrefab;