using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using FishNet.Object;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
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("Estonia")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MultiplierEditor")]
[assembly: AssemblyTitle("MultiplierEditor")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 MultiplierEditor
{
[BepInPlugin("estonia.howtofish.multipliereditor", "Multiplier Editor", "1.0.0")]
[BepInProcess("How to Fish.exe")]
public sealed class MultiplierEditorPlugin : BaseUnityPlugin
{
private sealed class BonusSetting
{
private readonly string[] _matches;
private readonly ConfigEntry<float> _config;
public string Label { get; }
public float DefaultValue { get; }
public float Value
{
get
{
return _config.Value;
}
set
{
_config.Value = value;
}
}
public BonusSetting(string label, float defaultValue, ConfigEntry<float> config, string[] aliases)
{
Label = label;
DefaultValue = defaultValue;
_config = config;
List<string> list = new List<string> { Normalize(label) };
foreach (string value in aliases)
{
list.Add(Normalize(value));
}
_matches = list.ToArray();
}
public bool Matches(string normalizedName)
{
string[] matches = _matches;
foreach (string text in matches)
{
if (normalizedName == text || normalizedName.Contains(text))
{
return true;
}
}
return false;
}
}
[HarmonyPatch(typeof(KillScoreCalculator), "GetExplosionBonuses")]
private static class ExplosionBonusesPatch
{
private static void Postfix(ref List<Bonus> __result)
{
_instance?.ApplyOverrides(__result);
}
}
[HarmonyPatch(typeof(KillScoreCalculator), "GetMeleeBonuses")]
private static class MeleeBonusesPatch
{
private static void Postfix(ref List<Bonus> __result)
{
_instance?.ApplyOverrides(__result);
}
}
[HarmonyPatch(typeof(KillScoreCalculator), "GetMeleePlayerBonuses")]
private static class MeleePlayerBonusesPatch
{
private static void Postfix(ref List<Bonus> __result)
{
_instance?.ApplyOverrides(__result);
}
}
[HarmonyPatch(typeof(KillScoreCalculator), "GetRangedBonuses")]
private static class RangedBonusesPatch
{
private static void Postfix(ref List<Bonus> __result)
{
_instance?.ApplyOverrides(__result);
}
}
[HarmonyPatch(typeof(KillScoreCalculator), "GetRangedPlayerBonuses")]
private static class RangedPlayerBonusesPatch
{
private static void Postfix(ref List<Bonus> __result)
{
_instance?.ApplyOverrides(__result);
}
}
[HarmonyPatch(typeof(KillScoreCalculator), "GetAllBonuses")]
private static class AllBonusesPatch
{
private static void Postfix(ref List<Bonus> __result)
{
_instance?.ApplyOverrides(__result);
}
}
private const string PluginGuid = "estonia.howtofish.multipliereditor";
private const string PluginName = "Multiplier Editor";
private const string PluginVersion = "1.0.0";
private const string Author = "Estonia";
private static readonly BindingFlags PrivateStatic = BindingFlags.Static | BindingFlags.NonPublic;
private static readonly BindingFlags PrivateInstance = BindingFlags.Instance | BindingFlags.NonPublic;
private static MultiplierEditorPlugin _instance;
private readonly List<BonusSetting> _bonusSettings = new List<BonusSetting>();
private readonly List<Button> _hostOnlyButtons = new List<Button>();
private ConfigEntry<bool> _enableOverrides;
private Harmony _harmony;
private PauseManager _pauseManager;
private GameObject _pauseHolder;
private GameObject _mainScreen;
private GameObject _optionsScreen;
private GameObject _serverSettingsScreen;
private GameObject _editorScreen;
private GameObject _menuButton;
private GameObject _buttonTemplate;
private TextMeshProUGUI _textTemplate;
private TextMeshProUGUI _selectedText;
private TextMeshProUGUI _statusText;
private TextMeshProUGUI _previewText;
private TextMeshProUGUI _toggleText;
private TextMeshProUGUI _set50Text;
private int _selectedIndex = 11;
private bool IsHost
{
get
{
if (Object.op_Implicit((Object)(object)Server.Instance))
{
return ((NetworkBehaviour)Server.Instance).IsServerInitialized;
}
return false;
}
}
private BonusSetting Selected => _bonusSettings[Mathf.Clamp(_selectedIndex, 0, _bonusSettings.Count - 1)];
private void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
_instance = this;
_enableOverrides = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableOverrides", true, (ConfigDescription)null);
BindBonusSettings();
_harmony = new Harmony("estonia.howtofish.multipliereditor");
_harmony.PatchAll(typeof(MultiplierEditorPlugin).Assembly);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Multiplier Editor 1.0.0 loaded. Author: Estonia.");
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
if (Object.op_Implicit((Object)(object)_editorScreen))
{
Object.Destroy((Object)(object)_editorScreen);
}
if (Object.op_Implicit((Object)(object)_menuButton))
{
Object.Destroy((Object)(object)_menuButton);
}
}
private void Update()
{
EnsurePauseUi();
RefreshUi();
}
private void BindBonusSettings()
{
_bonusSettings.Clear();
AddBonus("Melee", 1.05f, "melee");
AddBonus("Explosion", 1.5f, "explosion");
AddBonus("Endangered", 1.25f, "endangered");
AddBonus("Double Kill", 1.05f, "doublekill", "double");
AddBonus("Triple Kill", 1.1f, "triplekill", "triple");
AddBonus("Quadra Kill", 1.15f, "quadrakill", "quadra");
AddBonus("Penta Kill", 1.2f, "pentakill", "penta");
AddBonus("Multikill", 1.25f, "multikill");
AddBonus("360", 1.5f, "360", "threesixty");
AddBonus("No Scope", 1.2f, "noscope");
AddBonus("Quick Scope", 1.1f, "quickscope");
AddBonus("Longshot", 1.3f, "longshot", "longshots");
AddBonus("Headshot", 1.25f, "headshot", "headshots");
AddBonus("Dogfight", 1.5f, "dogfight");
AddBonus("Aerial", 1.25f, "aerial");
AddBonus("Fly Fishing", 1.25f, "flyfishing");
AddBonus("One Shot One Kill", 1.25f, "oneshotonekill");
AddBonus("Point Blank", 1.1f, "pointblank");
AddBonus("Overkill", 1.25f, "overkill");
AddBonus("Last Bullet", 1.25f, "lastbullet");
AddBonus("Finally", 1.1f, "finally");
AddBonus("Killsteal", 1.3f, "killsteal");
AddBonus("Noob Kill", 1.01f, "noobkill", "noob");
AddBonus("Impressive", 2f, "impressive");
}
private void AddBonus(string label, float defaultValue, params string[] aliases)
{
ConfigEntry<float> config = ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", label.Replace(" ", ""), defaultValue, (ConfigDescription)null);
_bonusSettings.Add(new BonusSetting(label, defaultValue, config, aliases));
}
private void EnsurePauseUi()
{
PauseManager pauseManager = GetPauseManager();
if (Object.op_Implicit((Object)(object)pauseManager) && (!((Object)(object)pauseManager == (Object)(object)_pauseManager) || !Object.op_Implicit((Object)(object)_editorScreen) || !Object.op_Implicit((Object)(object)_menuButton)))
{
_pauseManager = pauseManager;
_pauseHolder = GetPrivateField<GameObject>(_pauseManager, "_pauseHolder");
_mainScreen = GetPrivateField<GameObject>(_pauseManager, "_mainScreen");
_optionsScreen = GetPrivateField<GameObject>(_pauseManager, "_optionsScreen");
_serverSettingsScreen = GetPrivateField<GameObject>(_pauseManager, "_serverSettingsScreen");
if (Object.op_Implicit((Object)(object)_pauseHolder) && Object.op_Implicit((Object)(object)_mainScreen))
{
_buttonTemplate = FindButtonTemplate();
_textTemplate = (Object.op_Implicit((Object)(object)_buttonTemplate) ? _buttonTemplate.GetComponentInChildren<TextMeshProUGUI>(true) : FindTextTemplate());
BuildMenuButton();
BuildEditorScreen();
}
}
}
private void BuildMenuButton()
{
if (Object.op_Implicit((Object)(object)_menuButton))
{
Object.Destroy((Object)(object)_menuButton);
}
Transform val = FindMenuButtonParent();
if (Object.op_Implicit((Object)(object)val))
{
_menuButton = CreatePauseMenuButton(val, "Multiplier Editor", OpenEditor);
((Object)_menuButton).name = "MultiplierEditor_OpenButton";
_menuButton.transform.SetAsLastSibling();
GetPrivateField<List<GameObject>>(_pauseManager, "_serverButtons")?.Add(_menuButton);
}
}
private void BuildEditorScreen()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)_editorScreen))
{
Object.Destroy((Object)(object)_editorScreen);
}
Transform val = (Object.op_Implicit((Object)(object)_serverSettingsScreen) ? _serverSettingsScreen.transform.parent : _pauseHolder.transform);
_editorScreen = new GameObject("MultiplierEditor_Screen", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
_editorScreen.transform.SetParent(val, false);
_editorScreen.transform.SetAsLastSibling();
_editorScreen.SetActive(false);
RectTransform component = _editorScreen.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.5f, 0.5f);
component.anchorMax = new Vector2(0.5f, 0.5f);
component.pivot = new Vector2(0.5f, 0.5f);
component.sizeDelta = new Vector2(920f, 640f);
component.anchoredPosition = new Vector2(0f, -6f);
((Graphic)_editorScreen.GetComponent<Image>()).color = new Color(0.18f, 0.32f, 0.42f, 0.72f);
AddBorder(_editorScreen.transform, 2f, Color.white);
((TMP_Text)CreateAnchoredText(_editorScreen.transform, "Multiplier Editor", 38f, 0f, 252f, 860f, 58f)).alignment = (TextAlignmentOptions)514;
_statusText = CreateAnchoredText(_editorScreen.transform, "", 18f, 0f, 202f, 860f, 34f);
((TMP_Text)_statusText).alignment = (TextAlignmentOptions)514;
_previewText = CreateAnchoredText(_editorScreen.transform, "", 17f, 0f, 162f, 860f, 34f);
((TMP_Text)_previewText).alignment = (TextAlignmentOptions)514;
CreateButtonAt("Previous Bonus", -310f, 92f, 230f, 48f, PreviousBonus);
_selectedText = CreateAnchoredText(_editorScreen.transform, "", 30f, 0f, 92f, 360f, 58f);
((TMP_Text)_selectedText).alignment = (TextAlignmentOptions)514;
CreateButtonAt("Next Bonus", 310f, 92f, 230f, 48f, NextBonus);
CreateButtonAt("-10x", -320f, 20f, 150f, 44f, delegate
{
AdjustSelected(-10f);
});
CreateButtonAt("-1x", -160f, 20f, 150f, 44f, delegate
{
AdjustSelected(-1f);
});
CreateButtonAt("-0.1x", 0f, 20f, 150f, 44f, delegate
{
AdjustSelected(-0.1f);
});
CreateButtonAt("+0.1x", 160f, 20f, 150f, 44f, delegate
{
AdjustSelected(0.1f);
});
CreateButtonAt("+1x", 320f, 20f, 150f, 44f, delegate
{
AdjustSelected(1f);
});
CreateButtonAt("Reset Selected", -250f, -58f, 230f, 46f, ResetSelected);
_set50Text = CreateButtonAt("Set Selected To 50x", 0f, -58f, 230f, 46f, SetSelectedTo50);
CreateButtonAt("Toggle Overrides", 250f, -58f, 230f, 46f, ToggleOverrides, out _toggleText);
CreateButtonAt("Preset: Vanilla", -250f, -132f, 230f, 46f, ResetAll);
CreateButtonAt("Preset: All 10x", 0f, -132f, 230f, 46f, delegate
{
SetAll(10f);
});
CreateButtonAt("Preset: All 50x", 250f, -132f, 230f, 46f, delegate
{
SetAll(50f);
});
((TMP_Text)CreateAnchoredText(_editorScreen.transform, "Changes apply to new killscore bonuses calculated by the host.", 15f, 0f, -208f, 820f, 30f)).alignment = (TextAlignmentOptions)514;
CreateButtonAt("Back", 0f, -270f, 250f, 54f, CloseEditor);
}
private TextMeshProUGUI CreateButtonAt(string label, float x, float y, float width, float height, Action action)
{
TextMeshProUGUI text;
return CreateButtonAt(label, x, y, width, height, action, out text);
}
private TextMeshProUGUI CreateButtonAt(string label, float x, float y, float width, float height, Action action, out TextMeshProUGUI text)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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)
GameObject val = CreateTemplateButton(_editorScreen.transform, label, action);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.5f, 0.5f);
component.anchorMax = new Vector2(0.5f, 0.5f);
component.pivot = new Vector2(0.5f, 0.5f);
component.anchoredPosition = new Vector2(x, y);
component.sizeDelta = new Vector2(width, height);
LayoutElement component2 = val.GetComponent<LayoutElement>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.ignoreLayout = true;
}
Button component3 = val.GetComponent<Button>();
_hostOnlyButtons.Add(component3);
text = val.GetComponentInChildren<TextMeshProUGUI>(true);
return text;
}
private GameObject CreateTemplateButton(Transform parent, string label, Action action)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: 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_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Expected O, but got Unknown
GameObject val = new GameObject("MultiplierEditor_Button", new Type[4]
{
typeof(RectTransform),
typeof(Image),
typeof(Button),
typeof(LayoutElement)
});
val.transform.SetParent(parent, false);
val.GetComponent<RectTransform>().sizeDelta = new Vector2(250f, 54f);
LayoutElement component = val.GetComponent<LayoutElement>();
component.minHeight = 54f;
component.preferredHeight = 54f;
component.preferredWidth = 250f;
Image component2 = val.GetComponent<Image>();
((Graphic)component2).color = new Color(0.12f, 0.06f, 0.12f, 0.74f);
AddBorder(val.transform, 2f, Color.white);
Button component3 = val.GetComponent<Button>();
((Selectable)component3).targetGraphic = (Graphic)(object)component2;
((Selectable)component3).transition = (Transition)1;
ColorBlock colors = ((Selectable)component3).colors;
((ColorBlock)(ref colors)).normalColor = new Color(0.12f, 0.06f, 0.12f, 0.74f);
((ColorBlock)(ref colors)).highlightedColor = new Color(0.34f, 0.16f, 0.2f, 0.9f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.58f, 0.22f, 0.14f, 0.95f);
((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).highlightedColor;
((ColorBlock)(ref colors)).disabledColor = new Color(0.04f, 0.04f, 0.05f, 0.45f);
((ColorBlock)(ref colors)).colorMultiplier = 1f;
((Selectable)component3).colors = colors;
TextMeshProUGUI val2 = CreateAnchoredText(val.transform, label, 18f, 0f, 0f, 220f, 42f);
RectTransform component4 = ((Component)val2).GetComponent<RectTransform>();
component4.anchorMin = Vector2.zero;
component4.anchorMax = Vector2.one;
component4.offsetMin = new Vector2(10f, 0f);
component4.offsetMax = new Vector2(-10f, 0f);
((Graphic)val2).raycastTarget = false;
((TMP_Text)val2).text = label;
((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
((TMP_Text)val2).enableAutoSizing = true;
((TMP_Text)val2).fontSizeMax = Mathf.Min((((TMP_Text)val2).fontSizeMax <= 0f) ? 18f : ((TMP_Text)val2).fontSizeMax, 18f);
((TMP_Text)val2).fontSizeMin = 10f;
((UnityEventBase)component3.onClick).RemoveAllListeners();
((UnityEvent)component3.onClick).AddListener(new UnityAction(action.Invoke));
return val;
}
private GameObject CreatePauseMenuButton(Transform parent, string label, Action action)
{
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Expected O, but got Unknown
//IL_00de: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)_buttonTemplate))
{
GameObject val = Object.Instantiate<GameObject>(_buttonTemplate, parent);
((Object)val).name = "MultiplierEditor_PauseButton";
val.SetActive(true);
RemoveRelabelComponents(val);
Button[] componentsInChildren = val.GetComponentsInChildren<Button>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
}
Button obj = val.AddComponent<Button>();
((Selectable)obj).targetGraphic = val.GetComponent<Graphic>() ?? val.GetComponentInChildren<Graphic>(true);
((Selectable)obj).transition = (Transition)1;
ForceButtonText(val, label);
if (!Object.op_Implicit((Object)(object)val.GetComponentInChildren<TextMeshProUGUI>(true)) && !Object.op_Implicit((Object)(object)val.GetComponentInChildren<Text>(true)))
{
TextMeshProUGUI obj2 = CreateAnchoredText(val.transform, label, 18f, 0f, 0f, 240f, 44f);
((TMP_Text)obj2).alignment = (TextAlignmentOptions)514;
RectTransform component = ((Component)obj2).GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = new Vector2(8f, 0f);
component.offsetMax = new Vector2(-8f, 0f);
}
Button component2 = val.GetComponent<Button>();
((UnityEventBase)component2.onClick).RemoveAllListeners();
((UnityEvent)component2.onClick).AddListener(new UnityAction(action.Invoke));
return val;
}
return CreateTemplateButton(parent, label, action);
}
private static void ForceButtonText(GameObject buttonObject, string label)
{
TextMeshProUGUI[] componentsInChildren = buttonObject.GetComponentsInChildren<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI val in componentsInChildren)
{
if (Object.op_Implicit((Object)(object)val))
{
((TMP_Text)val).text = label;
((TMP_Text)val).alignment = (TextAlignmentOptions)514;
((TMP_Text)val).enableAutoSizing = true;
((TMP_Text)val).fontSizeMin = 10f;
((TMP_Text)val).fontSizeMax = Mathf.Max(18f, ((TMP_Text)val).fontSizeMax);
((Component)val).gameObject.SetActive(true);
}
}
Text[] componentsInChildren2 = buttonObject.GetComponentsInChildren<Text>(true);
foreach (Text val2 in componentsInChildren2)
{
if (Object.op_Implicit((Object)(object)val2))
{
val2.text = label;
val2.alignment = (TextAnchor)4;
((Component)val2).gameObject.SetActive(true);
}
}
}
private static void RemoveRelabelComponents(GameObject buttonObject)
{
Component[] componentsInChildren = buttonObject.GetComponentsInChildren<Component>(true);
foreach (Component val in componentsInChildren)
{
if (Object.op_Implicit((Object)(object)val))
{
Type type = ((object)val).GetType();
string text = type.FullName ?? type.Name;
if (text.IndexOf("Localiz", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Localized", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Localize", StringComparison.OrdinalIgnoreCase) >= 0)
{
Object.DestroyImmediate((Object)(object)val);
}
}
}
}
private static void AddBorder(Transform parent, float thickness, Color color)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0046: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
AddBorderPiece(parent, "BorderTop", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 0f - thickness), color);
AddBorderPiece(parent, "BorderBottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, thickness), color);
AddBorderPiece(parent, "BorderLeft", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(thickness, 0f), color);
AddBorderPiece(parent, "BorderRight", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f - thickness, 0f), color);
}
private static void AddBorderPiece(Transform parent, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Color color)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name, new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val.transform.SetParent(parent, false);
Image component = val.GetComponent<Image>();
((Graphic)component).color = color;
((Graphic)component).raycastTarget = false;
RectTransform component2 = val.GetComponent<RectTransform>();
component2.anchorMin = anchorMin;
component2.anchorMax = anchorMax;
component2.pivot = new Vector2(0.5f, 0.5f);
component2.anchoredPosition = Vector2.zero;
component2.sizeDelta = sizeDelta;
}
private TextMeshProUGUI CreateAnchoredText(Transform parent, string text, float size, float x, float y, float width, float height)
{
//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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MultiplierEditor_Text", new Type[2]
{
typeof(RectTransform),
typeof(TextMeshProUGUI)
});
val.transform.SetParent(parent, false);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.5f, 0.5f);
component.anchorMax = new Vector2(0.5f, 0.5f);
component.pivot = new Vector2(0.5f, 0.5f);
component.anchoredPosition = new Vector2(x, y);
component.sizeDelta = new Vector2(width, height);
TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>();
if (Object.op_Implicit((Object)(object)_textTemplate))
{
((TMP_Text)component2).font = ((TMP_Text)_textTemplate).font;
((Graphic)component2).material = ((Graphic)_textTemplate).material;
((Graphic)component2).color = ((Graphic)_textTemplate).color;
}
else
{
((Graphic)component2).color = Color.white;
}
((TMP_Text)component2).text = text;
((TMP_Text)component2).fontSize = size;
((TMP_Text)component2).enableAutoSizing = true;
((TMP_Text)component2).fontSizeMin = 10f;
((TMP_Text)component2).fontSizeMax = size;
((TMP_Text)component2).overflowMode = (TextOverflowModes)1;
return component2;
}
private void RefreshUi()
{
if (Object.op_Implicit((Object)(object)_menuButton))
{
_menuButton.SetActive(IsHost);
ForceButtonText(_menuButton, "Multiplier Editor");
}
if (Object.op_Implicit((Object)(object)_editorScreen) && _editorScreen.activeSelf && (!PauseManager.IsPaused || !IsHost))
{
CloseEditor();
}
if (Object.op_Implicit((Object)(object)_editorScreen))
{
BonusSetting selected = Selected;
SetText(_statusText, IsHost ? ("Host Only | Overrides: " + OnOff(_enableOverrides.Value)) : "Host a server to edit multipliers");
SetText(_previewText, $"Selected bonus changes from vanilla {selected.DefaultValue:0.##}x to {selected.Value:0.##}x");
SetText(_selectedText, $"{selected.Label}: {selected.Value:0.##}x");
SetText(_toggleText, _enableOverrides.Value ? "Disable Overrides" : "Enable Overrides");
SetText(_set50Text, "Set " + selected.Label + " To 50x");
SetButtonsInteractable(_hostOnlyButtons, IsHost);
}
}
private void OpenEditor()
{
if (IsHost && Object.op_Implicit((Object)(object)_editorScreen))
{
if (Object.op_Implicit((Object)(object)_mainScreen))
{
_mainScreen.SetActive(false);
}
if (Object.op_Implicit((Object)(object)_optionsScreen))
{
_optionsScreen.SetActive(false);
}
if (Object.op_Implicit((Object)(object)_serverSettingsScreen))
{
_serverSettingsScreen.SetActive(false);
}
_editorScreen.SetActive(true);
PlayerCamera.ToggleMouse(true);
}
}
private void CloseEditor()
{
if (Object.op_Implicit((Object)(object)_editorScreen))
{
_editorScreen.SetActive(false);
}
if (PauseManager.IsPaused && Object.op_Implicit((Object)(object)_mainScreen) && !MainMenuManager.IsInMenu)
{
_mainScreen.SetActive(true);
}
}
private void PreviousBonus()
{
_selectedIndex--;
if (_selectedIndex < 0)
{
_selectedIndex = _bonusSettings.Count - 1;
}
}
private void NextBonus()
{
_selectedIndex++;
if (_selectedIndex >= _bonusSettings.Count)
{
_selectedIndex = 0;
}
}
private void AdjustSelected(float delta)
{
Selected.Value = Mathf.Clamp((float)Math.Round(Selected.Value + delta, 2), 0f, 999f);
}
private void ResetSelected()
{
Selected.Value = Selected.DefaultValue;
}
private void SetSelectedTo50()
{
Selected.Value = 50f;
}
private void ToggleOverrides()
{
_enableOverrides.Value = !_enableOverrides.Value;
}
private void ResetAll()
{
foreach (BonusSetting bonusSetting in _bonusSettings)
{
bonusSetting.Value = bonusSetting.DefaultValue;
}
}
private void SetAll(float value)
{
foreach (BonusSetting bonusSetting in _bonusSettings)
{
bonusSetting.Value = value;
}
}
private void ApplyOverrides(List<Bonus> bonuses)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (!_enableOverrides.Value || !IsHost || bonuses == null)
{
return;
}
for (int i = 0; i < bonuses.Count; i++)
{
Bonus val = bonuses[i];
if (TryGetBonusValue(val.Name, out var value))
{
val.Worth = value;
bonuses[i] = val;
}
}
}
private bool TryGetBonusValue(string bonusName, out float value)
{
string normalizedName = Normalize(bonusName);
foreach (BonusSetting bonusSetting in _bonusSettings)
{
if (bonusSetting.Matches(normalizedName))
{
value = bonusSetting.Value;
return true;
}
}
value = 1f;
return false;
}
private Transform FindMenuButtonParent()
{
List<GameObject> privateField = GetPrivateField<List<GameObject>>(_pauseManager, "_serverButtons");
if (privateField != null)
{
foreach (GameObject item in privateField)
{
if (Object.op_Implicit((Object)(object)item))
{
return item.transform.parent;
}
}
}
VerticalLayoutGroup componentInChildren = _mainScreen.GetComponentInChildren<VerticalLayoutGroup>(true);
if (!Object.op_Implicit((Object)(object)componentInChildren))
{
return _mainScreen.transform;
}
return ((Component)componentInChildren).transform;
}
private GameObject FindButtonTemplate()
{
List<GameObject> privateField = GetPrivateField<List<GameObject>>(_pauseManager, "_serverButtons");
if (privateField != null)
{
foreach (GameObject item in privateField)
{
if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.GetComponentInChildren<Button>(true)))
{
return item;
}
}
}
if (!Object.op_Implicit((Object)(object)_serverSettingsScreen))
{
return null;
}
Button componentInChildren = _serverSettingsScreen.GetComponentInChildren<Button>(true);
if (componentInChildren == null)
{
return null;
}
return ((Component)componentInChildren).gameObject;
}
private static TextMeshProUGUI FindTextTemplate()
{
TextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll<TextMeshProUGUI>();
if (array.Length == 0)
{
return null;
}
return array[0];
}
private static PauseManager GetPauseManager()
{
object? obj = typeof(PauseManager).GetField("_instance", PrivateStatic)?.GetValue(null);
return (PauseManager)((obj is PauseManager) ? obj : null);
}
private static T GetPrivateField<T>(object instance, string fieldName) where T : class
{
if (instance == null)
{
return null;
}
return instance.GetType().GetField(fieldName, PrivateInstance)?.GetValue(instance) as T;
}
private static void SetButtonsInteractable(List<Button> buttons, bool interactable)
{
foreach (Button button in buttons)
{
if (Object.op_Implicit((Object)(object)button))
{
((Selectable)button).interactable = interactable;
}
}
}
private static void SetText(TextMeshProUGUI label, string text)
{
if (Object.op_Implicit((Object)(object)label))
{
((TMP_Text)label).text = text;
}
}
private static string Normalize(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return string.Empty;
}
char[] array = new char[value.Length];
int length = 0;
for (int i = 0; i < value.Length; i++)
{
char c = char.ToLowerInvariant(value[i]);
if (char.IsLetterOrDigit(c))
{
array[length++] = c;
}
}
return new string(array, 0, length);
}
private static string OnOff(bool value)
{
if (!value)
{
return "Off";
}
return "On";
}
}
}