using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Cpp2IL.Core.Extensions;
using Doozy.Runtime.Reactor.Targets;
using Doozy.Runtime.UIManager.Components;
using GKAPI.AssetBundles;
using GKAPI.Difficulties;
using GKAPI.Items;
using GKAPI.Lang;
using Gatekeeper.Achievements.Data;
using Gatekeeper.CameraScripts.HUD.Difficulty;
using Gatekeeper.CameraScripts.HUD.StatisticPanel;
using Gatekeeper.Char_Scripts.General;
using Gatekeeper.Char_Scripts.General.CharData;
using Gatekeeper.Elites;
using Gatekeeper.Enemy.Base;
using Gatekeeper.Enemy.Base.Data;
using Gatekeeper.Enemy.SpawnTemplates;
using Gatekeeper.EnvironmentStuff.InstabilityCapsule;
using Gatekeeper.General;
using Gatekeeper.General.Currency;
using Gatekeeper.General.Events.Characters;
using Gatekeeper.General.Events.Enemies;
using Gatekeeper.General.Events.Interactable;
using Gatekeeper.General.Extensions;
using Gatekeeper.General.Predictor;
using Gatekeeper.General.Tasks;
using Gatekeeper.Infrastructure.Providers.InfoProviders;
using Gatekeeper.Items;
using Gatekeeper.MainMenuScripts.Database;
using Gatekeeper.MainMenuScripts.Database.ItemsDatabaseController;
using Gatekeeper.MainMenuScripts.MainMenu.CharacterSelectPanel;
using Gatekeeper.MainMenuScripts.MainMenu.MainMenuPanel;
using Gatekeeper.MainMenuScripts.MainMenu.StorePanel;
using Gatekeeper.PoolScripts;
using Gatekeeper.Utility;
using Gatekeeper.Utility.SceneHelper;
using HarmonyLib;
using I2.Loc;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using RNGNeeds;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GKAPI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.9.0")]
[assembly: AssemblyInformationalVersion("0.1.9+645fc8b9d0950af04060e3a7544f3099e87bb1a7")]
[assembly: AssemblyProduct("Gatekeeper API")]
[assembly: AssemblyTitle("GKAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace GKAPI
{
[HarmonyPatch]
public class EventHandler
{
public static Action Init;
public static Action LateInit;
public static Action StartGame;
public static Action<string> LoadScene;
public static LoadingState State { get; private set; }
public static void OnLoad()
{
if (State == LoadingState.PreInit)
{
State = LoadingState.Init;
Init?.Invoke();
SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoad);
}
else
{
Plugin.Log.LogError((object)"Invalid loading state");
}
}
[HarmonyPatch(typeof(MainMenuController), "Awake")]
[HarmonyPostfix]
private static void OnMenuLoad()
{
if (State == LoadingState.Init)
{
State = LoadingState.LateInit;
LateInit?.Invoke();
}
}
private static void OnSceneLoad(Scene scene, LoadSceneMode mode)
{
LoadScene?.Invoke(((Scene)(ref scene)).name);
}
}
public enum LoadingState
{
PreInit,
Init,
LateInit
}
public abstract class GkPlugin : BasePlugin
{
public abstract void AddContent();
public override void Load()
{
PluginManager.AddPlugin(this);
}
}
[BepInPlugin("com.robocraft999.gkapi", "GKAPI", "0.1.9")]
public class Plugin : BasePlugin
{
public const string PluginGuid = "com.robocraft999.gkapi";
public const string PluginName = "GKAPI";
internal static ManualLogSource Log;
public override void Load()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
bool flag = default(bool);
try
{
Log.LogMessage((object)" ");
Log.LogMessage((object)"Inserting Harmony Hooks...");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.robocraft999.gkapi.il2cpp");
Log.LogMessage((object)"Runtime Hooks's Applied");
Log.LogMessage((object)" ");
}
catch (Exception ex)
{
ManualLogSource log = Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("FAILED to Apply Hooks's! ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogError(val);
}
ManualLogSource log2 = Log;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("GKAPI");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is loaded!");
}
log2.LogInfo(val2);
((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Finished += PluginManager.LoadPlugins;
}
}
public class PluginManager
{
private class GkPluginA : Attribute
{
}
private static List<GkPlugin> plugins = new List<GkPlugin>();
public static void AddPlugin(GkPlugin plugin)
{
plugins.Add(plugin);
}
internal static void LoadPlugins()
{
foreach (GkPlugin plugin in plugins)
{
plugin.AddContent();
}
EventHandler.OnLoad();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "GKAPI";
public const string PLUGIN_NAME = "Gatekeeper API";
public const string PLUGIN_VERSION = "0.1.9";
}
}
namespace GKAPI.Lang
{
public static class ColorHelper
{
public static string WrapInColorHex(string text, int colorHex)
{
return $"<color=#{colorHex:X}><b>{text}</b></color>";
}
public static string WrapInColorRGB(string text, int r, int g, int b)
{
return $"<color=#{r:X2}{g:X2}{b:X2}><b>{text}</b></color>";
}
}
public static class Colors
{
public const int Red = 15622229;
public const int Orange = 16104192;
public const int Lime = 12376441;
public const int Green = 5420936;
public const int Blue = 9420768;
public const int Lavender = 15583743;
public const int Grey = 10335666;
}
public class LangAPI
{
private List<TermData> _terms = new List<TermData>();
public static LangAPI Instance { get; } = new LangAPI();
private LangAPI()
{
EventHandler.LateInit = (Action)Delegate.Combine(EventHandler.LateInit, new Action(RegisterTerms));
}
public TermData CreateTerm(string key, string value)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
Il2CppStringArray languages = new Il2CppStringArray(new string[13]
{
value, value, value, value, value, value, value, value, value, value,
value, value, value
});
Il2CppStructArray<byte> flags = new Il2CppStructArray<byte>(new byte[13]);
return new TermData
{
Term = key,
Description = "",
TermType = (eTermType)0,
Languages = languages,
Flags = flags
};
}
public void CreateAndAddTerm(string key, string value)
{
if ((key != null && !(key == "")) || 1 == 0)
{
AddTerm(CreateTerm(key, value));
}
}
public void AddTerm(TermData term)
{
_terms.Add(term);
}
public void AddItemLang(GkItem item)
{
ItemDatabaseInfo info = item.Info;
CreateAndAddTerm(info.itemNameKey.mTerm, item.Name);
CreateAndAddTerm(info.itemLongDescKey.mTerm, item.Description);
CreateAndAddTerm(info.itemStatsKey.mTerm, item.StatsDescription);
}
public void AddDifficultyLang(GkDifficulty difficulty)
{
CreateAndAddTerm("MENU.UI.DIFFICULTY." + difficulty.TranslationKey, difficulty.DifficultyName + ": <b>" + difficulty.DifficultyValues.stringPercentage + "</b>");
}
private void RegisterTerms()
{
foreach (TermData term in _terms)
{
LocalizationManager.Sources[0].mTerms.Add(term);
}
LocalizationManager.GetTermsList((string)null);
}
}
}
namespace GKAPI.Items
{
public abstract class CustomItemController : ItemController
{
public virtual void OwnerHandleSkillUsed(EventClientCharacterSkillUsed eventData)
{
}
public virtual void OwnerHandleOnEnemyDied(EventClientEnemyDied eventData)
{
}
public virtual void ClientHandleInteractableUsed(EventClientInteractableObjectUsed eventData)
{
}
public virtual void OwnerHandleDamageTaken(DamageType damageType, float damageTaken)
{
}
public virtual void OwnerHandleCharacterHitSomething(EventOwnerCharacterHitSomething eventData)
{
}
public virtual void OwnerHandleFirstSkillHit(IEnemy enemy, EventOwnerCharacterHitSomething eventData)
{
}
public virtual void OwnerSkillHit(IEnemy enemy, EventOwnerCharacterHitSomething eventData)
{
}
public virtual void OwnerItemHit(IEnemy enemy, EventOwnerCharacterHitSomething eventData)
{
}
}
public class GkItem
{
public class Builder
{
private string _id;
private string _name;
private string _description;
private string _statsDescription;
private ItemType _itemType;
private bool _unlocked;
private bool _hidden = true;
private int _itemCost = 70;
private int _itemPedestalCost = 200;
private int _scrapValue = 10;
private int _maxCount = -1;
private ItemDropSource _dropSource = (ItemDropSource)(-1);
private List<ParamModification> _modifications = new List<ParamModification>();
private List<ItemID> _triadItems = new List<ItemID>();
private Sprite _icon;
private GameObject _fbx;
private static string FormatTerm(ItemType itemType, string id, string suffix)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected I4, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
return (int)itemType switch
{
0 => "ITEM.BASE." + id + "." + suffix,
1 => "ITEM.PURPLE." + id + "." + suffix,
2 => "ITEM.YELLOW." + id + "." + suffix,
3 => "ITEM.BLUE." + id + "." + suffix,
4 => "ITEM.RED." + id + "." + suffix,
5 => "TRIAD." + suffix + "." + id,
_ => throw new ArgumentOutOfRangeException("itemType", itemType, null),
};
}
public Builder(string name, string description = "Empty description", string statsDescription = "Empty stats description")
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
_id = name.ToUpper();
_name = name;
_description = description;
_statsDescription = statsDescription;
}
public Builder AsModifier()
{
return WithItemType((ItemType)0).WithItemCost(70).WithItemPedestalCost(200).WithScrapValue(10);
}
public Builder AsStructureChanger()
{
return WithItemType((ItemType)1).WithItemCost(140).WithItemPedestalCost(400).WithScrapValue(30);
}
public Builder AsAmulet()
{
return WithItemType((ItemType)2).WithItemCost(100).WithItemPedestalCost(300).WithScrapValue(20);
}
public Builder AsCursedSignature()
{
return WithItemType((ItemType)4).WithItemCost(0).WithItemPedestalCost(1).WithScrapValue(5);
}
public Builder AsRuneOfCreation()
{
return WithItemType((ItemType)3).WithItemCost(210).WithItemPedestalCost(600).WithScrapValue(40);
}
public Builder AsTriad(List<ItemID> itemIds)
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
foreach (ItemID itemId in itemIds)
{
_triadItems.Add(itemId);
}
return WithItemType((ItemType)5).WithDropSource((ItemDropSource)0).WithMaxCount(1).WithItemCost(500)
.WithItemPedestalCost(0)
.WithScrapValue(0);
}
public Builder WithId(string id)
{
_id = id;
return this;
}
public Builder WithItemType(ItemType itemType)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_itemType = itemType;
return this;
}
public Builder SetUnlocked(bool unlocked)
{
_unlocked = unlocked;
return this;
}
public Builder SetHidden(bool hidden)
{
_hidden = hidden;
return this;
}
public Builder WithIcon(Sprite icon)
{
_icon = icon;
return this;
}
public Builder WithModel(GameObject fbxPrefab)
{
_fbx = fbxPrefab;
return this;
}
public Builder WithItemCost(int cost)
{
_itemCost = cost;
return this;
}
public Builder WithItemPedestalCost(int cost)
{
_itemPedestalCost = cost;
return this;
}
public Builder WithMaxCount(int maxCount)
{
_maxCount = maxCount;
return this;
}
public Builder WithScrapValue(int scrapValue)
{
_scrapValue = scrapValue;
return this;
}
public Builder WithDropSource(ItemDropSource dropSource)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_dropSource = dropSource;
return this;
}
public Builder AddModification(ItemParamModificationType modificationType, float baseValue, float levelValue)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
ParamModification val = new ParamModification
{
modificationType = modificationType,
firstLevelModificationValue = baseValue,
otherLevelModificationValue = levelValue
};
_modifications.Add(val);
return this;
}
public GkItem Build(int itemId)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0117: 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_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Invalid comparison between Unknown and I4
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: 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_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Expected I4, but got Unknown
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Building GkItem with id: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(itemId);
}
log.LogInfo(val);
Dictionary<ItemID, ItemDatabaseInfo> itemInfos = DatabaseInfoProvider.Items.ItemInfos;
ItemDatabaseInfo val2 = ScriptableObject.CreateInstance<ItemDatabaseInfo>();
val2.ItemId = (ItemID)itemId;
MeshRenderer val3 = null;
Il2CppReferenceArray<Material> materials = ((Renderer)itemInfos[(ItemID)44].ItemFbx).materials;
if ((Object)(object)_fbx != (Object)null)
{
val3 = _fbx.GetComponent<MeshRenderer>();
}
else
{
GameObject val4 = AssetHelper.LoadAsset<GameObject>("GKAPI.Assets.testassetbundle", "assets/testbundle/Item_Placeholder.prefab");
if ((Object)(object)val4 != (Object)null)
{
val3 = val4.GetComponent<MeshRenderer>();
}
}
if ((Object)(object)val3 != (Object)null)
{
((Renderer)val3).materials = materials;
}
val2.ItemFbx = val3 ?? itemInfos[(ItemID)44].ItemFbx;
Sprite val5 = _icon ?? AssetHelper.LoadAsset<Sprite>("GKAPI.Assets.testassetbundle", "assets/testbundle/textures/logo-50x50.png");
((BaseDatabaseInfo)val2).DatabaseIcon = val5 ?? ((BaseDatabaseInfo)itemInfos[(ItemID)6]).DatabaseIcon;
((BaseDatabaseInfo)val2).hideInDatabase = false;
val2.ProjectileInfos = new List<ItemProjectileInfo>();
((BaseDatabaseInfo)val2).Id = _id;
val2.itemType = _itemType;
val2.itemMaxCount = _maxCount;
((BaseDatabaseInfo)val2).unlocked = _unlocked;
((BaseDatabaseInfo)val2).wasSeen = !_hidden;
val2.modificationParams = _modifications;
val2.defaultDropSource = _dropSource;
val2.arenaDropSource = _dropSource;
val2.currency = (CurrencyType)0;
val2.itemCost = _itemCost;
val2.itemCostStep = 0f;
val2.itemObeliskCost = 0;
val2.itemPedestalCost = _itemPedestalCost;
val2.itemTriadCost = 0;
val2.itemTriadCostStep = 0;
val2.itemSellingCost = _scrapValue;
val2.itemCreateCost = _scrapValue;
val2.itemUnlockCost = 1;
val2.itemExcludeCost = 3;
if ((int)_itemType == 5)
{
val2.itemUnlockCost = 0;
val2.itemCostStep = 500f;
val2.itemNameKey = LocalizedString.op_Implicit(FormatTerm(_itemType, _id, "NAME"));
val2.itemLongDescKey = LocalizedString.op_Implicit("");
val2.itemStatsKey = LocalizedString.op_Implicit(FormatTerm(_itemType, _id, "DESC"));
}
else
{
val2.itemNameKey = LocalizedString.op_Implicit(FormatTerm(_itemType, _id, "NAME"));
val2.itemLongDescKey = LocalizedString.op_Implicit(FormatTerm(_itemType, _id, "DESC"));
val2.itemStatsKey = LocalizedString.op_Implicit(FormatTerm(_itemType, _id, "STATS"));
}
val2.triadItems = new List<ItemDatabaseInfo>();
((Object)val2).name = $"{_itemType + 1}_{_id}";
return new GkItem
{
Info = val2,
Name = _name,
Description = _description,
StatsDescription = _statsDescription,
_triadItemIds = _triadItems
};
}
}
private List<ItemID> _triadItemIds = new List<ItemID>();
private const int ModifierCost = 70;
private const int ModifierPedestalCost = 200;
private const int ModifierScrapValue = 10;
private const int StructureChangersCost = 140;
private const int StructureChangersPedestalCost = 400;
private const int StructureChangersScrapValue = 30;
private const int AmuletCost = 100;
private const int AmuletPedestalCost = 300;
private const int AmuletScrapValue = 20;
private const int CursedSignaturesCost = 0;
private const int CursedSignaturesPedestalCost = 1;
private const int CursedSignaturesScrapValue = 5;
private const int RunesOfCreationCost = 210;
private const int RunesOfCreationPedestalCost = 600;
private const int RunesOfCreationScrapValue = 40;
private const int TriadCost = 500;
private const int TriadPedestalCost = 0;
private const int TriadScrapValue = 0;
public string Description { get; private init; }
public string Name { get; private init; }
public string StatsDescription { get; private init; }
public ItemID GetItemID => Info.ItemId;
public ItemDatabaseInfo Info { get; private init; }
public void SetupTriad()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0056: 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)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
if (_triadItemIds.Count != 3)
{
ManualLogSource log = Plugin.Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Triad has incorrect number of items: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_triadItemIds.Count);
}
log.LogError(val);
return;
}
Enumerator<ItemID> enumerator = _triadItemIds.GetEnumerator();
while (enumerator.MoveNext())
{
ItemID current = enumerator.Current;
ItemDatabaseInfo itemById = ItemAPI.Instance.GetItemById(current);
if ((Object)(object)itemById != (Object)null)
{
Info.triadItems.Add(itemById);
continue;
}
ManualLogSource log2 = Plugin.Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(42, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Triad Item ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemID>(current);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not found for item ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". Skipping.");
}
log2.LogError(val);
break;
}
}
}
public class ItemAPI
{
private readonly List<GkItem> _items = new List<GkItem>();
internal Dictionary<ItemID, Type> itemControllerTypes = new Dictionary<ItemID, Type>();
internal readonly Dictionary<ItemID, CustomItemController> itemControllers = new Dictionary<ItemID, CustomItemController>();
private readonly List<int> _existingIds = Enum.GetValues<ItemID>().Cast<int>().ToList();
private int _nextItemId;
private int NextItemId
{
get
{
while (_existingIds.Contains(_nextItemId))
{
_nextItemId++;
}
return _nextItemId++;
}
}
public static ItemAPI Instance { get; } = new ItemAPI();
private ItemAPI()
{
EventHandler.Init = (Action)Delegate.Combine(EventHandler.Init, new Action(RegisterItems));
}
public GkItem AddItem(string name)
{
return AddItem(new GkItem.Builder(name));
}
public GkItem AddItem(string name, Func<GkItem.Builder, GkItem.Builder> build)
{
GkItem.Builder builder = build(new GkItem.Builder(name));
return AddItem(builder);
}
public GkItem AddTriad(string name, List<ItemID> itemIds, Func<GkItem.Builder, GkItem.Builder> build)
{
GkItem.Builder builder = build(new GkItem.Builder(name).AsTriad(itemIds));
return AddItem(builder);
}
public GkItem AddItem(GkItem.Builder builder)
{
GkItem gkItem = builder.Build(NextItemId);
_items.Add(gkItem);
return gkItem;
}
public void AddItemController<T>(ItemID id) where T : CustomItemController
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
try
{
ClassInjector.RegisterTypeInIl2Cpp<T>();
Type value = Il2CppType.Of<T>();
itemControllerTypes.Add(id, value);
}
catch
{
Plugin.Log.LogError((object)"FAILED to Register Il2Cpp Type!");
}
}
public ItemDatabaseInfo GetItemById(ItemID id)
{
//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_0018: Unknown result type (might be due to invalid IL or missing references)
ItemDatabaseInfo val = DatabaseInfoProvider.Items.ItemInfos[id];
if ((Object)(object)val != (Object)null)
{
return val;
}
return _items.FirstOrDefault((GkItem x) => x.GetItemID == id)?.Info;
}
public CustomItemController GetItemControllerForID(ItemID id)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return itemControllers[id];
}
public List<CustomItemController> GetItemControllers()
{
return itemControllers.Values.ToList();
}
private void RegisterItems()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Invalid comparison between Unknown and I4
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_006e: 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)
//IL_008f: Expected O, but got Unknown
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Expected O, but got Unknown
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Registering Items");
}
log.LogInfo(val);
Dictionary<ItemID, ItemDatabaseInfo> itemInfos = DatabaseInfoProvider.Items.ItemInfos;
Dictionary<ItemID, ItemDatabaseInfo> triadsInfos = DatabaseInfoProvider.Items.TriadsInfos;
foreach (GkItem item in _items)
{
if ((int)item.Info.itemType == 5)
{
item.SetupTriad();
triadsInfos.Add(item.GetItemID, item.Info);
ManualLogSource log2 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Registered Triad ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemID>(item.GetItemID);
}
log2.LogInfo(val);
}
itemInfos.Add(item.GetItemID, item.Info);
ManualLogSource log3 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(18, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Registered Item ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemID>(item.GetItemID);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemType>(item.Info.itemType);
}
log3.LogInfo(val);
LangAPI.Instance.AddItemLang(item);
}
ManualLogSource log4 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(9, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("All Items");
}
log4.LogInfo(val);
Enumerator<ItemID, ItemDatabaseInfo> enumerator2 = itemInfos.GetEnumerator();
while (enumerator2.MoveNext())
{
KeyValuePair<ItemID, ItemDatabaseInfo> current2 = enumerator2.Current;
ManualLogSource log5 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(11, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Item ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemID>(current2.value.ItemId);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemType>(current2.value.itemType);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(current2.value.itemNameKey.mTerm);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(current2.value.itemLongDescKey.mTerm);
}
log5.LogInfo(val);
}
ManualLogSource log6 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Registered ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_items.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Items");
}
log6.LogInfo(val);
}
}
[HarmonyPatch]
public class ItemControllerEventListener
{
[HarmonyPatch(typeof(CharItemCaster), "OwnerHandleSkillUsed")]
[HarmonyPostfix]
private static void OnSkillUsed(EventClientCharacterSkillUsed eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerHandleSkillUsed(eventData);
}
}
[HarmonyPatch(typeof(CharItemCaster), "OwnerHandleOnEnemyDied")]
private static void OnEnemyDied(EventClientEnemyDied eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerHandleOnEnemyDied(eventData);
}
}
[HarmonyPatch(typeof(CharItemCaster), "ClientHandleInteractableObjectUsed")]
private static void OnInteractableUsed(EventClientInteractableObjectUsed eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.ClientHandleInteractableUsed(eventData);
}
}
[HarmonyPatch(typeof(CharItemCaster), "OwnerHandleDamageTaken")]
private static void OnDamageTaken(DamageType damageType, float damageTaken)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerHandleDamageTaken(damageType, damageTaken);
}
}
[HarmonyPatch(typeof(CharItemCaster), "OwnerHandleCharacterHitSomething")]
private static void OnCharacterHitSomething(EventOwnerCharacterHitSomething eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerHandleCharacterHitSomething(eventData);
}
}
[HarmonyPatch(typeof(CharItemCaster), "OwnerFirstSkillHit")]
private static void OnFirstSkillHit(IEnemy enemy, EventOwnerCharacterHitSomething eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerHandleFirstSkillHit(enemy, eventData);
}
}
[HarmonyPatch(typeof(CharItemCaster), "OwnerSkillHit")]
private static void OnSkillHit(IEnemy enemy, EventOwnerCharacterHitSomething eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerSkillHit(enemy, eventData);
}
}
[HarmonyPatch(typeof(CharItemCaster), "OwnerItemHit")]
private static void OnItemHit(IEnemy enemy, EventOwnerCharacterHitSomething eventData)
{
foreach (CustomItemController itemController in ItemAPI.Instance.GetItemControllers())
{
itemController.OwnerItemHit(enemy, eventData);
}
}
[HarmonyPatch(typeof(CharItemManager), "ClientInit")]
[HarmonyPostfix]
private static void OnCharacterLoad(CharItemManager __instance)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0067: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Appending ItemControllers");
}
log.LogInfo(val);
ItemAPI instance = ItemAPI.Instance;
Transform child = ((Component)__instance).transform.GetChild(0);
CharData component = ((Component)__instance).gameObject.GetComponent<CharData>();
foreach (KeyValuePair<ItemID, Type> itemControllerType in instance.itemControllerTypes)
{
itemControllerType.Deconstruct(out var key, out var value);
ItemID val2 = key;
Type val3 = value;
GameObject val4 = new GameObject("Controller - " + ((Object)instance.GetItemById(val2)).name);
CustomItemController customItemController = (CustomItemController)(object)val4.AddComponent(val3);
((ItemController)customItemController).ItemID = val2;
((ItemController)customItemController).charData = component;
val4.transform.SetParent(((Component)child).transform);
instance.itemControllers[val2] = customItemController;
}
}
}
}
namespace GKAPI.Enemies
{
public class EnemiesAPI
{
private readonly List<KnowingEnemySpawnTemplate> _templates = new List<KnowingEnemySpawnTemplate>();
public static EnemiesAPI Instance { get; } = new EnemiesAPI();
private EnemiesAPI()
{
EventHandler.Init = (Action)Delegate.Combine(EventHandler.Init, new Action(RegisterEnemies));
}
public KnowingEnemySpawnTemplate AddKnowingTemplate(GameDifficulty difficulties, bool forBossFight, List<SceneDesignation> scenes, Vector2Int locationNumberRange, ProbabilityList<EnemyCharacterInfo> enemyProbabilityList, string name = "", bool ignore = false)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
KnowingEnemySpawnTemplate val = ScriptableObject.CreateInstance<KnowingEnemySpawnTemplate>();
((Object)val).name = name;
val.difficulties = difficulties;
val.ForBossFight = forBossFight;
val.Ignore = ignore;
val.scenes = new List<SceneDesignation>();
foreach (SceneDesignation scene in scenes)
{
val.scenes.Add(scene);
}
val.locationNumberRange = locationNumberRange;
val.ProbabilityListOfEnemy = enemyProbabilityList;
_templates.Add(val);
return val;
}
private void RegisterEnemies()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
Plugin.Log.LogInfo((object)"Registering enemies");
foreach (KnowingEnemySpawnTemplate template in _templates)
{
DatabaseInfoProvider.Enemies.AllKnowingEnemySpawnTemplates.Add(template);
}
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Added ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_templates.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" knowing templates");
}
log.LogInfo(val);
Plugin.Log.LogInfo((object)"Registered enemies");
}
}
public class TemplateHelper
{
public class ProbListBuilder
{
private ProbabilityList<EnemyCharacterInfo> _list = new ProbabilityList<EnemyCharacterInfo>();
public ProbListBuilder AddItem(PoolItemID id, float probability)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
_list.AddItem(DatabaseInfoProvider.Enemies.GetCharacterInfoByPoolID(id), probability, true, false);
return this;
}
public ProbabilityList<EnemyCharacterInfo> Build()
{
float num = 0f;
Enumerator<ProbabilityItem<EnemyCharacterInfo>> enumerator = _list.ProbabilityItems.GetEnumerator();
while (enumerator.MoveNext())
{
ProbabilityItem<EnemyCharacterInfo> current = enumerator.Current;
num += current.Probability;
}
if (Math.Abs((double)num - 1.0) > 0.001)
{
Plugin.Log.LogWarning((object)"Probabilities of current Template does not add up to 1");
}
return _list;
}
}
public static List<SceneDesignation> AuroraScenes { get; } = new List<SceneDesignation>(4)
{
(SceneDesignation)108,
(SceneDesignation)101,
(SceneDesignation)102,
(SceneDesignation)107
};
public static List<SceneDesignation> CelestiumScenes { get; } = new List<SceneDesignation>(4)
{
(SceneDesignation)203,
(SceneDesignation)204,
(SceneDesignation)201,
(SceneDesignation)205
};
public static List<SceneDesignation> PurgatoryScenes { get; } = new List<SceneDesignation>(4)
{
(SceneDesignation)300,
(SceneDesignation)302,
(SceneDesignation)301,
(SceneDesignation)303
};
public static List<SceneDesignation> AriduneScenes { get; } = new List<SceneDesignation>(4)
{
(SceneDesignation)400,
(SceneDesignation)404,
(SceneDesignation)401,
(SceneDesignation)403
};
public static List<SceneDesignation> PaliumScenes { get; } = new List<SceneDesignation>(4)
{
(SceneDesignation)600,
(SceneDesignation)602,
(SceneDesignation)603,
(SceneDesignation)601
};
}
}
namespace GKAPI.Difficulties
{
[HarmonyPatch]
public class DifficultiesAPI
{
private int _nextId = 8;
private readonly Dictionary<GameDifficulty, GkDifficulty> _gkDifficulties = new Dictionary<GameDifficulty, GkDifficulty>();
private static GameDifficulty _cachedDifficulty;
public static DifficultiesAPI Instance { get; } = new DifficultiesAPI();
private DifficultiesAPI()
{
EventHandler.Init = (Action)Delegate.Combine(EventHandler.Init, new Action(RegisterDifficulties));
}
public (GameDifficulty, GkDifficulty) AddDifficulty(GkDifficulty.Builder builder)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
GkDifficulty gkDifficulty = builder.Build();
GameDifficulty val = (GameDifficulty)_nextId;
_nextId *= 2;
_gkDifficulties.Add(val, gkDifficulty);
return (val, gkDifficulty);
}
private void RegisterDifficulties()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: 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_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogInfo((object)"Registering difficulties");
foreach (var (val2, gkDifficulty2) in _gkDifficulties)
{
((Dictionary<GameDifficulty, DifficultyValues>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.difficultyValues).Add(val2, gkDifficulty2.DifficultyValues);
((Dictionary<GameDifficulty, GameEventData>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.gameEventsData).Add(val2, gkDifficulty2.GameEventData);
((Dictionary<GameDifficulty, SirenSpawnData>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.defaultModeSirenSpawnData).Add(val2, gkDifficulty2.SirenSpawnData);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.EnemyValues.EnemyExpLoopPow.Add(val2, gkDifficulty2.EnemyExpLoopPow);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.EnemyValues.EnemyExpPointsPerEvo.Add(val2, gkDifficulty2.EnemyExpPointsPerEvo);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.EnemyValues.EnemyExpPointsPerLoop.Add(val2, gkDifficulty2.EnemyExpPointsPerLoop);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.EnemyValues.EnemyExpPointsPerTimeTick.Add(val2, gkDifficulty2.EnemyExpPointsPerTimeTick);
((Dictionary<GameDifficulty, GameEventData>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.gameEventsData).Add(val2, gkDifficulty2.GameEventData);
((Dictionary<GameDifficulty, float>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.EnemyExpRoundPow).Add(val2, gkDifficulty2.ArenaValue.EnemyExpRoundPow);
((Dictionary<GameDifficulty, float>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.EnemyExpPointsPerRound).Add(val2, gkDifficulty2.ArenaValue.EnemyExpPointsPerRound);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.EnemyPowerDifficultyCoefficient.Add(val2, gkDifficulty2.ArenaValue.EnemyPowerDifficultyCoefficient);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.FixedSirenDifficultyCoefficient.Add(val2, gkDifficulty2.ArenaValue.FixedSirenDifficultyCoefficient);
SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.SirenSpawnDifficultyModifier.Add(val2, gkDifficulty2.ArenaValue.SirenSpawnDifficultyModifier);
((Dictionary<GameDifficulty, float>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ArenaValues.ArenaExpPointsPerTime).Add(val2, gkDifficulty2.ArenaValue.ArenaExpPointsPerTime);
((Dictionary<GameDifficulty, EliteSpawnData>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ElitesValues.arenaModeSpawnData).Add(val2, gkDifficulty2.ElitesData);
((Dictionary<GameDifficulty, EliteSpawnData>)(object)SingletonSerializedScriptableObject<GameDesignValuesHolder>.Instance.ElitesValues.defaultModeSpawnData).Add(val2, gkDifficulty2.ElitesData);
InstabilityCapsuleTaskInfo val3 = ((Il2CppObjectBase)DatabaseInfoProvider.Tasks._tasks[(TaskType)4]).TryCast<InstabilityCapsuleTaskInfo>();
if ((Object)(object)val3 != (Object)null)
{
((Dictionary<GameDifficulty, float>)(object)val3.capsulesSpeed).Add(val2, gkDifficulty2.InstabilityCapsuleSpeed);
}
LangAPI.Instance.AddDifficultyLang(gkDifficulty2);
}
}
public ProbabilityList<bool> CreateGameEventsProbabilities(float probability)
{
ProbabilityList<bool> obj = new ProbabilityList<bool>();
obj.AddItem(new ProbabilityItem<bool>(true, probability, true, false));
obj.AddItem(new ProbabilityItem<bool>(false, 1f - probability, true, false));
obj.PickValue();
return obj;
}
[HarmonyPatch(typeof(PanelDifficulty), "Awake")]
[HarmonyPostfix]
private static void ConstructDifficultyPanel(ref PanelDifficulty __instance)
{
//IL_0089: 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_00cd: 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_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: 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_0181: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogInfo((object)"Adding UI patch");
if ((Object)(object)__instance == (Object)null)
{
Plugin.Log.LogError((object)"PanelDifficulty instance is null");
return;
}
GameObject gameObject = ((Component)((IEnumerable<UIToggle>)Resources.FindObjectsOfTypeAll<UIToggle>()).First((UIToggle e) => ((Object)((Component)e).gameObject).name == "Toggle - Insane")).gameObject;
GameDifficultyInfo difficultyInfo = __instance.difficultyInfo;
foreach (KeyValuePair<GameDifficulty, GkDifficulty> gkDifficulty2 in Instance._gkDifficulties)
{
gkDifficulty2.Deconstruct(out var key, out var value);
GameDifficulty val = key;
GkDifficulty gkDifficulty = value;
Transform child = ((Component)__instance).gameObject.transform.GetChild(1);
GameObject obj = Object.Instantiate<GameObject>(gameObject, child);
((Object)obj).name = "Toggle - " + gkDifficulty.DifficultyName;
ToggleDifficulty component = obj.GetComponent<ToggleDifficulty>();
component.GameDifficulty = val;
UIToggle component2 = obj.GetComponent<UIToggle>();
GameObject gameObject2 = ((Component)obj.transform.GetChild(0)).gameObject;
((ReactorColorTarget)gameObject2.GetComponent<ImageColorTarget>()).color = gkDifficulty.BackgroundColor;
((ReactorColorTarget)((Component)gameObject2.transform.GetChild(0)).gameObject.GetComponent<ImageColorTarget>()).color = gkDifficulty.CheckmarkColor;
__instance._toggles.Add(component);
CollectionExtensions.AddItem<ToggleDifficulty>((IEnumerable<ToggleDifficulty>)__instance.difficultyToggles, component);
__instance.toggleGroup.AddToggle(component2);
if (!((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.BackgroundColors).ContainsKey(val))
{
((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.BackgroundColors).Add(val, gkDifficulty.BackgroundColor);
}
if (!((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.CheckmarkColors).ContainsKey(val))
{
((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.CheckmarkColors).Add(val, gkDifficulty.CheckmarkColor);
}
}
}
[HarmonyPatch(typeof(GameDifficultyIndicator), "OnEnable")]
[HarmonyPrefix]
private static void PatchGameDifficultyIndicator(ref GameDifficultyIndicator __instance)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogMessage((object)"Filling difficulty - indicator");
GameDifficultyInfo difficultyInfo = __instance.difficultyInfo;
foreach (var (val2, gkDifficulty2) in Instance._gkDifficulties)
{
if (!((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.BackgroundColors).ContainsKey(val2))
{
((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.BackgroundColors).Add(val2, gkDifficulty2.BackgroundColor);
}
if (!((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.CheckmarkColors).ContainsKey(val2))
{
((Dictionary<GameDifficulty, Color>)(object)difficultyInfo.CheckmarkColors).Add(val2, gkDifficulty2.CheckmarkColor);
}
}
}
[HarmonyPatch(typeof(StatisticPanelView), "FillInfo")]
[HarmonyPrefix]
private static void PrefixStatisticsPanel(ref StatisticPanelView __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
_cachedDifficulty = GlobalPredictor.Difficulty;
GlobalPredictor.Difficulty = (GameDifficulty)4;
}
[HarmonyPatch(typeof(StatisticPanelView), "FillInfo")]
[HarmonyPostfix]
private static void PostfixStatisticsPanel(ref StatisticPanelView __instance)
{
//IL_0000: 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_000f: 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)
//IL_0020: Expected O, but got Unknown
//IL_004a: 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_0062: Expected I4, but got Unknown
//IL_002f: 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)
GlobalPredictor.Difficulty = _cachedDifficulty;
GameDifficulty cachedDifficulty = _cachedDifficulty;
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(34, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Filling difficulty - statistics (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<GameDifficulty>(_cachedDifficulty);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
log.LogMessage(val);
GkDifficulty value;
string text = "MENU.UI.DIFFICULTY." + (cachedDifficulty - 1) switch
{
0 => "OBSERVER",
1 => "PARTICIPANT",
3 => "GATEKEEPER",
_ => (!Instance._gkDifficulties.TryGetValue(cachedDifficulty, out value)) ? "OBSERVER" : value.TranslationKey,
};
__instance.difficultText.m_text = Extensions.Translate((Component)(object)__instance, text, true);
}
}
public class GkDifficulty
{
public class Builder
{
private string _difficultyName = "Any";
private DifficultyValues _difficultyValues = new DifficultyValues
{
difficultyMultiplier = 0f,
prismMultiplier = 1f,
stringPercentage = "any%"
};
private Color _backgroundColor = Color.white;
private Color _checkmarkColor = Color.white;
private float _expLoopPow;
private float _expPointsPerEvo;
private float _expPointsPerLoop;
private float _expPointsPerTimeTick;
private GameEventData _gameEventData = new GameEventData
{
maxSkipLevels = 4,
minLevel = 6,
templateStartIndex = 0,
eventsProbability = DifficultiesAPI.Instance.CreateGameEventsProbabilities(0.2f)
};
private SirenSpawnData _sirenSpawnData = new SirenSpawnData
{
twoSirensLocation = 6,
threeSirensLocation = 21
};
private float _enemyExpRoundPow = 1f;
private float _enemyExpPointsPerRound;
private float _enemyPowerDifficultyCoefficient = 1f;
private float _fixedSirenDifficultyCoefficient = 0.1f;
private float _sirenSpawnDifficultyModifier;
private float _arenaExpPointsPerTime;
private EliteSpawnData _elitesData = new EliteSpawnData
{
difficultyModifier = 0.7f,
instantChance = 0f,
instantChanceMax = 0.25f,
instantChanceMod = 0.05f,
maxEnemyPower = 2f,
maxEnemyPowerMod = 1f,
templateStartIndex = 0
};
private float _instabilityCapsuleSpeed = 6f;
public Builder WithName(string difficultyName)
{
_difficultyName = difficultyName;
return this;
}
public Builder WithDifficultyValues(string percentageName, float difficultyMultiplier, float prismMultiplier)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_001b: Expected O, but got Unknown
DifficultyValues difficultyValues = new DifficultyValues
{
difficultyMultiplier = difficultyMultiplier,
prismMultiplier = prismMultiplier,
stringPercentage = percentageName
};
_difficultyValues = difficultyValues;
return this;
}
public Builder WithGameEventsData(int eventsMinLevel, int maxSkipLevels, int templateStartIndex, ProbabilityList<bool> eventsProbability)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
_gameEventData = new GameEventData
{
minLevel = eventsMinLevel,
maxSkipLevels = maxSkipLevels,
templateStartIndex = templateStartIndex,
eventsProbability = eventsProbability
};
return this;
}
public Builder WithSirenSpawnData(int twoSirensLocation, int threeSirensLocation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
_sirenSpawnData = new SirenSpawnData
{
twoSirensLocation = twoSirensLocation,
threeSirensLocation = threeSirensLocation
};
return this;
}
public Builder WithEliteSpawnData(float difficultyModifier, float instantChance, float instantChanceMax, float instantChanceMod, float maxEnemyPower, float maxEnemyPowerMod, int templateStartIndex)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
_elitesData = new EliteSpawnData
{
difficultyModifier = difficultyModifier,
instantChance = instantChance,
instantChanceMax = instantChanceMax,
instantChanceMod = instantChanceMod,
maxEnemyPower = maxEnemyPower,
maxEnemyPowerMod = maxEnemyPowerMod,
templateStartIndex = templateStartIndex
};
return this;
}
public Builder WithInstabilityCapsuleSpeed(float instabilityCapsuleSpeed)
{
_instabilityCapsuleSpeed = instabilityCapsuleSpeed;
return this;
}
public Builder WithColors(Color backgroundColor, Color checkmarkColor)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0009: Unknown result type (might be due to invalid IL or missing references)
_backgroundColor = backgroundColor;
_checkmarkColor = checkmarkColor;
return this;
}
public Builder WithExpLoopPow(float expLoopPow)
{
_expLoopPow = expLoopPow;
return this;
}
public Builder WithExpPoints(float expPointsPerEvo, float expPointsPerLoop, float expPointsPerTimeTick)
{
_expPointsPerEvo = expPointsPerEvo;
_expPointsPerLoop = expPointsPerLoop;
_expPointsPerTimeTick = expPointsPerTimeTick;
return this;
}
public Builder WithArenaValues(float enemyExpRoundPow, float enemyExpPointsPerRound, float enemyPowerDifficultyCoefficient, float fixedSirenDifficultyCoefficient, float sirenSpawnDifficultyModifier, float arenaExpPointsPerTime)
{
_enemyExpRoundPow = enemyExpRoundPow;
_enemyExpPointsPerRound = enemyExpPointsPerRound;
_enemyPowerDifficultyCoefficient = enemyPowerDifficultyCoefficient;
_fixedSirenDifficultyCoefficient = fixedSirenDifficultyCoefficient;
_sirenSpawnDifficultyModifier = sirenSpawnDifficultyModifier;
_arenaExpPointsPerTime = arenaExpPointsPerTime;
return this;
}
public GkDifficulty Build()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
return new GkDifficulty
{
DifficultyName = _difficultyName,
TranslationKey = _difficultyName.ToUpper().Replace(" ", "_"),
DifficultyValues = _difficultyValues,
GameEventData = _gameEventData,
SirenSpawnData = _sirenSpawnData,
ElitesData = _elitesData,
InstabilityCapsuleSpeed = _instabilityCapsuleSpeed,
BackgroundColor = _backgroundColor,
CheckmarkColor = _checkmarkColor,
EnemyExpLoopPow = _expLoopPow,
EnemyExpPointsPerEvo = _expPointsPerEvo,
EnemyExpPointsPerLoop = _expPointsPerLoop,
EnemyExpPointsPerTimeTick = _expPointsPerTimeTick,
ArenaValue = new Arena
{
EnemyExpRoundPow = _enemyExpRoundPow,
EnemyExpPointsPerRound = _enemyExpPointsPerRound,
EnemyPowerDifficultyCoefficient = _enemyPowerDifficultyCoefficient,
FixedSirenDifficultyCoefficient = _fixedSirenDifficultyCoefficient,
SirenSpawnDifficultyModifier = _sirenSpawnDifficultyModifier,
ArenaExpPointsPerTime = _arenaExpPointsPerTime
}
};
}
}
public class Arena
{
public float EnemyExpRoundPow { get; internal init; }
public float EnemyExpPointsPerRound { get; internal init; }
public float EnemyPowerDifficultyCoefficient { get; internal init; }
public float FixedSirenDifficultyCoefficient { get; internal init; }
public float SirenSpawnDifficultyModifier { get; internal init; }
public float ArenaExpPointsPerTime { get; internal init; }
}
public string DifficultyName { get; private set; }
public string TranslationKey { get; private set; }
public DifficultyValues DifficultyValues { get; private set; }
public GameEventData GameEventData { get; private set; }
public SirenSpawnData SirenSpawnData { get; private set; }
public EliteSpawnData ElitesData { get; private set; }
public float InstabilityCapsuleSpeed { get; private set; }
public Color BackgroundColor { get; private set; }
public Color CheckmarkColor { get; private set; }
public float EnemyExpLoopPow { get; private set; }
public float EnemyExpPointsPerEvo { get; private set; }
public float EnemyExpPointsPerLoop { get; private set; }
public float EnemyExpPointsPerTimeTick { get; private set; }
public Arena ArenaValue { get; private set; }
}
}
namespace GKAPI.AssetBundles
{
public static class AssetHelper
{
public const string PlaceholderBundlePath = "GKAPI.Assets.testassetbundle";
public const string PlaceholderSpritePath = "assets/testbundle/textures/logo-50x50.png";
public const string PlaceholderPrefabPath = "assets/testbundle/Item_Placeholder.prefab";
public static T LoadAsset<T>(string bundlePath, string assetPath) where T : Object
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading asset ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(assetPath);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" in bundle ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(bundlePath);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from assembly ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Assembly.GetCallingAssembly().GetName().Name);
}
log.LogInfo(val);
using Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream(bundlePath);
AssetBundle val2 = AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(StreamExtensions.ReadBytes(stream)));
foreach (string item in (Il2CppArrayBase<string>)(object)val2.AllAssetNames())
{
ManualLogSource log2 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Contains ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item);
}
log2.LogInfo(val);
}
Object val3 = val2.LoadAsset(assetPath, Il2CppType.Of<T>());
if (val3 == (Object)null)
{
Plugin.Log.LogWarning((object)("Failed to load raw asset: " + assetPath + " in bundle: " + bundlePath));
return default(T);
}
T val4 = ((Il2CppObjectBase)val3).TryCast<T>();
val2.Unload(false);
if ((Object)(object)val4 == (Object)null)
{
Plugin.Log.LogWarning((object)("Failed to load asset: " + assetPath + " in bundle: " + bundlePath));
}
return val4;
}
}
}
namespace GKAPI.Achievements
{
public class AchievementsAPI
{
private List<GkAchievement> _achievements = new List<GkAchievement>();
private static List<ushort> _existingIndicies = Enum.GetValues<AchievementID>().Cast<ushort>().ToList();
private static int _nextAchievementIndex = 5;
public static AchievementsAPI Instance { get; } = new AchievementsAPI();
private static int NextAchievementIndex
{
get
{
while (_existingIndicies.Contains((ushort)_nextAchievementIndex))
{
_nextAchievementIndex++;
}
return _nextAchievementIndex++;
}
}
private AchievementsAPI()
{
EventHandler.Init = (Action)Delegate.Combine(EventHandler.Init, new Action(RegisterAchievements));
}
public GkAchievement AddAchievement(GkAchievement.Builder builder)
{
GkAchievement gkAchievement = builder.Build(NextAchievementIndex);
_achievements.Add(gkAchievement);
return gkAchievement;
}
private void RegisterAchievements()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Registering Achievements");
}
log.LogInfo(val);
List<StoreAchievementInfo> storeAchievementInfos = DatabaseInfoProvider.StoreAchievements.StoreAchievementInfos;
foreach (GkAchievement achievement in _achievements)
{
achievement.WriteItems();
storeAchievementInfos.Add(achievement.Info);
}
ManualLogSource log2 = Plugin.Log;
val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Registered ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_achievements.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Achievements");
}
log2.LogInfo(val);
}
}
public class GkAchievement
{
public class Builder
{
public GkAchievement Build(int index, string name = "Test Achievement Name")
{
GkAchievement gkAchievement = new GkAchievement();
StoreAchievementInfo val = ScriptableObject.CreateInstance<StoreAchievementInfo>();
((Object)val).name = name;
val.Index = index;
val.AchievementID = (AchievementID)0;
gkAchievement.Info = val;
return gkAchievement;
}
}
private readonly List<ItemDatabaseInfo> _items = new List<ItemDatabaseInfo>();
public StoreAchievementInfo Info { get; private set; }
public void WriteItems()
{
Info.Items = new Il2CppReferenceArray<ItemDatabaseInfo>(_items.ToArray());
}
public void AddItem(ItemDatabaseInfo item)
{
_items.Add(item);
}
public void AddItems(ItemDatabaseInfo[] items)
{
_items.AddRange(items);
}
}
}