using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using Augmentum.Modules.ColorCatalogEntry;
using Augmentum.Modules.Compatability;
using Augmentum.Modules.ItemTiers;
using Augmentum.Modules.ItemTiers.CoreTier;
using Augmentum.Modules.ItemTiers.HighlanderTier;
using Augmentum.Modules.Pickups;
using Augmentum.Modules.Pickups.Equipments;
using Augmentum.Modules.Pickups.Items.CoreItems;
using Augmentum.Modules.Pickups.Items.Essences;
using Augmentum.Modules.Pickups.Items.HighlanderItems;
using Augmentum.Modules.Pickups.Items.NoTier;
using Augmentum.Modules.Pickups.Items.Tier1;
using Augmentum.Modules.Pickups.Items.Tier2;
using Augmentum.Modules.Pickups.Items.Tier3;
using Augmentum.Modules.StandaloneBuffs;
using Augmentum.Modules.Utils;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.VagrantMonster;
using HG;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using On.RoR2;
using On.RoR2.Items;
using ProperSave;
using ProperSave.Data;
using R2API;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.WwiseUtils;
using RoR2BepInExPack.GameAssetPaths.Version_1_35_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using ShareSuite;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;
[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("Augmentum")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d89d5b18af0230a14826074c628a326d4404ebfe")]
[assembly: AssemblyProduct("Augmentum")]
[assembly: AssemblyTitle("Augmentum")]
[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 Augmentum
{
[BepInDependency("com.bepis.r2api", "5.3.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.BrandonRosa.Augmentum", "Augmentum", "1.1.8")]
public class Augmentum : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_Init <0>__RegisterVoidPairings;
}
public const string ModGuid = "com.BrandonRosa.Augmentum";
public const string ModName = "Augmentum";
public const string ModVer = "1.1.8";
internal static ManualLogSource ModLogger;
public static ConfigFile AugConfig;
public static ConfigFile AugBackupConfig;
public static bool _preVersioning = false;
public static AssetBundle MainAssets;
public List<BuffBase> Buffs = new List<BuffBase>();
public List<ItemBase> Items = new List<ItemBase>();
public List<EquipmentBase> Equipments = new List<EquipmentBase>();
public List<ItemTierBase> ItemTiers = new List<ItemTierBase>();
public List<EliteEquipmentBase> EliteEquipments = new List<EliteEquipmentBase>();
public List<ArtifactBase> Artifacts = new List<ArtifactBase>();
public static HashSet<ItemDef> BlacklistedFromPrinter = new HashSet<ItemDef>();
public static Dictionary<ItemBase, bool> ItemStatusDictionary = new Dictionary<ItemBase, bool>();
public static Dictionary<EquipmentBase, bool> EquipmentStatusDictionary = new Dictionary<EquipmentBase, bool>();
public static Dictionary<BuffBase, bool> BuffStatusDictionary = new Dictionary<BuffBase, bool>();
public static Dictionary<EliteEquipmentBase, bool> EliteEquipmentStatusDictionary = new Dictionary<EliteEquipmentBase, bool>();
public static Dictionary<ArtifactBase, bool> ArtifactStatusDictionary = new Dictionary<ArtifactBase, bool>();
public static ConfigEntry<bool> enableAutoConfig { get; set; }
public static ConfigEntry<string> latestVersion { get; set; }
public static string EssenceKeyword => "<color=#" + ColorCatalog.GetColorHexString(Colors.TempCoreLight) + ">" + Language.GetString("TIER_CORE_ESSENCE_KEYWORD") + "</color>";
public static string EssencesKeyword => "<color=#" + ColorCatalog.GetColorHexString(Colors.TempCoreLight) + ">" + Language.GetString("TIER_CORE_ESSENCES_KEYWORD") + "</color>";
public static string CoreColorString => "<color=#" + ColorCatalog.GetColorHexString(Colors.TempCoreLight) + ">";
public void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
ModLogger = ((BaseUnityPlugin)this).Logger;
AugConfig = ((BaseUnityPlugin)this).Config;
AugBackupConfig = new ConfigFile(Paths.ConfigPath + "\\com.BrandonRosa.Augmentum..Backup.cfg", true);
AugBackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :");
enableAutoConfig = AugConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop Augmentum from syncing config whenever a new version is found.");
_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(AugConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
latestVersion = AugConfig.Bind<string>("Config", "Latest Version", "1.1.8", "DO NOT CHANGE THIS");
if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.8"))
{
latestVersion.Value = "1.1.8";
ConfigManager.VersionChanged = true;
ModLogger.LogInfo((object)"Config Autosync Enabled.");
}
}
private void Start()
{
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Expected O, but got Unknown
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Expected O, but got Unknown
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Expected O, but got Unknown
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Augmentum.bransitems_assets"))
{
MainAssets = AssetBundle.LoadFromStream(stream);
}
Colors.Init();
ItemTierPickupVFXHelper.SystemInitializer();
bool flag = true;
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ItemTierBase))
select type;
ModLogger.LogInfo((object)"-----------------ITEMTIERS---------------------");
foreach (Type item2 in enumerable)
{
ItemTierBase itemTierBase = (ItemTierBase)Activator.CreateInstance(item2);
bool flag2 = true;
itemTierBase.Init();
ModLogger.LogInfo((object)("ItemTier: " + itemTierBase.TierName + " Initialized!"));
}
bool flag3 = true;
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(BuffBase))
select type;
ModLogger.LogInfo((object)"--------------BUFFS---------------------");
foreach (Type item3 in enumerable2)
{
BuffBase buffBase = (BuffBase)Activator.CreateInstance(item3);
if (ValidateBuff(buffBase, Buffs))
{
buffBase.Init(((BaseUnityPlugin)this).Config);
ModLogger.LogInfo((object)("Buff: " + buffBase.BuffName + " Initialized!"));
}
}
if (!ConfigManager.ConfigOptionValue("Items", "Disable All Items?", defaultvalue: false, "Do you wish to disable every item in Augmentum?", restartRequired: true))
{
IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
select type;
ModLogger.LogInfo((object)"----------------------ITEMS--------------------");
foreach (Type item4 in enumerable3)
{
ItemBase item = (ItemBase)Activator.CreateInstance(item4);
if (!item.BlacklistFromPreLoad && ValidateItem(item, Items))
{
item.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Config.SettingChanged += delegate
{
item.ItemDef.descriptionToken = item.ItemFullDescriptionFormatted;
};
Language.LoadStrings += (hook_LoadStrings)delegate(orig_LoadStrings orig, Language self)
{
orig.Invoke(self);
item.ItemDef.descriptionToken = item.ItemFullDescriptionFormatted;
};
Language.SetCurrentLanguage += (hook_SetCurrentLanguage)delegate(orig_SetCurrentLanguage orig, string languageIndex)
{
orig.Invoke(languageIndex);
item.ItemDef.descriptionToken = item.ItemFullDescriptionFormatted;
};
ModLogger.LogInfo((object)("Item: " + item.ItemName + " Initialized!"));
}
}
object obj = <>O.<0>__RegisterVoidPairings;
if (obj == null)
{
hook_Init val = ItemBase.RegisterVoidPairings;
<>O.<0>__RegisterVoidPairings = val;
obj = (object)val;
}
ContagiousItemManager.Init += (hook_Init)obj;
}
if (!ConfigManager.ConfigOptionValue("Equipment", "Disable All Equipment?", defaultvalue: false, "Do you wish to disable every equipment in Augmentum?", restartRequired: true))
{
IEnumerable<Type> enumerable4 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase))
select type;
ModLogger.LogInfo((object)"-----------------EQUIPMENT---------------------");
foreach (Type item5 in enumerable4)
{
EquipmentBase equipment = (EquipmentBase)Activator.CreateInstance(item5);
if (ValidateEquipment(equipment, Equipments))
{
equipment.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Config.SettingChanged += delegate
{
equipment.EquipmentDef.descriptionToken = equipment.EquipmentFullDescriptionFormatted;
};
ModLogger.LogInfo((object)("Equipment: " + equipment.EquipmentName + " Initialized!"));
}
}
}
IEnumerable<Type> enumerable5 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(EliteEquipmentBase))
select type;
ModLogger.LogInfo((object)"-------------ELITE EQUIPMENT---------------------");
foreach (Type item6 in enumerable5)
{
EliteEquipmentBase eliteEquipment = (EliteEquipmentBase)Activator.CreateInstance(item6);
if (ValidateEliteEquipment(eliteEquipment, EliteEquipments))
{
eliteEquipment.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Config.SettingChanged += delegate
{
eliteEquipment.EliteEquipmentDef.descriptionToken = eliteEquipment.EliteEquipmentFullDescriptionFormatted;
};
ModLogger.LogInfo((object)("Elite Equipment: " + eliteEquipment.EliteEquipmentName + " Initialized!"));
}
}
IEnumerable<Type> enumerable6 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase))
select type;
ModLogger.LogInfo((object)"-------------ARTIFACTS---------------------");
foreach (Type item7 in enumerable6)
{
ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item7);
if (ValidateArtifact(artifactBase, Artifacts))
{
artifactBase.Init(((BaseUnityPlugin)this).Config);
ModLogger.LogInfo((object)("Artifact: " + artifactBase.ArtifactName + " Initialized!"));
}
}
ModLogger.LogInfo((object)"-------------COMPATIBILITY---------------------");
ValidateModCompatability();
OptionPickupFix.Init();
}
private void ValidateModCompatability()
{
string defaultvalue = "ITEM_MINI_MATROYSHKA,ITEM_ABYSSAL_BEACON,ITEM_AUGMENTED_CONTACT,ITEM_CURVED_HORN,ITEM_GOAT_LEG,ITEM_MEDIUM_MATROYSHKA,ITEM_CHARM_OF_DESIRES,ITEM_MASSIVE_MATROYSHKA,ITEM_BLOODBURST_CLAM,ITEM_DISCOVERY_MEDALLION,ITEM_MEGA_MATROYSHKA";
bool flag = ConfigManager.ConfigOptionValue("Mod Compatability: ShareSuite", "Enable Compatability Patches?", defaultvalue: true, "Attempt to patch ShareSuite (if installed) to work with this mod?", restartRequired: true);
string customBlacklist = ConfigManager.ConfigOptionValue("Mod Compatability: ShareSuite", "ShareSuite Blacklist", defaultvalue, "Add items to ShareSuite blacklist?", restartRequired: true);
if (ModCompatability.ShareSuiteCompat.IsShareSuiteInstalled && flag)
{
ModLogger.LogInfo((object)"ModCompatability: ShareSuite Recognized!");
ModCompatability.ShareSuiteCompat.AddTierToShareSuite();
ModLogger.LogInfo((object)"ModCompatability: ShareSuite CoreTier added to Whitelist!");
ModCompatability.ShareSuiteCompat.AddBransItemsBlacklist(customBlacklist);
ModLogger.LogInfo((object)"ModCompatability: ShareSuite Blacklist added to Whitelist!");
}
bool flag2 = ConfigManager.ConfigOptionValue("Mod Compatability: HighItemVizability", "Enable Compatability Patches?", defaultvalue: true, "Attempt to patch HighItemVizability (if installed) to work with this mod?", restartRequired: true);
if (ModCompatability.HighItemVizabilityCompat.IsHighItemVizabilityInstalled && flag2)
{
ModLogger.LogInfo((object)"ModCompatability: HighItemVizability Recognized!");
}
bool flag3 = ConfigManager.ConfigOptionValue("Mod Compatability: ProperSave", "Enable Compatability Patches?", defaultvalue: true, "Attempt to add Propersave compatability (if installed)?", restartRequired: true);
if (ModCompatability.ProperSaveCompat.IsProperSaveInstalled && flag3)
{
ModLogger.LogInfo((object)"ModCompatability: ProperSave Recognized!");
ModCompatability.ProperSaveCompat.AddProperSaveFunctionality = true;
}
bool flag4 = ConfigManager.ConfigOptionValue("Mod Compatability: Judgment", "Enable Compatability Patches?", defaultvalue: true, "Attempt to add Judgment compatability (if installed)?", restartRequired: true);
if (ModCompatability.JudgementCompat.IsJudgementInstalled && flag4)
{
ModLogger.LogInfo((object)"ModCompatability: Judgment Recognized!");
ModCompatability.JudgementCompat.AddJudgementCompat = true;
}
if (flag || flag2 || flag3)
{
ModCompatability.FinishedLoading();
}
}
public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
{
bool value = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Enable Item?", defaultvalue: true, "Should this item appear in runs?", restartRequired: true).Value;
bool flag = ConfigManager.ConfigOptionValue("Item: " + item.ConfigItemName, "Blacklist Item from AI Use?", defaultvalue: false, "Should the AI not be able to obtain this item?");
bool flag2 = ConfigManager.ConfigOptionValue("Item: " + item.ConfigItemName, "Blacklist Item from Printers?", defaultvalue: false, "Should the printers be able to print this item?", restartRequired: true);
bool value2 = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Require Unlock", defaultvalue: true, "Should we require this item to be unlocked before it appears in runs? (Will only affect items with associated unlockables.)", restartRequired: true).Value;
ItemStatusDictionary.Add(item, value);
if (value)
{
itemList.Add(item);
if (flag)
{
item.AIBlacklisted = true;
}
if (flag2)
{
item.PrinterBlacklisted = true;
}
}
return value;
}
public bool ValidateBuff(BuffBase buff, List<BuffBase> buffList)
{
BuffStatusDictionary.Add(buff, ((Behaviour)this).enabled);
bool flag = true;
buffList.Add(buff);
return ((Behaviour)this).enabled;
}
public bool ValidateEquipment(EquipmentBase equipment, List<EquipmentBase> equipmentList)
{
bool value = ConfigManager.ConfigOption("Equipment: " + equipment.EquipmentName, "Enable Equipment?", defaultvalue: true, "Should this equipment appear in runs?", restartRequired: true).Value;
EquipmentStatusDictionary.Add(equipment, value);
if (value)
{
equipmentList.Add(equipment);
return true;
}
return false;
}
public bool ValidateEliteEquipment(EliteEquipmentBase eliteEquipment, List<EliteEquipmentBase> eliteEquipmentList)
{
bool value = ConfigManager.ConfigOption("Elite: " + eliteEquipment.EliteModifier, "Enable Elite Equipment?", defaultvalue: true, "Should this elite equipment appear in runs? If disabled, the associated elite will not appear in runs either.", restartRequired: true).Value;
EliteEquipmentStatusDictionary.Add(eliteEquipment, value);
if (value)
{
eliteEquipmentList.Add(eliteEquipment);
return true;
}
return false;
}
public bool ValidateArtifact(ArtifactBase artifact, List<ArtifactBase> artifactList)
{
bool value = ConfigManager.ConfigOption("Artifact: " + artifact.ArtifactName, "Enable Artifact?", defaultvalue: true, "Should this artifact appear in the menu? If disabled, the associated artifact will not appear.", restartRequired: true).Value;
ArtifactStatusDictionary.Add(artifact, value);
if (value)
{
artifactList.Add(artifact);
return true;
}
return false;
}
private void Update()
{
bool flag = false;
}
}
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);
}
}
internal static class OptionPickupFix
{
[CompilerGenerated]
private static class <>O
{
public static Manipulator <0>__PickupDisplay_RebuildModel;
}
[SystemInitializer(new Type[] { })]
public static void Init()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
object obj = <>O.<0>__PickupDisplay_RebuildModel;
if (obj == null)
{
Manipulator val = PickupDisplay_RebuildModel;
<>O.<0>__PickupDisplay_RebuildModel = val;
obj = (object)val;
}
PickupDisplay.RebuildModel += (Manipulator)obj;
}
private static void PickupDisplay_RebuildModel(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo<PickupDisplay>((Expression<Action<PickupDisplay>>)((PickupDisplay _) => _.DestroyModel())))
}))
{
Log.Error("Failed to find patch location");
return;
}
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PickupDisplay), "dontInstantiatePickupModel"));
val.EmitSkipMethodCall(OpCodes.Brtrue);
}
public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode, MethodDefinition method = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
c.EmitSkipMethodCall(branchOpCode, null, method);
}
public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode, Action<ILCursor> emitSkippedReturnValue, MethodDefinition method = null)
{
//IL_0016: 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_0025: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
if (c == null)
{
throw new ArgumentNullException("c");
}
if ((int)((OpCode)(ref branchOpCode)).FlowControl != 0 && (int)((OpCode)(ref branchOpCode)).FlowControl != 3)
{
throw new ArgumentException($"Invalid branch OpCode: {branchOpCode}");
}
if (method == null)
{
MethodReference val = default(MethodReference);
if (!ILPatternMatchingExt.MatchCallOrCallvirt(c.Next, ref val))
{
Log.Error($"Failed to find method call to skip: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next} ({c.Index})");
return;
}
method = Extensions.SafeResolve(val);
if (method == null)
{
Log.Error($"Failed to resolve method '{((MemberReference)val).FullName}': {((MemberReference)c.Context.Method).FullName} at instruction {c.Next} ({c.Index})");
return;
}
}
int num = ((MethodReference)method).Parameters.Count + ((!method.IsStatic) ? 1 : 0);
bool flag = Extensions.Is((MemberReference)(object)((MethodReference)method).ReturnType, (MemberInfo)typeof(void));
ILLabel val2 = c.DefineLabel();
c.Emit(branchOpCode, (object)val2);
int index = c.Index;
c.Index = index + 1;
if (num > 0 || !flag)
{
ILLabel val3 = c.DefineLabel();
c.Emit(OpCodes.Br, (object)val3);
c.MarkLabel(val2);
for (int i = 0; i < num; i++)
{
c.Emit(OpCodes.Pop);
}
if (emitSkippedReturnValue != null)
{
emitSkippedReturnValue(c);
}
else if (!flag)
{
Log.Warning($"Skipped method ({((MemberReference)method).FullName}) is not void, emitting default value: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next} ({c.Index})");
if (((MethodReference)method).ReturnType.IsValueType)
{
VariableDefinition val4 = c.Context.AddVariable(((MethodReference)method).ReturnType);
c.Emit(OpCodes.Ldloca, val4);
c.Emit(OpCodes.Initobj, ((MethodReference)method).ReturnType);
c.Emit(OpCodes.Ldloc, val4);
}
else
{
c.Emit(OpCodes.Ldnull);
}
}
c.MarkLabel(val3);
}
else
{
c.MarkLabel(val2);
}
}
public static VariableDefinition AddVariable(this ILContext context, TypeReference variableType)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
VariableDefinition val = new VariableDefinition(variableType);
context.Method.Body.Variables.Add(val);
return val;
}
}
}
namespace Augmentum.Modules.Utils
{
public static class ColorCatalogUtils
{
[CompilerGenerated]
private static class <>O
{
public static hook_GetColor <0>__ColorCatalog_GetColor;
public static hook_GetColorHexString <1>__ColorCatalog_GetColorHexString;
}
private static bool _hookEnabled = false;
private static List<Color32> indexToColor32 = new List<Color32>();
private static List<string> indexToHexString = new List<string>();
internal static void SetHooks()
{
//IL_001d: 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_0028: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
if (!_hookEnabled)
{
object obj = <>O.<0>__ColorCatalog_GetColor;
if (obj == null)
{
hook_GetColor val = ColorCatalog_GetColor;
<>O.<0>__ColorCatalog_GetColor = val;
obj = (object)val;
}
ColorCatalog.GetColor += (hook_GetColor)obj;
object obj2 = <>O.<1>__ColorCatalog_GetColorHexString;
if (obj2 == null)
{
hook_GetColorHexString val2 = ColorCatalog_GetColorHexString;
<>O.<1>__ColorCatalog_GetColorHexString = val2;
obj2 = (object)val2;
}
ColorCatalog.GetColorHexString += (hook_GetColorHexString)obj2;
_hookEnabled = true;
}
}
private static Color DamageColor_FindColor(orig_FindColor orig, DamageColorIndex colorIndex)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return orig.Invoke(colorIndex);
}
private static string ColorCatalog_GetColorHexString(orig_GetColorHexString orig, ColorIndex colorIndex)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected I4, but got Unknown
if ((int)colorIndex < 0)
{
return indexToHexString[-1 - colorIndex];
}
return orig.Invoke(colorIndex);
}
private static Color32 ColorCatalog_GetColor(orig_GetColor orig, ColorIndex colorIndex)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected I4, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if ((int)colorIndex < 0)
{
return indexToColor32[-1 - colorIndex];
}
return orig.Invoke(colorIndex);
}
public static ColorIndex RegisterColor(Color color)
{
//IL_0016: 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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
SetHooks();
int num = -indexToColor32.Count - 1;
ColorIndex result = (ColorIndex)num;
indexToColor32.Add(Color32.op_Implicit(color));
indexToHexString.Add(Util.RGBToHex(Color32.op_Implicit(color)));
return result;
}
}
public class ConfigManager
{
internal static bool ConfigChanged;
internal static bool VersionChanged;
public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
where x.Name == "Bind"
select x).First();
methodInfo = methodInfo.MakeGenericMethod(typeof(T));
object[] parameters = new object[3]
{
(object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + entry.Definition.Section, name),
entry.DefaultValue,
(object)new ConfigDescription(entry.Description.Description, (AcceptableValueBase)null, Array.Empty<object>())
};
ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, parameters);
if (Augmentum._preVersioning)
{
entry.BoxedValue = entry.DefaultValue;
}
if (!ConfigEqual(val.DefaultValue, val.BoxedValue) && VersionChanged)
{
entry.BoxedValue = entry.DefaultValue;
val.BoxedValue = val.DefaultValue;
}
return default(T);
}
private static bool ConfigEqual(object a, object b)
{
if (a.Equals(b))
{
return true;
}
if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001)
{
return true;
}
return false;
}
public static ConfigEntry<T> ConfigOption<T>(string section, string key, T defaultvalue, string description, bool restartRequired = false)
{
ConfigEntry<T> val = Augmentum.AugConfig.Bind<T>(section, key, defaultvalue, description);
HandleConfig<T>((ConfigEntryBase)(object)val, Augmentum.AugBackupConfig, key);
if (ModCompatability.RiskOfOptionsCompatability.IsShareSuiteInstalled)
{
ModCompatability.RiskOfOptionsCompatability.AddConfig<ConfigEntry<T>>(val, restartRequired);
}
return val;
}
public static T ConfigOptionValue<T>(string section, string key, T defaultvalue, string description, bool restartRequired = false)
{
return ConfigOption(section, key, defaultvalue, description, restartRequired).Value;
}
}
public static class EffectHelpers
{
public static void SetParticleSystemColorOverTime(ref ParticleSystem particleSystem, MinMaxGradient color)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
ColorOverLifetimeModule colorOverLifetime = particleSystem.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = color;
}
public static void SetParticleSystemLightColor(ref ParticleSystem particleSystem, Color color)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
LightsModule lights = particleSystem.lights;
((LightsModule)(ref lights)).light.color = color;
}
public static void SetTextureInParticleSystemRenderer(ref ParticleSystemRenderer particleSystemRenderer, string name, Texture2D texture)
{
((Renderer)particleSystemRenderer).GetMaterial().SetTexture(name, (Texture)(object)texture);
}
}
public static class ExtensionMethods
{
public static void FilterElites(this BullseyeSearch search)
{
if (search.candidatesEnumerable.Any())
{
search.candidatesEnumerable = search.candidatesEnumerable.Where((CandidateInfo x) => Object.op_Implicit((Object)(object)x.hurtBox) && x.hurtBox.IsHurtboxAnElite()).ToList();
}
}
public static void FilterOutItemWielders(this BullseyeSearch search, ItemDef item)
{
if (search.candidatesEnumerable.Any())
{
search.candidatesEnumerable = search.candidatesEnumerable.Where((CandidateInfo x) => Object.op_Implicit((Object)(object)x.hurtBox) && !x.hurtBox.DoesHurtboxHaveItem(item)).ToList();
}
}
public static void FilterOutItemWielders(this BullseyeSearch search, List<ItemDef> items)
{
List<CandidateInfo> list = search.candidatesEnumerable.ToList();
if (!list.Any())
{
return;
}
foreach (ItemDef item in items)
{
list.RemoveAll((CandidateInfo x) => Object.op_Implicit((Object)(object)x.hurtBox) && x.hurtBox.DoesHurtboxHaveItem(item));
}
search.candidatesEnumerable = list;
}
public static bool DoesHurtboxHaveItem(this HurtBox hurtbox, ItemDef item)
{
if (!Object.op_Implicit((Object)(object)hurtbox.healthComponent) || !Object.op_Implicit((Object)(object)hurtbox.healthComponent.body) || !Object.op_Implicit((Object)(object)item))
{
Augmentum.ModLogger.LogError((object)"Can't check if the hurtbox has the item, some information is missing!");
return false;
}
CharacterBody body = hurtbox.healthComponent.body;
if (body.inventory.GetItemCount(item) > 0)
{
return true;
}
return false;
}
public static bool IsHurtboxAnElite(this HurtBox hurtbox)
{
if (!Object.op_Implicit((Object)(object)hurtbox.healthComponent) || !Object.op_Implicit((Object)(object)hurtbox.healthComponent.body))
{
Augmentum.ModLogger.LogError((object)"Can't check if the hurtbox is an elite, some information is missing!");
return false;
}
return hurtbox.healthComponent.body.isElite;
}
}
internal class ItemHelpers
{
public class BossGroupDamageTakenTracker : MonoBehaviour
{
public float TotalDamageTaken;
public static Dictionary<float, List<Action<BossGroup, DamageInfo, int>>> PercentLostActionList = new Dictionary<float, List<Action<BossGroup, DamageInfo, int>>>();
private void Awake()
{
TotalDamageTaken = 0f;
}
public static void AddToPercentLostActionList(float percent, Action<BossGroup, DamageInfo, int> action)
{
if (!PercentLostActionList.ContainsKey(percent))
{
PercentLostActionList.Add(percent, new List<Action<BossGroup, DamageInfo, int>>());
}
if (PercentLostActionList[percent] == null)
{
PercentLostActionList[percent] = new List<Action<BossGroup, DamageInfo, int>>();
}
PercentLostActionList[percent].Add(action);
}
public void UpdateValues(BossGroup bossGroup, DamageInfo damageInfo, float damageTaken)
{
float totalDamageTaken = TotalDamageTaken;
TotalDamageTaken += damageTaken;
float[] array = PercentLostActionList.Keys.ToArray();
for (int i = 0; i < PercentLostActionList.Count; i++)
{
float num = array[i];
int num2 = (int)(TotalDamageTaken / (num * bossGroup.totalMaxObservedMaxHealth));
int num3 = (int)(totalDamageTaken / (num * bossGroup.totalMaxObservedMaxHealth));
int arg = num2 - num3;
foreach (Action<BossGroup, DamageInfo, int> item in PercentLostActionList[num])
{
item(bossGroup, damageInfo, arg);
}
}
}
}
[CompilerGenerated]
private static class <>O
{
public static hook_TakeDamage <0>__HealthComponent_TakeDamage;
}
private static bool _IsBossGroupDamageHookEnabled;
public static bool IsBossGroupDamageHookEnabled => _IsBossGroupDamageHookEnabled;
public static RendererInfo[] ItemDisplaySetup(GameObject obj, bool IgnoreOverlays = false, bool debugmode = false)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
List<Renderer> list = new List<Renderer>();
MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
if (componentsInChildren.Length != 0)
{
list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren);
}
SkinnedMeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<SkinnedMeshRenderer>();
if (componentsInChildren2.Length != 0)
{
list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren2);
}
RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[list.Count];
for (int i = 0; i < list.Count; i++)
{
if (debugmode)
{
}
array[i] = new RendererInfo
{
defaultMaterial = ((list[i] is SkinnedMeshRenderer) ? list[i].sharedMaterial : list[i].material),
renderer = list[i],
defaultShadowCastingMode = (ShadowCastingMode)1,
ignoreOverlays = false
};
}
return array;
}
public static string OrderManifestLoreFormatter(string deviceName, string estimatedDelivery, string sentTo, string trackingNumber, string devicePickupDesc, string shippingMethod, string orderDetails)
{
string[] value = new string[19]
{
"<align=left>Estimated Delivery:<indent=70%>Sent To:</indent></align>",
"<align=left>" + estimatedDelivery + "<indent=70%>" + sentTo + "</indent></align>",
"",
"<indent=1%><style=cIsDamage><size=125%><u> Shipping Details:</u></size></style></indent>",
"",
"<indent=2%>-Order: <style=cIsUtility>" + deviceName + "</style></indent>",
"<indent=4%><style=cStack>Tracking Number: " + trackingNumber + "</style></indent>",
"",
"<indent=2%>-Order Description: " + devicePickupDesc + "</indent>",
"",
"<indent=2%>-Shipping Method: <style=cIsHealth>" + shippingMethod + "</style></indent>",
"",
"",
"",
"<indent=2%>-Order Details: " + orderDetails + "</indent>",
"",
"",
"",
"<style=cStack>Delivery being brought to you by the brand new </style><style=cIsUtility>Orbital Drop-Crate System (TM)</style>. <style=cStack><u>No refunds.</u></style>"
};
return string.Join("\n", value);
}
public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float duration)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)body) || body.GetBuffCount(buffDef) <= 0)
{
return;
}
foreach (TimedBuff timedBuff in body.timedBuffs)
{
if (buffDef.buffIndex == timedBuff.buffIndex)
{
timedBuff.timer = duration;
}
}
}
public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float taperStart, float taperDuration)
{
//IL_003b: 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)
if (!Object.op_Implicit((Object)(object)body) || body.GetBuffCount(buffDef) <= 0)
{
return;
}
int num = 0;
foreach (TimedBuff timedBuff in body.timedBuffs)
{
if (buffDef.buffIndex == timedBuff.buffIndex)
{
timedBuff.timer = taperStart + (float)num * taperDuration;
num++;
}
}
}
public static DotIndex FindAssociatedDotForBuff(BuffDef buff)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
return (DotIndex)Array.FindIndex(DotController.dotDefs, (DotDef dotDef) => (Object)(object)dotDef.associatedBuff == (Object)(object)buff);
}
public static T[] GetRandomSelectionFromArray<T>(List<T> itemList, int maxCount, Xoroshiro128Plus rng)
{
int num = Math.Min(itemList.Count, maxCount);
T[] array = new T[num];
HashSet<T> hashSet = new HashSet<T>();
for (int i = 0; i < num; i++)
{
T val;
do
{
val = itemList[rng.RangeInt(0, itemList.Count)];
}
while (hashSet.Contains(val));
array[i] = val;
hashSet.Add(val);
}
return array;
}
public static List<ItemDef> ItemDefsWithTier(ItemTierDef itemTierDef)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_002b: 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)
HashSet<ItemDef> hashSet = new HashSet<ItemDef>();
Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
if ((int)current.itemIndex != -1 && current.tier == itemTierDef.tier)
{
hashSet.Add(current);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
return hashSet.ToList();
}
public static List<PickupDef> PickupDefsWithTier(ItemTierDef itemTierDef)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Invalid comparison between Unknown and I4
//IL_0027: 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)
HashSet<PickupDef> hashSet = new HashSet<PickupDef>();
foreach (PickupDef allPickup in PickupCatalog.allPickups)
{
if ((int)allPickup.itemIndex != -1 && allPickup.itemTier == itemTierDef.tier)
{
hashSet.Add(allPickup);
}
}
return hashSet.ToList();
}
public static bool ToggleBossGroupDamageHooks(bool enable)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
if (enable == IsBossGroupDamageHookEnabled)
{
return false;
}
_IsBossGroupDamageHookEnabled = enable;
if (enable)
{
object obj = <>O.<0>__HealthComponent_TakeDamage;
if (obj == null)
{
hook_TakeDamage val = HealthComponent_TakeDamage;
<>O.<0>__HealthComponent_TakeDamage = val;
obj = (object)val;
}
HealthComponent.TakeDamage += (hook_TakeDamage)obj;
}
else
{
object obj2 = <>O.<0>__HealthComponent_TakeDamage;
if (obj2 == null)
{
hook_TakeDamage val2 = HealthComponent_TakeDamage;
<>O.<0>__HealthComponent_TakeDamage = val2;
obj2 = (object)val2;
}
HealthComponent.TakeDamage -= (hook_TakeDamage)obj2;
}
return true;
}
private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
float num = 0f;
BossGroup val = null;
orig.Invoke(self, damageInfo);
if (!Object.op_Implicit((Object)(object)self.body) || !self.body.isBoss || !self.alive || !(self.health > 0f))
{
return;
}
val = BossGroup.FindBossGroup(self.body);
if ((Object)(object)val != (Object)null)
{
BossGroupDamageTakenTracker bossGroupDamageTakenTracker = ((Component)val).GetComponent<BossGroupDamageTakenTracker>();
if (!Object.op_Implicit((Object)(object)bossGroupDamageTakenTracker))
{
bossGroupDamageTakenTracker = ((Component)val).gameObject.AddComponent<BossGroupDamageTakenTracker>();
}
num = damageInfo.damage;
if (val.totalObservedHealth > 0f)
{
bossGroupDamageTakenTracker.UpdateValues(val, damageInfo, num);
}
}
}
public static void DelayChatMessage(string message, float delay)
{
((MonoBehaviour)Run.instance).StartCoroutine(DelayedChatMessageCoroutine(message, delay));
}
public static IEnumerator DelayedChatMessageCoroutine(string message, float delay)
{
yield return (object)new WaitForSeconds(delay);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = message
});
}
}
public class ItemTierPickupVFXHelper : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static hook_DestroyModel <0>__PickupDisplay_DestroyModel;
public static hook_RebuildModel <1>__PickupDisplay_RebuildModel;
}
private PickupDisplay display;
private GameObject effectInstance;
[SystemInitializer(new Type[]
{
typeof(ItemTierCatalog),
typeof(ItemTierBase)
})]
public static void SystemInitializer()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//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
object obj = <>O.<0>__PickupDisplay_DestroyModel;
if (obj == null)
{
hook_DestroyModel val = PickupDisplay_DestroyModel;
<>O.<0>__PickupDisplay_DestroyModel = val;
obj = (object)val;
}
PickupDisplay.DestroyModel += (hook_DestroyModel)obj;
object obj2 = <>O.<1>__PickupDisplay_RebuildModel;
if (obj2 == null)
{
hook_RebuildModel val2 = PickupDisplay_RebuildModel;
<>O.<1>__PickupDisplay_RebuildModel = val2;
obj2 = (object)val2;
}
PickupDisplay.RebuildModel += (hook_RebuildModel)obj2;
}
private static void PickupDisplay_RebuildModel(orig_RebuildModel orig, PickupDisplay self, GameObject modelObjectOverride)
{
ItemTierPickupVFXHelper component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
if (!Object.op_Implicit((Object)(object)component))
{
((Component)self).gameObject.AddComponent<ItemTierPickupVFXHelper>();
component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
}
orig.Invoke(self, modelObjectOverride);
component.OnPickupDisplayRebuildModel();
}
private static void PickupDisplay_DestroyModel(orig_DestroyModel orig, PickupDisplay self)
{
ItemTierPickupVFXHelper component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
if (!Object.op_Implicit((Object)(object)component))
{
((Component)self).gameObject.AddComponent<ItemTierPickupVFXHelper>();
component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
}
orig.Invoke(self);
component.OnPickupDisplayDestroyModel();
}
private void Awake()
{
display = ((Component)this).GetComponent<PickupDisplay>();
}
private void OnPickupDisplayRebuildModel()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Expected O, but got Unknown
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)display))
{
return;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(display.GetPickupIndex());
ItemIndex val = (ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex));
if ((int)val == -1)
{
return;
}
ItemTier tier = ItemCatalog.GetItemDef(val).tier;
ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(tier);
if (Object.op_Implicit((Object)(object)itemTierDef) && ItemTierBase.IsBransCustomTier(itemTierDef, out var itemTierBase) && itemTierBase != null && Object.op_Implicit((Object)(object)itemTierBase.PickupDisplayVFX))
{
effectInstance = Object.Instantiate<GameObject>(itemTierBase.PickupDisplayVFX, ((Component)display).gameObject.transform);
Transform transform = effectInstance.transform;
transform.position -= Vector3.up * 1.5f;
effectInstance.SetActive(true);
Color32 color = ColorCatalog.GetColor(itemTierDef.colorIndex);
ParticleSystem[] componentsInChildren = effectInstance.GetComponentsInChildren<ParticleSystem>();
ParticleSystem[] array = componentsInChildren;
foreach (ParticleSystem val2 in array)
{
((Component)val2).gameObject.SetActive(true);
MainModule main = val2.main;
((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(color));
}
if (ModCompatability.HighItemVizabilityCompat.IsHighItemVizabilityInstalled)
{
float num = 0f;
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(Color32.op_Implicit(color), ref num2, ref num3, ref num);
Color32 val3 = Color32.op_Implicit(Color.HSVToRGB(num2, 1f, num));
GameObject gameObject = ((Component)display).gameObject;
Vector3 position = ((Component)display).transform.position;
Vector3 val4 = position + new Vector3(0f, 100f, 0f);
LineRenderer val5 = gameObject.AddComponent<LineRenderer>();
val5.positionCount = 2;
((Renderer)val5).material = new Material(LegacyShaderAPI.Find("Hopoo Games/FX/Vertex Colors Only"));
val5.startColor = Color32.op_Implicit(val3);
val5.endColor = Color32.op_Implicit(val3);
val5.startWidth = 0.25f;
val5.endWidth = 0f;
val5.SetPosition(0, position);
val5.SetPosition(1, val4);
}
}
}
private void OnPickupDisplayDestroyModel()
{
if (Object.op_Implicit((Object)(object)effectInstance))
{
Object.Destroy((Object)(object)effectInstance);
}
}
}
}
namespace Augmentum.Modules.StandaloneBuffs
{
public abstract class BuffBase<T> : BuffBase where T : BuffBase<T>
{
public static T instance { get; private set; }
public BuffBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting BuffBase was instantiated twice");
}
instance = this as T;
}
}
public abstract class BuffBase
{
public BuffDef BuffDef;
public abstract string BuffName { get; }
public abstract Color Color { get; }
public virtual bool CanStack { get; } = false;
public virtual bool IsDebuff { get; } = false;
public virtual bool IsCooldown { get; } = true;
public virtual bool IsHidden { get; } = false;
public virtual Sprite BuffIcon { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");
public abstract void Init(ConfigFile config);
public void CreateBuff()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
BuffDef = ScriptableObject.CreateInstance<BuffDef>();
((Object)BuffDef).name = BuffName;
BuffDef.buffColor = Color;
BuffDef.canStack = CanStack;
BuffDef.isDebuff = IsDebuff;
BuffDef.iconSprite = BuffIcon;
BuffDef.isCooldown = IsCooldown;
BuffDef.isHidden = IsHidden;
ContentAddition.AddBuffDef(BuffDef);
}
public abstract void Hooks();
}
public class Fortified : BuffBase<Fortified>
{
public override string BuffName => "Fortified";
public override Color Color => Color32.op_Implicit(new Color32((byte)245, (byte)245, (byte)245, byte.MaxValue));
public override Sprite BuffIcon => Augmentum.MainAssets.LoadAsset<Sprite>("Assets/Textrures/Icons/Buff/Fortified.png");
public override bool CanStack => true;
public override bool IsDebuff => false;
public override bool IsCooldown => false;
public override void Init(ConfigFile config)
{
CreateBuff();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
bool flag = false;
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.GetBuffCount(BuffDef) > 0)
{
self.itemCounts.armorPlate += self.body.GetBuffCount(BuffDef);
orig.Invoke(self, damageInfo);
flag = true;
self.itemCounts.armorPlate -= self.body.GetBuffCount(BuffDef);
}
if (!flag)
{
orig.Invoke(self, damageInfo);
}
}
private void OnLoadModCompat()
{
}
}
public class Laceration : BuffBase<Laceration>
{
public override string BuffName => "Laceration";
public override Color Color => Color32.op_Implicit(new Color32((byte)240, (byte)0, (byte)0, byte.MaxValue));
public override Sprite BuffIcon => Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/ArmorReductionOnHit/texBuffPulverizeIcon.tif").WaitForCompletion();
public override bool CanStack => true;
public override bool IsDebuff => true;
public override bool IsCooldown => false;
public override void Init(ConfigFile config)
{
CreateBuff();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
bool flag = false;
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.GetBuffCount(BuffDef) > 0)
{
damageInfo.damage += (float)self.body.GetBuffCount(BuffDef) * 0.1f;
orig.Invoke(self, damageInfo);
flag = true;
}
if (!flag)
{
orig.Invoke(self, damageInfo);
}
}
private void OnLoadModCompat()
{
}
}
public class Safegaurd : BuffBase<Safegaurd>
{
public override string BuffName => "Safegaurd";
public override Color Color => Color32.op_Implicit(new Color32(byte.MaxValue, (byte)215, (byte)0, byte.MaxValue));
public override bool CanStack => true;
public override bool IsDebuff => false;
public override bool IsCooldown => false;
public override void Init(ConfigFile config)
{
CreateBuff();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body))
{
int buffCount = self.body.GetBuffCount(BuffDef);
if (buffCount > 0)
{
float num = (100f - (float)buffCount) / 100f * self.fullCombinedHealth;
if (damageInfo.damage > num)
{
damageInfo.damage = num;
}
}
}
orig.Invoke(self, damageInfo);
}
private void OnLoadModCompat()
{
}
}
public class TemporaryShield : BuffBase<TemporaryShield>
{
public override string BuffName => "Temporary Shield";
public override Color Color => Color32.op_Implicit(new Color32((byte)68, (byte)94, (byte)182, byte.MaxValue));
public override Sprite BuffIcon => Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffGenericShield.tif").WaitForCompletion();
public override bool CanStack => true;
public override bool IsDebuff => false;
public override bool IsCooldown => false;
public override void Init(ConfigFile config)
{
CreateBuff();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
args.baseShieldAdd += (float)sender.GetBuffCount(BuffDef);
}
private void OnLoadModCompat()
{
}
}
}
namespace Augmentum.Modules.Pickups
{
public abstract class ArtifactBase<T> : ArtifactBase where T : ArtifactBase<T>
{
public static T instance { get; private set; }
public ArtifactBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBase was instantiated twice");
}
instance = this as T;
}
}
public abstract class ArtifactBase
{
public ArtifactDef ArtifactDef;
public abstract string ArtifactName { get; }
public string ConfigItemName => ArtifactName.Replace("'", "");
public abstract string ArtifactLangTokenName { get; }
public abstract string ArtifactFullDescription { get; }
public virtual GameObject ArtifactModel { get; } = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery");
public virtual Sprite ArtifactIconDeselected { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");
public virtual Sprite ArtifactIconSelected { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactFullDescription);
}
protected void CreateArtifact()
{
ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
ArtifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
ArtifactDef.pickupModelPrefab = ArtifactModel;
ArtifactDef.smallIconDeselectedSprite = ArtifactIconDeselected;
ArtifactDef.smallIconSelectedSprite = ArtifactIconSelected;
FixScriptableObjectName();
ContentAddition.AddArtifactDef(ArtifactDef);
}
public abstract void Hooks();
public bool IsSelectedAndInRun()
{
return Augmentum.ArtifactStatusDictionary.GetValueOrDefault(this, defaultValue: false) && Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
}
public void FixScriptableObjectName()
{
((Object)ArtifactDef).name = ArtifactDef.cachedName;
}
}
public abstract class EliteEquipmentBase<T> : EliteEquipmentBase where T : EliteEquipmentBase<T>
{
public static T instance { get; private set; }
public EliteEquipmentBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting EquipmentBoilerplate/Equipment was instantiated twice");
}
instance = this as T;
}
}
public abstract class EliteEquipmentBase
{
public class EliteOverlayManager : MonoBehaviour
{
public TemporaryOverlay Overlay;
public CharacterBody Body;
public BuffDef EliteBuffDef;
public void FixedUpdate()
{
if (!Body.HasBuff(EliteBuffDef))
{
Object.Destroy((Object)(object)Overlay);
Object.Destroy((Object)(object)this);
}
}
}
public enum TargetingType
{
Enemies,
Friendlies
}
public class TargetingControllerComponent : MonoBehaviour
{
public GameObject TargetObject;
public GameObject VisualizerPrefab;
public Indicator Indicator;
public BullseyeSearch TargetFinder;
public Action<BullseyeSearch> AdditionalBullseyeFunctionality = delegate
{
};
public void Awake()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
Indicator = new Indicator(((Component)this).gameObject, (GameObject)null);
}
public void OnDestroy()
{
Invalidate();
}
public void Invalidate()
{
TargetObject = null;
Indicator.targetTransform = null;
}
public void ConfigureTargetFinderBase(EquipmentSlot self)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
if (TargetFinder == null)
{
TargetFinder = new BullseyeSearch();
}
TargetFinder.teamMaskFilter = TeamMask.allButNeutral;
((TeamMask)(ref TargetFinder.teamMaskFilter)).RemoveTeam(self.characterBody.teamComponent.teamIndex);
TargetFinder.sortMode = (SortMode)2;
TargetFinder.filterByLoS = true;
float num = default(float);
Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self).gameObject, ref num);
TargetFinder.searchOrigin = ((Ray)(ref val)).origin;
TargetFinder.searchDirection = ((Ray)(ref val)).direction;
TargetFinder.maxAngleFilter = 10f;
TargetFinder.viewer = self.characterBody;
}
public void ConfigureTargetFinderForEnemies(EquipmentSlot self)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
ConfigureTargetFinderBase(self);
TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
TargetFinder.RefreshCandidates();
TargetFinder.FilterOutGameObject(((Component)self).gameObject);
AdditionalBullseyeFunctionality(TargetFinder);
PlaceTargetingIndicator(TargetFinder.GetResults());
}
public void ConfigureTargetFinderForFriendlies(EquipmentSlot self)
{
//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_002f: Unknown result type (might be due to invalid IL or missing references)
ConfigureTargetFinderBase(self);
TargetFinder.teamMaskFilter = TeamMask.none;
((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
TargetFinder.RefreshCandidates();
TargetFinder.FilterOutGameObject(((Component)self).gameObject);
AdditionalBullseyeFunctionality(TargetFinder);
PlaceTargetingIndicator(TargetFinder.GetResults());
}
public void PlaceTargetingIndicator(IEnumerable<HurtBox> TargetFinderResults)
{
HurtBox val = (TargetFinderResults.Any() ? TargetFinderResults.First() : null);
if (Object.op_Implicit((Object)(object)val))
{
TargetObject = ((Component)val.healthComponent).gameObject;
Indicator.visualizerPrefab = VisualizerPrefab;
Indicator.targetTransform = ((Component)val).transform;
}
else
{
Invalidate();
}
Indicator.active = Object.op_Implicit((Object)(object)val);
}
}
public EquipmentDef EliteEquipmentDef;
public BuffDef EliteBuffDef;
public CustomElite CustomEliteDef;
public CustomElite CustomEliteDefHonor;
public static List<EliteEquipmentBase> elites = new List<EliteEquipmentBase>();
public GameObject TargetingIndicatorPrefabBase = null;
public abstract string EliteEquipmentName { get; }
public abstract string EliteAffixToken { get; }
public abstract string EliteEquipmentPickupDesc { get; }
public abstract string EliteEquipmentFullDescriptionRaw { get; }
public abstract string EliteEquipmentFullDescriptionFormatted { get; }
public abstract string EliteEquipmentLore { get; }
public abstract string EliteModifier { get; }
public virtual bool AppearsInSinglePlayer { get; } = true;
public virtual bool AppearsInMultiPlayer { get; } = true;
public virtual bool CanDrop { get; } = false;
public virtual float Cooldown { get; } = 60f;
public virtual bool EnigmaCompatible { get; } = false;
public virtual bool IsBoss { get; } = false;
public virtual bool IsLunar { get; } = false;
public virtual bool AllowHonor { get; } = true;
public abstract GameObject EliteEquipmentModel { get; }
public virtual GameObject EliteBodyModel { get; } = null;
public virtual Texture2D RampTexture { get; } = null;
public abstract Sprite EliteEquipmentIcon { get; }
public abstract Sprite EliteBuffIcon { get; }
public virtual Color EliteBuffColor { get; set; } = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
public virtual EliteTierDef[] CanAppearInEliteTiers { get; set; } = EliteAPI.GetCombatDirectorEliteTiers();
public virtual Material EliteMaterial { get; set; } = null;
public EliteDef EliteDef => CustomEliteDef.EliteDef;
public virtual float HealthMultiplier { get; set; } = 1f;
public virtual float DamageMultiplier { get; set; } = 1f;
public virtual float HonorHealthMultiplier { get; set; } = 1f;
public virtual float HonorDamageMultiplier { get; set; } = 1f;
public virtual float CostMultiplierOfElite { get; set; } = 1f;
public virtual VanillaEliteTier VanillaTier { get; set; } = (VanillaEliteTier)1;
public virtual float DropChance { get; set; } = 0.00025f;
public static Color AffixColor { get; set; } = Color.grey;
public static Color AffixLightColor { get; set; } = Color.white;
public virtual bool UseTargeting { get; } = false;
public virtual TargetingType TargetingTypeEnum { get; } = TargetingType.Enemies;
public abstract void Init(ConfigFile config);
public abstract ItemDisplayRuleDict CreateItemDisplayRules();
protected void CreateLang()
{
LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_NAME", EliteEquipmentName);
LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_PICKUP", EliteEquipmentPickupDesc);
LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_DESCRIPTION", EliteEquipmentFullDescriptionRaw);
LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_LORE", EliteEquipmentLore);
LanguageAPI.Add("BRANS_ELITE_" + EliteAffixToken + "_MODIFIER", EliteModifier + " {0}");
}
public string GetLangDesc()
{
return Language.GetString("BRANS_ELITE_" + EliteAffixToken + "_DESCRIPTION");
}
protected void CreateEquipment()
{
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Expected O, but got Unknown
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Expected O, but got Unknown
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
EliteEquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
((Object)EliteEquipmentDef).name = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken;
EliteEquipmentDef.nameToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_NAME";
EliteEquipmentDef.pickupToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_PICKUP";
EliteEquipmentDef.descriptionToken = EliteEquipmentFullDescriptionFormatted;
EliteEquipmentDef.loreToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_LORE";
EliteEquipmentDef.pickupModelPrefab = EliteEquipmentModel;
EliteEquipmentDef.pickupIconSprite = EliteEquipmentIcon;
EliteEquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
EliteEquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
EliteEquipmentDef.canDrop = CanDrop;
EliteEquipmentDef.cooldown = Cooldown;
EliteEquipmentDef.enigmaCompatible = EnigmaCompatible;
EliteEquipmentDef.isBoss = IsBoss;
EliteEquipmentDef.isLunar = IsLunar;
EliteEquipmentDef.passiveBuffDef = EliteBuffDef;
EliteEquipmentDef.dropOnDeathChance = DropChance;
elites.Add(this);
DefaultTexture();
ItemAPI.Add(new CustomEquipment(EliteEquipmentDef, CreateItemDisplayRules()));
EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
if (UseTargeting && Object.op_Implicit((Object)(object)TargetingIndicatorPrefabBase))
{
EquipmentSlot.Update += new hook_Update(UpdateTargeting);
}
if (Object.op_Implicit((Object)(object)EliteMaterial))
{
CharacterBody.FixedUpdate += new hook_FixedUpdate(OverlayManager);
}
CombatDirector.Init += new hook_Init(CombatDirector_Init);
}
private void CombatDirector_Init(orig_Init orig)
{
orig.Invoke();
}
protected void CreateAffixBuffDef()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
EliteBuffDef = ScriptableObject.CreateInstance<BuffDef>();
((Object)EliteBuffDef).name = EliteAffixToken;
EliteBuffDef.isDebuff = false;
EliteBuffDef.buffColor = EliteBuffColor;
EliteBuffDef.canStack = false;
EliteBuffDef.iconSprite = EliteBuffIcon;
ContentAddition.AddBuffDef(EliteBuffDef);
}
private void DefaultTexture()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
EliteEquipmentDef.pickupModelPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteFire/PickupEliteFire.prefab").WaitForCompletion(), "PickupAffixAdaptive", false);
Material val = Object.Instantiate<Material>(((Renderer)EliteEquipmentDef.pickupModelPrefab.GetComponentInChildren<MeshRenderer>()).material);
val.color = AffixColor;
Renderer[] componentsInChildren = EliteEquipmentDef.pickupModelPrefab.GetComponentsInChildren<Renderer>();
foreach (Renderer val2 in componentsInChildren)
{
val2.material = val;
}
}
public virtual void OverlayManager(orig_FixedUpdate orig, CharacterBody self)
{
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.modelLocator) && Object.op_Implicit((Object)(object)self.modelLocator.modelTransform) && self.HasBuff(EliteBuffDef) && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<EliteOverlayManager>()))
{
TemporaryOverlay val = ((Component)self.modelLocator.modelTransform).gameObject.AddComponent<TemporaryOverlay>();
val.duration = float.PositiveInfinity;
val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
val.animateShaderAlpha = true;
val.destroyComponentOnEnd = true;
val.originalMaterial = EliteMaterial;
val.AddToCharacerModel(((Component)self.modelLocator.modelTransform).GetComponent<CharacterModel>());
EliteOverlayManager eliteOverlayManager = ((Component)self).gameObject.AddComponent<EliteOverlayManager>();
eliteOverlayManager.Overlay = val;
eliteOverlayManager.Body = self;
eliteOverlayManager.EliteBuffDef = EliteBuffDef;
}
orig.Invoke(self);
}
protected void CreateElite()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Invalid comparison between Unknown and I4
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Expected O, but got Unknown
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Expected O, but got Unknown
IEnumerable<EliteTierDef> eliteTierEnumerable = EliteAPI.GetEliteTierEnumerable(VanillaTier);
if (eliteTierEnumerable == null)
{
return;
}
CustomEliteDef = new CustomElite("Elite" + EliteEquipmentName, EliteEquipmentDef, Color32.op_Implicit(EliteBuffColor), EliteModifier, eliteTierEnumerable, RampTexture);
((Object)EliteDef).name = "BRANS_ELITE_" + EliteAffixToken;
EliteDef.modifierToken = "BRANS_ELITE_" + EliteAffixToken + "_MODIFIER";
EliteDef.eliteEquipmentDef = EliteEquipmentDef;
EliteDef.healthBoostCoefficient = HealthMultiplier;
EliteDef.damageBoostCoefficient = DamageMultiplier;
EliteBuffDef.eliteDef = EliteDef;
EliteAPI.Add(CustomEliteDef);
IEnumerable<EliteTierDef> honorEliteTierEnumerable = EliteAPI.GetHonorEliteTierEnumerable(VanillaTier);
if (AllowHonor && honorEliteTierEnumerable != null)
{
CustomEliteDefHonor = new CustomElite("Elite" + EliteEquipmentName + "Honor", EliteEquipmentDef, Color32.op_Implicit(EliteBuffColor), EliteModifier, honorEliteTierEnumerable, RampTexture);
CustomEliteDefHonor.EliteDef.healthBoostCoefficient = HonorHealthMultiplier;
CustomEliteDefHonor.EliteDef.damageBoostCoefficient = HonorDamageMultiplier;
EliteAPI.Add(CustomEliteDefHonor);
}
EliteTierDef[] baseEliteTierDefs = EliteAPI.GetCombatDirectorEliteTiers();
if ((int)VanillaTier != 0)
{
return;
}
if (!CanAppearInEliteTiers.All((EliteTierDef x) => baseEliteTierDefs.Contains(x)))
{
IEnumerable<EliteTierDef> enumerable = CanAppearInEliteTiers.Except(baseEliteTierDefs);
foreach (EliteTierDef eliteTierDef in enumerable)
{
int num = Array.FindIndex(baseEliteTierDefs, (EliteTierDef x) => x.costMultiplier >= eliteTierDef.costMultiplier);
if (num >= 0)
{
EliteAPI.AddCustomEliteTier(eliteTierDef, num);
}
else
{
EliteAPI.AddCustomEliteTier(eliteTierDef);
}
baseEliteTierDefs = EliteAPI.GetCombatDirectorEliteTiers();
}
}
EliteAPI.Add(new CustomElite(EliteDef, (IEnumerable<EliteTierDef>)CanAppearInEliteTiers));
}
protected bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
{
if ((Object)(object)equipmentDef == (Object)(object)EliteEquipmentDef)
{
return ActivateEquipment(self);
}
return orig.Invoke(self, equipmentDef);
}
protected abstract bool ActivateEquipment(EquipmentSlot slot);
public abstract void Hooks();
protected void UpdateTargeting(orig_Update orig, EquipmentSlot self)
{
//IL_000a: 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)
orig.Invoke(self);
if (self.equipmentIndex != EliteEquipmentDef.equipmentIndex)
{
return;
}
TargetingControllerComponent targetingControllerComponent = ((Component)self).GetComponent<TargetingControllerComponent>();
if (!Object.op_Implicit((Object)(object)targetingControllerComponent))
{
targetingControllerComponent = ((Component)self).gameObject.AddComponent<TargetingControllerComponent>();
targetingControllerComponent.VisualizerPrefab = TargetingIndicatorPrefabBase;
}
if (self.stock > 0)
{
switch (TargetingTypeEnum)
{
case TargetingType.Enemies:
targetingControllerComponent.ConfigureTargetFinderForEnemies(self);
break;
case TargetingType.Friendlies:
targetingControllerComponent.ConfigureTargetFinderForFriendlies(self);
break;
}
}
else
{
targetingControllerComponent.Invalidate();
targetingControllerComponent.Indicator.active = false;
}
}
}
public abstract class EquipmentBase<T> : EquipmentBase where T : EquipmentBase<T>
{
public static T instance { get; private set; }
public EquipmentBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting EquipmentBoilerplate/Equipment was instantiated twice");
}
instance = this as T;
}
}
public abstract class EquipmentBase
{
public enum TargetingType
{
Enemies,
Friendlies,
Interactables,
Items
}
public class TargetingControllerComponent : MonoBehaviour
{
public GameObject TargetObject;
public GameObject VisualizerPrefab;
public Indicator Indicator;
public BullseyeSearch TargetFinder;
public Action<BullseyeSearch> AdditionalBullseyeFunctionality = delegate
{
};
public void Awake()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
Indicator = new Indicator(((Component)this).gameObject, (GameObject)null);
}
public void OnDestroy()
{
Invalidate();
}
public void Invalidate()
{
TargetObject = null;
Indicator.targetTransform = null;
}
public void ConfigureTargetFinderBase(EquipmentSlot self)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
if (TargetFinder == null)
{
TargetFinder = new BullseyeSearch();
}
TargetFinder.teamMaskFilter = TeamMask.allButNeutral;
((TeamMask)(ref TargetFinder.teamMaskFilter)).RemoveTeam(self.characterBody.teamComponent.teamIndex);
TargetFinder.sortMode = (SortMode)2;
TargetFinder.filterByLoS = true;
float num = default(float);
Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self).gameObject, ref num);
TargetFinder.searchOrigin = ((Ray)(ref val)).origin;
TargetFinder.searchDirection = ((Ray)(ref val)).direction;
TargetFinder.maxAngleFilter = 10f;
TargetFinder.viewer = self.characterBody;
}
public void ConfigureTargetFinderForEnemies(EquipmentSlot self)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
ConfigureTargetFinderBase(self);
TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
TargetFinder.RefreshCandidates();
TargetFinder.FilterOutGameObject(((Component)self).gameObject);
AdditionalBullseyeFunctionality(TargetFinder);
PlaceTargetingIndicator(TargetFinder.GetResults());
}
public void ConfigureTargetFinderForFriendlies(EquipmentSlot self)
{
//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_002f: Unknown result type (might be due to invalid IL or missing references)
ConfigureTargetFinderBase(self);
TargetFinder.teamMaskFilter = TeamMask.none;
((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
TargetFinder.RefreshCandidates();
TargetFinder.FilterOutGameObject(((Component)self).gameObject);
AdditionalBullseyeFunctionality(TargetFinder);
PlaceTargetingIndicator(TargetFinder.GetResults());
}
public void PlaceTargetingIndicator(IEnumerable<HurtBox> TargetFinderResults)
{
HurtBox val = (TargetFinderResults.Any() ? TargetFinderResults.First() : null);
if (Object.op_Implicit((Object)(object)val))
{
TargetObject = ((Component)val.healthComponent).gameObject;
Indicator.visualizerPrefab = VisualizerPrefab;
Indicator.targetTransform = ((Component)val).transform;
}
else
{
Invalidate();
}
Indicator.active = Object.op_Implicit((Object)(object)val);
}
internal void ConfigureTargetFinderForInteractables(EquipmentSlot self)
{
throw new NotImplementedException();
}
internal void ConfigureTargetFinderForItems(EquipmentSlot self)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
ConfigureTargetFinderBase(self);
((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
TargetFinder.RefreshCandidates();
TargetFinder.FilterOutGameObject(((Component)self).gameObject);
AdditionalBullseyeFunctionality(TargetFinder);
PlaceTargetingIndicator(TargetFinder.GetResults());
}
}
public EquipmentDef EquipmentDef;
public GameObject TargetingIndicatorPrefabBase = null;
public abstract string EquipmentName { get; }
public abstract string EquipmentLangTokenName { get; }
public abstract string EquipmentPickupDesc { get; }
public abstract string EquipmentFullDescriptionRaw { get; }
public abstract string EquipmentFullDescriptionFormatted { get; }
public abstract string EquipmentLore { get; }
public virtual GameObject EquipmentModel { get; } = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery");
public virtual Sprite EquipmentIcon { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");
public virtual bool AppearsInSinglePlayer { get; } = true;
public virtual bool AppearsInMultiPlayer { get; } = true;
public virtual bool CanDrop { get; } = true;
public virtual float Cooldown { get; } = 60f;
public virtual bool EnigmaCompatible { get; } = true;
public virtual bool IsBoss { get; } = false;
public virtual bool IsLunar { get; } = false;
public virtual bool UseTargeting { get; } = false;
public virtual TargetingType TargetingTypeEnum { get; } = TargetingType.Enemies;
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_NAME", EquipmentName);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP", EquipmentPickupDesc);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION", EquipmentFullDescriptionRaw);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore);
}
public string GetLangDesc()
{
return Language.GetString("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION");
}
public abstract ItemDisplayRuleDict CreateItemDisplayRules();
protected void CreateEquipment()
{
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
((Object)EquipmentDef).name = "EQUIPMENT_" + EquipmentLangTokenName;
EquipmentDef.nameToken = "EQUIPMENT_" + EquipmentLangTokenName + "_NAME";
EquipmentDef.pickupToken = "EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP";
EquipmentDef.descriptionToken = EquipmentFullDescriptionFormatted;
EquipmentDef.loreToken = "EQUIPMENT_" + EquipmentLangTokenName + "_LORE";
EquipmentDef.pickupModelPrefab = EquipmentModel;
EquipmentDef.pickupIconSprite = EquipmentIcon;
EquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
EquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
EquipmentDef.canDrop = CanDrop;
EquipmentDef.cooldown = Cooldown;
EquipmentDef.enigmaCompatible = EnigmaCompatible;
EquipmentDef.isBoss = IsBoss;
EquipmentDef.isLunar = IsLunar;
ItemAPI.Add(new CustomEquipment(EquipmentDef, CreateItemDisplayRules()));
EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
}
private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
{
if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef)
{
return ActivateEquipment(self);
}
return orig.Invoke(self, equipmentDef);
}
protected abstract bool ActivateEquipment(EquipmentSlot slot);
public abstract void Hooks();
protected void UpdateTargeting(orig_Update orig, EquipmentSlot self)
{
//IL_000a: 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)
orig.Invoke(self);
if (self.equipmentIndex != EquipmentDef.equipmentIndex)
{
return;
}
TargetingControllerComponent targetingControllerComponent = ((Component)self).GetComponent<TargetingControllerComponent>();
if (!Object.op_Implicit((Object)(object)targetingControllerComponent))
{
targetingControllerComponent = ((Component)self).gameObject.AddComponent<TargetingControllerComponent>();
targetingControllerComponent.VisualizerPrefab = TargetingIndicatorPrefabBase;
}
if (self.stock > 0)
{
switch (TargetingTypeEnum)
{
case TargetingType.Enemies:
targetingControllerComponent.ConfigureTargetFinderForEnemies(self);
break;
case TargetingType.Friendlies:
targetingControllerComponent.ConfigureTargetFinderForFriendlies(self);
break;
case TargetingType.Interactables:
targetingControllerComponent.ConfigureTargetFinderForInteractables(self);
break;
case TargetingType.Items:
targetingControllerComponent.ConfigureTargetFinderForItems(self);
break;
}
}
else
{
targetingControllerComponent.Invalidate();
targetingControllerComponent.Indicator.active = false;
}
}
}
public abstract class ItemBase<T> : ItemBase where T : ItemBase<T>
{
public static T instance { get; private set; }
public ItemBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBase was instantiated twice");
}
instance = this as T;
}
}
public abstract class ItemBase
{
public ItemDef ItemDef;
public abstract string ItemName { get; }
public string ConfigItemName => ItemName.Replace("'", "");
public abstract string ItemLangTokenName { get; }
public abstract string ItemPickupDesc { get; }
public abstract string ItemFullDescriptionRaw { get; }
public abstract string ItemFullDescriptionFormatted { get; }
public abstract string ItemLore { get; }
public virtual ItemTierDef ModdedTierDef { get; } = null;
public abstract ItemTier Tier { get; }
public virtual ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[0];
public virtual GameObject ItemModel { get; } = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery");
public virtual Sprite ItemIcon { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");
public virtual bool CanRemove { get; } = true;
public virtual bool Hidden { get; } = false;
public bool AIBlacklisted { get; internal set; }
public bool PrinterBlacklisted { get; internal set; }
public virtual bool BlacklistFromPreLoad { get; internal set; } = false;
public virtual string[] CorruptsItem { get; set; } = null;
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescriptionRaw);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore);
}
public string GetLangDesc()
{
return Language.GetString("ITEM_" + ItemLangTokenName + "_DESCRIPTION");
}
public abstract ItemDisplayRuleDict CreateItemDisplayRules();
protected void CreateItem()
{
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Expected O, but got Unknown
ItemDef = ScriptableObject.CreateInstance<ItemDef>();
((Object)ItemDef).name = "ITEM_" + ItemLangTokenName;
ItemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME";
ItemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP";
ItemDef.descriptionToken = ItemFullDescriptionFormatted;
ItemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE";
ItemDef.pickupModelPrefab = ItemModel;
ItemDef.pickupIconSprite = ItemIcon;
ItemDef.hidden = Hidden;
ItemDef.canRemove = CanRemove;
if ((Object)(object)ModdedTierDef == (Object)null)
{
ItemDef.deprecatedTier = Tier;
}
else
{
ItemDef._itemTierDef = ModdedTierDef;
}
ItemDef.tags = ItemTags;
ItemDisplayRuleDict val = CreateItemDisplayRules();
ItemAPI.Add(new CustomItem(ItemDef, val));
}
protected virtual void SetLogbookCameraPosition()
{
//IL_0058: 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)
ModelPanelParameters val = ItemModel.AddComponent<ModelPanelParameters>();
val.focusPointTransform = ItemModel.transform.Find("FocusPoint");
val.cameraPositionTransform = ItemModel.transform.Find("CameraPosition");
val.modelRotation = new Quaternion(0f, 0f, 0f, 1f);
val.minDistance = 1f;
val.maxDistance = 3f;
}
public abstract void Hooks();
public int GetCount(CharacterBody body)
{
if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
{
return 0;
}
return body.inventory.GetItemCount(ItemDef);
}
public int GetCount(CharacterMaster master)
{
if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory))
{
return 0;
}
return master.inventory.GetItemCount(ItemDef);
}
internal static void RegisterVoidPairings(orig_Init orig)
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
ItemTier[] array = new ItemTier[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
ItemTier[] source = (ItemTier[])(object)array;
foreach (KeyValuePair<ItemBase, bool> item2 in Augmentum.ItemStatusDictionary)
{
if (!item2.Value)
{
continue;
}
ItemBase item = item2.Key;
if (!Object.op_Implicit((Object)(object)item.ItemDef) || !source.Any((ItemTier x) => item.ItemDef.tier == x))
{
continue;
}
int i;
for (i = 0; i < item.CorruptsItem.Count(); i++)
{
ItemDef val = ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where((ItemDef x) => x.nameToken == item.CorruptsItem[i]).FirstOrDefault();
if (!Object.op_Implicit((Object)(object)val))
{
Augmentum.ModLogger.LogError((object)("Tried to add " + item.ItemName + " in a Void item tier but no relationship was set for what it corrupts or could not be found. Aborting!"));
continue;
}
Pair[] array2 = (Pair[])(object)new Pair[1]
{
new Pair
{
itemDef1 = val,
itemDef2 = item.ItemDef
}
};
ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = CollectionExtensions.AddRangeToArray<Pair>(ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem], array2);
}
}
orig.Invoke();
}
}
}
namespace Augmentum.Modules.Pickups.Equipments
{
internal class AirTotem : EquipmentBase<AirTotem>
{
public static GameObject ItemBodyModelPrefab;
public static ConfigEntry<int> T1EssenceCountEntry;
public static ConfigEntry<int> T2EssenceCountEntry;
public static ConfigEntry<int> T3EssenceCountEntry;
public static ConfigEntry<int> BossEssenceCountEntry;
public override string EquipmentName => "Reducer";
public override string EquipmentLangTokenName => "Reducer";
public override string EquipmentPickupDesc => "Transform an item to its " + Augmentum.EssencesKeyword + ".";
public override string EquipmentFullDescriptionRaw => "<style=cIsUtility>Transform</style> an item to an {0} which gives a slight <style=cIsUtility>stat boost</style>.<style=cIsUtility> Scales with item rarity</style>.";
public override string EquipmentFullDescriptionFormatted => string.Format(GetLangDesc(), Augmentum.EssenceKeyword);
public override string EquipmentLore => "";
public override bool UseTargeting => true;
public override GameObject EquipmentModel => SetupModel();
public override Sprite EquipmentIcon => Augmentum.MainAssets.LoadAsset<Sprite>("Assets/Textrures/Icons/Equipment/Reducer/ReducerIcon.png");
public override float Cooldown { get; } = 30f;
public static int T1EssenceCount => T1EssenceCountEntry.Value;
public static int T2EssenceCount => T2EssenceCountEntry.Value;
public static int T3EssenceCount => T3EssenceCountEntry.Value;
public static int BossEssenceCount => BossEssenceCountEntry.Value;
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateTargetingIndicator();
CreateEquipment();
Hooks();
}
private void CreateConfig(ConfigFile config)
{
T1EssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from T1 items", 1, "How many essences should drop from T1 Items?");
T2EssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from T2 items", 3, "How many essences should drop from T2 Items?");
T3EssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from T3 items", 15, "How many essences should drop from T3 Items?");
BossEssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from Boss items", 8, "How many essences should drop from Boss Items?");
}
private void CreateTargetingIndicator()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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)
TargetingIndicatorPrefabBase = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/RecyclerIndicator"), "AirTotemIndicator", false);
TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>().color = Color.white;
((Component)TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>()).transform.rotation = Quaternion.identity;
((Graphic)TargetingIndicatorPrefabBase.GetComponentInChildren<TextMeshPro>()).color = new Color(0.423f, 1f, 0.749f);
}
private GameObject SetupModel()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Recycle/PickupRecycler.prefab").WaitForCompletion(), "Reducer", false);
Textur