using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HG.Reflection;
using On.RoR2;
using On.RoR2.UI;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DistantPicker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DistantPicker")]
[assembly: AssemblyTitle("DistantPicker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DistantItemPick;
[Serializable]
[BepInPlugin("com.brynzananas.remoteinteractor", "Remote Interactor", "1.0.0")]
[BepInDependency("com.bepis.r2api", "5.0.10")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
public const string ModGuid = "com.brynzananas.remoteinteractor";
public const string ModName = "Remote Interactor";
public const string ModVer = "1.0.0";
public static ConfigEntry<KeyboardShortcut> OpenPickupMenu;
public static ConfigEntry<KeyboardShortcut> OpenInteractableMenu;
public static ConfigEntry<KeyboardShortcut> MenuScrollUp;
public static ConfigEntry<KeyboardShortcut> MenuScrollDown;
public static ConfigEntry<KeyboardShortcut> PickSelected;
public static ConfigEntry<KeyboardShortcut> InspectSelected;
public static ConfigEntry<Color> TextColor;
public static ConfigEntry<Color> OutlineColor;
public static ConfigEntry<float> PickerXPosition;
public static ConfigEntry<float> PickerYPosition;
public static ConfigEntry<float> PickerScale;
private Sprite modIcon;
[SyncVar]
public static List<PurchaseInteraction> interactableList = new List<PurchaseInteraction>();
public static int interactableIndex = 0;
public Sprite lunarcoin;
public RenderTexture renderTexture;
public GameObject copyUI;
public Sprite background;
public PositionIndicator positionIndicator;
private HUD hud = null;
public GameObject hudBackgroundImageObject;
public RectTransform BackgroundImageRectTransform;
public GameObject hudItemToPickupImageObject;
public GameObject hudItemToPickupTextObject;
public RectTransform ItemImageRectTransform;
public RectTransform ItemTextRectTransform;
public GameObject hudInteractableImageObject;
public GameObject hudInteractableTextObject;
public RectTransform InteractableImageRectTransform;
public RectTransform InteractableTextRectTransform;
[SyncVar]
public static List<GenericPickupController> pickupList = new List<GenericPickupController>();
public static int pickupIndex = 0;
public static bool updateItemHud = false;
public static bool updateInteractableHud = false;
private void Awake()
{
//IL_0018: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Expected O, but got Unknown
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Expected O, but got Unknown
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Expected O, but got Unknown
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Expected O, but got Unknown
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Expected O, but got Unknown
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Expected O, but got Unknown
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Expected O, but got Unknown
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Expected O, but got Unknown
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Expected O, but got Unknown
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Expected O, but got Unknown
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Expected O, but got Unknown
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Expected O, but got Unknown
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Expected O, but got Unknown
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Expected O, but got Unknown
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
OpenPickupMenu = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Open pickup picker", new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()), "Set a keybind to open picker menu");
OpenInteractableMenu = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Open interactable picker", new KeyboardShortcut((KeyCode)122, Array.Empty<KeyCode>()), "Set a keybind to open picker menu");
MenuScrollUp = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Picker sroll up", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), "Set a keybind to scrol picker slot to next the next one");
MenuScrollDown = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Picker sroll down", new KeyboardShortcut((KeyCode)118, Array.Empty<KeyCode>()), "Set a keybind to scrol picker slot to next the previous one");
PickSelected = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Pick selected", new KeyboardShortcut((KeyCode)99, Array.Empty<KeyCode>()), "Set a keybind to pick selection");
InspectSelected = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Inspect pickup", new KeyboardShortcut((KeyCode)9, Array.Empty<KeyCode>()), "Set a keybind to inspect selection");
TextColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "Text color", Color.white, "Choose the text color");
OutlineColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "Outline color", Color.black, "Choose the outline color");
PickerXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Picker X position", 525f, "Control horizontal position of the picker");
PickerYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Picker Y position", 315f, "Control vertical position of the picker");
PickerScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Picker scale", 0.4f, "Control X position of the picker");
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(OpenPickupMenu));
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(OpenInteractableMenu));
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(MenuScrollUp));
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(MenuScrollDown));
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(PickSelected));
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(InspectSelected));
ModSettingsManager.AddOption((BaseOption)new ColorOption(TextColor));
ModSettingsManager.AddOption((BaseOption)new ColorOption(OutlineColor));
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(PickerXPosition));
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(PickerYPosition));
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(PickerScale));
HUD.Awake += new hook_Awake(AwakeHud);
HUD.Update += new hook_Update(UpdateNumbers);
GenericPickupController.OnEnable += new hook_OnEnable(AddToList);
GenericPickupController.OnDisable += new hook_OnDisable(RemoveFromList);
PurchaseInteraction.Awake += new hook_Awake(AddToChestList);
PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(UpdateFromChestList);
PurchaseInteraction.OnDisable += new hook_OnDisable(RemoveFromChestList);
PickerXPosition.SettingChanged += UpdateHud;
PickerYPosition.SettingChanged += UpdateHud;
PickerScale.SettingChanged += UpdateHud;
lunarcoin = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texCoinsIcon.png").WaitForCompletion();
background = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIAnimateSliceNakedButton.png").WaitForCompletion();
modIcon = LoadSpriteFromDisk();
if (Object.op_Implicit((Object)(object)modIcon))
{
ModSettingsManager.SetModIcon(modIcon);
}
}
private Sprite LoadSpriteFromDisk()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_0065: 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)
string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png");
if (!File.Exists(path))
{
return null;
}
byte[] array = File.ReadAllBytes(path);
Texture2D val = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val, array))
{
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
return null;
}
private void RemoveFromChestList(orig_OnDisable orig, PurchaseInteraction self)
{
interactableList.Remove(self);
if (interactableIndex >= interactableList.Count)
{
interactableIndex = interactableList.Count - 1;
}
updateInteractableHud = true;
orig.Invoke(self);
}
private void UpdateFromChestList(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
orig.Invoke(self, activator);
if (interactableIndex >= interactableList.Count)
{
interactableIndex = interactableList.Count - 1;
}
updateInteractableHud = true;
}
private void AddToChestList(orig_Awake orig, PurchaseInteraction self)
{
orig.Invoke(self);
if (!((Object)self).name.Contains("NewtStatue"))
{
interactableList.Add(self);
}
}
[ClientRpc]
private static void RemoveFromAll(PurchaseInteraction self)
{
if (interactableIndex >= interactableList.Count)
{
interactableIndex = interactableList.Count - 1;
}
interactableList.Remove(self);
}
[ClientRpc]
private static void UpdateForAll()
{
updateInteractableHud = true;
updateItemHud = true;
}
[ClientRpc]
private static void SyncLists(List<PurchaseInteraction> list)
{
interactableList = list;
}
[ClientRpc]
private static void SyncLists(List<GenericPickupController> list)
{
pickupList = list;
}
private void UpdateHud(object sender, EventArgs e)
{
//IL_0020: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
((Transform)ItemImageRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
((Transform)ItemImageRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value / 5f, PickerScale.Value / 5f));
((Transform)ItemTextRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
((Transform)ItemTextRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value, PickerScale.Value));
((Transform)InteractableImageRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
((Transform)InteractableImageRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value / 5f, PickerScale.Value / 5f));
((Transform)InteractableTextRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
((Transform)InteractableTextRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value, PickerScale.Value));
((Transform)BackgroundImageRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
((Transform)BackgroundImageRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value / 5f, PickerScale.Value / 5f));
}
private void UpdateNumbers(orig_Update orig, HUD self)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_046b: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
//IL_077b: Unknown result type (might be due to invalid IL or missing references)
//IL_078d: Unknown result type (might be due to invalid IL or missing references)
//IL_0792: Unknown result type (might be due to invalid IL or missing references)
//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
//IL_07dd: Unknown result type (might be due to invalid IL or missing references)
//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ef: Invalid comparison between Unknown and I4
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: 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_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: 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_03a6: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
KeyboardShortcut value;
if (updateItemHud && Object.op_Implicit((Object)(object)hudItemToPickupImageObject))
{
if (pickupList.Count > 0)
{
value = OpenPickupMenu.Value;
if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
{
PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupList[pickupIndex].pickupIndex);
if (pickupDef != null)
{
Sprite iconSprite = pickupDef.iconSprite;
string text = Language.GetString(((PickupIndex)(ref pickupList[pickupIndex].pickupIndex)).GetPickupNameToken());
ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)));
int num = 0;
foreach (GenericPickupController pickup in pickupList)
{
if (PickupCatalog.GetPickupDef(pickup.pickupIndex) == pickupDef)
{
num++;
}
}
if (num > 1)
{
text = text + " [" + num + "]";
}
if (!Object.op_Implicit((Object)(object)iconSprite))
{
iconSprite = lunarcoin;
}
if (!Object.op_Implicit((Object)(object)positionIndicator))
{
positionIndicator = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/PositionIndicators/PoiPositionIndicator"), ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent<PositionIndicator>();
positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite = iconSprite;
}
if ((Object)(object)positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite != (Object)(object)iconSprite)
{
positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite = iconSprite;
}
positionIndicator.targetTransform = ((Component)pickupList[pickupIndex]).gameObject.transform;
if (!Object.op_Implicit((Object)(object)hudBackgroundImageObject.GetComponent<Image>()))
{
Image val = hudBackgroundImageObject.AddComponent<Image>();
val.sprite = background;
}
if (!Object.op_Implicit((Object)(object)hudItemToPickupImageObject.GetComponent<Image>()))
{
Image val2 = hudItemToPickupImageObject.AddComponent<Image>();
val2.sprite = iconSprite;
}
else
{
hudItemToPickupImageObject.GetComponent<Image>().sprite = iconSprite;
}
if (!Object.op_Implicit((Object)(object)hudItemToPickupTextObject.GetComponent<Text>()))
{
Text val3 = hudItemToPickupTextObject.AddComponent<Text>();
val3.font = Addressables.LoadAssetAsync<Font>((object)"RoR2/Base/Common/Fonts/Bombardier/BOMBARD_.ttf").WaitForCompletion();
val3.fontStyle = (FontStyle)0;
val3.fontSize = 32;
val3.lineSpacing = 1f;
val3.supportRichText = true;
val3.alignment = (TextAnchor)4;
val3.alignByGeometry = true;
val3.horizontalOverflow = (HorizontalWrapMode)0;
val3.verticalOverflow = (VerticalWrapMode)1;
val3.resizeTextForBestFit = true;
val3.text = text;
((Object)val3).name = "pickupNameText";
((Graphic)val3).color = TextColor.Value;
((Graphic)val3).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/Fonts/Bombardier/BOMBARD_.ttf").WaitForCompletion();
hudItemToPickupTextObject.AddComponent<Outline>();
((Shadow)hudItemToPickupTextObject.GetComponent<Outline>()).effectDistance = new Vector2(2f, 2f);
((Shadow)hudItemToPickupTextObject.GetComponent<Outline>()).effectColor = OutlineColor.Value;
}
else
{
hudItemToPickupTextObject.GetComponent<Text>().text = text;
}
}
goto IL_0433;
}
}
if (Object.op_Implicit((Object)(object)hudItemToPickupImageObject.GetComponent<Image>()))
{
Object.Destroy((Object)(object)hudItemToPickupImageObject.GetComponent<Image>());
}
if (Object.op_Implicit((Object)(object)hudItemToPickupTextObject.GetComponent<Text>()))
{
Object.Destroy((Object)(object)hudItemToPickupTextObject.GetComponent<Text>());
Object.Destroy((Object)(object)hudItemToPickupTextObject.GetComponent<Outline>());
}
goto IL_0433;
}
goto IL_043a;
IL_043a:
if (updateInteractableHud && Object.op_Implicit((Object)(object)hudInteractableImageObject))
{
if (interactableList.Count > 0)
{
value = OpenInteractableMenu.Value;
if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
{
PurchaseInteraction val4 = (Object.op_Implicit((Object)(object)interactableList[interactableIndex]) ? interactableList[interactableIndex] : null);
if ((Object)(object)val4 != (Object)null)
{
Sprite interactableIcon = PingIndicator.GetInteractableIcon(((Component)val4).gameObject);
string text2 = Language.GetString(val4.displayNameToken, Language.currentLanguageName);
if ((int)val4.costType == 1)
{
text2 = text2 + "\n$$$: " + val4.cost;
}
ShopTerminalBehavior component = ((Component)val4).GetComponent<ShopTerminalBehavior>();
try
{
if (Object.op_Implicit((Object)(object)component))
{
text2 = text2 + "\nItem: " + Language.GetString(PickupCatalog.GetPickupDef(component.CurrentPickupIndex()).nameToken);
}
}
catch
{
}
if (!val4.available)
{
text2 += "\nUnavailable";
}
if (!Object.op_Implicit((Object)(object)interactableIcon))
{
interactableIcon = lunarcoin;
}
if (!Object.op_Implicit((Object)(object)positionIndicator))
{
positionIndicator = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/PositionIndicators/PoiPositionIndicator"), ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent<PositionIndicator>();
positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite = interactableIcon;
}
if ((Object)(object)positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite != (Object)(object)interactableIcon)
{
positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite = interactableIcon;
}
positionIndicator.targetTransform = ((Component)val4).gameObject.transform;
if (!Object.op_Implicit((Object)(object)hudBackgroundImageObject.GetComponent<Image>()))
{
Image val5 = hudBackgroundImageObject.AddComponent<Image>();
val5.sprite = background;
}
if (!Object.op_Implicit((Object)(object)hudInteractableImageObject.GetComponent<Image>()))
{
Image val6 = hudInteractableImageObject.AddComponent<Image>();
val6.sprite = interactableIcon;
}
else
{
hudInteractableImageObject.GetComponent<Image>().sprite = interactableIcon;
}
if (!Object.op_Implicit((Object)(object)hudInteractableTextObject.GetComponent<Text>()))
{
Text val7 = hudInteractableTextObject.AddComponent<Text>();
val7.font = Addressables.LoadAssetAsync<Font>((object)"RoR2/Base/Common/Fonts/Bombardier/BOMBARD_.ttf").WaitForCompletion();
val7.fontStyle = (FontStyle)0;
val7.fontSize = 32;
val7.lineSpacing = 1f;
val7.supportRichText = true;
val7.alignment = (TextAnchor)4;
val7.alignByGeometry = true;
val7.horizontalOverflow = (HorizontalWrapMode)0;
val7.verticalOverflow = (VerticalWrapMode)1;
val7.resizeTextForBestFit = true;
val7.text = text2;
((Object)val7).name = "interactableNameText";
((Graphic)val7).color = TextColor.Value;
((Graphic)val7).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/Fonts/Bombardier/BOMBARD_.ttf").WaitForCompletion();
hudInteractableTextObject.AddComponent<Outline>();
((Shadow)hudInteractableTextObject.GetComponent<Outline>()).effectDistance = new Vector2(2f, 2f);
((Shadow)hudInteractableTextObject.GetComponent<Outline>()).effectColor = OutlineColor.Value;
}
else
{
hudInteractableTextObject.GetComponent<Text>().text = text2;
}
}
goto IL_0869;
}
}
if (Object.op_Implicit((Object)(object)hudInteractableImageObject.GetComponent<Image>()))
{
Object.Destroy((Object)(object)hudInteractableImageObject.GetComponent<Image>());
}
if (Object.op_Implicit((Object)(object)hudInteractableTextObject.GetComponent<Text>()))
{
Object.Destroy((Object)(object)hudInteractableTextObject.GetComponent<Text>());
Object.Destroy((Object)(object)hudInteractableTextObject.GetComponent<Outline>());
}
goto IL_0869;
}
goto IL_0870;
IL_0433:
updateItemHud = false;
goto IL_043a;
IL_0870:
if (Object.op_Implicit((Object)(object)hudInteractableImageObject.GetComponent<Image>()) || Object.op_Implicit((Object)(object)hudItemToPickupImageObject.GetComponent<Image>()))
{
return;
}
if (Object.op_Implicit((Object)(object)positionIndicator))
{
if (Object.op_Implicit((Object)(object)positionIndicator.insideViewObject.GetComponent<SpriteRenderer>()))
{
Object.Destroy((Object)(object)positionIndicator.insideViewObject.GetComponent<SpriteRenderer>());
}
if (Object.op_Implicit((Object)(object)positionIndicator.outsideViewObject.GetComponent<SpriteRenderer>()))
{
Object.Destroy((Object)(object)positionIndicator.outsideViewObject.GetComponent<SpriteRenderer>());
}
if (Object.op_Implicit((Object)(object)positionIndicator.outsideViewObject))
{
Object.Destroy((Object)(object)positionIndicator.outsideViewObject);
}
positionIndicator.targetTransform = null;
Object.Destroy((Object)(object)positionIndicator);
}
if (Object.op_Implicit((Object)(object)hudBackgroundImageObject.GetComponent<Image>()))
{
Object.Destroy((Object)(object)hudBackgroundImageObject.GetComponent<Image>());
}
return;
IL_0869:
updateInteractableHud = false;
goto IL_0870;
}
private void AwakeHud(orig_Awake orig, HUD self)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0062: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_0181: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Expected O, but got Unknown
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Expected O, but got Unknown
//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_0486: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Expected O, but got Unknown
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0519: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_0559: Unknown result type (might be due to invalid IL or missing references)
//IL_055e: Unknown result type (might be due to invalid IL or missing references)
//IL_0588: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
hud = self;
hudBackgroundImageObject = new GameObject("pickerBackgroundImage");
hudBackgroundImageObject.transform.SetParent(hud.mainContainer.transform);
BackgroundImageRectTransform = hudBackgroundImageObject.AddComponent<RectTransform>();
BackgroundImageRectTransform.anchorMin = new Vector2(0.25f, 0f);
BackgroundImageRectTransform.anchorMax = new Vector2(0.75f, 1f);
BackgroundImageRectTransform.sizeDelta = Vector2.zero;
BackgroundImageRectTransform.pivot = new Vector2(0.5f, 0.5f);
BackgroundImageRectTransform.anchoredPosition = new Vector2(0.5f, 0.5f);
((Transform)BackgroundImageRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value / 5f, PickerScale.Value / 5f));
((Transform)BackgroundImageRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
hudItemToPickupImageObject = new GameObject("pickerPickupImage");
hudItemToPickupImageObject.transform.SetParent(hud.mainContainer.transform);
ItemImageRectTransform = hudItemToPickupImageObject.AddComponent<RectTransform>();
ItemImageRectTransform.anchorMin = new Vector2(0.25f, 0f);
ItemImageRectTransform.anchorMax = new Vector2(0.75f, 1f);
ItemImageRectTransform.sizeDelta = Vector2.zero;
ItemImageRectTransform.pivot = new Vector2(0.5f, 0.5f);
ItemImageRectTransform.anchoredPosition = new Vector2(0.5f, 0.5f);
((Transform)ItemImageRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value / 5f, PickerScale.Value / 5f));
((Transform)ItemImageRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
hudItemToPickupTextObject = new GameObject("pickerPickupText");
hudItemToPickupTextObject.transform.SetParent(hud.mainContainer.transform);
ItemTextRectTransform = hudItemToPickupTextObject.AddComponent<RectTransform>();
ItemTextRectTransform.anchorMin = new Vector2(0.25f, 0f);
ItemTextRectTransform.anchorMax = new Vector2(0.75f, 1f);
ItemTextRectTransform.sizeDelta = Vector2.zero;
ItemTextRectTransform.pivot = new Vector2(0.5f, 0.5f);
ItemTextRectTransform.anchoredPosition = new Vector2(0.5f, 0.5f);
((Transform)ItemTextRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value, PickerScale.Value));
((Transform)ItemTextRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
hudInteractableImageObject = new GameObject("pickerInteractableImage");
hudInteractableImageObject.transform.SetParent(hud.mainContainer.transform);
InteractableImageRectTransform = hudInteractableImageObject.AddComponent<RectTransform>();
InteractableImageRectTransform.anchorMin = new Vector2(0.25f, 0f);
InteractableImageRectTransform.anchorMax = new Vector2(0.75f, 1f);
InteractableImageRectTransform.sizeDelta = Vector2.zero;
InteractableImageRectTransform.pivot = new Vector2(0.5f, 0.5f);
InteractableImageRectTransform.anchoredPosition = new Vector2(0.5f, 0.5f);
((Transform)InteractableImageRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value / 5f, PickerScale.Value / 5f));
((Transform)InteractableImageRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
hudInteractableTextObject = new GameObject("pickerInteractableText");
hudInteractableTextObject.transform.SetParent(hud.mainContainer.transform);
InteractableTextRectTransform = hudInteractableTextObject.AddComponent<RectTransform>();
InteractableTextRectTransform.anchorMin = new Vector2(0.25f, 0f);
InteractableTextRectTransform.anchorMax = new Vector2(0.75f, 1f);
InteractableTextRectTransform.sizeDelta = Vector2.zero;
InteractableTextRectTransform.pivot = new Vector2(0.5f, 0.5f);
InteractableTextRectTransform.anchoredPosition = new Vector2(0.5f, 0.5f);
((Transform)InteractableTextRectTransform).localScale = Vector2.op_Implicit(new Vector2(PickerScale.Value, PickerScale.Value));
((Transform)InteractableTextRectTransform).localPosition = new Vector3(PickerXPosition.Value, PickerYPosition.Value, 0f);
}
private void AddToList(orig_OnEnable orig, GenericPickupController self)
{
orig.Invoke(self);
pickupList.Add(self);
}
private void RemoveFromList(orig_OnDisable orig, GenericPickupController self)
{
pickupList.Remove(self);
if (pickupIndex >= pickupList.Count)
{
pickupIndex = 0;
}
updateItemHud = true;
orig.Invoke(self);
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void JustInteract(ConCommandArgs args)
{
if (Object.op_Implicit((Object)(object)((ConCommandArgs)(ref args)).senderBody) && Object.op_Implicit((Object)(object)((Component)((ConCommandArgs)(ref args)).senderBody).GetComponent<Interactor>()))
{
int argInt = ((ConCommandArgs)(ref args)).GetArgInt(0);
interactableList[argInt].OnInteractionBegin(((Component)((ConCommandArgs)(ref args)).senderBody).GetComponent<Interactor>());
SyncLists(interactableList);
}
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void JustGrant(ConCommandArgs args)
{
if (Object.op_Implicit((Object)(object)((ConCommandArgs)(ref args)).senderBody))
{
int argInt = ((ConCommandArgs)(ref args)).GetArgInt(0);
pickupList[argInt].AttemptGrant(((ConCommandArgs)(ref args)).senderBody);
SyncLists(pickupList);
}
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: 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_006b: 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_0073: 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_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: 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_037f: 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_0387: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0581: Unknown result type (might be due to invalid IL or missing references)
//IL_0586: Unknown result type (might be due to invalid IL or missing references)
//IL_0589: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0454: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_046a: Unknown result type (might be due to invalid IL or missing references)
//IL_046f: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = OpenPickupMenu.Value;
if (!Input.GetKey(((KeyboardShortcut)(ref value)).MainKey) && interactableList.Count > 0 && Object.op_Implicit((Object)(object)Run.instance) && !PauseManager.isPaused)
{
CharacterMaster master = NetworkUser.readOnlyLocalPlayersList[0].master;
if (Object.op_Implicit((Object)(object)((master != null) ? master.GetBody() : null)))
{
value = OpenInteractableMenu.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
if (interactableIndex < 0 || interactableIndex >= interactableList.Count)
{
interactableIndex = 0;
}
updateInteractableHud = true;
}
value = OpenInteractableMenu.Value;
if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
{
if (!(Input.mouseScrollDelta.y > 0f))
{
value = MenuScrollUp.Value;
if (!Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
goto IL_013c;
}
}
interactableIndex++;
if (interactableIndex >= interactableList.Count)
{
interactableIndex = 0;
}
updateInteractableHud = true;
goto IL_013c;
}
goto IL_02c0;
}
}
goto IL_0313;
IL_0313:
value = OpenInteractableMenu.Value;
if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey) || pickupList.Count <= 0 || !Object.op_Implicit((Object)(object)Run.instance) || PauseManager.isPaused)
{
return;
}
CharacterMaster master2 = NetworkUser.readOnlyLocalPlayersList[0].master;
if (!Object.op_Implicit((Object)(object)((master2 != null) ? master2.GetBody() : null)))
{
return;
}
value = OpenPickupMenu.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
if (pickupIndex < 0 || pickupIndex >= pickupList.Count)
{
pickupIndex = 0;
}
updateItemHud = true;
}
value = OpenPickupMenu.Value;
if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
{
if (!(Input.mouseScrollDelta.y > 0f))
{
value = MenuScrollUp.Value;
if (!Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
goto IL_0454;
}
}
pickupIndex++;
if (pickupIndex >= pickupList.Count)
{
pickupIndex = 0;
}
updateItemHud = true;
goto IL_0454;
}
goto IL_057c;
IL_057c:
value = InspectSelected.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) && Object.op_Implicit((Object)(object)pickupList[pickupIndex]))
{
CharacterMasterNotificationQueue.PushPickupNotification(NetworkUser.readOnlyLocalPlayersList[0].master, pickupList[pickupIndex].pickupIndex);
}
value = OpenPickupMenu.Value;
if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey))
{
if (pickupIndex < 0 || pickupIndex >= pickupList.Count)
{
pickupIndex = 0;
}
updateItemHud = true;
}
return;
IL_04ba:
value = PickSelected.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
if (NetworkServer.active)
{
GenericPickupController obj = pickupList[pickupIndex];
CharacterMaster master3 = NetworkUser.readOnlyLocalPlayersList[0].master;
obj.AttemptGrant((master3 != null) ? master3.GetBody() : null);
}
else
{
Console.instance.SubmitCmd(NetworkUser.readOnlyLocalPlayersList.FirstOrDefault(), "JustGrant " + pickupIndex, false);
}
if (pickupIndex >= pickupList.Count)
{
pickupIndex = pickupList.Count - 1;
}
updateItemHud = true;
}
goto IL_057c;
IL_013c:
if (!(Input.mouseScrollDelta.y < 0f))
{
value = MenuScrollDown.Value;
if (!Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
goto IL_01a2;
}
}
interactableIndex--;
if (interactableIndex < 0)
{
interactableIndex = interactableList.Count - 1;
}
updateInteractableHud = true;
goto IL_01a2;
IL_02c0:
value = OpenInteractableMenu.Value;
if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey))
{
if (interactableIndex < 0 || interactableIndex >= interactableList.Count)
{
interactableIndex = 0;
}
updateInteractableHud = true;
}
goto IL_0313;
IL_0454:
if (!(Input.mouseScrollDelta.y < 0f))
{
value = MenuScrollDown.Value;
if (!Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
goto IL_04ba;
}
}
pickupIndex--;
if (pickupIndex < 0)
{
pickupIndex = pickupList.Count - 1;
}
updateItemHud = true;
goto IL_04ba;
IL_01a2:
value = PickSelected.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
if (Object.op_Implicit((Object)(object)interactableList[interactableIndex]) && interactableList[interactableIndex].available)
{
CharacterMaster master4 = NetworkUser.readOnlyLocalPlayersList[0].master;
if (Object.op_Implicit((Object)(object)((master4 != null) ? ((Component)master4.GetBody()).GetComponent<Interactor>() : null)))
{
if (NetworkServer.active)
{
PurchaseInteraction obj2 = interactableList[interactableIndex];
CharacterMaster master5 = NetworkUser.readOnlyLocalPlayersList[0].master;
obj2.OnInteractionBegin((master5 != null) ? ((Component)master5.GetBody()).GetComponent<Interactor>() : null);
}
else
{
Console.instance.SubmitCmd(NetworkUser.readOnlyLocalPlayersList.FirstOrDefault(), "JustInteract " + interactableIndex, false);
}
}
}
if (interactableIndex >= interactableList.Count)
{
interactableIndex = interactableList.Count - 1;
}
}
goto IL_02c0;
}
}