using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterSoulCost;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.CaptainSupplyDrop;
using EntityStates.GrandParent;
using EntityStates.LaserTurbine;
using HG;
using HG.Reflection;
using IL.RoR2;
using IL.RoR2.Items;
using IL.RoR2.Orbs;
using MissileRework;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MoreStats;
using On.EntityStates;
using On.EntityStates.LaserTurbine;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.Orbs;
using R2API;
using R2API.Utils;
using RainrotSharedUtils.Status;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using SwanSongExtended.Changes;
using SwanSongExtended.Components;
using SwanSongExtended.Modules;
using SwanSongExtended.Skills;
using SwanSongExtended.States;
using ThreeEyedGames;
using Unity;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SwanSongExtended")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SwanSongExtended")]
[assembly: AssemblyTitle("SwanSongExtended")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace SwanSongExtended
{
[BepInIncompatibility("com.RiskOfBrainrot.SwanSongExtended")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[R2APISubmoduleDependency(new string[] { "LanguageAPI", "PrefabAPI", "RecalculateStatsAPI", "DotAPI", "DifficultyAPI" })]
[BepInPlugin("com.duckduckgreyduck.SpareChange", "SpareChange", "0.0.1")]
public class SwanSongPlugin : BaseUnityPlugin
{
public static int ignitionTankBurnChance = 15;
public float ignitionBurnDamage = 2f;
public float ignitionBurnDuration = 2f;
private bool shouldIgnitionDamageAndDurationCompound = false;
public static int stacheBurnChance = 25;
public static int brandBurnChance = 30;
public const string guid = "com.duckduckgreyduck.SpareChange";
public const string teamName = "duckduckgreyduck";
public const string modName = "SpareChange";
public const string version = "0.0.1";
public const string expansionName = "Swan Song";
public const string expansionName2 = "Secrets of the Scug";
public const string expansionToken = "EXPANSION2R4R";
public const string expansionToken2 = "EXPANSIONSOTS";
public const string DEVELOPER_PREFIX = "FRUIT";
public static SwanSongPlugin instance;
public static ExpansionDef expansionDefSS2;
public static ExpansionDef expansionDefSOTS;
public const string iconsPath = "";
private GameObject meatballNapalmPool => CommonAssets.meatballNapalmPool;
public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle;
public static AssetBundle retierAssetBundle => CommonAssets.retierAssetBundle;
public static bool iabMissilesLoaded => ModLoaded("com.HouseOfFruits.IAmBecomeMissiles");
public static bool isAELoaded => ModLoaded("com.Borbo.ArtificerExtended");
public static bool is2R4RLoaded => ModLoaded("com.RiskOfBrainrot.RiskierRain");
public static bool isHBULoaded => ModLoaded("com.Borbo.HuntressBuffULTIMATE");
public static bool isScepterLoaded => ModLoaded("com.DestroyedClone.AncientScepter");
public static bool autosprintLoaded => ModLoaded("com.johnedwa.RTAutoSprintEx");
public static bool acridLungeLoaded => ModLoaded("Withor.AcridBiteLunge");
public static bool ucrLoaded => ModLoaded("HIFU.UltimateCustomRun");
internal static event Action onSwanSongLoaded;
private void BurnReworks()
{
IgnitionTankRework();
}
private void IgnitionTankRework()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(IgniTankBurnChance);
StrengthenBurnUtils.CheckDotForUpgrade += new hook_CheckDotForUpgrade(OverrideIgnitionBurn);
LanguageAPI.Add("ITEM_STRENGTHENBURN_PICKUP", "Your ignite effects deal triple damage.");
LanguageAPI.Add("ITEM_STRENGTHENBURN_DESC", $"Gain <style=cIsDamage>{ignitionTankBurnChance}% ignite chance</style>. " + "All ignition effects deal <style=cIsDamage>+" + Tools.ConvertDecimal(ignitionBurnDamage) + "</style> <style=cStack>(+" + Tools.ConvertDecimal(ignitionBurnDamage) + " per stack)</style> more damage and last <style=cIsUtility>+" + Tools.ConvertDecimal(ignitionBurnDuration) + "</style> <style=cStack>(+" + Tools.ConvertDecimal(ignitionBurnDuration) + " per stack)</style> longer.");
}
private void IgniTankBurnChance(CharacterBody sender, MoreStatHookEventArgs args)
{
Inventory inventory = sender.inventory;
if (Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCountEffective(Items.StrengthenBurn) > 0)
{
args.burnChanceOnHit += (float)ignitionTankBurnChance;
}
}
private void OverrideIgnitionBurn(orig_CheckDotForUpgrade orig, Inventory inventory, ref InflictDotInfo dotInfo)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if ((int)dotInfo.dotIndex != 1 && (int)dotInfo.dotIndex != 2)
{
return;
}
int itemCountEffective = inventory.GetItemCountEffective(Items.StrengthenBurn);
if (itemCountEffective > 0)
{
dotInfo.preUpgradeDotIndex = dotInfo.dotIndex;
dotInfo.dotIndex = (DotIndex)7;
float num = 1f + ignitionBurnDamage * (float)itemCountEffective;
float num2 = 1f + ignitionBurnDuration * (float)itemCountEffective;
if (shouldIgnitionDamageAndDurationCompound)
{
dotInfo.totalDamage *= num * num2;
dotInfo.damageMultiplier *= num;
}
else
{
dotInfo.totalDamage *= num;
dotInfo.damageMultiplier *= num / num2;
}
}
}
public static int GetBurnCount(CharacterBody victimBody)
{
return victimBody.GetBuffCount(Buffs.OnFire) + victimBody.GetBuffCount(Buffs.StrongerBurn);
}
public static bool ModLoaded(string modGuid)
{
return modGuid != "" && Chainloader.PluginInfos.ContainsKey(modGuid);
}
public static bool IsMissileArtifactEnabled()
{
if (ModLoaded("com.RiskOfBrainrot.IAmBecomeMissiles"))
{
return GetMissileArtifactEnabled();
}
return false;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static bool GetMissileArtifactEnabled()
{
return RunArtifactManager.instance.IsArtifactEnabled(MissileReworkPlugin.MissileArtifact);
}
private void Awake()
{
instance = this;
Config.Init();
Log.Init(((BaseUnityPlugin)this).Logger);
ShockUtilsModule.UseShockSparks = true;
Language.Init();
Hooks.Init();
CommonAssets.Init();
Spawnlists.Init();
Materials.SwapShadersFromMaterialsInBundle(mainAssetBundle);
ConfigManager.HandleConfigAttributes(((object)this).GetType(), "SwanSong", Config.MyConfig);
InitializeContent();
InitializeChanges();
SwanSongPlugin.onSwanSongLoaded();
Config.Save();
new ContentPacks().Initialize();
}
public static void DebugBreakpoint(string methodName, int breakpointNumber = -1)
{
Log.DebugBreakpoint(methodName, breakpointNumber);
}
private void CreateExpansionDef()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
expansionDefSS2 = ScriptableObject.CreateInstance<ExpansionDef>();
expansionDefSS2.nameToken = "EXPANSION2R4R_NAME";
expansionDefSS2.descriptionToken = "EXPANSION2R4R_DESCRIPTION";
expansionDefSS2.iconSprite = mainAssetBundle.LoadAsset<Sprite>("Assets/Textures/Icons/texIconExpansionSwanSong.png");
expansionDefSS2.disabledIconSprite = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_Common_MiscIcons.texUnlockIcon_png).WaitForCompletion();
LanguageAPI.Add("EXPANSION2R4R_NAME", "Swan Song");
LanguageAPI.Add("EXPANSION2R4R_DESCRIPTION", "Adds content from the 'Swan Song' expansion to the game.");
Content.AddExpansionDef(expansionDefSS2);
expansionDefSOTS = ScriptableObject.CreateInstance<ExpansionDef>();
expansionDefSOTS.nameToken = "EXPANSIONSOTS_NAME";
expansionDefSOTS.descriptionToken = "EXPANSIONSOTS_DESCRIPTION";
expansionDefSOTS.iconSprite = null;
expansionDefSOTS.disabledIconSprite = null;
}
private void InitializeContent()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
BeginInitializing<ReworkBase>(types, "SwanSongReworks.txt");
BeginInitializing<SkillBase>(types, "SwanSongSkills.txt");
}
private void InitializeChanges()
{
}
private void BeginInitializing<T>(Type[] allTypes, string fileName = "") where T : SharedBase
{
Type baseType = typeof(T);
if (!baseType.IsAbstract)
{
Log.Error(Log.Combine() + "Incorrect BaseType: " + baseType.Name);
return;
}
IEnumerable<Type> source = allTypes.Where((Type type) => !type.IsAbstract && type.IsSubclassOf(baseType));
if (source.Count() <= 0)
{
return;
}
IEnumerable<SharedBase> enumerable = from objType in source
select (T)Activator.CreateInstance(objType) into sharedBase
orderby sharedBase.loadOrder
select sharedBase;
Log.Debug(Log.Combine(baseType.Name) + "Initializing");
foreach (SharedBase item in enumerable)
{
string text = Log.Combine(baseType.Name, item.ConfigName);
if (ValidateBaseType(item))
{
Log.Debug(text + "Validated");
InitializeBaseType(item);
Log.Debug(text + "Initialized");
}
}
if (!string.IsNullOrEmpty(fileName))
{
Language.TryPrintOutput(fileName);
}
}
private bool ValidateBaseType(SharedBase obj)
{
bool isEnabled = obj.isEnabled;
if (obj.forcePrerequisites)
{
return isEnabled && obj.GetPrerequisites();
}
return obj.Bind(isEnabled, "Should This Content Be Enabled") && obj.GetPrerequisites();
}
private void InitializeBaseType(SharedBase obj)
{
obj.Init();
}
public static bool GetConfigBool(bool defaultValue, string packetTitle, string desc = "")
{
return ConfigManager.DualBindToConfig(packetTitle, Config.MyConfig, "Should This Content Be Enabled", defaultValue, desc);
}
public static Sprite TryLoadSpriteFromBundle(string path, AssetBundle assetBundle = null, bool fallBackOnWrench = false)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Sprite val = SwanSongPlugin.TryLoadFromBundle<Sprite>(path, assetBundle);
if (Object.op_Implicit((Object)(object)val))
{
return val;
}
return Addressables.LoadAssetAsync<Sprite>((object)(fallBackOnWrench ? RoR2_Base_Core.texNullIcon_png : RoR2_Base_Common_MiscIcons.texWIPIcon_png)).WaitForCompletion();
}
public static T TryLoadFromBundle<T>(string path, AssetBundle assetBundle = null) where T : Object
{
if ((Object)(object)assetBundle == (Object)null)
{
assetBundle = mainAssetBundle;
}
if (Object.op_Implicit((Object)(object)assetBundle) && !string.IsNullOrWhiteSpace(path) && assetBundle.Contains(path))
{
return assetBundle.LoadAsset<T>(path);
}
return default(T);
}
public static AssetReferenceT<T> LoadAsync<T>(string guid, Action<T> callback) where T : Object
{
//IL_0018: 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_0040: Unknown result type (might be due to invalid IL or missing references)
AssetReferenceT<T> val = new AssetReferenceT<T>(guid);
AsyncOperationHandle<T> handle2 = AssetAsyncReferenceManager<T>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
if (callback == null)
{
return val;
}
if (handle2.IsDone)
{
onCompleted(handle2);
return val;
}
handle2.Completed += onCompleted;
return val;
void onCompleted(AsyncOperationHandle<T> handle)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
if (handle.Result == null || (int)handle.Status != 1)
{
Debug.LogError((object)$"Failed to load asset [{handle.DebugName}] : {handle.OperationException}");
}
else
{
callback(handle.Result);
}
}
}
public static void RemoveCraftingRecipe(string guid)
{
SwanSongPlugin.LoadAsync<CraftableDef>(guid, (Action<CraftableDef>)delegate(CraftableDef craftableDef)
{
craftableDef.recipes = (Recipe[])(object)new Recipe[0];
});
}
public static void RetierItemAsync(string itemGuid, ItemTier tier = 5, Action<ItemDef> callback = null)
{
//IL_0007: 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_001e: 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)
AssetReferenceT<ItemDef> val = new AssetReferenceT<ItemDef>(itemGuid);
AsyncOperationHandle<ItemDef> val2 = AssetAsyncReferenceManager<ItemDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<ItemDef> ctx)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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)
ItemDef result = ctx.Result;
result.tier = tier;
result.deprecatedTier = tier;
if (callback != null)
{
callback(result);
}
};
}
public static void RemoveEquipmentAsync(string equipmentGuid, Action<EquipmentDef> callback = null)
{
//IL_0017: 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)
AssetReferenceT<EquipmentDef> val = new AssetReferenceT<EquipmentDef>(equipmentGuid);
AsyncOperationHandle<EquipmentDef> val2 = AssetAsyncReferenceManager<EquipmentDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EquipmentDef> ctx)
{
EquipmentDef result = ctx.Result;
result.canDrop = false;
result.canBeRandomlyTriggered = false;
result.enigmaCompatible = false;
result.dropOnDeathChance = 0f;
if (callback != null)
{
callback(result);
}
};
}
internal static void BlacklistSingleItem(ItemDef itemDef, ItemTag itemTag = 4)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)itemDef != (Object)null)
{
List<ItemTag> list = new List<ItemTag>(itemDef.tags);
list.Add(itemTag);
itemDef.tags = list.ToArray();
}
else
{
Log.Error("ItemDef null - unable to blacklist");
}
}
internal static void BlacklistSingleItem(string name, ItemTag itemTag = 4)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
ItemDef itemDef = LoadItemDef(name);
BlacklistSingleItem(itemDef, itemTag);
}
public static void ChangeBuffStacking(string buffName, bool canStack)
{
BuffDef val = LoadBuffDef(buffName);
if ((Object)(object)val != (Object)null)
{
val.canStack = canStack;
}
}
private static ItemDef LoadItemDef(string name)
{
return LegacyResourcesAPI.Load<ItemDef>("ItemDefs/" + name);
}
private static EquipmentDef LoadEquipDef(string name)
{
return LegacyResourcesAPI.Load<EquipmentDef>("EquipmentDefs/" + name);
}
private static BuffDef LoadBuffDef(string name)
{
return LegacyResourcesAPI.Load<BuffDef>("BuffDefs/" + name);
}
}
internal static class Log
{
public static bool enableDebugging;
internal static ManualLogSource _logSource;
public static void DebugBreakpoint(string methodName, int breakpointNumber = -1)
{
string text = "SpareChange: " + methodName + " IL hook failed!";
if (breakpointNumber >= 0)
{
text += $" (breakpoint {breakpointNumber})";
}
Error(text);
}
internal static void Init(ManualLogSource logSource)
{
enableDebugging = ConfigManager.DualBindToConfig("Swan Song", Config.MyConfig, "Enable Debugging", defaultValue: false, "Enable debug outputs to the log for troubleshooting purposes. Enabling this will slow down the game.");
_logSource = logSource;
}
internal static string Combine(params string[] parameters)
{
string text = "SpareChange : ";
foreach (string text2 in parameters)
{
text = text + text2 + " : ";
}
return text;
}
internal static void Debug(object data)
{
if (enableDebugging)
{
_logSource.LogDebug(data);
}
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void ErrorAssetBundle(string assetName, string bundleName)
{
Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
public abstract class SharedBase
{
public virtual int loadOrder => 0;
public virtual bool forcePrerequisites { get; } = false;
public abstract string ConfigName { get; }
public virtual bool isEnabled { get; } = true;
public static ManualLogSource Logger => Log._logSource;
public abstract AssetBundle assetBundle { get; }
public abstract void Hooks();
public abstract void Lang();
public virtual bool GetPrerequisites()
{
return true;
}
public virtual void Init()
{
ConfigManager.HandleConfigAttributes(GetType(), ConfigName, Config.MyConfig);
Hooks();
Lang();
SwanSongPlugin.onSwanSongLoaded += PostInit;
}
public T Bind<T>(T defaultValue, string configName, string configDesc = "")
{
return ConfigManager.DualBindToConfig(ConfigName, Config.MyConfig, configName, defaultValue, configDesc);
}
public virtual void PostInit()
{
}
public static float GetHyperbolic(float firstStack, float cap, float chance)
{
if (firstStack >= cap)
{
return cap * (chance / firstStack);
}
float num = chance / firstStack;
float num2 = 100f * firstStack / (cap - firstStack);
return cap * (1f - 100f / (num * num2 + 100f));
}
public static ExpansionDef SotvExpansionDef()
{
//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)
return Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
}
}
public static class Extensions
{
public static bool InteractableIsPermittedForSpawn(this GameObject interactableObject, bool disallowPickups = true)
{
if ((Object)(object)interactableObject == (Object)null)
{
return false;
}
InteractionProcFilter val = default(InteractionProcFilter);
if (interactableObject.TryGetComponent<InteractionProcFilter>(ref val))
{
return val.shouldAllowOnInteractionBeginProc;
}
PurchaseInteraction val2 = default(PurchaseInteraction);
if (interactableObject.TryGetComponent<PurchaseInteraction>(ref val2))
{
return !val2.disableSpawnOnInteraction;
}
DelusionChestController val3 = default(DelusionChestController);
if (interactableObject.TryGetComponent<DelusionChestController>(ref val3))
{
PickupPickerController val4 = default(PickupPickerController);
if (interactableObject.TryGetComponent<PickupPickerController>(ref val4) && ((Behaviour)val4).enabled)
{
return false;
}
return true;
}
GenericPickupController val5 = default(GenericPickupController);
if (interactableObject.TryGetComponent<GenericPickupController>(ref val5))
{
return disallowPickups || val5.Duplicated;
}
if (Object.op_Implicit((Object)(object)interactableObject.GetComponent<VehicleSeat>()))
{
return false;
}
if (Object.op_Implicit((Object)(object)interactableObject.GetComponent<NetworkUIPromptController>()))
{
return false;
}
PowerPedestal val6 = default(PowerPedestal);
if (interactableObject.TryGetComponent<PowerPedestal>(ref val6))
{
return val6.CanTriggerFireworks;
}
AccessCodesNodeController val7 = default(AccessCodesNodeController);
if (interactableObject.TryGetComponent<AccessCodesNodeController>(ref val7))
{
return val7.CheckInteractionOrder();
}
return true;
}
public static GameObject FixItemModel(this GameObject prefab)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)prefab == (Object)null)
{
prefab = Resources.Load<GameObject>("prefabs/NullModel");
}
ModelPanelParameters val = prefab.AddComponent<ModelPanelParameters>();
val.minDistance = 1f;
val.maxDistance = 15f;
Transform val2 = prefab.transform.Find("FocusPos");
if ((Object)(object)val2 == (Object)null)
{
GameObject val3 = new GameObject("FocusPos");
val2 = val3.transform;
val2.parent = prefab.transform;
val2.localPosition = Vector3.zero;
}
val.focusPointTransform = val2;
Transform val4 = prefab.transform.Find("CameraPos");
if ((Object)(object)val4 == (Object)null)
{
GameObject val5 = new GameObject("CameraPos");
val4 = val5.transform;
val4.parent = prefab.transform;
val4.SetPositionAndRotation(val2.position + Vector3.forward * -7f + Vector3.right * -1f, val4.rotation);
}
val.cameraPositionTransform = val4;
return prefab;
}
public static string AsPercent(this float d)
{
return d * 100f + "%";
}
public static void AddPersistentListener(this HoldoutZoneControllerChargedUnityEvent unityEvent, UnityAction<HoldoutZoneController> action)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls;
PersistentCall val = new PersistentCall();
ref Object target = ref val.m_Target;
object? target2 = ((Delegate)(object)action).Target;
target = (Object)((target2 is Object) ? target2 : null);
val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName);
val.m_MethodName = ((Delegate)(object)action).Method.Name;
val.m_CallState = (UnityEventCallState)2;
val.m_Mode = (PersistentListenerMode)0;
persistentCalls.AddListener(val);
}
public static void AddPersistentListener(this UnityEvent<Interactor> unityEvent, UnityAction<Interactor> action)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls;
PersistentCall val = new PersistentCall();
ref Object target = ref val.m_Target;
object? target2 = ((Delegate)(object)action).Target;
target = (Object)((target2 is Object) ? target2 : null);
val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName);
val.m_MethodName = ((Delegate)(object)action).Method.Name;
val.m_CallState = (UnityEventCallState)2;
val.m_Mode = (PersistentListenerMode)0;
persistentCalls.AddListener(val);
}
public static void AddPersistentListener(this UnityEvent<CharacterMaster> unityEvent, UnityAction<CharacterMaster> action)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls;
PersistentCall val = new PersistentCall();
ref Object target = ref val.m_Target;
object? target2 = ((Delegate)(object)action).Target;
target = (Object)((target2 is Object) ? target2 : null);
val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName);
val.m_MethodName = ((Delegate)(object)action).Method.Name;
val.m_CallState = (UnityEventCallState)2;
val.m_Mode = (PersistentListenerMode)0;
persistentCalls.AddListener(val);
}
public static void AddPersistentListener(this UnityEvent<GameObject> unityEvent, UnityAction<GameObject> action)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls;
PersistentCall val = new PersistentCall();
ref Object target = ref val.m_Target;
object? target2 = ((Delegate)(object)action).Target;
target = (Object)((target2 is Object) ? target2 : null);
val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName);
val.m_MethodName = ((Delegate)(object)action).Method.Name;
val.m_CallState = (UnityEventCallState)2;
val.m_Mode = (PersistentListenerMode)0;
persistentCalls.AddListener(val);
}
}
public static class Tools
{
public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons");
public static AssetBundle LoadAssetBundle(byte[] resourceBytes)
{
if (resourceBytes == null)
{
throw new ArgumentNullException("resourceBytes");
}
return AssetBundle.LoadFromMemory(resourceBytes);
}
public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName)
{
return $"@{plugin.Info.Metadata.Name}+{bundleName}";
}
internal static bool isLoaded(string modguid)
{
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
string key = pluginInfo.Key;
PluginInfo value = pluginInfo.Value;
if (key == modguid)
{
return true;
}
}
return false;
}
internal static string ConvertDecimal(float d)
{
return d * 100f + "%";
}
internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
Renderer val2 = val;
if (string.Equals(((Object)val).name, childObject))
{
if (color == Color.clear)
{
Object.Destroy((Object)(object)val);
break;
}
if ((Object)(object)material == (Object)null)
{
material = new Material(val.material);
material.mainTexture = val.material.mainTexture;
material.shader = val.material.shader;
material.color = color;
}
val.material = material;
Transform transform = ((Component)val).transform;
transform.localScale *= scaleMultiplier;
if (!replaceAll)
{
break;
}
}
}
}
internal static void DebugMaterial(GameObject model)
{
Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
Renderer val2 = val;
Debug.Log((object)("Material: " + ((Object)val2).name.ToString()));
}
}
internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
ParticleSystem[] array = componentsInChildren;
foreach (ParticleSystem val in array)
{
ParticleSystem val2 = val;
MainModule main = val2.main;
ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
ColorBySpeedModule colorBySpeed = val2.colorBySpeed;
if (string.Equals(((Object)val2).name, childObject))
{
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier;
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color);
((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color);
if (!replaceAll)
{
break;
}
}
}
}
internal static void DebugParticleSystem(GameObject model)
{
ParticleSystem[] components = model.GetComponents<ParticleSystem>();
ParticleSystem[] array = components;
foreach (ParticleSystem val in array)
{
ParticleSystem val2 = val;
Debug.Log((object)("Particle: " + ((Object)val2).name.ToString()));
}
}
internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
Light[] componentsInChildren = model.GetComponentsInChildren<Light>();
Light[] array = componentsInChildren;
foreach (Light val in array)
{
Light val2 = val;
if (string.Equals(((Object)val2).name, childObject))
{
val2.color = color;
if (!replaceAll)
{
break;
}
}
}
}
internal static void DebugLight(GameObject model)
{
Light[] componentsInChildren = model.GetComponentsInChildren<Light>();
Light[] array = componentsInChildren;
foreach (Light val in array)
{
Light val2 = val;
Debug.Log((object)("Light: " + ((Object)val2).name.ToString()));
}
}
public static void ClearDotStacksForType(this DotController dotController, DotIndex dotIndex)
{
//IL_001e: 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)
for (int num = dotController.dotStackList.Count - 1; num >= 0; num--)
{
if (dotController.dotStackList[num].dotIndex == dotIndex)
{
dotController.RemoveDotStackAtServer(num);
}
}
}
public static void ApplyCooldownScale(GenericSkill skillSlot, float cooldownScale)
{
if ((Object)(object)skillSlot != (Object)null)
{
skillSlot.cooldownScale *= cooldownScale;
}
}
public static int CountOverspillTriangular(float totalValue, float incrementor = 1f)
{
int num = 0;
while (totalValue > 0f)
{
num++;
totalValue -= incrementor * (float)num;
}
return num;
}
public static int CountOverspillFibonacci(float totalValue, float thresholdScale = 1f, int startingIndex = 1)
{
int num = 1;
int num2 = 1;
int num3 = 0;
while (totalValue > (float)num2 * thresholdScale)
{
num2 += num;
num = num2 - num;
if (num3 > startingIndex)
{
num3++;
}
}
return num3;
}
}
}
namespace SwanSongExtended.Modules
{
public static class CommonAssets
{
private static AssetBundle _mainAssetBundle;
private static AssetBundle _retierAssetBundle;
public static string dropPrefabsPath = "Assets/Models/DropPrefabs";
public static string iconsPath = "Assets/Textures/Icons/";
public static string eliteMaterialsPath = "Assets/Textures/Materials/Elite/";
public static string executeKeywordToken = "DUCK_EXECUTION_KEYWORD";
public static float survivorExecuteThreshold = 0.15f;
public static float banditExecutionThreshold = 0.1f;
public static float harvestExecutionThreshold = 0.2f;
public static BuffDef bossHunterDebuffWithScalpel;
public static GameObject meatballNapalmPool;
public static AssetBundle mainAssetBundle
{
get
{
if ((Object)(object)_mainAssetBundle == (Object)null)
{
_mainAssetBundle = Assets.LoadAssetBundle("itmightbebad");
}
return _mainAssetBundle;
}
set
{
_mainAssetBundle = value;
}
}
public static AssetBundle retierAssetBundle
{
get
{
if ((Object)(object)_retierAssetBundle == (Object)null)
{
_retierAssetBundle = Assets.LoadAssetBundle("retier");
}
return _retierAssetBundle;
}
set
{
_retierAssetBundle = value;
}
}
public static void Init()
{
CreateMeatballNapalmPool();
AddTrophyHunterDebuffs();
}
private static void AddTrophyHunterDebuffs()
{
//IL_000b: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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)
bossHunterDebuffWithScalpel = Content.CreateAndAddBuff("bdTrophyHunterScalpelDebuff", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/LunarSkillReplacements/texBuffLunarDetonatorIcon.tif").WaitForCompletion(), new Color(0.2f, 0.9f, 0.8f, 1f), canStack: false, isDebuff: true, (StackingDisplayMethod)0);
BuffDef obj = bossHunterDebuffWithScalpel;
obj.flags = (Flags)(obj.flags | 1);
}
private static void CreateMeatballNapalmPool()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: 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_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
meatballNapalmPool = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/beetlequeenacid"), "NapalmFire", true);
Color val = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)120, (byte)0, byte.MaxValue));
Transform val2 = meatballNapalmPool.transform.Find("FX/Decal");
Material val3 = new Material(((Component)val2).GetComponent<Decal>().Material);
val3.SetColor("_Color", val);
((Component)val2).GetComponent<Decal>().Material = val3;
ProjectileDotZone component = meatballNapalmPool.GetComponent<ProjectileDotZone>();
component.lifetime = 5f;
component.fireFrequency = 2f;
component.damageCoefficient = 0.5f;
component.overlapProcCoefficient = 0.5f;
component.attackerFiltering = (AttackerFiltering)0;
meatballNapalmPool.GetComponent<ProjectileDamage>().damageType = DamageTypeCombo.op_Implicit((DamageType)128);
meatballNapalmPool.GetComponent<ProjectileController>().procCoefficient = 1f;
float num = 2.5f;
meatballNapalmPool.GetComponent<Transform>().localScale = new Vector3(num, num, num);
Transform val4 = meatballNapalmPool.transform.Find("FX");
((Component)val4.Find("Spittle")).gameObject.SetActive(false);
GameObject val5 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("prefabs/FireTrail").GetComponent<DamageTrail>().segmentPrefab, ((Component)val4).transform);
MainModule main = val5.GetComponent<ParticleSystem>().main;
((MainModule)(ref main)).duration = 8f;
((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.075f);
MinMaxCurve startSizeX = ((MainModule)(ref main)).startSizeX;
((MinMaxCurve)(ref startSizeX)).constantMin = ((MinMaxCurve)(ref startSizeX)).constantMin * 0.6f;
((MinMaxCurve)(ref startSizeX)).constantMax = ((MinMaxCurve)(ref startSizeX)).constantMax * 0.8f;
MinMaxCurve startSizeY = ((MainModule)(ref main)).startSizeY;
((MinMaxCurve)(ref startSizeY)).constantMin = ((MinMaxCurve)(ref startSizeY)).constantMin * 0.8f;
((MinMaxCurve)(ref startSizeY)).constantMax = ((MinMaxCurve)(ref startSizeY)).constantMax * 1f;
MinMaxCurve startSizeZ = ((MainModule)(ref main)).startSizeZ;
((MinMaxCurve)(ref startSizeZ)).constantMin = ((MinMaxCurve)(ref startSizeZ)).constantMin * 0.6f;
((MinMaxCurve)(ref startSizeZ)).constantMax = ((MinMaxCurve)(ref startSizeZ)).constantMax * 0.8f;
MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
((MinMaxCurve)(ref startLifetime)).constantMin = 0.9f;
((MinMaxCurve)(ref startLifetime)).constantMax = 1.1f;
((Behaviour)val5.GetComponent<DestroyOnTimer>()).enabled = false;
val5.transform.localPosition = Vector3.zero;
val5.transform.localPosition = Vector3.zero;
val5.transform.localScale = Vector3.one;
ShapeModule shape = val5.GetComponent<ParticleSystem>().shape;
((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
((ShapeModule)(ref shape)).scale = Vector3.one * 0.5f;
GameObject gameObject = ((Component)val4.Find("Point Light")).gameObject;
Light component2 = gameObject.GetComponent<Light>();
component2.color = new Color(1f, 0.5f, 0f);
component2.intensity = 6f;
component2.range = 12f;
Content.AddProjectilePrefab(meatballNapalmPool);
}
}
public class CustomRendererInfo
{
public string childName;
public Material material = null;
public bool dontHotpoo = false;
public bool ignoreOverlays = false;
}
internal static class Assets
{
internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>();
internal static AssetBundle LoadAssetBundle(string bundleName)
{
if (loadedBundles.ContainsKey(bundleName))
{
return loadedBundles[bundleName];
}
AssetBundle val = null;
val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)SwanSongPlugin.instance).Info.Location), bundleName));
loadedBundles[bundleName] = val;
return val;
}
internal static GameObject CloneTracer(string originalTracerName, string newTracerName)
{
if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null)
{
return null;
}
GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true);
if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>()))
{
val.AddComponent<EffectComponent>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>()))
{
val.AddComponent<VFXAttributes>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
{
val.AddComponent<NetworkIdentity>();
}
val.GetComponent<Tracer>().speed = 250f;
val.GetComponent<Tracer>().length = 50f;
Content.CreateAndAddEffectDef(val);
return val;
}
internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
{
if (!Object.op_Implicit((Object)(object)objectToConvert))
{
return;
}
MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val in componentsInChildren)
{
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
{
((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo();
}
}
SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
{
if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial))
{
((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo();
}
}
}
internal static GameObject LoadCrosshair(string crosshairName)
{
GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
if ((Object)(object)val == (Object)null)
{
Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard");
return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
}
return val;
}
internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform)
{
return assetBundle.LoadEffect(resourceName, "", parentToTransform);
}
internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = assetBundle.LoadAsset<GameObject>(resourceName);
if (!Object.op_Implicit((Object)(object)val))
{
Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name);
return null;
}
val.AddComponent<DestroyOnTimer>().duration = 12f;
val.AddComponent<NetworkIdentity>();
val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
EffectComponent val2 = val.AddComponent<EffectComponent>();
val2.applyScale = false;
val2.effectIndex = (EffectIndex)(-1);
val2.parentToReferencedTransform = parentToTransform;
val2.positionAtReferencedTransform = true;
val2.soundName = soundName;
Content.CreateAndAddEffectDef(val);
return val;
}
internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName)
{
GameObject val = assetBundle.LoadAsset<GameObject>(ghostName);
if ((Object)(object)val == (Object)null)
{
Log.Error("Failed to load ghost prefab " + ghostName);
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
{
val.AddComponent<NetworkIdentity>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>()))
{
val.AddComponent<ProjectileGhostController>();
}
ConvertAllRenderersToHopooShader(val);
return val;
}
internal static GameObject CreateProjectileGhostPrefab(GameObject ghostObject, string newName)
{
if ((Object)(object)ghostObject == (Object)null)
{
Log.Error("Failed to load ghost prefab " + ((Object)ghostObject).name);
}
GameObject val = PrefabAPI.InstantiateClone(ghostObject, newName);
if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
{
val.AddComponent<NetworkIdentity>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>()))
{
val.AddComponent<ProjectileGhostController>();
}
return val;
}
internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName)
{
return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName);
}
internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName)
{
GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName);
if ((Object)(object)val == (Object)null)
{
Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name);
return null;
}
Content.AddProjectilePrefab(val);
return val;
}
}
internal static class Prefabs
{
private static PhysicMaterial ragdollMaterial;
public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab)
{
GameObject val = assetBundle.LoadAsset<GameObject>(displayPrefabName);
if ((Object)(object)val == (Object)null)
{
Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name);
return null;
}
CharacterModel val2 = val.GetComponent<CharacterModel>();
if (!Object.op_Implicit((Object)(object)val2))
{
val2 = val.AddComponent<CharacterModel>();
}
val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos;
Assets.ConvertAllRenderersToHopooShader(val);
return val;
}
public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy)
{
CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy);
}
public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy)
{
GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true);
val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab;
Content.AddMasterPrefab(val);
return val;
}
public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName)
{
GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/CommandoMonsterMaster"), masterName, true);
ContentPacks.masterPrefabs.Add(val);
CharacterMaster component = val.GetComponent<CharacterMaster>();
component.bodyPrefab = bodyPrefab;
AISkillDriver[] components = val.GetComponents<AISkillDriver>();
for (int i = 0; i < components.Length; i++)
{
Object.Destroy((Object)(object)components[i]);
}
return val;
}
public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = assetBundle.LoadAsset<GameObject>(assetName);
BaseAI val2 = val.GetComponent<BaseAI>();
if ((Object)(object)val2 == (Object)null)
{
val2 = val.AddComponent<BaseAI>();
val2.aimVectorDampTime = 0.1f;
val2.aimVectorMaxSpeed = 360f;
}
val2.scanState = new SerializableEntityStateType(typeof(Wander));
EntityStateMachine component = val.GetComponent<EntityStateMachine>();
if ((Object)(object)component == (Object)null)
{
AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander));
}
val2.stateMachine = component;
CharacterMaster val3 = val.GetComponent<CharacterMaster>();
if ((Object)(object)val3 == (Object)null)
{
val3 = val.AddComponent<CharacterMaster>();
}
val3.bodyPrefab = bodyPrefab;
val3.teamIndex = (TeamIndex)2;
Content.AddMasterPrefab(val);
return val;
}
public static void ClearEntityStateMachines(GameObject bodyPrefab)
{
EntityStateMachine[] components = bodyPrefab.GetComponents<EntityStateMachine>();
for (int num = components.Length - 1; num >= 0; num--)
{
Object.DestroyImmediate((Object)(object)components[num]);
}
NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>();
component.stateMachines = Array.Empty<EntityStateMachine>();
CharacterDeathBehavior component2 = bodyPrefab.GetComponent<CharacterDeathBehavior>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.idleStateMachine = Array.Empty<EntityStateMachine>();
}
SetStateOnHurt component3 = bodyPrefab.GetComponent<SetStateOnHurt>();
if (Object.op_Implicit((Object)(object)component3))
{
component3.idleStateMachine = Array.Empty<EntityStateMachine>();
}
}
public static void AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null)
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName);
if ((Object)(object)val == (Object)null)
{
val = bodyPrefab.AddComponent<EntityStateMachine>();
}
else
{
Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing.");
}
val.customName = machineName;
if (mainStateType == null)
{
mainStateType = typeof(GenericCharacterMain);
}
val.mainStateType = new SerializableEntityStateType(mainStateType);
if (initalStateType == null)
{
initalStateType = typeof(SpawnTeleporterState);
}
val.initialStateType = new SerializableEntityStateType(initalStateType);
NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>();
if (Object.op_Implicit((Object)(object)component))
{
component.stateMachines = component.stateMachines.Append(val).ToArray();
}
CharacterDeathBehavior component2 = bodyPrefab.GetComponent<CharacterDeathBehavior>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.deathStateMachine = val;
}
SetStateOnHurt component3 = bodyPrefab.GetComponent<SetStateOnHurt>();
if (Object.op_Implicit((Object)(object)component3))
{
component3.targetStateMachine = val;
}
}
public static void AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null)
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName);
if ((Object)(object)val == (Object)null)
{
val = prefab.AddComponent<EntityStateMachine>();
}
else
{
Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing.");
}
val.customName = machineName;
if (mainStateType == null)
{
mainStateType = typeof(Idle);
}
val.mainStateType = new SerializableEntityStateType(mainStateType);
if (initalStateType == null)
{
initalStateType = typeof(Idle);
}
val.initialStateType = new SerializableEntityStateType(initalStateType);
NetworkStateMachine component = prefab.GetComponent<NetworkStateMachine>();
if (Object.op_Implicit((Object)(object)component))
{
component.stateMachines = component.stateMachines.Append(val).ToArray();
}
CharacterDeathBehavior component2 = prefab.GetComponent<CharacterDeathBehavior>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray();
}
SetStateOnHurt component3 = prefab.GetComponent<SetStateOnHurt>();
if (Object.op_Implicit((Object)(object)component3))
{
component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray();
}
}
public static void SetupHitBoxGroup(GameObject modelPrefab, string hitBoxGroupName, params string[] hitboxChildNames)
{
ChildLocator component = modelPrefab.GetComponent<ChildLocator>();
Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length];
for (int i = 0; i < hitboxChildNames.Length; i++)
{
array[i] = component.FindChild(hitboxChildNames[i]);
if ((Object)(object)array[i] == (Object)null)
{
Log.Error("missing hitbox for " + hitboxChildNames[i]);
}
}
SetupHitBoxGroup(modelPrefab, hitBoxGroupName, array);
}
public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms)
{
List<HitBox> list = new List<HitBox>();
foreach (Transform val in hitBoxTransforms)
{
if ((Object)(object)val == (Object)null)
{
Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null");
continue;
}
HitBox item = ((Component)val).gameObject.AddComponent<HitBox>();
((Component)val).gameObject.layer = LayerIndex.projectile.intVal;
list.Add(item);
}
if (list.Count == 0)
{
Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName);
return;
}
HitBoxGroup val2 = prefab.AddComponent<HitBoxGroup>();
val2.hitBoxes = list.ToArray();
val2.groupName = hitBoxGroupName;
}
}
internal static class Materials
{
private static List<Material> cachedMaterials = new List<Material>();
internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");
public static List<Material> MaterialsWithSwappedShaders { get; } = new List<Material>();
internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
Renderer val2 = val;
if (string.Equals(((Object)val).name, childObject))
{
if (color == Color.clear)
{
Object.Destroy((Object)(object)val);
break;
}
if ((Object)(object)material == (Object)null)
{
material = new Material(val.material);
material.mainTexture = val.material.mainTexture;
material.shader = val.material.shader;
material.color = color;
}
val.material = material;
Transform transform = ((Component)val).transform;
transform.localScale *= scaleMultiplier;
if (!replaceAll)
{
break;
}
}
}
}
internal static void DebugMaterial(GameObject model)
{
Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
Renderer val2 = val;
Debug.Log((object)("Material: " + ((Object)val2).name.ToString()));
}
}
public static void SwapShadersFromMaterialsInBundle(AssetBundle bundle)
{
SwapAllShaders(bundle);
}
internal static void SwapAllShaders(AssetBundle assetBundle)
{
Material[] array = assetBundle.LoadAllAssets<Material>();
foreach (Material val in array)
{
Log.Debug("Trying to swap shader for " + ((Object)val).name);
TrySwapShader(val);
}
}
internal static void TrySwapShader(Material material)
{
//IL_0039: 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_0105: Unknown result type (might be due to invalid IL or missing references)
string name = ((Object)material.shader).name;
if (name.Contains("Stubbed"))
{
name = name.Replace("Stubbed", string.Empty) + ".shader";
Shader val = Addressables.LoadAssetAsync<Shader>((object)name).WaitForCompletion();
if ((Object)(object)val != (Object)null)
{
material.shader = val;
}
else
{
Log.Error("Failed to load shader " + name);
}
}
else if (name == "Standard")
{
Texture texture = material.GetTexture("_BumpMap");
float @float = material.GetFloat("_BumpScale");
Texture texture2 = material.GetTexture("_EmissionMap");
material.shader = Resources.Load<Shader>("Shaders/Deferred/HGStandard");
material.SetTexture("_NormalMap", texture);
material.SetFloat("_NormalStrength", @float);
material.SetTexture("_EmTex", texture2);
material.SetColor("_EmColor", new Color(0.2f, 0.2f, 0.2f));
material.SetFloat("_EmPower", 0.15f);
}
}
private static void SwapShader(Material material)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
string text = ((Object)material.shader).name.Substring("Stubbed".Length);
string text2 = text + ".shader";
Shader shader = Addressables.LoadAssetAsync<Shader>((object)text2).WaitForCompletion();
material.shader = shader;
MaterialsWithSwappedShaders.Add(material);
}
public static Material LoadMaterial(this AssetBundle assetBundle, string materialName)
{
return assetBundle.CreateHopooMaterialFromBundle(materialName);
}
public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
Material val = cachedMaterials.Find(delegate(Material mat)
{
materialName.Replace(" (Instance)", "");
return ((Object)mat).name.Contains(materialName);
});
if (Object.op_Implicit((Object)(object)val))
{
Log.Debug(((Object)val).name + " has already been loaded. returning cached");
return val;
}
val = assetBundle.LoadAsset<Material>(materialName);
if (!Object.op_Implicit((Object)(object)val))
{
Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name);
return new Material(hotpoo);
}
return val.ConvertDefaultShaderToHopoo();
}
public static Material SetHopooMaterial(this Material tempMat)
{
return tempMat.ConvertDefaultShaderToHopoo();
}
public static Material ConvertDefaultShaderToHopoo(this Material tempMat)
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
if (cachedMaterials.Contains(tempMat))
{
Log.Debug(((Object)tempMat).name + " has already been loaded. returning cached");
return tempMat;
}
float? num = null;
Color? val = null;
if (tempMat.IsKeywordEnabled("_NORMALMAP"))
{
num = tempMat.GetFloat("_BumpScale");
}
if (tempMat.IsKeywordEnabled("_EMISSION"))
{
val = tempMat.GetColor("_EmissionColor");
}
tempMat.shader = hotpoo;
tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap"));
tempMat.EnableKeyword("DITHER");
if (num.HasValue)
{
tempMat.SetFloat("_NormalStrength", num.Value);
tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap"));
}
if (val.HasValue)
{
tempMat.SetColor("_EmColor", val.Value);
tempMat.SetFloat("_EmPower", 1f);
}
if (tempMat.IsKeywordEnabled("NOCULL"))
{
tempMat.SetInt("_Cull", 0);
}
if (tempMat.IsKeywordEnabled("LIMBREMOVAL"))
{
tempMat.SetInt("_LimbRemovalOn", 1);
}
cachedMaterials.Add(tempMat);
return tempMat;
}
public static Material MakeUnique(this Material material)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (cachedMaterials.Contains(material))
{
return new Material(material);
}
return material;
}
public static Material SetColor(this Material material, Color color)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
material.SetColor("_Color", color);
return material;
}
public static Material SetNormal(this Material material, float normalStrength = 1f)
{
material.SetFloat("_NormalStrength", normalStrength);
return material;
}
public static Material SetEmission(this Material material)
{
return material.SetEmission(1f);
}
public static Material SetEmission(this Material material, float emission)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return material.SetEmission(emission, Color.white);
}
public static Material SetEmission(this Material material, float emission, Color emissionColor)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
material.SetFloat("_EmPower", emission);
material.SetColor("_EmColor", emissionColor);
return material;
}
public static Material SetCull(this Material material, bool cull = false)
{
material.SetInt("_Cull", cull ? 1 : 0);
return material;
}
public static Material SetSpecular(this Material material, float strength)
{
material.SetFloat("_SpecularStrength", strength);
return material;
}
public static Material SetSpecular(this Material material, float strength, float exponent)
{
material.SetFloat("_SpecularStrength", strength);
material.SetFloat("SpecularExponent", exponent);
return material;
}
}
internal static class Particles
{
internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
ParticleSystem[] array = componentsInChildren;
foreach (ParticleSystem val in array)
{
ParticleSystem val2 = val;
MainModule main = val2.main;
ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
ColorBySpeedModule colorBySpeed = val2.colorBySpeed;
if (string.Equals(((Object)val2).name, childObject))
{
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier;
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color);
((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color);
if (!replaceAll)
{
break;
}
}
}
}
internal static void DebugParticleSystem(GameObject model)
{
ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
ParticleSystem[] array = componentsInChildren;
foreach (ParticleSystem val in array)
{
ParticleSystem val2 = val;
Debug.Log((object)("Particle: " + ((Object)val2).name.ToString()));
}
}
}
internal class Content
{
internal static void AddExpansionDef(ExpansionDef expansion)
{
ContentPacks.expansionDefs.Add(expansion);
}
internal static void AddCharacterBodyPrefab(GameObject bprefab)
{
ContentPacks.bodyPrefabs.Add(bprefab);
}
internal static void AddMasterPrefab(GameObject prefab)
{
ContentPacks.masterPrefabs.Add(prefab);
}
internal static void AddProjectilePrefab(GameObject prefab)
{
ContentPacks.projectilePrefabs.Add(prefab);
}
internal static void AddSurvivorDef(SurvivorDef survivorDef)
{
ContentPacks.survivorDefs.Add(survivorDef);
}
internal static void AddVoidItemRelationship(ItemDef itemToCorrupt, ItemDef itemThatCorrupts)
{
//IL_002a: 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)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
ItemRelationshipProvider val = ScriptableObject.CreateInstance<ItemRelationshipProvider>();
((Object)val).name = ((Object)itemThatCorrupts).name + ((Object)itemToCorrupt).name + "Relationship";
val.relationshipType = Addressables.LoadAssetAsync<ItemRelationshipType>((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion();
val.relationships = (Pair[])(object)new Pair[1]
{
new Pair
{
itemDef1 = itemToCorrupt,
itemDef2 = itemThatCorrupts
}
};
ContentPacks.itemRelationships.Add(val);
}
internal static void AddItemDef(ItemDef itemDef)
{
ContentPacks.itemDefs.Add(itemDef);
}
internal static void AddEliteDef(EliteDef eliteDef)
{
ContentPacks.eliteDefs.Add(eliteDef);
}
internal static void AddArtifactDef(ArtifactDef artifactDef)
{
ContentPacks.artifactDefs.Add(artifactDef);
}
internal static void AddNetworkedObjectPrefab(GameObject prefab)
{
ContentPacks.networkedObjectPrefabs.Add(prefab);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>();
val.bodyPrefab = bodyPrefab;
val.displayPrefab = displayPrefab;
val.primaryColor = charColor;
val.cachedName = ((Object)bodyPrefab).name.Replace("Body", "");
val.displayNameToken = tokenPrefix + "NAME";
val.descriptionToken = tokenPrefix + "DESCRIPTION";
val.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR";
val.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE";
val.desiredSortPosition = sortPosition;
val.unlockableDef = unlockableDef;
AddSurvivorDef(val);
}
internal static void AddUnlockableDef(UnlockableDef unlockableDef)
{
ContentPacks.unlockableDefs.Add(unlockableDef);
}
internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon)
{
UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>();
val.cachedName = identifier;
val.nameToken = nameToken;
val.achievementIcon = achievementIcon;
AddUnlockableDef(val);
return val;
}
internal static void AddSkillDef(SkillDef skillDef)
{
ContentPacks.skillDefs.Add(skillDef);
}
internal static void AddSkillFamily(SkillFamily skillFamily)
{
ContentPacks.skillFamilies.Add(skillFamily);
}
internal static void AddEntityState(Type entityState)
{
ContentPacks.entityStates.Add(entityState);
}
internal static void AddBuffDef(BuffDef buffDef)
{
ContentPacks.buffDefs.Add(buffDef);
}
internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, StackingDisplayMethod stackingDisplayMethod = 0)
{
//IL_0010: 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_0034: 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)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = buffName;
val.buffColor = buffColor;
val.canStack = canStack;
val.isDebuff = isDebuff;
val.eliteDef = null;
val.iconSprite = buffIcon;
val.stackingDisplayMethod = stackingDisplayMethod;
AddBuffDef(val);
return val;
}
internal static void AddEffectDef(EffectDef effectDef)
{
ContentPacks.effectDefs.Add(effectDef);
}
internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
EffectDef val = new EffectDef(effectPrefab);
AddEffectDef(val);
return val;
}
internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
{
ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
}
internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName)
{
NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
val.akId = AkSoundEngine.GetIDFromString(eventName);
val.eventName = eventName;
AddNetworkSoundEventDef(val);
return val;
}
}
internal static class Skills
{
public static Dictionary<string, SkillLocator> characterSkillLocators = new Dictionary<string, SkillLocator>();
public static void CreateSkillFamilies(GameObject targetPrefab)
{
SkillSlot[] array = new SkillSlot[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array);
}
public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots)
{
//IL_0010: 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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected I4, but got Unknown
SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
foreach (SkillSlot val in slots)
{
SkillSlot val2 = val;
switch (val2 - -1)
{
case 1:
component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
break;
case 2:
component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
break;
case 3:
component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
break;
case 4:
component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
break;
}
}
}
public static void ClearGenericSkills(GameObject targetPrefab)
{
GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
foreach (GenericSkill val in componentsInChildren)
{
Object.DestroyImmediate((Object)(object)val);
}
}
public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected I4, but got Unknown
SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
switch (skillSlot - -1)
{
case 1:
return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden);
case 2:
return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden);
case 3:
return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden);
case 4:
return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden);
case 0:
Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName");
return null;
default:
return null;
}
}
public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false)
{
return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden);
}
public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false)
{
GenericSkill val = targetPrefab.AddComponent<GenericSkill>();
val.skillName = genericSkillName;
val.hideInCharacterSelect = hidden;
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family";
val2.variants = (Variant[])(object)new Variant[0];
val._skillFamily = val2;
Content.AddSkillFamily(val2);
return val;
}
public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val = new Variant
{
skillDef = skillDef,
unlockableDef = unlockableDef
};
((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
variants[num] = val;
}
public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs)
{
foreach (SkillDef skillDef in skillDefs)
{
AddSkillToFamily(skillFamily, skillDef);
}
}
public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs);
}
public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs);
}
public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs);
}
public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs);
}
public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
for (int i = 0; i < unlockableDefs.Length; i++)
{
Variant val = skillFamily.variants[i];
val.unlockableDef = unlockableDefs[i];
skillFamily.variants[i] = val;
}
}
public static Combo ComboFromType(Type t)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
Combo result = default(Combo);
result.activationStateType = new SerializableEntityStateType(t);
return result;
}
}
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public class AutoConfigAttribute : Attribute
{
public string name;
public string desc;
public object defaultValue;
public AutoConfigAttribute(string name, object defaultValue)
{
Init(name, string.Empty, defaultValue);
}
public AutoConfigAttribute(string name, string desc, object defaultValue)
{
Init(name, desc, defaultValue);
}
public void Init(string name, string desc, object defaultValue)
{
this.name = name;
this.desc = desc;
this.defaultValue = defaultValue;
}
}
public static class Config
{
public static ConfigFile MyConfig;
public static ConfigFile BackupConfig;
public static void Init()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
MyConfig = new ConfigFile(Paths.ConfigPath + "\\SpareChange.cfg", true);
MyConfig.SaveOnConfigSet = false;
BackupConfig = new ConfigFile(Paths.ConfigPath + "\\SpareChange.Backup.cfg", true);
BackupConfig.SaveOnConfigSet = false;
BackupConfig.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 :");
}
public static void Save()
{
MyConfig.SaveOnConfigSet = true;
MyConfig.Save();
BackupConfig.SaveOnConfigSet = true;
BackupConfig.Save();
}
public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true)
{
if (string.IsNullOrEmpty(description))
{
description = "Set to false to disable this character and as much of its code and content as possible";
}
return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true);
}
public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false)
{
return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired);
}
public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false)
{
if (string.IsNullOrEmpty(description))
{
description = name;
}
if (restartRequired)
{
description += " (restart required)";
}
ConfigEntry<T> val = MyConfig.Bind<T>(section, name, defaultValue, description);
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
TryRegisterOption<T>(val, min, max, restartRequired);
}
return val;
}
public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false)
{
return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired)
{
}
public static bool GetKeyPressed(KeyboardShortcut entry)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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)
foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers)
{
if (!Input.GetKey(modifier))
{
return false;
}
}
return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey);
}
}
public class ConfigManager
{
internal static bool ConfigChanged;
internal static bool VersionChanged;
public static void HandleConfigAttributes(Type type, string section, ConfigFile config)
{
TypeInfo typeInfo = type.GetTypeInfo();
FieldInfo[] fields = typeInfo.GetFields();
foreach (FieldInfo fieldInfo in fields)
{
if (fieldInfo.IsStatic)
{
Type fieldType = fieldInfo.FieldType;
AutoConfigAttribute customAttribute = fieldInfo.GetCustomAttribute<AutoConfigAttribute>();
if (customAttribute != null)
{
string name = customAttribute.name;
object defaultValue = customAttribute.defaultValue;
string desc = customAttribute.desc;
fieldInfo.SetValue(null, DualBindToConfig(fieldType, section, config, name, defaultValue, desc));
}
}
}
}
private static object DualBindToConfig(Type t, string section, ConfigFile config, string configName, object defaultValue, string configDesc)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
if (string.IsNullOrWhiteSpace(section) || string.IsNullOrWhiteSpace(configName))
{
return defaultValue;
}
ConfigDescription val = new ConfigDescription(configDesc, (AcceptableValueBase)null, Array.Empty<object>());
MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
where x.Name == "Bind"
select x).First();
methodInfo = methodInfo.MakeGenericMethod(t);
ConfigEntryBase val2 = (ConfigEntryBase)methodInfo.Invoke(config, new object[3]
{
(object)new ConfigDefinition(section, configName),
defaultValue,
val
});
ConfigEntryBase val3 = (ConfigEntryBase)methodInfo.Invoke(Config.BackupConfig, new object[3]
{
(object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + section, configName),
defaultValue,
val
});
if (!ConfigEqual(val3.DefaultValue, val3.BoxedValue))
{
bool flag = true;
Log.Warning("Syncing config to new version");
val2.BoxedValue = val2.DefaultValue;
val3.BoxedValue = val3.DefaultValue;
}
if (!ConfigEqual(val2.DefaultValue, val2.BoxedValue))
{
ConfigChanged = true;
}
return val2.BoxedValue;
}
public static T DualBindToConfig<T>(string section, ConfigFile config, string configName, T defaultValue, string configDesc)
{
return (T)DualBindToConfig(typeof(T), section, config, configName, defaultValue, configDesc);
}
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;
}
}
internal class ContentPacks : IContentPackProvider
{
internal ContentPack contentPack = new ContentPack();
public static List<ExpansionDef> expansionDefs = new List<ExpansionDef>();
public static List<GameObject> bodyPrefabs = new List<GameObject>();
public static List<GameObject> masterPrefabs = new List<GameObject>();
public static List<GameObject> projectilePrefabs = new List<GameObject>();
public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();
public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();
public static List<SkillFamily> skillFamilies = new List<SkillFamily>();
public static List<SkillDef> skillDefs = new List<SkillDef>();
public static List<Type> entityStates = new List<Type>();
public static List<BuffDef> buffDefs = new List<BuffDef>();
public static List<EffectDef> effectDefs = new List<EffectDef>();
public static List<ItemRelationshipProvider> itemRelationships = new List<ItemRelationshipProvider>();
public static List<ItemDef> itemDefs = new List<ItemDef>();
public static List<EliteDef> eliteDefs = new List<EliteDef>();
public static List<ArtifactDef> artifactDefs = new List<ArtifactDef>();
public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();
public static List<GameObject> networkedObjectPrefabs = new List<GameObject>();
public string identifier => "com.duckduckgreyduck.SpareChange";
public void Initialize()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
}
private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)this);
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
contentPack.identifier = identifier;
contentPack.expansionDefs.Add(expansionDefs.ToArray());
contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
contentPack.survivorDefs.Add(survivorDefs.ToArray());
contentPack.eliteDefs.Add(eliteDefs.ToArray());
contentPack.itemRelationshipProviders.Add(itemRelationships.ToArray());
contentPack.itemDefs.Add(itemDefs.ToArray());
contentPack.buffDefs.Add(buffDefs.ToArray());
contentPack.artifactDefs.Add(artifactDefs.ToArray());
contentPack.skillDefs.Add(skillDefs.ToArray());
contentPack.skillFamilies.Add(skillFamilies.ToArray());
contentPack.entityStateTypes.Add(entityStates.ToArray());
contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
contentPack.effectDefs.Add(effectDefs.ToArray());
contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray());
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
}
public static class Spawnlists
{
public static void Init()
{
SpawnCards.Init();
DirectorCards.Init();
}
public static void AddMonsterCardToSpawnlist(DirectorCardCategorySelection categorySelection, DirectorCard directorCard, MonsterCategory monsterCategory)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected I4, but got Unknown
categorySelection.AddCard((int)monsterCategory, directorCard);
}
}
public static class SpawnCards
{
public static bool initialized;
public static CharacterSpawnCard AlphaConstruct;
public static CharacterSpawnCard Beetle;
public static CharacterSpawnCard Lemurian;
public static CharacterSpawnCard Larva;
public static CharacterSpawnCard Wisp;
public static CharacterSpawnCard Jellyfish;
public static CharacterSpawnCard BlindPestSnowy;
public static CharacterSpawnCard BlindVerminSnowy;
public static CharacterSpawnCard Imp;
public static CharacterSpawnCard Vulture;
public static CharacterSpawnCard Golem;
public static CharacterSpawnCard BeetleGuard;
public static CharacterSpawnCard Mushrum;
public static CharacterSpawnCard Bison;
public static CharacterSpawnCard ClayApothecary;
public static CharacterSpawnCard ElderLemurian;
public static CharacterSpawnCard Parent;
public static CharacterSpawnCard Gup;
public static CharacterSpawnCard Bronzong;
public static CharacterSpawnCard GreaterWisp;
public static CharacterSpawnCard TitanBlackBeach;
public static CharacterSpawnCard TitanDampCave;
public static CharacterSpawnCard TitanGolemPlains;
public static CharacterSpawnCard TitanGooLake;
public static CharacterSpawnCard Vagrant;
public static CharacterSpawnCard BeetleQueen;
public static CharacterSpawnCard Dunestrider;
public static CharacterSpawnCard MagmaWorm;
public static CharacterSpawnCard ImpOverlord;
public static CharacterSpawnCard Grovetender;
public static CharacterSpawnCard RoboBall;
public static CharacterSpawnCard XiConstruct;
public static CharacterSpawnCard OverloadingWorm;
public static void LoadSpawnCardAsync(string guid, Action<CharacterSpawnCard> callback)
{
//IL_0017: 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)
AssetReferenceT<CharacterSpawnCard> val = new AssetReferenceT<CharacterSpawnCard>(guid);
AsyncOperationHandle<CharacterSpawnCard> val2 = AssetAsyncReferenceManager<CharacterSpawnCard>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> ctx)
{
CharacterSpawnCard result = ctx.Result;
if (callback != null)
{
callback(result);
}
};
}
public static void Init()
{
//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_008b: 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_00c0: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
if (!initialized)
{
initialized = true;
AlphaConstruct = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)RoR2_DLC1_MajorAndMinorConstruct.cscMinorConstruct_asset).WaitForCompletion();
Beetle = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscbeetle");
Lemurian = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csclemurian");
Wisp = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csclesserwisp");
Jellyfish = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscjellyfish");
Imp = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscimp");
Vulture = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscvulture");
Golem = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Golem/cscGolem.asset").WaitForCompletion();
BeetleGuard = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscbeetleguard");
Mushrum = LegacyResourcesAPI.Load<Char