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.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.ArtifactShell; using HG; using IL.RoR2; using IL.RoR2.Items; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour.HookGen; using Newtonsoft.Json; using On.EntityStates.ArtifactShell; using On.RoR2; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using RoR2.Items; using TTATweaks.Tweaks; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TTATweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7446f2b9ac34a59aff285ee013e67ef66a29d9b5")] [assembly: AssemblyProduct("TTATweaks")] [assembly: AssemblyTitle("TTATweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TTATweaks { public class Assets { public static AssetBundle assetBundle; public static Sprite icon; public static void Init() { GetAssetBundle(); icon = assetBundle.LoadAsset("icon"); } private static void GetAssetBundle() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TTATweaks.ttatweaks"); if (stream != null) { assetBundle = AssetBundle.LoadFromStream(stream); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public class Options { private static bool? _rooEnabled; public static bool rooEnabled { get { if (!_rooEnabled.HasValue) { _rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _rooEnabled.Value; } } public static ConfigEntry syncMinionItems { get; set; } public static ConfigEntry honorEliteMinions { get; set; } public static ConfigEntry honorEliteUrchins { get; set; } public static ConfigEntry honorEliteUmbras { get; set; } public static ConfigEntry honorElitePlayers { get; set; } public static ConfigEntry honorGildedAurelionite { get; set; } public static ConfigEntry honorGildedReliquary { get; set; } public static ConfigEntry minionEliteBuffs { get; set; } public static ConfigEntry glacialSlowDurationMult { get; set; } public static ConfigEntry glacialExplosion { get; set; } public static ConfigEntry blacklistJson { get; set; } public static ConfigEntry allyAurelioniteItemsJson { get; set; } private static void BlacklistChanged() { try { Dictionary jsonObject = JsonConvert.DeserializeObject>("{" + blacklistJson.Value + "}"); SyncItems.blacklist = SyncItems.GenerateBlacklist(jsonObject); Log.Info("Blacklist valid!"); SyncItems.useCustomBlacklist = true; } catch (Exception ex) { if (ex is JsonReaderException || ex is JsonSerializationException) { Log.Warning("Blacklist currently invalid!"); } else { Log.Error(ex.ToString()); } SyncItems.useCustomBlacklist = false; } } private static void AllyAurelioniteItemsChanged() { try { Dictionary jsonObject = JsonConvert.DeserializeObject>("{" + allyAurelioniteItemsJson.Value + "}"); HonorTweaks.allyAurelioniteItems = HonorTweaks.GenerateAllyAurelioniteItems(jsonObject); Log.Info("Item list invalid!"); HonorTweaks.giveAurelioniteItems = true; } catch (Exception ex) { if (ex is JsonReaderException || ex is JsonSerializationException) { Log.Warning("Item list currently invalid!"); } else { Log.Error(ex.ToString()); } HonorTweaks.giveAurelioniteItems = false; } } public static void Init() { syncMinionItems = TTATweaks.config.Bind("General", "Sync Minion Items", true, "Whether or not minions share most of their owner's items (like Engi turrets)."); glacialSlowDurationMult = TTATweaks.config.Bind("General", "Glacial Slow Duration Multiplier", 2f, "A multiplier for how long glacial elites inflict the slow debuff for. At a multiplier of 1, the slow lasts for 1.5s, scaled by proc coefficient."); glacialExplosion = TTATweaks.config.Bind("General", "Glacial Explosion", false, "Whether or not glacial elites should generate the freeze explosion on death."); honorEliteMinions = TTATweaks.config.Bind("Artifact of Honor", "Elite Minions", true, "Whether or not minions spawn as a tier 1 elite while the Artifact of Honor is active."); minionEliteBuffs = TTATweaks.config.Bind("Artifact of Honor", "Elite Minion Stat Buffs", true, "Whether or not minions spawning as a tier 1 elites also acquire the elite stat buff while the Artifact of Honor is active."); honorEliteUrchins = TTATweaks.config.Bind("Artifact of Honor", "Elite Urchins", true, "Whether or not malachite urchins spawn as a tier 1 elite while the Artifact of Honor is active."); honorEliteUmbras = TTATweaks.config.Bind("Artifact of Honor", "Elite Umbras", true, "Whether or not Artifact of Vengeance umbras are given a tier 1 elite equipment while the Artifact of Honor is active."); honorElitePlayers = TTATweaks.config.Bind("Artifact of Honor", "Elite Players", false, "Whether or not players start with a tier 1 elite equipment while the Artifact of Honor is active."); honorGildedAurelionite = TTATweaks.config.Bind("Artifact of Honor", "Gilded Aurelionite", true, "Whether or not ally Aurelionite spawns as a gilded elite while the Artifact of Honor is active."); honorGildedReliquary = TTATweaks.config.Bind("Artifact of Honor", "Gilded Artifact Reliquary", true, "Whether or not the Artifact Reliquary spawns as a gilded elite while the Artifact of Honor is active."); blacklistJson = TTATweaks.config.Bind("General", "Minion Item Blacklist", "\"all\":[\"MinorConstructOnKill\", \"DroneWeapons\", \"RoboBallBuddy\", \"FocusConvergence\", \"TitanGoldDuringTP\", \"TPHealingNova\", \"VoidMegaCrabItem\", \"BeetleGland\", \"WardOnLevel\", \"PhysicsProjectile\", \"DronesDropDynamite\"]", "What items shouldn't be inherited by all or specific minions. Format example: `\"internal_enemy_name_1\":[\"internal_item_name_1\",\"internal_item_name_2\"], \"internal_enemy_name_2\":[\"internal_item_name_3\",\"internal_item_name_4\"]`"); blacklistJson.SettingChanged += delegate { BlacklistChanged(); AllyAurelioniteItemsChanged(); }; allyAurelioniteItemsJson = TTATweaks.config.Bind("General", "Ally Aurelionite Items", "\"GoldOnHurt\": 1, \"BonusGoldPackOnKill\": 5, \"Knurl\": 1", "What items ally Aurelionite should spawn with. Format example: `\"item_1_name:\" item_1_count, \"item_2_name:\" item_2_count`.\n\nThe logic for finding items from names is copied from DebugToolkit - names are not strict, unlike with the minion item blacklist, and approximate names will work."); allyAurelioniteItemsJson.SettingChanged += delegate { AllyAurelioniteItemsChanged(); }; if (rooEnabled) { RoOInit(); } } private static void RoOInit() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0046: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(syncMinionItems, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(glacialSlowDurationMult, new StepSliderConfig { min = 0f, max = 30f, increment = 1f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(glacialExplosion, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorEliteMinions, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(minionEliteBuffs, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorEliteUrchins, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorEliteUmbras, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorElitePlayers, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorGildedAurelionite, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorGildedReliquary, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(blacklistJson, new InputFieldConfig())); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(allyAurelioniteItemsJson, new InputFieldConfig())); ModSettingsManager.SetModDescription("Various tweaks relating to elites, minions, and the Artifact of Honor."); ModSettingsManager.SetModIcon(Assets.icon); } public static void OnLoadFinished() { BlacklistChanged(); AllyAurelioniteItemsChanged(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("mwmw.TTATweaks", "TTATweaks", "1.1.0")] public class TTATweaks : BaseUnityPlugin { public const string PluginGUID = "mwmw.TTATweaks"; public const string PluginAuthor = "mwmw"; public const string PluginName = "TTATweaks"; public const string PluginVersion = "1.1.0"; public static ConfigFile config; public static BaseUnityPlugin plugin; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); config = ((BaseUnityPlugin)this).Config; plugin = (BaseUnityPlugin)(object)this; Assets.Init(); Options.Init(); HonorTweaks.Init(); SyncItems.Init(); RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(OnLoadFinished)); } private void OnLoadFinished() { Options.OnLoadFinished(); } } public static class Utils { private struct MatchSimilarity { public int similarity; public object item; } [CompilerGenerated] private sealed class d__2 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private ItemIndex <>2__current; private int <>l__initialThreadId; private string name; public string <>3__name; private int 5__1; private List 5__2; private ItemIndex 5__3; private Enumerator <>s__4; private ItemDef 5__5; private string 5__6; private IEnumerator <>s__7; private MatchSimilarity 5__8; ItemIndex IEnumerator.Current { [DebuggerHidden] get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>s__4 = default(Enumerator); 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = default(MatchSimilarity); <>1__state = -2; } private bool MoveNext() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (TextSerialization.TryParseInvariant(name, ref 5__1)) { 5__3 = (ItemIndex)5__1; if (ItemCatalog.IsIndexValid(ref 5__3)) { <>2__current = 5__3; <>1__state = 1; return true; } goto IL_0087; } name = name.ToUpperInvariant(); 5__2 = new List(); <>s__4 = ItemCatalog.allItemDefs.GetEnumerator(); try { while (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; 5__6 = GetLangInvar(5__5.nameToken).ToUpper(); if (((Object)5__5).name.ToUpper().Contains(name) || 5__6.Contains(name)) { 5__2.Add(new MatchSimilarity { similarity = Math.Max(GetSimilarity(((Object)5__5).name, name), GetSimilarity(5__6, name)), item = 5__5.itemIndex }); } 5__6 = null; 5__5 = null; } } finally { ((IDisposable)<>s__4).Dispose(); } <>s__4 = default(Enumerator); <>s__7 = 5__2.OrderByDescending((MatchSimilarity m) => m.similarity).GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -1; goto IL_0087; case 2: { <>1__state = -3; 5__8 = default(MatchSimilarity); break; } IL_0087: return false; } if (<>s__7.MoveNext()) { 5__8 = <>s__7.Current; <>2__current = (ItemIndex)5__8.item; <>1__state = 2; return true; } <>m__Finally1(); <>s__7 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__7 != null) { <>s__7.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__2 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__2(0); } d__.name = <>3__name; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public static ItemIndex GetItemFromPartial(string name) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return GetItemsFromPartial(name).DefaultIfEmpty((ItemIndex)(-1)).First(); } [IteratorStateMachine(typeof(d__2))] private static IEnumerable GetItemsFromPartial(string name) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(-2) { <>3__name = name }; } private static string GetLangInvar(string baseToken) { if (baseToken == null) { return ""; } return RemoveSpacesAndAlike(Language.GetString(baseToken)); } private static int GetSimilarity(string s, string partial) { if (string.IsNullOrEmpty(partial) || !s.ToUpper().Contains(partial)) { return int.MinValue; } int num = (s.StartsWith(partial, StringComparison.InvariantCultureIgnoreCase) ? 1000 : 0); return num + partial.Length - s.Length; } private static string RemoveSpacesAndAlike(string input) { return Regex.Replace(input, "[ '(),-]|\\{\\d+\\}", string.Empty); } } } namespace TTATweaks.Tweaks { public class HonorTweaks { [CompilerGenerated] private static class <>O { public static Action <0>__DoppelgangersSpawnElite; public static Action <1>__AllyAurelioniteTweaks; public static Action <2>__MinionsSpawnElite; public static Manipulator <3>__UrchinsSpawnElite; public static Manipulator <4>__AdjustGlacialSlow; public static Manipulator <5>__SkipGlacialExplosion; public static Action <6>__PlayersSpawnElite; public static hook_OnEnter <7>__ArtifactReliquarySpawnsGilded; } public static bool giveAurelioniteItems; public static Dictionary allyAurelioniteItems; public const string defaultAllyAurelioniteItemsString = "\"GoldOnHurt\": 1, \"BonusGoldPackOnKill\": 5, \"Knurl\": 1"; private static Xoroshiro128Plus rng; public static void Init() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00d8: 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_00e3: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo methodCached = Reflection.GetMethodCached(typeof(DoppelgangerInvasionManager).GetNestedTypes(bindingAttr)[0], "b__0"); HookEndpointManager.Modify((MethodBase)methodCached, (Delegate)new Action(DoppelgangersSpawnElite)); MethodInfo method = typeof(GoldTitanManager).GetNestedType("<>c__DisplayClass24_0", bindingAttr).GetMethod("g__OnSpawnedServer|0", bindingAttr); HookEndpointManager.Modify((MethodBase)method, (Delegate)new Action(AllyAurelioniteTweaks)); CharacterBody.onBodyStartGlobal += MinionsSpawnElite; object obj = <>O.<3>__UrchinsSpawnElite; if (obj == null) { Manipulator val = UrchinsSpawnElite; <>O.<3>__UrchinsSpawnElite = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (Manipulator)obj; object obj2 = <>O.<4>__AdjustGlacialSlow; if (obj2 == null) { Manipulator val2 = AdjustGlacialSlow; <>O.<4>__AdjustGlacialSlow = val2; obj2 = (object)val2; } GlobalEventManager.ProcessHitEnemy += (Manipulator)obj2; object obj3 = <>O.<5>__SkipGlacialExplosion; if (obj3 == null) { Manipulator val3 = SkipGlacialExplosion; <>O.<5>__SkipGlacialExplosion = val3; obj3 = (object)val3; } GlobalEventManager.OnCharacterDeath += (Manipulator)obj3; Run.onRunStartGlobal += PlayersSpawnElite; object obj4 = <>O.<7>__ArtifactReliquarySpawnsGilded; if (obj4 == null) { hook_OnEnter val4 = ArtifactReliquarySpawnsGilded; <>O.<7>__ArtifactReliquarySpawnsGilded = val4; obj4 = (object)val4; } WaitForKey.OnEnter += (hook_OnEnter)obj4; rng = new Xoroshiro128Plus(RoR2Application.rng.nextUlong); } public static Dictionary GenerateAllyAurelioniteItems(Dictionary jsonObject) { Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in jsonObject) { dictionary[item.Key] = item.Value; } return dictionary; } private static void AdjustGlacialSlow(ILContext il) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Func func = (int hasBuff) => (hasBuff > 0) ? ((int)Options.glacialSlowDurationMult.Value * hasBuff) : 0; ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixWhite") }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1) })) { val.EmitDelegate>(func); } else { Log.Error("DoubleGlacialSlow IL hook failed! Glacial elite slow duration is unchanged."); } } private static void SkipGlacialExplosion(ILContext il) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Func func = (bool hasGlacial) => hasGlacial && Options.glacialExplosion.Value; ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixWhite") }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff") })) { val.EmitDelegate>(func); } else { Log.Error("SkipGlacialExplosion IL hook failed! Glacial elite explosion behaviour will always occur."); } } private static void ArtifactReliquarySpawnsGilded(orig_OnEnter orig, WaitForKey self) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active && ((EntityState)self).healthComponent.combinedHealthFraction >= 1f && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorGildedReliquary.Value) { ((EntityState)self).characterBody.master.inventory.SetEquipmentIndex(Elites.AurelioniteHonor.eliteEquipmentDef.equipmentIndex, true); } } private static void AllyAurelioniteTweaks(ILContext il) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) Action action = delegate(SpawnResult result) { //IL_0001: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) GameObject spawnedInstance = result.spawnedInstance; CharacterMaster val2 = ((spawnedInstance != null) ? spawnedInstance.GetComponent() : null); if (val2 != null) { if (CombatDirector.IsEliteOnlyArtifactActive() && Options.honorGildedAurelionite.Value) { val2.inventory.SetEquipmentIndex(Elites.AurelioniteHonor.eliteEquipmentDef.equipmentIndex, true); } if (giveAurelioniteItems) { foreach (string key in allyAurelioniteItems.Keys) { ItemIndex itemFromPartial = Utils.GetItemFromPartial(key); if ((int)itemFromPartial != -1) { Log.Info($"Giving {key}x{allyAurelioniteItems[key]} to Aurelionite"); val2.inventory.GiveItemPermanent(itemFromPartial, allyAurelioniteItems[key]); } else { Log.Warning("Couldn't find an item from item name '" + key + "'!"); } } } } }; Type displayClass = typeof(GoldTitanManager).GetNestedType("<>c__DisplayClass24_0", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, displayClass, "currentBoostHpCoefficient") })) { val.Emit(OpCodes.Ldc_R4, 3.5f); val.Emit(OpCodes.Mul); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, displayClass, "currentBoostDamageCoefficient") })) { val.Emit(OpCodes.Ldc_R4, 2f); val.Emit(OpCodes.Mul); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>(action); } else { Log.Error("Part 2 of AurelioniteSpawnsGilded IL hook failed! Aurelionite will not correctly spawn as gilded in Artifact of Honor."); } } else { Log.Error("Part 1 of AurelioniteSpawnsGilded IL hook failed! Aurelionite will not correctly spawn as gilded in Artifact of Honor."); } } private static void PlayersSpawnElite(Run run) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { object obj; if (instance == null) { obj = null; } else { CharacterMaster master = instance.master; obj = ((master != null) ? master.inventory : null); } Inventory val = (Inventory)obj; if (val != null && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorElitePlayers.Value) { EliteDef randomAvailableT1EliteDefUnconditional = GetRandomAvailableT1EliteDefUnconditional(rng); val.SetEquipmentIndex(randomAvailableT1EliteDefUnconditional.eliteEquipmentDef.equipmentIndex, true); } } } private static void DoppelgangersSpawnElite(ILContext il) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) Action action = delegate(SpawnResult result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) GameObject spawnedInstance = result.spawnedInstance; CharacterMaster val2 = ((spawnedInstance != null) ? spawnedInstance.GetComponent() : null); if (val2 != null && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorEliteUmbras.Value) { EliteDef randomAvailableT1EliteDef = GetRandomAvailableT1EliteDef(rng); val2.inventory.SetEquipmentIndex(randomAvailableT1EliteDef.eliteEquipmentDef.equipmentIndex, true); } }; ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddMember") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>(action); } else { Log.Error("DoppelgangersSpawnElite IL hook failed! Vengeance doppelgangers will be unchanged in Artifact of Honor."); } } private static void MinionsSpawnElite(CharacterBody body) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!Options.honorEliteMinions.Value || !NetworkServer.active || !CombatDirector.IsEliteOnlyArtifactActive() || !Object.op_Implicit((Object)(object)body) || !(((Object)((Component)body).gameObject).name != "EquipmentDroneBody(Clone)")) { return; } CharacterMaster master = body.master; MinionOwnership val = ((master != null) ? ((Component)master).GetComponent() : null); if ((Object)(object)val != (Object)null && !body.isElite && (Object)(object)val.ownerMaster != (Object)null) { EliteDef randomAvailableT1HonorEliteDef = GetRandomAvailableT1HonorEliteDef(rng); master.inventory.SetEquipmentIndex(randomAvailableT1HonorEliteDef.eliteEquipmentDef.equipmentIndex, false); if (Options.minionEliteBuffs.Value) { master.inventory.GiveItemPermanent(Items.BoostHp, Mathf.RoundToInt((randomAvailableT1HonorEliteDef.healthBoostCoefficient - 1f) * 10f)); master.inventory.GiveItemPermanent(Items.BoostDamage, Mathf.RoundToInt(randomAvailableT1HonorEliteDef.damageBoostCoefficient - 1f) * 10); } } } private static void UrchinsSpawnElite(ILContext il) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Action action = delegate(CharacterMaster master) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)master) && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorEliteUrchins.Value) { EliteDef randomAvailableT1HonorEliteDef = GetRandomAvailableT1HonorEliteDef(rng); master.inventory.SetEquipmentIndex(randomAvailableT1HonorEliteDef.eliteEquipmentDef.equipmentIndex, false); master.inventory.GiveItemPermanent(Items.BoostHp, Mathf.RoundToInt((randomAvailableT1HonorEliteDef.healthBoostCoefficient - 1f) * 10f)); master.inventory.GiveItemPermanent(Items.BoostDamage, Mathf.RoundToInt(randomAvailableT1HonorEliteDef.damageBoostCoefficient - 1f) * 10); } }; int characterMasterLoc = 0; ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/CharacterMasters/UrchinTurretMaster") }) && val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetComponent") }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref characterMasterLoc) })) { val.Emit(OpCodes.Ldloc, characterMasterLoc); val.EmitDelegate>(action); } else { Log.Error("UrchinsSpawnElite IL hook failed! Malachite urchins will be unchanged in Artifact of Honor."); } } private static EliteDef GetRandomAvailableT1EliteDef(Xoroshiro128Plus rng) { EliteTierDef val = ((Run.instance.stageClearCount >= 2) ? CombatDirector.eliteTiers[4] : CombatDirector.eliteTiers[1]); return val.GetRandomAvailableEliteDef(rng); } private static EliteDef GetRandomAvailableT1EliteDefUnconditional(Xoroshiro128Plus rng) { return CombatDirector.eliteTiers[4].GetRandomAvailableEliteDef(rng); } private static EliteDef GetRandomAvailableT1HonorEliteDef(Xoroshiro128Plus rng) { EliteTierDef val = ((Run.instance.stageClearCount >= 2) ? CombatDirector.eliteTiers[3] : CombatDirector.eliteTiers[2]); return val.GetRandomAvailableEliteDef(rng); } } public static class SyncItems { private class MirrorSource : MonoBehaviour { public event Action onItemGiven; public event Action onEquipmentGiven; public void InvokeItemGivenEvent(ItemIndex item, int count) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) this.onItemGiven?.Invoke(item, count); } public void InvokeEquipGivenEvent(EquipmentState equipmentState) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) this.onEquipmentGiven?.Invoke(equipmentState); } } private class MirrorLink : MonoBehaviour { private MirrorSource mirrorSource; private Inventory droneInventory; public void Init(MirrorSource mirrorSource, Inventory droneInventory) { this.droneInventory = droneInventory; this.mirrorSource = mirrorSource; if (Object.op_Implicit((Object)(object)mirrorSource)) { mirrorSource.onItemGiven += OnOwnerGetItem; mirrorSource.onEquipmentGiven += OnOwnerGetEquip; } } private void OnOwnerGetItem(ItemIndex item, int amount) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) if (NetworkServer.active && Object.op_Implicit((Object)(object)mirrorSource) && Object.op_Implicit((Object)(object)droneInventory)) { droneInventory.ChangeItemStacksCount(new GiveItemPermanentImpl { inventory = droneInventory }, item, ItemFilter(item, ((Object)droneInventory).name) ? amount : 0); } } private void OnOwnerGetEquip(EquipmentState equipmentState) { if (NetworkServer.active && Object.op_Implicit((Object)(object)mirrorSource) && Object.op_Implicit((Object)(object)droneInventory)) { SetToOwnerEquip(((Component)mirrorSource).GetComponent(), droneInventory); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)mirrorSource)) { mirrorSource.onItemGiven -= OnOwnerGetItem; } } } [CompilerGenerated] private static class <>O { public static Action <0>__LinkAllies; public static hook_Add <1>__FireItemGetEvent; public static hook_SetEquipmentInternal_EquipmentState_uint_uint <2>__FireEquipmentGetEvent; public static hook_UpdateMinionInventory <3>__AddDevotionInventoryBack; public static Manipulator <4>__SkipFriendUnitItemUpdate; public static Func <5>__ItemFilter; } [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CharacterMaster master; private CharacterMaster 5__1; private Inventory 5__2; private Inventory 5__3; private MirrorSource 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: { <>1__state = -1; CharacterMaster obj = master; object obj2; if (obj == null) { obj2 = null; } else { MinionOwnership component = ((Component)obj).GetComponent(); obj2 = ((component != null) ? component.ownerMaster : null); } 5__1 = (CharacterMaster)obj2; CharacterMaster obj3 = 5__1; 5__2 = ((obj3 != null) ? obj3.inventory : null); 5__3 = master.inventory; if ((Object)(object)5__2 == (Object)null || (Object)(object)5__3 == (Object)null) { return false; } Inventory obj4 = 5__2; 5__4 = ((obj4 != null) ? ((Component)obj4).GetComponent() : null); if ((Object)(object)5__4 == (Object)null) { 5__4 = ((Component)5__2).gameObject.AddComponent(); } ((Component)master).gameObject.AddComponent().Init(5__4, 5__3); if (!((Object)((Component)master).gameObject).name.Contains("EngiTurret")) { AddFullOwnerInventory(5__2, 5__3); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static Dictionary> blacklist; public static Dictionary> defaultBlacklist; public const string defaultBlacklistString = "\"all\":[\"MinorConstructOnKill\", \"DroneWeapons\", \"RoboBallBuddy\", \"FocusConvergence\", \"TitanGoldDuringTP\", \"TPHealingNova\", \"VoidMegaCrabItem\", \"BeetleGland\", \"WardOnLevel\", \"PhysicsProjectile\", \"DronesDropDynamite\"]"; public static bool useCustomBlacklist; private const BindingFlags allFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static void Init() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown CharacterMaster.onStartGlobal += LinkAllies; object obj = <>O.<1>__FireItemGetEvent; if (obj == null) { hook_Add val = FireItemGetEvent; <>O.<1>__FireItemGetEvent = val; obj = (object)val; } GiveItemPermanentImpl.Add += (hook_Add)obj; object obj2 = <>O.<2>__FireEquipmentGetEvent; if (obj2 == null) { hook_SetEquipmentInternal_EquipmentState_uint_uint val2 = FireEquipmentGetEvent; <>O.<2>__FireEquipmentGetEvent = val2; obj2 = (object)val2; } Inventory.SetEquipmentInternal_EquipmentState_uint_uint += (hook_SetEquipmentInternal_EquipmentState_uint_uint)obj2; object obj3 = <>O.<3>__AddDevotionInventoryBack; if (obj3 == null) { hook_UpdateMinionInventory val3 = AddDevotionInventoryBack; <>O.<3>__AddDevotionInventoryBack = val3; obj3 = (object)val3; } DevotionInventoryController.UpdateMinionInventory += (hook_UpdateMinionInventory)obj3; object obj4 = <>O.<4>__SkipFriendUnitItemUpdate; if (obj4 == null) { Manipulator val4 = SkipFriendUnitItemUpdate; <>O.<4>__SkipFriendUnitItemUpdate = val4; obj4 = (object)val4; } PhysicsProjectileBehavior.UpdateFriendUnitMovementItems += (Manipulator)obj4; defaultBlacklist = GenerateBlacklist(JsonConvert.DeserializeObject>("{\"all\":[\"MinorConstructOnKill\", \"DroneWeapons\", \"RoboBallBuddy\", \"FocusConvergence\", \"TitanGoldDuringTP\", \"TPHealingNova\", \"VoidMegaCrabItem\", \"BeetleGland\", \"WardOnLevel\", \"PhysicsProjectile\", \"DronesDropDynamite\"]}")); } public static Dictionary> GenerateBlacklist(Dictionary jsonObject) { Dictionary> dictionary = new Dictionary>(); foreach (KeyValuePair item in jsonObject) { dictionary[item.Key] = new HashSet(item.Value); } return dictionary; } private static void LinkAllies(CharacterMaster master) { if (NetworkServer.active && Options.syncMinionItems.Value && NetworkServer.active && Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory)) { MinionOwnership component = ((Component)master).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.ownerMaster) && (Object)(object)component.ownerMaster.playerCharacterMasterController != (Object)null && !Object.op_Implicit((Object)(object)((Component)master).GetComponent())) { ((MonoBehaviour)TTATweaks.plugin).StartCoroutine(DeferredLink(master)); } } } [IteratorStateMachine(typeof(d__10))] private static IEnumerator DeferredLink(CharacterMaster master) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { master = master }; } private static void FireItemGetEvent(orig_Add orig, ref GiveItemPermanentImpl self, ItemIndex itemIndex, int countToAdd) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(ref self, itemIndex, countToAdd); MirrorSource component = ((Component)self.inventory).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.InvokeItemGivenEvent(itemIndex, countToAdd); } } private static bool FireEquipmentGetEvent(orig_SetEquipmentInternal_EquipmentState_uint_uint orig, Inventory self, EquipmentState equipmentState, uint slot, uint set) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) bool result = orig.Invoke(self, equipmentState, slot, set); MirrorSource component = ((Component)self).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.InvokeEquipGivenEvent(equipmentState); } return result; } private static void AddDevotionInventoryBack(orig_UpdateMinionInventory orig, DevotionInventoryController self, DevotedLemurianController devotedLemurianController, bool shouldEvolve) { orig.Invoke(self, devotedLemurianController, shouldEvolve); MirrorLink component = ((Component)devotedLemurianController).GetComponent(); CharacterMaster lemurianMaster = devotedLemurianController._lemurianMaster; object obj; if (lemurianMaster == null) { obj = null; } else { MinionOwnership minionOwnership = lemurianMaster.minionOwnership; if (minionOwnership == null) { obj = null; } else { CharacterMaster ownerMaster = minionOwnership.ownerMaster; obj = ((ownerMaster != null) ? ownerMaster.inventory : null); } } Inventory ownerInventory = (Inventory)obj; if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)devotedLemurianController.LemurianInventory)) { AddFullOwnerInventory(ownerInventory, devotedLemurianController.LemurianInventory); } } private static void SkipFriendUnitItemUpdate(ILContext il) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) Func func = () => Options.syncMinionItems.Value; ILCursor val = new ILCursor(il); ILLabel val2 = val.DefineLabel(); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) })) { val.EmitDelegate>(func); val.Emit(OpCodes.Brtrue, (object)val2); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "UpdateFriendUnit") })) { val.MarkLabel(val2); } } } private static void AddFullOwnerInventory(Inventory ownerInventory, Inventory minionInventory) { SetToOwnerEquip(ownerInventory, minionInventory); minionInventory.AddItemsFrom(ownerInventory, ItemFilter); } private static void SetToOwnerEquip(Inventory ownerInventory, Inventory minionInventory) { if (Object.op_Implicit((Object)(object)ownerInventory) && Object.op_Implicit((Object)(object)minionInventory) && !CombatDirector.IsEliteOnlyArtifactActive() && ((Object)((Component)minionInventory).gameObject).name != "EquipmentDroneMaster(Clone)") { minionInventory.CopyEquipmentFrom(ownerInventory, true); } } public static void AddItemsFrom(this Inventory owner, Inventory other, Func bodyFilter) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void RoR2.Inventory::AddItemsFrom(RoR2.Inventory,System.Func`2)' called on client"); return; } InventoryChangeScope val = default(InventoryChangeScope); ((InventoryChangeScope)(ref val))..ctor(owner); try { List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { ((ItemCollection)(ref other.permanentItemStacks)).GetNonZeroIndices(list); foreach (ItemIndex item in list) { owner.ChangeItemStacksCount(new GiveItemPermanentImpl { inventory = owner }, item, bodyFilter(item, ((Object)owner).name) ? ((ItemCollection)(ref other.permanentItemStacks)).GetStackValue(item) : 0); } } finally { val2.Dispose(); } } finally { ((InventoryChangeScope)(ref val)).Dispose(); } } public static bool ItemFilter(ItemIndex itemIndex, string masterName) { //IL_00b0: 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_007f: Unknown result type (might be due to invalid IL or missing references) if (masterName.EndsWith("Master(Clone)")) { masterName = masterName.Substring(0, masterName.Length - "Master(Clone)".Length); } if (useCustomBlacklist) { if (blacklist.TryGetValue("all", out var value) && value.Contains(((Object)ItemCatalog.GetItemDef(itemIndex)).name)) { return false; } if (blacklist.TryGetValue(masterName, out value) && value.Contains(((Object)ItemCatalog.GetItemDef(itemIndex)).name)) { return false; } return true; } return !defaultBlacklist["all"].Contains(((Object)ItemCatalog.GetItemDef(itemIndex)).name); } } }