using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using LevelUpChoices.Artifacts;
using LevelUpChoices.Extensions;
using LevelUpChoices.UI;
using LevelUpChoices.UI.Builders;
using LevelUpChoices.UI.Components;
using LevelUpChoices.UI.Constants;
using LevelUpChoices.UI.Integration;
using LevelUpChoices.UI.Services;
using LookingGlass.ItemStatsNameSpace;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LevelUpChoices")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+afca92e1895240713eca745ffb34868407a04f9e")]
[assembly: AssemblyProduct("LevelUpChoices")]
[assembly: AssemblyTitle("LevelUpChoices")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LevelUpChoices
{
public class DebugManager : MonoBehaviour
{
private bool CheckDebugEnabled()
{
if (ModConfig.DebugPassword == null)
{
return false;
}
if (ModConfig.DebugPassword.Value != 3169)
{
return false;
}
return true;
}
private void Update()
{
try
{
if (Input.GetKeyDown((KeyCode)283))
{
if (CheckDebugEnabled() && NetworkServer.active)
{
TeamManager.instance.GiveTeamExperience((TeamIndex)1, TeamManager.instance.GetTeamNextLevelExperience((TeamIndex)1) - TeamManager.instance.GetTeamCurrentLevelExperience((TeamIndex)1) + 1);
Log.Info("Granted debug XP", "C:\\Users\\erenk\\Public\\src\\DebugManager.cs", "Update");
}
}
else if (Input.GetKeyDown((KeyCode)285) && CheckDebugEnabled())
{
DumpAllItemsToJson();
}
}
catch (Exception data)
{
Log.Error(data, "C:\\Users\\erenk\\Public\\src\\DebugManager.cs", "Update");
}
}
private static void DumpAllItemsToJson()
{
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad6: Invalid comparison between Unknown and I4
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Expected I4, but got Unknown
//IL_0c1e: Unknown result type (might be due to invalid IL or missing references)
//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0c2c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c31: Unknown result type (might be due to invalid IL or missing references)
//IL_0590: Unknown result type (might be due to invalid IL or missing references)
//IL_0c44: Unknown result type (might be due to invalid IL or missing references)
//IL_0c5f: Unknown result type (might be due to invalid IL or missing references)
//IL_0c66: Expected I4, but got Unknown
//IL_0ec6: Unknown result type (might be due to invalid IL or missing references)
//IL_0fec: Unknown result type (might be due to invalid IL or missing references)
//IL_0fee: Unknown result type (might be due to invalid IL or missing references)
//IL_0ff3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ff5: Unknown result type (might be due to invalid IL or missing references)
//IL_0ff7: Unknown result type (might be due to invalid IL or missing references)
//IL_1015: Unknown result type (might be due to invalid IL or missing references)
//IL_0755: Unknown result type (might be due to invalid IL or missing references)
//IL_0757: Unknown result type (might be due to invalid IL or missing references)
//IL_075c: Unknown result type (might be due to invalid IL or missing references)
//IL_075e: Unknown result type (might be due to invalid IL or missing references)
//IL_0760: Unknown result type (might be due to invalid IL or missing references)
//IL_077e: Unknown result type (might be due to invalid IL or missing references)
//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
//IL_087b: Unknown result type (might be due to invalid IL or missing references)
//IL_0885: Expected I4, but got Unknown
//IL_0898: Unknown result type (might be due to invalid IL or missing references)
//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
//IL_08bf: Expected I4, but got Unknown
//IL_0a40: Unknown result type (might be due to invalid IL or missing references)
try
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("{");
stringBuilder.AppendLine(" \"_metadata\": {");
stringBuilder.AppendLine(" \"dumpTime\": \"" + Esc(DateTime.UtcNow.ToString("o")) + "\",");
stringBuilder.AppendLine($" \"itemCatalogCount\": {ItemCatalog.itemCount},");
stringBuilder.AppendLine($" \"pickupCatalogCount\": {PickupCatalog.pickupCount},");
stringBuilder.AppendLine($" \"equipmentCatalogCount\": {EquipmentCatalog.equipmentCount}");
stringBuilder.AppendLine(" },");
stringBuilder.AppendLine(" \"itemTierDefs\": [");
bool flag = true;
ItemTier[] array = new ItemTier[11];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
ItemTier[] array2 = (ItemTier[])(object)array;
foreach (ItemTier val in array2)
{
if (!flag)
{
stringBuilder.AppendLine(",");
}
flag = false;
ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(val);
stringBuilder.AppendLine(" {");
stringBuilder.AppendLine($" \"tier\": \"{val}\",");
stringBuilder.AppendLine(" \"tierDefExists\": " + Bool((Object)(object)itemTierDef != (Object)null) + ",");
if ((Object)(object)itemTierDef != (Object)null)
{
stringBuilder.AppendLine(" \"isDroppable\": " + Bool(itemTierDef.isDroppable) + ",");
stringBuilder.AppendLine(" \"canScrap\": " + Bool(itemTierDef.canScrap) + ",");
stringBuilder.AppendLine(" \"canRestack\": " + Bool(itemTierDef.canRestack) + ",");
stringBuilder.AppendLine($" \"colorIndex\": \"{itemTierDef.colorIndex}\",");
stringBuilder.AppendLine($" \"darkColorIndex\": \"{itemTierDef.darkColorIndex}\",");
stringBuilder.AppendLine($" \"pickupRules\": \"{itemTierDef.pickupRules}\",");
stringBuilder.AppendLine(" \"bgIconTexture\": \"" + Esc(((Object)(object)itemTierDef.bgIconTexture != (Object)null) ? ((Object)itemTierDef.bgIconTexture).name : "null") + "\",");
stringBuilder.AppendLine(" \"highlightPrefab\": \"" + Esc(((Object)(object)itemTierDef.highlightPrefab != (Object)null) ? ((Object)itemTierDef.highlightPrefab).name : "null") + "\",");
stringBuilder.AppendLine(" \"dropletDisplayPrefab\": \"" + Esc(((Object)(object)itemTierDef.dropletDisplayPrefab != (Object)null) ? ((Object)itemTierDef.dropletDisplayPrefab).name : "null") + "\"");
}
else
{
stringBuilder.AppendLine(" \"_note\": \"ItemTierDef is null for this tier\"");
}
stringBuilder.Append(" }");
}
stringBuilder.AppendLine();
stringBuilder.AppendLine(" ],");
stringBuilder.AppendLine(" \"items\": [");
bool flag2 = true;
AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator();
try
{
while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
{
ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
if (!flag2)
{
stringBuilder.AppendLine(",");
}
flag2 = false;
ItemDef itemDef = ItemCatalog.GetItemDef(current);
bool flag3 = (Object)(object)itemDef == (Object)null;
stringBuilder.AppendLine(" {");
stringBuilder.AppendLine($" \"itemIndex\": {(int)current},");
stringBuilder.AppendLine(" \"itemDefExists\": " + Bool(!flag3) + ",");
if (flag3)
{
stringBuilder.AppendLine(" \"skipReason\": \"DEF_NULL\"");
stringBuilder.Append(" }");
continue;
}
stringBuilder.AppendLine(" \"name\": \"" + Esc(((Object)itemDef).name) + "\",");
stringBuilder.AppendLine(" \"nameToken\": \"" + Esc(itemDef.nameToken) + "\",");
stringBuilder.AppendLine(" \"displayName\": \"" + Esc(SafeGetString(itemDef.nameToken)) + "\",");
stringBuilder.AppendLine(" \"pickupToken\": \"" + Esc(itemDef.pickupToken) + "\",");
stringBuilder.AppendLine(" \"pickupDescription\": \"" + Esc(SafeGetString(itemDef.pickupToken)) + "\",");
stringBuilder.AppendLine(" \"descriptionToken\": \"" + Esc(itemDef.descriptionToken) + "\",");
stringBuilder.AppendLine(" \"fullDescription\": \"" + Esc(SafeGetString(Integrations.lookingGlassEnabled ? LookingGlassIntegration.GetItemDescription(itemDef, 0, null, withOneMore: false) : itemDef.descriptionToken)) + "\",");
stringBuilder.AppendLine(" \"loreToken\": \"" + Esc(itemDef.loreToken) + "\",");
stringBuilder.AppendLine($" \"tier\": \"{itemDef.tier}\",");
ItemTierDef itemTierDef2 = ItemTierCatalog.GetItemTierDef(itemDef.tier);
stringBuilder.AppendLine(" \"tierDef\": {");
if ((Object)(object)itemTierDef2 != (Object)null)
{
stringBuilder.AppendLine(" \"isDroppable\": " + Bool(itemTierDef2.isDroppable) + ",");
stringBuilder.AppendLine(" \"canScrap\": " + Bool(itemTierDef2.canScrap) + ",");
stringBuilder.AppendLine(" \"canRestack\": " + Bool(itemTierDef2.canRestack) + ",");
stringBuilder.AppendLine($" \"pickupRules\": \"{itemTierDef2.pickupRules}\"");
}
else
{
stringBuilder.AppendLine(" \"_note\": \"null\"");
}
stringBuilder.AppendLine(" },");
stringBuilder.AppendLine(" \"hidden\": " + Bool(itemDef.hidden) + ",");
stringBuilder.AppendLine(" \"canRemove\": " + Bool(itemDef.canRemove) + ",");
string s = ((itemDef.tags != null) ? string.Join(", ", itemDef.tags) : "null");
stringBuilder.AppendLine(" \"tags\": \"" + Esc(s) + "\",");
stringBuilder.AppendLine(" \"tagsArray\": [" + ((itemDef.tags != null) ? string.Join(", ", itemDef.tags.Select((ItemTag t) => $"\"{t}\"")) : "") + "],");
stringBuilder.AppendLine(" \"pickupIconSprite\": \"" + Esc(((Object)(object)itemDef.pickupIconSprite != (Object)null) ? ((Object)itemDef.pickupIconSprite).name : "null") + "\",");
stringBuilder.AppendLine(" \"unlockableDef\": \"" + Esc(((Object)(object)itemDef.unlockableDef != (Object)null) ? itemDef.unlockableDef.cachedName : "null") + "\",");
stringBuilder.AppendLine(" \"requiredExpansion\": \"" + Esc(((Object)(object)itemDef.requiredExpansion != (Object)null) ? ((Object)itemDef.requiredExpansion).name : "null") + "\",");
PickupIndex val2 = PickupCatalog.FindPickupIndex(current);
bool flag4 = val2 != PickupIndex.none;
stringBuilder.AppendLine(" \"pickup\": {");
stringBuilder.AppendLine($" \"pickupIndex\": {val2.value},");
stringBuilder.AppendLine(" \"hasPickup\": " + Bool(flag4) + ",");
if (flag4)
{
PickupDef pickupDef = PickupCatalog.GetPickupDef(val2);
if (pickupDef != null)
{
stringBuilder.AppendLine(" \"internalName\": \"" + Esc(pickupDef.internalName) + "\",");
stringBuilder.AppendLine(" \"nameToken\": \"" + Esc(pickupDef.nameToken) + "\",");
stringBuilder.AppendLine(" \"interactContextToken\": \"" + Esc(pickupDef.interactContextToken) + "\",");
stringBuilder.AppendLine(" \"isLunar\": " + Bool(pickupDef.isLunar) + ",");
stringBuilder.AppendLine(" \"isBoss\": " + Bool(pickupDef.isBoss) + ",");
stringBuilder.AppendLine($" \"itemIndex\": {(int)pickupDef.itemIndex},");
stringBuilder.AppendLine($" \"itemTier\": \"{pickupDef.itemTier}\",");
stringBuilder.AppendLine($" \"equipmentIndex\": {(int)pickupDef.equipmentIndex},");
stringBuilder.AppendLine($" \"coinValue\": {pickupDef.coinValue},");
stringBuilder.AppendLine(" \"baseColor\": \"" + Esc(((object)(Color)(ref pickupDef.baseColor)).ToString()) + "\",");
stringBuilder.AppendLine(" \"darkColor\": \"" + Esc(((object)(Color)(ref pickupDef.darkColor)).ToString()) + "\",");
stringBuilder.AppendLine(" \"iconSprite\": \"" + Esc(((Object)(object)pickupDef.iconSprite != (Object)null) ? ((Object)pickupDef.iconSprite).name : "null") + "\",");
stringBuilder.AppendLine(" \"displayPrefab\": \"" + Esc(((Object)(object)pickupDef.displayPrefab != (Object)null) ? ((Object)pickupDef.displayPrefab).name : "null") + "\",");
stringBuilder.AppendLine(" \"dropletDisplayPrefab\": \"" + Esc(((Object)(object)pickupDef.dropletDisplayPrefab != (Object)null) ? ((Object)pickupDef.dropletDisplayPrefab).name : "null") + "\"");
}
else
{
stringBuilder.AppendLine(" \"_note\": \"PickupDef is null despite valid PickupIndex\"");
}
}
else
{
stringBuilder.AppendLine(" \"_note\": \"no pickup entry\"");
}
stringBuilder.AppendLine(" },");
bool flag5 = false;
bool flag6 = false;
try
{
if ((Object)(object)Run.instance != (Object)null)
{
flag6 = true;
flag5 = Run.instance.availableItems.Contains(current);
}
}
catch
{
}
stringBuilder.AppendLine(" \"run\": {");
stringBuilder.AppendLine(" \"runInstanceExists\": " + Bool(flag6) + ",");
stringBuilder.AppendLine(" \"isAvailableInRun\": " + Bool(flag5));
stringBuilder.AppendLine(" },");
bool flag7 = PlayerDropTable.BannedItemNames.Contains(((Object)itemDef).name);
bool flag8 = itemDef.tags != null && itemDef.tags.Contains((ItemTag)25);
ItemTier tier = itemDef.tier;
bool flag9 = (int)tier <= 4;
bool flag10 = flag9;
string text = "INCLUDED";
if (itemDef.hidden)
{
text = "HIDDEN";
}
else if (flag8)
{
text = "IGNORE_FOR_DROP_LIST";
}
else if (flag7)
{
text = "BANNED";
}
else if (!flag10)
{
text = "INVALID_TIER";
}
else if (!flag4)
{
text = "NO_PICKUP_INDEX";
}
else if (!flag6)
{
text = "RUN_INSTANCE_NULL";
}
else if (!flag5)
{
text = "NOT_AVAILABLE_IN_RUN";
}
stringBuilder.AppendLine(" \"filter\": {");
stringBuilder.AppendLine(" \"isBanned\": " + Bool(flag7) + ",");
stringBuilder.AppendLine(" \"ignoreForDropList\": " + Bool(flag8) + ",");
stringBuilder.AppendLine(" \"isAllowedTier\": " + Bool(flag10) + ",");
stringBuilder.AppendLine(" \"skipReason\": \"" + text + "\"");
stringBuilder.AppendLine(" }");
stringBuilder.Append(" }");
}
}
finally
{
((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
}
stringBuilder.AppendLine();
stringBuilder.AppendLine(" ],");
stringBuilder.AppendLine(" \"equipment\": [");
bool flag11 = true;
AllEquipmentEnumerator enumerator2 = EquipmentCatalog.allEquipment.GetEnumerator();
try
{
while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext())
{
EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current;
if (!flag11)
{
stringBuilder.AppendLine(",");
}
flag11 = false;
EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current2);
stringBuilder.AppendLine(" {");
stringBuilder.AppendLine($" \"equipmentIndex\": {(int)current2},");
stringBuilder.AppendLine(" \"equipmentDefExists\": " + Bool((Object)(object)equipmentDef != (Object)null) + ",");
if ((Object)(object)equipmentDef == (Object)null)
{
stringBuilder.AppendLine(" \"_note\": \"EquipmentDef is null\"");
stringBuilder.Append(" }");
continue;
}
stringBuilder.AppendLine(" \"name\": \"" + Esc(((Object)equipmentDef).name) + "\",");
stringBuilder.AppendLine(" \"nameToken\": \"" + Esc(equipmentDef.nameToken) + "\",");
stringBuilder.AppendLine(" \"displayName\": \"" + Esc(SafeGetString(equipmentDef.nameToken)) + "\",");
stringBuilder.AppendLine(" \"pickupToken\": \"" + Esc(equipmentDef.pickupToken) + "\",");
stringBuilder.AppendLine(" \"pickupDescription\": \"" + Esc(SafeGetString(equipmentDef.pickupToken)) + "\",");
stringBuilder.AppendLine(" \"descriptionToken\": \"" + Esc(equipmentDef.descriptionToken) + "\",");
stringBuilder.AppendLine(" \"loreToken\": \"" + Esc(equipmentDef.loreToken) + "\",");
stringBuilder.AppendLine(" \"isLunar\": " + Bool(equipmentDef.isLunar) + ",");
stringBuilder.AppendLine(" \"isBoss\": " + Bool(equipmentDef.isBoss) + ",");
stringBuilder.AppendLine($" \"cooldown\": {equipmentDef.cooldown},");
stringBuilder.AppendLine(" \"enigmaCompatible\": " + Bool(equipmentDef.enigmaCompatible) + ",");
stringBuilder.AppendLine(" \"canDrop\": " + Bool(equipmentDef.canDrop) + ",");
stringBuilder.AppendLine(" \"canBeRandomlyTriggered\": " + Bool(equipmentDef.canBeRandomlyTriggered) + ",");
stringBuilder.AppendLine(" \"appearsInSinglePlayer\": " + Bool(equipmentDef.appearsInSinglePlayer) + ",");
stringBuilder.AppendLine(" \"appearsInMultiPlayer\": " + Bool(equipmentDef.appearsInMultiPlayer) + ",");
stringBuilder.AppendLine($" \"colorIndex\": \"{equipmentDef.colorIndex}\",");
stringBuilder.AppendLine($" \"dropOnDeathChance\": {equipmentDef.dropOnDeathChance},");
stringBuilder.AppendLine(" \"passiveBuffDef\": \"" + Esc(((Object)(object)equipmentDef.passiveBuffDef != (Object)null) ? ((Object)equipmentDef.passiveBuffDef).name : "null") + "\",");
stringBuilder.AppendLine(" \"pickupIconSprite\": \"" + Esc(((Object)(object)equipmentDef.pickupIconSprite != (Object)null) ? ((Object)equipmentDef.pickupIconSprite).name : "null") + "\",");
stringBuilder.AppendLine(" \"unlockableDef\": \"" + Esc(((Object)(object)equipmentDef.unlockableDef != (Object)null) ? equipmentDef.unlockableDef.cachedName : "null") + "\",");
stringBuilder.AppendLine(" \"requiredExpansion\": \"" + Esc(((Object)(object)equipmentDef.requiredExpansion != (Object)null) ? ((Object)equipmentDef.requiredExpansion).name : "null") + "\",");
PickupIndex val3 = PickupCatalog.FindPickupIndex(current2);
bool v = val3 != PickupIndex.none;
stringBuilder.AppendLine(" \"pickup\": {");
stringBuilder.AppendLine($" \"pickupIndex\": {val3.value},");
stringBuilder.AppendLine(" \"hasPickup\": " + Bool(v));
stringBuilder.AppendLine(" }");
stringBuilder.Append(" }");
}
}
finally
{
((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose();
}
stringBuilder.AppendLine();
stringBuilder.AppendLine(" ]");
stringBuilder.AppendLine("}");
string text2 = Path.Combine(Paths.BepInExRootPath, "LevelUpChoices");
string text3 = Path.Combine(text2, "item_dump.json");
Directory.CreateDirectory(text2);
File.WriteAllText(text3, stringBuilder.ToString());
Log.Info("Item dump written to " + text3, "C:\\Users\\erenk\\Public\\src\\DebugManager.cs", "DumpAllItemsToJson");
}
catch (Exception data)
{
Log.Error(data, "C:\\Users\\erenk\\Public\\src\\DebugManager.cs", "DumpAllItemsToJson");
}
}
private static string Bool(bool v)
{
if (!v)
{
return "false";
}
return "true";
}
private static string Esc(string s)
{
if (string.IsNullOrEmpty(s))
{
return "";
}
return s.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\n", "\\n")
.Replace("\r", "\\r")
.Replace("\t", "\\t");
}
private static string SafeGetString(string token)
{
try
{
if (string.IsNullOrEmpty(token))
{
return "";
}
return Language.GetString(token) ?? "";
}
catch
{
return "";
}
}
}
public class ExperienceHook : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static hook_Update <0>__AmbientLevelDisplay_Update;
}
private ulong[] customExperienceTable;
private uint customNaturalLevelCap;
private ulong customHardExpCap;
private int lastMaxLevel = -1;
private bool lastEnableCustomLevelSystem;
private bool lastEnableMonsterLevelScaling;
private const double XP_BASE = 20.0;
private const double XP_BUFFER = 100000.0;
private const double SEARCH_LOW = 1.000001;
private const double SEARCH_HIGH = 100.0;
private static FieldInfo _teamExperienceField;
private static FieldInfo _teamLevelsField;
private static FieldInfo _teamCurrentExpField;
private static FieldInfo _teamNextExpField;
private int MaxLevel => ModConfig.MaxLevelValue;
public static event Action<uint> OnLevelUp;
private void Awake()
{
CacheReflectionFields();
ModConfig.EnableCustomLevelSystem.SettingChanged += OnSettingsChanged;
ModConfig.EnableMonsterLevelScaling.SettingChanged += OnSettingsChanged;
ModConfig.MaxLevel.SettingChanged += OnSettingsChanged;
ModConfig.OnServerConfigSynced += OnServerConfigSynced;
Run.onRunStartGlobal += OnRunStartGlobal;
Run.onRunDestroyGlobal += OnRunDestroyGlobal;
OnSettingsChanged(null, null);
}
private void OnServerConfigSynced()
{
OnSettingsChanged(null, null);
}
private static void SyncConfigAsServer()
{
if (NetworkServer.active)
{
NetMessageExtensions.Send((INetMessage)(object)new Networking.SyncConfig(ModConfig.MaxLevel.Value, ModConfig.EnableMonsterLevelScaling.Value, ModConfig.EnableCustomLevelSystem.Value), (NetworkDestination)1);
}
}
private void OnRunStartGlobal(Run run)
{
SyncConfigAsServer();
}
private void OnRunDestroyGlobal(Run run)
{
ModConfig.ResetServerConfig();
OnSettingsChanged(null, null);
}
private void CacheReflectionFields()
{
Type typeFromHandle = typeof(TeamManager);
_teamExperienceField = typeFromHandle.GetField("teamExperience", BindingFlags.Instance | BindingFlags.NonPublic);
_teamLevelsField = typeFromHandle.GetField("teamLevels", BindingFlags.Instance | BindingFlags.NonPublic);
_teamCurrentExpField = typeFromHandle.GetField("teamCurrentLevelExperience", BindingFlags.Instance | BindingFlags.NonPublic);
_teamNextExpField = typeFromHandle.GetField("teamNextLevelExperience", BindingFlags.Instance | BindingFlags.NonPublic);
}
private void OnDestroy()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0076: 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)
//IL_0081: Expected O, but got Unknown
TeamManager.FindLevelForExperience -= new hook_FindLevelForExperience(TeamManager_FindLevelForExperience);
TeamManager.GetExperienceForLevel -= new hook_GetExperienceForLevel(TeamManager_GetExperienceForLevel);
TeamManager.GiveTeamExperience -= new hook_GiveTeamExperience(TeamManager_GiveTeamExperience);
TeamManager.SetTeamExperience -= new hook_SetTeamExperience(TeamManager_SetTeamExperience);
TeamManager.SetTeamLevel -= new hook_SetTeamLevel(TeamManager_SetTeamLevel);
CharacterBody.RecalculateStats -= new hook_RecalculateStats(CharacterBody_RecalculateStats);
object obj = <>O.<0>__AmbientLevelDisplay_Update;
if (obj == null)
{
hook_Update val = AmbientLevelDisplay_Update;
<>O.<0>__AmbientLevelDisplay_Update = val;
obj = (object)val;
}
AmbientLevelDisplay.Update -= (hook_Update)obj;
ModConfig.EnableCustomLevelSystem.SettingChanged -= OnSettingsChanged;
ModConfig.EnableMonsterLevelScaling.SettingChanged -= OnSettingsChanged;
ModConfig.MaxLevel.SettingChanged -= OnSettingsChanged;
ModConfig.OnServerConfigSynced -= OnServerConfigSynced;
Run.onRunStartGlobal -= OnRunStartGlobal;
Run.onRunDestroyGlobal -= OnRunDestroyGlobal;
}
private void OnSettingsChanged(object sender, object args)
{
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Expected O, but got Unknown
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Expected O, but got Unknown
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
bool enableCustomLevelSystemValue = ModConfig.EnableCustomLevelSystemValue;
bool enableMonsterLevelScalingValue = ModConfig.EnableMonsterLevelScalingValue;
if (enableCustomLevelSystemValue)
{
if (!lastEnableCustomLevelSystem)
{
TeamManager.FindLevelForExperience += new hook_FindLevelForExperience(TeamManager_FindLevelForExperience);
TeamManager.GetExperienceForLevel += new hook_GetExperienceForLevel(TeamManager_GetExperienceForLevel);
TeamManager.GiveTeamExperience += new hook_GiveTeamExperience(TeamManager_GiveTeamExperience);
TeamManager.SetTeamExperience += new hook_SetTeamExperience(TeamManager_SetTeamExperience);
TeamManager.SetTeamLevel += new hook_SetTeamLevel(TeamManager_SetTeamLevel);
Log.Info("Custom XP enabled.", "C:\\Users\\erenk\\Public\\src\\ExperienceHook.cs", "OnSettingsChanged");
}
RebuildCustomTable();
if (enableMonsterLevelScalingValue && !lastEnableMonsterLevelScaling)
{
CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
object obj = <>O.<0>__AmbientLevelDisplay_Update;
if (obj == null)
{
hook_Update val = AmbientLevelDisplay_Update;
<>O.<0>__AmbientLevelDisplay_Update = val;
obj = (object)val;
}
AmbientLevelDisplay.Update += (hook_Update)obj;
Log.Info("Monster level scaling enabled.", "C:\\Users\\erenk\\Public\\src\\ExperienceHook.cs", "OnSettingsChanged");
}
else if (!enableMonsterLevelScalingValue && lastEnableMonsterLevelScaling)
{
CharacterBody.RecalculateStats -= new hook_RecalculateStats(CharacterBody_RecalculateStats);
object obj2 = <>O.<0>__AmbientLevelDisplay_Update;
if (obj2 == null)
{
hook_Update val2 = AmbientLevelDisplay_Update;
<>O.<0>__AmbientLevelDisplay_Update = val2;
obj2 = (object)val2;
}
AmbientLevelDisplay.Update -= (hook_Update)obj2;
Log.Info("Monster level scaling disabled.", "C:\\Users\\erenk\\Public\\src\\ExperienceHook.cs", "OnSettingsChanged");
}
}
else if (lastEnableCustomLevelSystem)
{
TeamManager.FindLevelForExperience -= new hook_FindLevelForExperience(TeamManager_FindLevelForExperience);
TeamManager.GetExperienceForLevel -= new hook_GetExperienceForLevel(TeamManager_GetExperienceForLevel);
TeamManager.GiveTeamExperience -= new hook_GiveTeamExperience(TeamManager_GiveTeamExperience);
TeamManager.SetTeamExperience -= new hook_SetTeamExperience(TeamManager_SetTeamExperience);
TeamManager.SetTeamLevel -= new hook_SetTeamLevel(TeamManager_SetTeamLevel);
if (lastEnableMonsterLevelScaling)
{
CharacterBody.RecalculateStats -= new hook_RecalculateStats(CharacterBody_RecalculateStats);
object obj3 = <>O.<0>__AmbientLevelDisplay_Update;
if (obj3 == null)
{
hook_Update val3 = AmbientLevelDisplay_Update;
<>O.<0>__AmbientLevelDisplay_Update = val3;
obj3 = (object)val3;
}
AmbientLevelDisplay.Update -= (hook_Update)obj3;
}
customExperienceTable = null;
Log.Info("Custom XP disabled.", "C:\\Users\\erenk\\Public\\src\\ExperienceHook.cs", "OnSettingsChanged");
}
lastEnableCustomLevelSystem = enableCustomLevelSystemValue;
lastEnableMonsterLevelScaling = enableMonsterLevelScalingValue;
lastMaxLevel = MaxLevel;
SyncConfigAsServer();
}
public static int GetCurrentMonsterLevel()
{
if (!Object.op_Implicit((Object)(object)Run.instance))
{
return 1;
}
if (ModConfig.EnableMonsterLevelScalingValue && ModConfig.IsModEnabled)
{
float num = (float)ModConfig.MaxLevelValue / 94f;
return Mathf.Min(Mathf.FloorToInt((float)Run.instance.ambientLevelFloor * num), ModConfig.MaxLevelValue);
}
return Run.instance.ambientLevelFloor;
}
private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Invalid comparison between Unknown and I4
//IL_0041: 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_004d: Invalid comparison between Unknown and I4
orig.Invoke(self);
if (Object.op_Implicit((Object)(object)Run.instance) && ModConfig.EnableMonsterLevelScalingValue && ModConfig.IsModEnabled && !((Object)(object)self.teamComponent == (Object)null) && (int)self.teamComponent.teamIndex != 1 && (self.bodyFlags & 0x20000000) > 0)
{
self.level = Mathf.Max(self.level, (float)GetCurrentMonsterLevel());
}
}
private static void AmbientLevelDisplay_Update(orig_Update orig, AmbientLevelDisplay self)
{
orig.Invoke(self);
if (ModConfig.EnableMonsterLevelScalingValue && ModConfig.IsModEnabled && Object.op_Implicit((Object)(object)Run.instance))
{
int currentMonsterLevel = GetCurrentMonsterLevel();
((TMP_Text)self.text).text = Language.GetStringFormatted("AMBIENT_LEVEL_DISPLAY_FORMAT", new object[1] { currentMonsterLevel.ToString() });
}
}
private double CalculateOptimalMultiplier(uint maxLevel)
{
if (maxLevel < 2)
{
return 1.0;
}
double num = 1.8446744073709451E+19;
double num2 = 1.000001;
double num3 = 100.0;
double num4 = 0.0;
for (int i = 0; i < 64; i++)
{
num4 = (num2 + num3) / 2.0;
if (20.0 * (Math.Pow(num4, maxLevel - 1) - 1.0) / (num4 - 1.0) < num)
{
num2 = num4;
}
else
{
num3 = num4;
}
}
return num4;
}
private void RebuildCustomTable()
{
int num = MaxLevel;
if (num < 2)
{
Log.Error("MaxLevel must be at least 2. Defaulting to 256.", "C:\\Users\\erenk\\Public\\src\\ExperienceHook.cs", "RebuildCustomTable");
num = 256;
}
double num2 = CalculateOptimalMultiplier((uint)num);
double num3 = 0.0;
double num4 = 1.0;
List<ulong> list = new List<ulong> { 0uL, 0uL };
bool flag = false;
for (uint num5 = 2u; num5 <= num; num5++)
{
ulong num6;
if (flag)
{
num6 = ulong.MaxValue;
}
else
{
double num7 = 20.0 * num4;
num4 *= num2;
num3 += num7;
if (!(num3 >= 1.8446744073709552E+19))
{
num6 = ((!(num3 < 0.0)) ? ((ulong)num3) : 0);
}
else
{
num3 = 1.8446744073709552E+19;
num6 = ulong.MaxValue;
flag = true;
}
if (list.Count > 1)
{
if (num6 <= list[list.Count - 1] && num6 != ulong.MaxValue)
{
num6 = ulong.MaxValue;
flag = true;
}
}
}
list.Add(num6);
}
customExperienceTable = list.ToArray();
customNaturalLevelCap = (uint)(customExperienceTable.Length - 1);
customHardExpCap = customExperienceTable[^1];
Log.Info($"XP table rebuilt. Max: {customNaturalLevelCap}, Cap: {customHardExpCap}, R: {num2:F4}", "C:\\Users\\erenk\\Public\\src\\ExperienceHook.cs", "RebuildCustomTable");
}
private uint TeamManager_FindLevelForExperience(orig_FindLevelForExperience orig, ulong exp)
{
if (!ModConfig.IsModEnabled)
{
return orig.Invoke(exp);
}
if (customExperienceTable == null || customExperienceTable.Length == 0)
{
return orig.Invoke(exp);
}
for (uint num = 1u; num < customExperienceTable.Length; num++)
{
if (customExperienceTable[num] > exp)
{
return num - 1;
}
}
return customNaturalLevelCap;
}
private ulong TeamManager_GetExperienceForLevel(orig_GetExperienceForLevel orig, uint level)
{
if (!ModConfig.IsModEnabled)
{
return orig.Invoke(level);
}
if (customExperienceTable == null || customExperienceTable.Length == 0)
{
return orig.Invoke(level);
}
if (level >= customExperienceTable.Length)
{
level = customNaturalLevelCap;
}
return customExperienceTable[level];
}
private void TeamManager_GiveTeamExperience(orig_GiveTeamExperience orig, TeamManager self, TeamIndex teamIndex, ulong exp)
{
//IL_001b: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Invalid comparison between Unknown and I4
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
if (!ModConfig.IsModEnabled)
{
orig.Invoke(self, teamIndex, exp);
return;
}
ulong teamExperience = self.GetTeamExperience(teamIndex);
ulong num = teamExperience + exp;
if (num < teamExperience)
{
num = ulong.MaxValue;
}
self.SetTeamExperience(teamIndex, num);
if ((int)teamIndex != 1)
{
return;
}
ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(teamIndex);
for (int i = 0; i < teamMembers.Count; i++)
{
CharacterBody component = ((Component)teamMembers[i]).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)((component != null) ? component.master : null)))
{
component.master.TrackBeadExperience(exp);
}
}
}
private void TeamManager_SetTeamLevel(orig_SetTeamLevel orig, TeamManager self, TeamIndex teamIndex, uint newLevel)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
//IL_0009: 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_0018: Invalid comparison between Unknown and I4
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!ModConfig.IsModEnabled)
{
orig.Invoke(self, teamIndex, newLevel);
}
else if ((int)teamIndex >= 0 && (int)teamIndex < 5 && self.GetTeamLevel(teamIndex) != newLevel)
{
self.SetTeamExperience(teamIndex, TeamManager_GetExperienceForLevel(null, newLevel));
}
}
private void TeamManager_SetTeamExperience(orig_SetTeamExperience orig, TeamManager self, TeamIndex teamIndex, ulong exp)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_0113: Invalid comparison between Unknown and I4
if (!ModConfig.IsModEnabled)
{
orig.Invoke(self, teamIndex, exp);
return;
}
if (exp > customHardExpCap)
{
exp = customHardExpCap;
}
ulong[] array = (ulong[])_teamExperienceField?.GetValue(self);
if (array != null)
{
array[teamIndex] = exp;
}
uint teamLevel = self.GetTeamLevel(teamIndex);
uint num = TeamManager_FindLevelForExperience(null, exp);
if (teamLevel != num)
{
ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(teamIndex);
for (int i = 0; i < teamMembers.Count; i++)
{
CharacterBody component = ((Component)teamMembers[i]).GetComponent<CharacterBody>();
if (component != null)
{
component.OnTeamLevelChanged();
}
}
uint[] array2 = (uint[])_teamLevelsField?.GetValue(self);
if (array2 != null)
{
array2[teamIndex] = num;
}
ulong[] array3 = (ulong[])_teamCurrentExpField?.GetValue(self);
if (array3 != null)
{
array3[teamIndex] = TeamManager_GetExperienceForLevel(null, num);
}
ulong[] array4 = (ulong[])_teamNextExpField?.GetValue(self);
if (array4 != null)
{
array4[teamIndex] = TeamManager_GetExperienceForLevel(null, num + 1);
}
if (teamLevel < num)
{
GlobalEventManager.OnTeamLevelUp(teamIndex);
if ((int)teamIndex == 1)
{
for (uint num2 = teamLevel + 1; num2 <= num; num2++)
{
ExperienceHook.OnLevelUp?.Invoke(num2);
}
}
}
}
if (NetworkServer.active)
{
((NetworkBehaviour)self).SetDirtyBit((uint)(1 << (int)teamIndex));
}
}
}
public class InteractableSpawnHook : MonoBehaviour
{
private static readonly HashSet<string> BlacklistedSpawns = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"isccasinochest", "isccategorychestdamage", "isccategorychesthealing", "isccategorychestutility", "iscchest1", "iscchest1stealthed", "iscchest2", "iscduplicator", "iscduplicatorlarge", "iscduplicatormilitary",
"iscduplicatorwild", "iscgoldchest", "isclunarchest", "iscscrapper", "iscshrineblood", "iscshrinebloodsandy", "iscshrinebloodsnowy", "iscshrinechance", "iscshrinechancesandy", "iscshrinechancesnowy",
"iscshrinecleanse", "iscshrinecleansesandy", "iscshrinecleansesnowy", "iscshrinecombat", "iscshrinecombatsandy", "iscshrinecombatsnowy", "iscshrinerestack", "iscshrinerestacksandy", "iscshrinerestacksnowy", "isctripleshop",
"isctripleshoplarge", "isccategorychest2damage", "isccategorychest2healing", "isccategorychest2utility"
};
private void Start()
{
SceneDirector.onPrePopulateSceneServer += OnPrePopulateSceneServer;
}
private void OnPrePopulateSceneServer(SceneDirector director)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
if (!ModConfig.IsModEnabled || !ModConfig.EnableInteractableRemoval.Value || !Object.op_Implicit((Object)(object)ClassicStageInfo.instance) || !Object.op_Implicit((Object)(object)ClassicStageInfo.instance.interactableCategories))
{
return;
}
DirectorCardCategorySelection interactableCategories = ClassicStageInfo.instance.interactableCategories;
if (!Object.op_Implicit((Object)(object)interactableCategories))
{
Log.Error("No interactable categories found on ClassicStageInfo!", "C:\\Users\\erenk\\Public\\src\\InteractableSpawnHook.cs", "OnPrePopulateSceneServer");
return;
}
float num = 0f;
for (int i = 0; i < interactableCategories.categories.Length; i++)
{
Category val = interactableCategories.categories[i];
DirectorCard[] cards = val.cards;
DirectorCard[] array = (DirectorCard[])(object)new DirectorCard[cards.Length];
int num2 = 0;
for (int j = 0; j < cards.Length; j++)
{
if (!BlacklistedSpawns.Contains(((Object)cards[j].spawnCard).name))
{
array[num2++] = cards[j];
}
}
if (num2 < cards.Length)
{
Array.Resize(ref array, num2);
val.cards = array;
if (num2 == 0)
{
num += val.selectionWeight;
val.selectionWeight = 0f;
}
interactableCategories.categories[i] = val;
}
}
for (int k = 0; k < interactableCategories.categories.Length; k++)
{
if (interactableCategories.categories[k].name.Equals("Barrels", StringComparison.OrdinalIgnoreCase))
{
interactableCategories.categories[k].selectionWeight += num;
break;
}
}
}
}
public static class ItemSimilarityManager
{
private static readonly HashSet<string> StopWords = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"the", "a", "an", "and", "or", "but", "in", "on", "at", "to",
"for", "with", "by", "of", "from", "is", "are", "was", "were", "it",
"this", "that", "these", "those", "you", "your", "we", "our", "he", "she",
"they", "their", "has", "have", "had", "can", "could", "will", "would", "do",
"does", "did", "not", "be", "been", "being", "as", "if", "when", "than",
"then", "which", "who", "whom", "what", "per", "stack", "maximum", "chance"
};
public static Dictionary<ItemIndex, List<ItemIndex>> SimilarItemsMap { get; private set; } = new Dictionary<ItemIndex, List<ItemIndex>>();
private static string Stem(string word)
{
if (word.EndsWith("ies"))
{
string text = word;
return text.Substring(0, text.Length - 3) + "y";
}
if (word.EndsWith("es"))
{
string text = word;
return text.Substring(0, text.Length - 2);
}
if (word.EndsWith("s") && !word.EndsWith("ss"))
{
string text = word;
return text.Substring(0, text.Length - 1);
}
if (word.EndsWith("ing"))
{
string text = word;
return text.Substring(0, text.Length - 3);
}
if (word.EndsWith("ed"))
{
string text = word;
return text.Substring(0, text.Length - 2);
}
return word;
}
private static List<string> Tokenize(string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return new List<string>();
}
text = Regex.Replace(text, "<.*?>", string.Empty);
text = Regex.Replace(text, "\\b\\d+%?\\b", "");
MatchCollection matchCollection = Regex.Matches(text.ToLowerInvariant(), "[a-z]+");
List<string> list = new List<string>();
foreach (Match item in matchCollection)
{
string value = item.Value;
if (!StopWords.Contains(value))
{
list.Add(Stem(value));
}
}
List<string> list2 = new List<string>();
for (int i = 0; i < list.Count - 1; i++)
{
list2.Add(list[i] + "_" + list[i + 1]);
}
list.AddRange(list2);
return list;
}
public static void Initialize()
{
//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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Invalid comparison between Unknown and I4
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_058a: Unknown result type (might be due to invalid IL or missing references)
//IL_059b: Unknown result type (might be due to invalid IL or missing references)
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
Log.Info("Initializing ItemSimilarityManager...", "C:\\Users\\erenk\\Public\\src\\ItemSimilarityManager.cs", "Initialize");
List<ItemDef> list = new List<ItemDef>();
AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator();
try
{
while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
{
ItemDef itemDef = ItemCatalog.GetItemDef(((AllItemsEnumerator)(ref enumerator)).Current);
if ((Object)(object)itemDef != (Object)null && !itemDef.hidden && (int)itemDef.tier != 5)
{
list.Add(itemDef);
}
}
}
finally
{
((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
}
Dictionary<ItemIndex, List<string>> dictionary = new Dictionary<ItemIndex, List<string>>();
foreach (ItemDef item2 in list)
{
string obj = ((!string.IsNullOrEmpty(item2.nameToken)) ? Language.GetString(item2.nameToken) : "");
string text = ((!string.IsNullOrEmpty(item2.descriptionToken)) ? Language.GetString(item2.descriptionToken) : "");
string text2 = obj + " " + text;
dictionary[item2.itemIndex] = Tokenize(text2);
}
Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
foreach (List<string> value3 in dictionary.Values)
{
foreach (string item3 in value3.Distinct())
{
if (dictionary2.ContainsKey(item3))
{
dictionary2[item3]++;
}
else
{
dictionary2[item3] = 1;
}
}
}
int count = list.Count;
Dictionary<string, double> dictionary3 = new Dictionary<string, double>();
foreach (KeyValuePair<string, int> item4 in dictionary2)
{
dictionary3[item4.Key] = Math.Log((double)count / (double)item4.Value) + 1.0;
}
Dictionary<ItemIndex, Dictionary<string, double>> dictionary4 = new Dictionary<ItemIndex, Dictionary<string, double>>();
foreach (KeyValuePair<ItemIndex, List<string>> item5 in dictionary)
{
ItemIndex key = item5.Key;
List<string> value = item5.Value;
Dictionary<string, double> dictionary5 = new Dictionary<string, double>();
Dictionary<string, int> dictionary6 = (from t in value
group t by t).ToDictionary((IGrouping<string, string> g) => g.Key, (IGrouping<string, string> g) => g.Count());
int count2 = value.Count;
foreach (KeyValuePair<string, int> item6 in dictionary6)
{
string key2 = item6.Key;
double num = (double)item6.Value / (double)count2;
dictionary5[key2] = num * dictionary3[key2];
}
dictionary4[key] = dictionary5;
}
double similarityThreshold = ModConfig.SimilarityThreshold.Value;
foreach (ItemDef item7 in list)
{
Dictionary<string, double> dictionary7 = dictionary4[item7.itemIndex];
List<(ItemIndex, double)> list2 = new List<(ItemIndex, double)>();
foreach (ItemDef item8 in list)
{
if (item7.itemIndex == item8.itemIndex)
{
continue;
}
Dictionary<string, double> dictionary8 = dictionary4[item8.itemIndex];
double num2 = 0.0;
double num3 = 0.0;
double num4 = 0.0;
foreach (KeyValuePair<string, double> item9 in dictionary7)
{
num3 += item9.Value * item9.Value;
}
foreach (KeyValuePair<string, double> item10 in dictionary8)
{
num4 += item10.Value * item10.Value;
}
num3 = Math.Sqrt(num3);
num4 = Math.Sqrt(num4);
if (num3 == 0.0 || num4 == 0.0)
{
continue;
}
foreach (KeyValuePair<string, double> item11 in dictionary7)
{
if (dictionary8.TryGetValue(item11.Key, out var value2))
{
num2 += item11.Value * value2;
}
}
double item = num2 / (num3 * num4);
list2.Add((item8.itemIndex, item));
}
List<ItemIndex> list3 = (from s in (from s in list2
where s.Score >= similarityThreshold
orderby s.Score descending
select s).Take(ModConfig.SimilarItemCount.Value - 1)
select s.OtherItem).ToList();
list3.Insert(0, item7.itemIndex);
SimilarItemsMap[item7.itemIndex] = list3;
}
Log.Info($"ItemSimilarityManager initialized with {SimilarItemsMap.Count} items mapped.", "C:\\Users\\erenk\\Public\\src\\ItemSimilarityManager.cs", "Initialize");
}
}
public class LevelUpArtifact : IContentPackProvider
{
[CompilerGenerated]
private static class <>O
{
public static CollectContentPackProvidersDelegate <0>__ContentManager_collectContentPackProviders;
}
[CompilerGenerated]
private sealed class <FinalizeAsync>d__8 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public FinalizeAsyncArgs args;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FinalizeAsync>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <GenerateContentPackAsync>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelUpArtifact <>4__this;
public GetContentPackAsyncArgs args;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GenerateContentPackAsync>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
LevelUpArtifact levelUpArtifact = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
ContentPack.Copy(levelUpArtifact.contentPack, args.output);
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadStaticContentAsync>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelUpArtifact <>4__this;
public LoadStaticContentAsyncArgs args;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadStaticContentAsync>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
LevelUpArtifact levelUpArtifact = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
ArtifactDef.cachedName = "ARTIFACT_LEVELUPCHOICES";
ArtifactDef.nameToken = "ARTIFACT_LEVELUPCHOICES_NAME";
ArtifactDef.descriptionToken = "ARTIFACT_LEVELUPCHOICES_DESC";
if (!string.IsNullOrEmpty(_basePath))
{
string path = Path.Combine(_basePath, "Assets", "AoC_On.png");
string path2 = Path.Combine(_basePath, "Assets", "AoC_Off.png");
ArtifactDef.smallIconSelectedSprite = LoadSprite(path);
ArtifactDef.smallIconDeselectedSprite = LoadSprite(path2);
}
levelUpArtifact.contentPack.artifactDefs.Add((ArtifactDef[])(object)new ArtifactDef[1] { ArtifactDef });
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static ArtifactDef ArtifactDef;
private static string _basePath;
public ContentPack contentPack = new ContentPack();
public string identifier => "LevelUpChoices.LevelUpArtifact";
[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__5))]
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadStaticContentAsync>d__5(0)
{
<>4__this = this,
args = args
};
}
private static Sprite LoadSprite(string path)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_004a: 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_0065: Unknown result type (might be due to invalid IL or missing references)
if (File.Exists(path))
{
byte[] array = File.ReadAllBytes(path);
Texture2D val = new Texture2D(256, 256, (TextureFormat)5, false, false);
ImageConversion.LoadImage(val, array);
((Texture)val).filterMode = (FilterMode)0;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 1u, (SpriteMeshType)1, Vector4.zero, true);
}
return null;
}
[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__7))]
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GenerateContentPackAsync>d__7(0)
{
<>4__this = this,
args = args
};
}
[IteratorStateMachine(typeof(<FinalizeAsync>d__8))]
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FinalizeAsync>d__8(0)
{
args = args
};
}
internal static void Init(PluginInfo pluginInfo)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
_basePath = Path.GetDirectoryName(pluginInfo.Location);
LanguageAPI.Add("ARTIFACT_LEVELUPCHOICES_NAME", "Artifact of Choice");
LanguageAPI.Add("ARTIFACT_LEVELUPCHOICES_DESC", "Choose an item out of multiple options when you level up. Alters level scaling and maximum level.");
object obj = <>O.<0>__ContentManager_collectContentPackProviders;
if (obj == null)
{
CollectContentPackProvidersDelegate val = ContentManager_collectContentPackProviders;
<>O.<0>__ContentManager_collectContentPackProviders = val;
obj = (object)val;
}
ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
}
private static void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)new LevelUpArtifact());
}
public static bool IsEnabled()
{
if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && Object.op_Implicit((Object)(object)ArtifactDef))
{
return RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
}
return false;
}
}
[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.*/)]
[BepInPlugin("karaeren.LevelUpChoices", "LevelUpChoices", "1.1.3")]
public class LevelUpChoices : BaseUnityPlugin
{
public const string PluginGUID = "karaeren.LevelUpChoices";
public const string PluginAuthor = "karaeren";
public const string PluginName = "LevelUpChoices";
public const string PluginVersion = "1.1.3";
public void Awake()
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
ModConfig.Init(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Info);
ChoiceArtifact.Init(((BaseUnityPlugin)this).Info);
EqualityArtifact.Init(((BaseUnityPlugin)this).Info);
((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)Integrations.Init);
((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)ItemSimilarityManager.Initialize);
((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)EqualityArtifact.InitItems);
NetworkingAPI.RegisterMessageType<Networking.SyncPlayerState>();
NetworkingAPI.RegisterMessageType<Networking.SyncItems>();
NetworkingAPI.RegisterMessageType<Networking.SendItemSelection>();
NetworkingAPI.RegisterMessageType<Networking.SendBanish>();
NetworkingAPI.RegisterMessageType<Networking.SendReroll>();
NetworkingAPI.RegisterMessageType<Networking.SendPickingState>();
NetworkingAPI.RegisterMessageType<Networking.SyncConfig>();
GameObject val = new GameObject("LevelUpLogic");
Object.DontDestroyOnLoad((Object)val);
val.AddComponent<LevelUpManager>();
val.AddComponent<UIPauseIntegration>();
val.AddComponent<ItemSelectUI>();
val.AddComponent<ExperienceHook>();
val.AddComponent<InteractableSpawnHook>();
val.AddComponent<DebugManager>();
Log.Info("LevelUpChoices initialized.", "C:\\Users\\erenk\\Public\\src\\LevelUpChoices.cs", "Awake");
}
}
public class LevelUpManager : MonoBehaviour
{
public class PlayerState
{
public int SelectionTokens;
public int BanishTokens = ModConfig.StartingBanishTokens.Value;
public int RerollTokens = ModConfig.StartingRerollTokens.Value;
public int UsedTokens;
public List<ItemIndex> CurrentOptions = new List<ItemIndex>();
public List<ItemIndex> CurrentSynergies = new List<ItemIndex>();
public PlayerDropTable DropTable = new PlayerDropTable();
}
private List<PickupIndex> currentOptions = new List<PickupIndex>();
private List<ItemIndex> currentSynergies = new List<ItemIndex>();
private readonly Dictionary<NetworkInstanceId, PlayerState> playerStates = new Dictionary<NetworkInstanceId, PlayerState>();
public static LevelUpManager Instance { get; private set; }
public int AvailableTokens { get; private set; }
public int BanishTokens { get; private set; }
public int RerollTokens { get; private set; }
private void Awake()
{
if (Object.op_Implicit((Object)(object)Instance))
{
Object.Destroy((Object)(object)Instance);
}
Instance = this;
ExperienceHook.OnLevelUp += OnLevelUp;
Run.onRunDestroyGlobal += OnRunDestroy;
}
private void OnDestroy()
{
ExperienceHook.OnLevelUp -= OnLevelUp;
Run.onRunDestroyGlobal -= OnRunDestroy;
}
private void OnLevelUp(uint newLevel)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active || !ModConfig.IsModEnabled)
{
return;
}
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (!Object.op_Implicit((Object)(object)instance.networkUser))
{
continue;
}
NetworkInstanceId netId = ((NetworkBehaviour)instance.networkUser).netId;
if (!playerStates.TryGetValue(netId, out var value))
{
value = new PlayerState();
playerStates[netId] = value;
bool enableScraps = false;
if ((Object)(object)BodyPrefabs.DrifterBody != (Object)null)
{
if (Object.op_Implicit((Object)(object)instance.master) && Object.op_Implicit((Object)(object)instance.master.bodyPrefab))
{
CharacterBody component = instance.master.bodyPrefab.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
enableScraps = component.bodyIndex == BodyPrefabs.DrifterBody.bodyIndex;
}
}
else if (Object.op_Implicit((Object)(object)instance.body))
{
enableScraps = instance.body.bodyIndex == BodyPrefabs.DrifterBody.bodyIndex;
}
}
value.DropTable.Initialize(enableScraps);
}
value.SelectionTokens++;
int value2 = ModConfig.LevelsPerBanishToken.Value;
if (value2 > 0 && newLevel % (uint)value2 == 0)
{
value.BanishTokens++;
}
if (value.CurrentOptions == null || value.CurrentOptions.Count == 0)
{
RollItemsForPlayer(netId);
}
SyncState(netId);
SyncOptions(netId);
}
}
private void OnRunDestroy(Run run)
{
AvailableTokens = 0;
BanishTokens = 0;
RerollTokens = 0;
playerStates.Clear();
currentOptions.Clear();
currentSynergies.Clear();
GamePauseManager.ForceReset();
if (Object.op_Implicit((Object)(object)ItemSelectUI.Instance))
{
ItemSelectUI.Instance.Hide();
}
}
public void UpdatePlayerState(int sTokens, int bTokens, int rTokens)
{
AvailableTokens = sTokens;
BanishTokens = bTokens;
RerollTokens = rTokens;
ItemSelectUI.Instance?.UpdateTokens();
}
public void UpdateAvailableItems(List<PickupIndex> options, List<ItemIndex> synergies = null)
{
currentOptions = options;
currentSynergies = synergies ?? ((IEnumerable<ItemIndex>)(object)new ItemIndex[options.Count]).ToList();
if ((Object)(object)ItemSelectUI.Instance != (Object)null && ItemSelectUI.Instance.IsVisible)
{
ItemSelectUI.Instance.UpdateOptions(currentOptions, currentSynergies);
}
}
public bool SpendTokenLocal()
{
if (AvailableTokens > 0)
{
AvailableTokens--;
if (AvailableTokens <= 0)
{
ItemSelectUI.Instance.Hide();
}
ItemSelectUI.Instance.UpdateTokens();
return true;
}
return false;
}
private void SyncState(NetworkInstanceId netId)
{
//IL_0006: 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)
if (playerStates.TryGetValue(netId, out var value))
{
NetMessageExtensions.Send((INetMessage)(object)new Networking.SyncPlayerState(netId, value.SelectionTokens, value.BanishTokens, value.RerollTokens), (NetworkDestination)1);
}
}
private void SyncOptions(NetworkInstanceId netId)
{
//IL_0006: 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)
if (playerStates.TryGetValue(netId, out var value))
{
List<PickupIndex> pickupIndices = value.CurrentOptions.Select((ItemIndex i) => PickupCatalog.FindPickupIndex(i)).ToList();
NetMessageExtensions.Send((INetMessage)(object)new Networking.SyncItems(netId, pickupIndices, value.CurrentSynergies), (NetworkDestination)1);
}
}
public void HandlePlayerSelection(NetworkInstanceId netId, PickupIndex selection)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Invalid comparison between Unknown and I4
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: 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)
if (!NetworkServer.active || !playerStates.TryGetValue(netId, out var value) || value.SelectionTokens <= 0)
{
return;
}
value.SelectionTokens--;
value.UsedTokens++;
value.DropTable.RecalculateWeights(value.UsedTokens);
if (ModConfig.RerollTokenRefreshOnPick.Value)
{
value.RerollTokens = 1;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(selection);
if (pickupDef == null || (int)pickupDef.itemIndex == -1)
{
Log.Warning($"Invalid pickup {selection}. Refunding token.", "C:\\Users\\erenk\\Public\\src\\LevelUpManager.cs", "HandlePlayerSelection");
value.SelectionTokens++;
value.UsedTokens--;
SyncState(netId);
return;
}
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (Object.op_Implicit((Object)(object)instance.networkUser) && ((NetworkBehaviour)instance.networkUser).netId == netId)
{
CharacterMaster master = instance.master;
if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory))
{
master.inventory.GiveItemPermanent(pickupDef.itemIndex, 1);
}
break;
}
}
RollItemsForPlayer(netId);
SyncState(netId);
}
private static float GetPlayerLuck(NetworkInstanceId netId)
{
//IL_0027: 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)
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (Object.op_Implicit((Object)(object)instance.networkUser) && ((NetworkBehaviour)instance.networkUser).netId == netId && Object.op_Implicit((Object)(object)instance.master))
{
CharacterBody body = instance.master.GetBody();
if (body != null)
{
body.RecalculateStats();
}
return instance.master.luck;
}
}
return 0f;
}
public void HandlePlayerBanish(NetworkInstanceId netId, int slotIndex)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if (NetworkServer.active && playerStates.TryGetValue(netId, out var value) && value.BanishTokens > 0 && slotIndex >= 0 && slotIndex < value.CurrentOptions.Count)
{
ItemIndex item = value.CurrentOptions[slotIndex];
value.BanishTokens--;
value.DropTable.Remove(item);
List<ItemIndex> list = new List<ItemIndex>(value.CurrentOptions);
list.RemoveAt(slotIndex);
var (value2, value3) = RollSingleSlot(netId, value, list);
value.CurrentOptions[slotIndex] = value2;
if (slotIndex < value.CurrentSynergies.Count)
{
value.CurrentSynergies[slotIndex] = value3;
}
SyncState(netId);
SyncOptions(netId);
}
}
public void HandlePlayerReroll(NetworkInstanceId netId, int slotIndex)
{
//IL_000e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if (NetworkServer.active && playerStates.TryGetValue(netId, out var value) && value.RerollTokens > 0 && slotIndex >= 0 && slotIndex < value.CurrentOptions.Count)
{
value.RerollTokens--;
List<ItemIndex> list = new List<ItemIndex>(value.CurrentOptions);
list.RemoveAt(slotIndex);
var (value2, value3) = RollSingleSlot(netId, value, list);
value.CurrentOptions[slotIndex] = value2;
if (slotIndex < value.CurrentSynergies.Count)
{
value.CurrentSynergies[slotIndex] = value3;
}
SyncState(netId);
SyncOptions(netId);
}
}
private static (ItemIndex RolledItem, ItemIndex SynergizedWith) RollSingleSlot(NetworkInstanceId netId, PlayerState state, List<ItemIndex> exclude)
{
//IL_0000: 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_0014: 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_0017: Invalid comparison between Unknown and I4
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Invalid comparison between Unknown and I4
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_0076: 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)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
float playerLuck = GetPlayerLuck(netId);
ItemIndex val = state.DropTable.Roll(playerLuck, exclude);
if ((int)val == -1)
{
Log.Warning("Rolled invalid normallyRolled item, skipping slot.", "C:\\Users\\erenk\\Public\\src\\LevelUpManager.cs", "RollSingleSlot");
return ((ItemIndex)(-1), (ItemIndex)(-1));
}
ItemIndex val2 = val;
ItemIndex item = (ItemIndex)(-1);
ItemDef itemDef = ItemCatalog.GetItemDef(val);
if ((Object)(object)itemDef != (Object)null)
{
var (val3, val4) = TryRollSimilarItem(netId, exclude, state.DropTable, itemDef.tier);
if ((int)val3 != -1)
{
val2 = val3;
item = val4;
}
}
if ((int)val2 == -1 || PickupCatalog.FindPickupIndex(val2) == PickupIndex.none)
{
Log.Warning($"Rolled invalid item {val2}, skipping slot.", "C:\\Users\\erenk\\Public\\src\\LevelUpManager.cs", "RollSingleSlot");
return ((ItemIndex)(-1), (ItemIndex)(-1));
}
return (val2, item);
}
private static (ItemIndex RolledItem, ItemIndex SynergizedWith) TryRollSimilarItem(NetworkInstanceId netId, List<ItemIndex> exclude, PlayerDropTable dropTable, ItemTier targetTier)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: 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_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: 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_0174: 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_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
if (Random.Range(0f, 100f) >= ModConfig.SimilarItemChance.Value)
{
return ((ItemIndex)(-1), (ItemIndex)(-1));
}
Inventory val = null;
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (Object.op_Implicit((Object)(object)instance.networkUser) && ((NetworkBehaviour)instance.networkUser).netId == netId)
{
if (Object.op_Implicit((Object)(object)instance.master))
{
val = instance.master.inventory;
}
break;
}
}
if (!Object.op_Implicit((Object)(object)val))
{
return ((ItemIndex)(-1), (ItemIndex)(-1));
}
List<(ItemIndex, int)> list = new List<(ItemIndex, int)>();
foreach (ItemIndex item2 in val.itemAcquisitionOrder)
{
int itemCountEffective = val.GetItemCountEffective(item2);
if (itemCountEffective > 0)
{
list.Add((item2, itemCountEffective));
}
}
if (list.Count == 0)
{
return ((ItemIndex)(-1), (ItemIndex)(-1));
}
List<(ItemIndex, int)> list2 = list.OrderByDescending<(ItemIndex, int), int>(((ItemIndex Item, int Count) x) => x.Count).Take(5).ToList();
ItemIndex item = list2[Random.Range(0, list2.Count)].Item1;
if (ItemSimilarityManager.SimilarItemsMap.TryGetValue(item, out var value))
{
foreach (ItemIndex item3 in value)
{
if (!exclude.Contains(item3) && dropTable.CanDrop(item3))
{
ItemDef itemDef = ItemCatalog.GetItemDef(item3);
if ((Object)(object)itemDef != (Object)null && itemDef.tier == targetTier)
{
return (item3, item);
}
}
}
}
return ((ItemIndex)(-1), (ItemIndex)(-1));
}
private void RollItemsForPlayer(NetworkInstanceId netId)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Invalid comparison between Unknown and I4
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
if (!playerStates.TryGetValue(netId, out var value))
{
return;
}
value.CurrentOptions.Clear();
value.CurrentSynergies.Clear();
int num = Mathf.Max(1, ModConfig.ItemChoiceCount.Value);
for (int j = 0; j < num; j++)
{
var (val, item) = RollSingleSlot(netId, value, value.CurrentOptions);
if ((int)val != -1)
{
value.CurrentOptions.Add(val);
value.CurrentSynergies.Add(item);
}
}
SyncOptions(netId);
ReadOnlyCollection<NetworkUser> readOnlyLocalPlayersList = NetworkUser.readOnlyLocalPlayersList;
if (readOnlyLocalPlayersList.Count > 0 && ((NetworkBehaviour)readOnlyLocalPlayersList[0]).netId == netId)
{
UpdateAvailableItems(value.CurrentOptions.Select((ItemIndex i) => PickupCatalog.FindPickupIndex(i)).ToList(), value.CurrentSynergies);
}
}
private void Update()
{
//IL_0005: 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)
KeyboardShortcut value = ModConfig.ToggleMenuKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown() && Object.op_Implicit((Object)(object)ItemSelectUI.Instance))
{
if (ItemSelectUI.Instance.IsVisible)
{
ItemSelectUI.Instance.Hide();
}
else if ((Object)(object)Run.instance != (Object)null && AvailableTokens > 0)
{
ItemSelectUI.Instance.ShowChoices(currentOptions, currentSynergies);
}
}
}
}
public class LevelUpUI : MonoBehaviour
{
[CompilerGenerated]
private sealed class <HideNextFrame>d__28 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelUpUI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HideNextFrame>d__28(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
LevelUpUI levelUpUI = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
EventSystem current = EventSystem.current;
if (current != null)
{
current.SetSelectedGameObject((GameObject)null);
}
levelUpUI.containerObject.SetActive(false);
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static LevelUpUI Instance;
private GameObject canvasObject;
private GameObject containerObject;
private GameObject notificationPanel;
private HGTextMeshProUGUI notificationText;
private HGTextMeshProUGUI tokenHeader;
private TMP_FontAsset ror2Font;
private Sprite panelSprite;
private Sprite buttonSprite;
private readonly List<GameObject> buttonObjects = new List<GameObject>();
private bool isPaused;
private float lastClickTime;
private const float ClickCooldown = 0.15f;
public bool IsVisible { get; private set; }
private void Awake()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
if (Object.op_Implicit((Object)(object)Instance))
{
Object.Destroy((Object)(object)Instance);
}
Instance = this;
ror2Font = Addressables.LoadAssetAsync<TMP_FontAsset>((object)"RoR2/Base/Common/Fonts/Bombardier.asset").WaitForCompletion();
panelSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUICleanButton.png").WaitForCompletion();
buttonSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIHighlightBoxOutlineThick.png").WaitForCompletion();
BuildUI();
PauseScreenController.OnEnable += new hook_OnEnable(OnPauseScreenEnabled);
PauseScreenController.OnDisable += new hook_OnDisable(OnPauseScreenDisabled);
}
private void OnDestroy()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
PauseScreenController.OnEnable -= new hook_OnEnable(OnPauseScreenEnabled);
PauseScreenController.OnDisable -= new hook_OnDisable(OnPauseScreenDisabled);
}
private void OnPauseScreenEnabled(orig_OnEnable orig, PauseScreenController self)
{
orig.Invoke(self);
isPaused = true;
if (!GamePauseManager.IsPausedByUs && Object.op_Implicit((Object)(object)canvasObject))
{
canvasObject.SetActive(false);
}
}
private void OnPauseScreenDisabled(orig_OnDisable orig, PauseScreenController self)
{
orig.Invoke(self);
isPaused = false;
if (!GamePauseManager.IsPausedByUs && Object.op_Implicit((Object)(object)canvasObject))
{
canvasObject.SetActive(true);
}
}
private HGTextMeshProUGUI MakeLabel(Transform parent, string text, float fontSize, Color color, TextAlignmentOptions alignment = 514, bool wordWrap = false)
{
//IL_0005: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Label");
val.transform.SetParent(parent, false);
HGTextMeshProUGUI val2 = val.AddComponent<HGTextMeshProUGUI>();
if (Object.op_Implicit((Object)(object)ror2Font))
{
((TMP_Text)val2).font = ror2Font;
}
((TMP_Text)val2).text = text;
((TMP_Text)val2).fontSize = fontSize;
((Graphic)val2).color = color;
((TMP_Text)val2).alignment = alignment;
((TMP_Text)val2).enableWordWrapping = wordWrap;
return val2;
}
private Image MakePanel(Transform parent, Color color, bool sliced = true)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
Image val = ((Component)parent).gameObject.AddComponent<Image>();
if (Object.op_Implicit((Object)(object)panelSprite))
{
val.sprite = panelSprite;
val.type = (Type)(sliced ? 1 : 0);
}
((Graphic)val).color = color;
return val;
}
private Color GetTierColor(ItemDef itemDef)
{
//IL_0010: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)itemDef == (Object)null)
{
return Color.white;
}
ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier);
if ((Object)(object)itemTierDef == (Object)null)
{
return Color.white;
}
return Color32.op_Implicit(ColorCatalog.GetColor(itemTierDef.colorIndex));
}
private void BuildUI()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: 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_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Expected O, but got Unknown
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Expected O, but got Unknown
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_0482: Unknown result type (might be due to invalid IL or missing references)
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Unknown result type (might be due to invalid IL or missing references)
//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
canvasObject = new GameObject("LevelUpCanvas");
Object.DontDestroyOnLoad((Object)(object)canvasObject);
Canvas obj = canvasObject.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 100;
CanvasScaler obj2 = canvasObject.AddComponent<CanvasScaler>();
obj2.uiScaleMode = (ScaleMode)1;
obj2.referenceResolution = new Vector2(1920f, 1080f);
obj2.screenMatchMode = (ScreenMatchMode)0;
obj2.matchWidthOrHeight = 0.5f;
canvasObject.AddComponent<GraphicRaycaster>();
canvasObject.AddComponent<MPEventSystemProvider>().fallBackToMainEventSystem = true;
canvasObject.AddComponent<MPEventSystemLocator>();
containerObject = new GameObject("Container");
containerObject.transform.SetParent(canvasObject.transform, false);
RectTransform obj3 = containerObject.AddComponent<RectTransform>();
obj3.anchorMin = new Vector2(0.5f, 0.5f);
obj3.anchorMax = new Vector2(0.5f, 0.5f);
obj3.pivot = new Vector2(0.5f, 0.5f);
obj3.sizeDelta = new Vector2(1560f, 0f);
obj3.anchoredPosition = Vector2.zero;
containerObject.AddComponent<CursorOpener>();
MakePanel(containerObject.transform, new Color(0.04f, 0.04f, 0.06f, 0.97f));
VerticalLayoutGroup obj4 = containerObject.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj4).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)obj4).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj4).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)obj4).spacing = 4f;
((LayoutGroup)obj4).padding = new RectOffset(12, 12, 10, 10);
containerObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
GameObject val = new GameObject("TitleBar");
val.transform.SetParent(containerObject.transform, false);
((Graphic)val.AddComponent<Image>()).color = new Color(1f, 0.82f, 0.18f, 0.12f);
val.AddComponent<LayoutElement>().preferredHeight = 36f;
RectTransform component = ((Component)MakeLabel(val.transform, "CHOOSE AN ITEM", 32f, new Color(1f, 0.88f, 0.35f), (TextAlignmentOptions)514)).GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
GameObject val2 = new GameObject("TokenHeader");
val2.transform.SetParent(containerObject.transform, false);
val2.AddComponent<LayoutElement>().preferredHeight = 24f;
tokenHeader = MakeLabel(val2.transform, "Loading...", 24f, new Color(0.75f, 0.88f, 1f), (TextAlignmentOptions)514);
RectTransform component2 = ((Component)tokenHeader).GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
GameObject val3 = new GameObject("ItemRow");
val3.transform.SetParent(containerObject.transform, false);
HorizontalLayoutGroup obj5 = val3.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj5).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj5).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj5).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)obj5).childForceExpandHeight = true;
((HorizontalOrVerticalLayoutGroup)obj5).spacing = 16f;
val3.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
containerObject.SetActive(false);
notificationPanel = new GameObject("NotificationPanel");
notificationPanel.transform.SetParent(canvasObject.transform, false);
RectTransform obj6 = notificationPanel.AddComponent<RectTransform>();
obj6.anchorMin = new Vector2(0.5f, 0f);
obj6.anchorMax = new Vector2(0.5f, 0f);
obj6.pivot = new Vector2(0.5f, 0f);
obj6.anchoredPosition = new Vector2(0f, 24f);
obj6.sizeDelta = new Vector2(260f, 62f);
Image val4 = notificationPanel.AddComponent<Image>();
if (Object.op_Implicit((Object)(object)panelSprite))
{
val4.sprite = panelSprite;
val4.type = (Type)1;
}
((Graphic)val4).color = new Color(0.9f, 0.68f, 0.08f, 0.88f);
GameObject val5 = new GameObject("Accent");
val5.transform.SetParent(notificationPanel.transform, false);
RectTransform obj7 = val5.AddComponent<RectTransform>();
obj7.anchorMin = new Vector2(0f, 1f);
obj7.anchorMax = new Vector2(1f, 1f);
obj7.offsetMin = new Vector2(0f, -5f);
obj7.offsetMax = new Vector2(0f, 0f);
((Graphic)val5.AddComponent<Image>()).color = new Color(1f, 0.88f, 0.18f, 1f);
notificationText = MakeLabel(notificationPanel.transform, "LEVEL UP!\nPress F3", 18f, Color.white, (TextAlignmentOptions)514);
RectTransform component3 = ((Component)notificationText).GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
notificationPanel.SetActive(false);
}
public void UpdateTokens()
{
if (Object.op_Implicit((Object)(object)tokenHeader))
{
((TMP_Text)tokenHeader).text = $"<color=#FFE066>SELECT</color> {LevelUpManager.Instance.AvailableTokens} " + $"<color=#FF6060>BANISH</color> {LevelUpManager.Instance.BanishTokens} " + $"<color=#60AAFF>REROLL</color> {LevelUpManager.Instance.RerollTokens}";
}
}
public void ShowChoices(List<PickupIndex> pickupIndices)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (!IsVisible)
{