using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BingBongCommunication")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("BingBongCommunication")]
[assembly: AssemblyTitle("BingBongCommunication")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace BingBongCommunication
{
internal sealed class BingBongController : MonoBehaviour
{
private readonly BingBongWheel wheel = new BingBongWheel();
private Toast toast;
private Item? held;
private Coroutine? pendingDestroy;
internal static BingBongController? Instance { get; private set; }
private void Awake()
{
Instance = this;
toast = ((Component)this).gameObject.AddComponent<Toast>();
}
private void Update()
{
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
Character localCharacter = Character.localCharacter;
if ((Object)(object)localCharacter == (Object)null)
{
CloseWheel();
Forget();
return;
}
if (held != null && ((Object)(object)held == (Object)null || (Object)(object)localCharacter.data.currentItem != (Object)(object)held))
{
Debug("BingBong left the hands.");
CloseWheel();
Forget();
}
if ((Object)(object)held != (Object)null && !localCharacter.data.fullyConscious)
{
CloseWheel();
DestroyHeld(localCharacter);
}
else if (BingBongWheel.IsOpen)
{
UpdateWheel(localCharacter);
}
else if (InputCompat.GetKeyDown(PluginConfig.WheelKey.Value))
{
TryOpen(localCharacter);
}
}
private void TryOpen(Character character)
{
GUIManager instance = GUIManager.instance;
if ((Object)(object)instance == (Object)null || instance.wheelActive || instance.windowBlockingInput || !character.data.fullyConscious || !PhotonNetwork.InRoom)
{
return;
}
bool flag = (Object)(object)held != (Object)null && (Object)(object)character.data.currentItem == (Object)(object)held;
if (!flag)
{
if ((Object)(object)character.data.currentItem != (Object)null)
{
toast.Show(Messages.HandsFull);
return;
}
if (character.data.isClimbingAnything)
{
toast.Show(Messages.Climbing);
return;
}
}
var (newIndices, array) = BingBongSource.GetLines();
if (array.Length == 0)
{
toast.Show(Messages.NotFound);
return;
}
CancelPendingDestroy();
if (wheel.Open(newIndices, array) && !flag)
{
SpawnInHands(character);
}
}
private void UpdateWheel(Character character)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)held == (Object)null)
{
CloseWheel();
return;
}
if (InputCompat.RightClickDown())
{
wheel.Tab(1);
}
else if (InputCompat.LeftClickDown())
{
int num = wheel.ArrowUnderMouse();
wheel.Tab((num != 0) ? num : (-1));
}
wheel.UpdateHover();
if (!InputCompat.GetKey(PluginConfig.WheelKey.Value))
{
int hovered = wheel.Hovered;
CloseWheel();
if (hovered < 0)
{
DestroyHeld(character);
}
else
{
Speak(character, hovered);
}
}
}
private void CloseWheel()
{
if (BingBongWheel.IsOpen)
{
wheel.Close();
}
}
private void SpawnInHands(Character character)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
Transform transform = character.GetBodypart((BodypartType)2).transform;
Vector3 val = 0.6f * transform.forward;
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(transform.position, transform.forward, ref val2, 0.6f, LayerMask.GetMask(new string[2] { "Terrain", "Map" })))
{
val = Mathf.Max(((RaycastHit)(ref val2)).distance - 0.4f, 0.1f) * transform.forward;
}
GameObject val3 = PhotonNetwork.Instantiate(BingBongSource.PrefabPath, transform.position + val, Quaternion.identity, (byte)0, (object[])null);
PhotonView component = val3.GetComponent<PhotonView>();
component.RPC("SetItemInstanceDataRPC", (RpcTarget)0, new object[1] { NewInstanceData() });
CharacterItems items = character.refs.items;
if (items.currentSelectedSlot.IsSome)
{
items.lastSelectedSlot = items.currentSelectedSlot;
items.currentSelectedSlot = Optionable<byte>.None;
}
held = val3.GetComponent<Item>();
items.photonView.RPC("EquipSlotRpc", (RpcTarget)0, new object[2] { -1, component.ViewID });
Debug($"Spawned BingBong (view {component.ViewID}).");
}
private void Speak(Character character, int index)
{
Action_AskBingBong ask = BingBongSource.GetAsk(held);
if ((Object)(object)ask == (Object)null)
{
DestroyHeld(character);
return;
}
((MonoBehaviourPun)held).photonView.RPC("Ask", (RpcTarget)0, new object[2] { index, false });
Debug($"Ask line #{index}.");
pendingDestroy = ((MonoBehaviour)this).StartCoroutine(DestroyAfterTalking(character, held, ask));
}
private IEnumerator DestroyAfterTalking(Character character, Item item, Action_AskBingBong ask)
{
float voiceStart = Time.time + 1f;
bool started = false;
while (true)
{
if (Time.time >= voiceStart)
{
if (ask.source.isPlaying || ((Component)ask.subtitles).gameObject.activeSelf)
{
started = true;
}
else if (started || Time.time > voiceStart + 2f)
{
break;
}
}
yield return null;
}
yield return (object)new WaitForSeconds(PluginConfig.DestroyDelay.Value);
pendingDestroy = null;
if ((Object)(object)held == (Object)(object)item && (Object)(object)character.data.currentItem == (Object)(object)item)
{
DestroyHeld(character);
}
}
private void DestroyHeld(Character character)
{
if ((Object)(object)held != (Object)null && (Object)(object)character.data.currentItem == (Object)(object)held)
{
character.refs.items.photonView.RPC("DestroyHeldItemRpc", (RpcTarget)0, Array.Empty<object>());
Debug("Destroyed BingBong.");
}
Forget();
}
internal void CancelPendingDestroy()
{
if (pendingDestroy != null)
{
((MonoBehaviour)this).StopCoroutine(pendingDestroy);
pendingDestroy = null;
Debug("Pending destroy cancelled.");
}
}
private void Forget()
{
CancelPendingDestroy();
held = null;
}
internal void OnItemUsed(Item item)
{
if ((Object)(object)held != (Object)null && (Object)(object)item == (Object)(object)held)
{
CancelPendingDestroy();
}
}
internal bool OnEquipSlot(CharacterItems items)
{
Character character = items.character;
if (!character.IsLocal || (Object)(object)held == (Object)null || (Object)(object)character.data.currentItem != (Object)(object)held || items.currentSelectedSlot.IsSome)
{
return true;
}
CloseWheel();
DestroyHeld(character);
return !character.input.unselectSlotWasPressed;
}
internal bool HandleDropping(CharacterItems items)
{
Character character = items.character;
if (!character.IsLocal || (Object)(object)held == (Object)null || (Object)(object)character.data.currentItem != (Object)(object)held || !items.pressedDrop || !character.input.dropWasReleased || held.progress > 0f)
{
return true;
}
items.throwChargeLevel = 0f;
items.pressedDrop = false;
DestroyHeld(character);
return false;
}
private static ItemInstanceData NewInstanceData()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
ItemInstanceData val = new ItemInstanceData(Guid.NewGuid());
ItemInstanceDataHandler.AddInstanceData(val);
return val;
}
private static void Debug(string message)
{
if (PluginConfig.DebugLogging.Value)
{
Plugin.Log.LogInfo((object)message);
}
}
}
internal static class BingBongSource
{
private const string FallbackName = "BingBong";
private static Item? prefab;
private static readonly int[] DisplayOrder = new int[26]
{
0, 5, 8, 4, 1, 2, 7, 3, 14, 10,
15, 17, 11, 9, 12, 16, 24, 18, 21, 20,
25, 6, 13, 19, 23, 22
};
internal static Item? Prefab
{
get
{
if ((Object)(object)prefab == (Object)null)
{
prefab = Load(PluginConfig.PrefabName.Value) ?? Load("BingBong");
if ((Object)(object)prefab == (Object)null)
{
Plugin.Log.LogError((object)("No BingBong prefab found (looked for '" + PluginConfig.PrefabName.Value + "' and 'BingBong')."));
}
else
{
Plugin.Log.LogInfo((object)("Using BingBong prefab '" + ((Object)((Component)prefab).gameObject).name + "'."));
}
}
return prefab;
}
}
internal static string PrefabPath => "0_Items/" + ((Object)((Component)Prefab).gameObject).name;
internal static Action_AskBingBong? GetAsk(Item item)
{
return ((Component)item).GetComponentInChildren<Action_AskBingBong>(true);
}
internal static (int[] indices, string[] lines) GetLines()
{
Action_AskBingBong ask = (((Object)(object)Prefab != (Object)null) ? GetAsk(Prefab) : null);
if ((Object)(object)ask == (Object)null || ask.responses == null)
{
return (indices: Array.Empty<int>(), lines: Array.Empty<string>());
}
int count = ask.responses.Length;
List<int> list = DisplayOrder.Where((int i) => i < count).ToList();
list.AddRange(Enumerable.Range(0, count).Except(list));
int[] array = list.ToArray();
string[] item = array.Select((int i) => LocalizedText.GetText(ask.responses[i].subtitleID, true)).ToArray();
return (indices: array, lines: item);
}
private static Item? Load(string name)
{
GameObject val = Resources.Load<GameObject>("0_Items/" + name);
Item val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<Item>() : null);
if (!((Object)(object)val2 != (Object)null) || !((Object)(object)GetAsk(val2) != (Object)null))
{
return null;
}
return val2;
}
}
internal sealed class BingBongWheel
{
private sealed class Slice
{
internal Transform transform;
internal Button button;
internal Image image;
internal TextMeshProUGUI label;
}
private const int SlicesPerPage = 8;
private const float DeadZone = 40f;
private GameObject? root;
private Slice[] slices;
private TextMeshProUGUI centerText;
private GameObject nextArrow;
private GameObject prevArrow;
private CanvasGroup nextArrowGroup;
private GameObject noPageLabel;
private int[] responseIndices = Array.Empty<int>();
private string[] lines = Array.Empty<string>();
private int page;
private int hovered = -1;
internal static bool IsOpen { get; private set; }
private int PageCount => Mathf.Max(1, (lines.Length + 8 - 1) / 8);
internal int Hovered
{
get
{
if (hovered >= 0)
{
return responseIndices[hovered];
}
return -1;
}
}
internal bool Open(int[] newIndices, string[] newLines)
{
if (!EnsureBuilt())
{
return false;
}
responseIndices = newIndices;
lines = newLines;
page = ((PluginConfig.Reopen.Value != ReopenPage.FirstPage) ? Mathf.Clamp(page, 0, PageCount - 1) : 0);
hovered = -1;
root.SetActive(true);
IsOpen = true;
Refresh();
return true;
}
internal void Close()
{
IsOpen = false;
hovered = -1;
if ((Object)(object)root != (Object)null)
{
root.SetActive(false);
}
if ((Object)(object)EventSystem.current != (Object)null)
{
EventSystem.current.SetSelectedGameObject((GameObject)null);
}
}
internal void Tab(int delta)
{
int num = Mathf.Clamp(page + delta, 0, PageCount - 1);
if (num != page)
{
page = num;
hovered = -1;
Refresh();
}
}
internal void UpdateHover()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0034: 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_003a: 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_007f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)root == (Object)null)
{
return;
}
Canvas canvas;
Camera val = EventCamera(out canvas);
Vector2 val2 = RectTransformUtility.WorldToScreenPoint(val, root.transform.position);
Vector2 val3 = InputCompat.MousePosition() - val2;
int num = -1;
if (((Vector2)(ref val3)).magnitude >= 40f * canvas.scaleFactor)
{
float num2 = float.MaxValue;
for (int i = 0; i < slices.Length; i++)
{
if (((Selectable)slices[i].button).interactable)
{
float num3 = Vector2.Angle(val3, Direction(slices[i]));
if (num3 < num2)
{
num2 = num3;
num = i;
}
}
}
}
int num4 = ((num < 0) ? (-1) : (page * 8 + num));
if (num4 != hovered)
{
hovered = num4;
if ((Object)(object)EventSystem.current != (Object)null)
{
EventSystem.current.SetSelectedGameObject((num < 0) ? null : ((Component)slices[num].button).gameObject);
}
UpdateCenterText();
}
}
internal int ArrowUnderMouse()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0043: Expected O, but got Unknown
//IL_005f: 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_006b: Expected O, but got Unknown
if ((Object)(object)root == (Object)null)
{
return 0;
}
Canvas canvas;
Camera val = EventCamera(out canvas);
Vector2 val2 = InputCompat.MousePosition();
if (nextArrow.activeInHierarchy && RectTransformUtility.RectangleContainsScreenPoint((RectTransform)nextArrow.transform, val2, val))
{
return 1;
}
if (prevArrow.activeInHierarchy && RectTransformUtility.RectangleContainsScreenPoint((RectTransform)prevArrow.transform, val2, val))
{
return -1;
}
return 0;
}
private Camera? EventCamera(out Canvas canvas)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
canvas = root.GetComponentInParent<Canvas>().rootCanvas;
if ((int)canvas.renderMode != 0)
{
return canvas.worldCamera;
}
return null;
}
private void Refresh()
{
for (int i = 0; i < slices.Length; i++)
{
int num = page * 8 + i;
bool flag = num < lines.Length;
Slice slice = slices[i];
((Selectable)slice.button).interactable = flag;
((TMP_Text)slice.label).text = (flag ? lines[num] : "");
}
bool flag2 = page + 1 < PageCount;
nextArrowGroup.alpha = (flag2 ? 1f : 0.25f);
noPageLabel.SetActive(!flag2);
prevArrow.SetActive(page > 0);
if ((Object)(object)EventSystem.current != (Object)null)
{
EventSystem.current.SetSelectedGameObject((GameObject)null);
}
UpdateCenterText();
}
private void UpdateCenterText()
{
((TMP_Text)centerText).text = ((hovered >= 0) ? lines[hovered] : $"{page + 1} / {PageCount}");
}
private bool EnsureBuilt()
{
if ((Object)(object)root != (Object)null)
{
return true;
}
GUIManager instance = GUIManager.instance;
if ((Object)(object)instance == (Object)null || (Object)(object)instance.emoteWheel == (Object)null)
{
return false;
}
EmoteWheel component = instance.emoteWheel.GetComponent<EmoteWheel>();
if ((Object)(object)component == (Object)null)
{
Plugin.Log.LogError((object)"Vanilla emote wheel not found; cannot build the BingBong wheel.");
return false;
}
GameObject val = Object.Instantiate<GameObject>(((Component)component).gameObject, ((Component)component).transform.parent);
val.SetActive(false);
((Object)val).name = "BingBongWheel";
EmoteWheel component2 = val.GetComponent<EmoteWheel>();
centerText = component2.selectedEmoteName;
((TMP_Text)centerText).text = "";
nextArrow = ((Component)component2.nextButton).gameObject;
prevArrow = ((Component)component2.prevButton).gameObject;
((Behaviour)component2.nextButton).enabled = false;
((Behaviour)component2.prevButton).enabled = false;
nextArrow.SetActive(true);
if (!nextArrow.TryGetComponent<CanvasGroup>(ref nextArrowGroup))
{
nextArrowGroup = nextArrow.AddComponent<CanvasGroup>();
}
noPageLabel = CreateNoPageLabel(nextArrow.transform, centerText);
EmoteWheelSlice[] array = component2.slices;
slices = new Slice[array.Length];
for (int i = 0; i < array.Length; i++)
{
EmoteWheelSlice val2 = array[i];
slices[i] = new Slice
{
transform = ((Component)val2).transform,
button = ((UIWheelSlice)val2).button,
image = val2.image,
label = CreateLabel(val2.image, centerText)
};
Object.DestroyImmediate((Object)(object)val2);
}
Object.DestroyImmediate((Object)(object)component2);
root = val;
Array.Sort(slices, (Slice a, Slice b) => CcwKey(a).CompareTo(CcwKey(b)));
return true;
}
private float CcwKey(Slice slice)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return (Vector2.SignedAngle(Vector2.up, Direction(slice)) + 360f + 22.5f) % 360f;
}
private Vector2 Direction(Slice slice)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return Vector2.op_Implicit(root.transform.InverseTransformPoint(((TMP_Text)slice.label).transform.position));
}
private static GameObject CreateNoPageLabel(Transform arrow, TextMeshProUGUI fontSource)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("NoPage", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(arrow, false);
RectTransform val2 = (RectTransform)val.transform;
val2.anchorMin = new Vector2(0.5f, 0.5f);
val2.anchorMax = new Vector2(0.5f, 0.5f);
val2.pivot = new Vector2(0.5f, 0.5f);
val2.anchoredPosition = Vector2.zero;
val2.sizeDelta = new Vector2(120f, 40f);
val.AddComponent<CanvasGroup>().ignoreParentGroups = true;
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = "No page";
((TMP_Text)val3).font = ((TMP_Text)fontSource).font;
((TMP_Text)val3).fontSharedMaterial = ((TMP_Text)fontSource).fontSharedMaterial;
((Graphic)val3).color = Color.white;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
((TMP_Text)val3).textWrappingMode = (TextWrappingModes)0;
((TMP_Text)val3).enableAutoSizing = true;
((TMP_Text)val3).fontSizeMin = 12f;
((TMP_Text)val3).fontSizeMax = 24f;
((Graphic)val3).raycastTarget = false;
val.SetActive(false);
return val;
}
private static TextMeshProUGUI CreateLabel(Image icon, TextMeshProUGUI fontSource)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_004e: 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_0078: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)icon).enabled = false;
GameObject val = new GameObject("Line", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)icon).transform, false);
RectTransform val2 = (RectTransform)val.transform;
val2.anchorMin = new Vector2(0.5f, 0.5f);
val2.anchorMax = new Vector2(0.5f, 0.5f);
val2.pivot = new Vector2(0.5f, 0.5f);
val2.anchoredPosition = Vector2.zero;
val2.sizeDelta = new Vector2(150f, 90f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).font = ((TMP_Text)fontSource).font;
((TMP_Text)val3).fontSharedMaterial = ((TMP_Text)fontSource).fontSharedMaterial;
((Graphic)val3).color = Color.white;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
((TMP_Text)val3).textWrappingMode = (TextWrappingModes)1;
((TMP_Text)val3).enableAutoSizing = true;
((TMP_Text)val3).fontSizeMin = 14f;
((TMP_Text)val3).fontSizeMax = 28f;
((Graphic)val3).raycastTarget = false;
return val3;
}
}
internal static class InputCompat
{
internal static bool GetKeyDown(KeyCode keyCode)
{
//IL_0009: 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)
Keyboard current = Keyboard.current;
if (current != null && TryMapKey(keyCode, out var key))
{
return ((ButtonControl)current[key]).wasPressedThisFrame;
}
return false;
}
internal static bool GetKey(KeyCode keyCode)
{
//IL_0009: 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)
Keyboard current = Keyboard.current;
if (current != null && TryMapKey(keyCode, out var key))
{
return ((ButtonControl)current[key]).isPressed;
}
return false;
}
internal static bool LeftClickDown()
{
Mouse current = Mouse.current;
if (current == null)
{
return false;
}
return current.leftButton.wasPressedThisFrame;
}
internal static bool RightClickDown()
{
Mouse current = Mouse.current;
if (current == null)
{
return false;
}
return current.rightButton.wasPressedThisFrame;
}
internal static Vector2 MousePosition()
{
//IL_0014: 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)
Mouse current = Mouse.current;
if (current == null)
{
return Vector2.zero;
}
return ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue();
}
private unsafe static bool TryMapKey(KeyCode keyCode, out Key key)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected I4, but got Unknown
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Invalid comparison between Unknown and I4
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected I4, but got Unknown
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
if ((int)keyCode <= 32)
{
if ((int)keyCode == 9)
{
key = (Key)3;
return true;
}
if ((int)keyCode == 13)
{
key = (Key)2;
return true;
}
if ((int)keyCode == 32)
{
key = (Key)1;
return true;
}
}
else
{
switch (keyCode - 48)
{
case 0:
key = (Key)50;
return true;
case 1:
key = (Key)41;
return true;
case 2:
key = (Key)42;
return true;
case 3:
key = (Key)43;
return true;
case 4:
key = (Key)44;
return true;
case 5:
key = (Key)45;
return true;
case 6:
key = (Key)46;
return true;
case 7:
key = (Key)47;
return true;
case 8:
key = (Key)48;
return true;
case 9:
key = (Key)49;
return true;
}
if ((int)keyCode == 96)
{
key = (Key)4;
return true;
}
switch (keyCode - 303)
{
case 3:
key = (Key)55;
return true;
case 2:
key = (Key)56;
return true;
case 5:
key = (Key)53;
return true;
case 4:
key = (Key)54;
return true;
case 1:
key = (Key)51;
return true;
case 0:
key = (Key)52;
return true;
}
}
if (Enum.TryParse<Key>(((object)(*(KeyCode*)(&keyCode))/*cast due to .constrained prefix*/).ToString(), ignoreCase: false, out key))
{
return (int)key != 0;
}
return false;
}
}
internal static class Messages
{
internal static string HandsFull => Pick("Your hands are full", "Vous avez les mains pleines", "Hai le mani occupate", "Deine Hände sind voll", "Tienes las manos ocupadas", "Tienes las manos ocupadas", "Suas mãos estão ocupadas", "У вас заняты руки", "У вас зайняті руки", "你的双手被占用了", "你的雙手被佔用了", "両手がふさがっています", "양손이 사용 중입니다", "Masz zajęte ręce", "Ellerin dolu");
internal static string Climbing => Pick("You can't do that while climbing", "Impossible pendant l'escalade", "Non puoi farlo mentre ti arrampichi", "Das geht nicht beim Klettern", "No puedes hacerlo mientras escalas", "No puedes hacerlo mientras escalas", "Você não pode fazer isso enquanto escala", "Нельзя во время лазания", "Не можна під час лазіння", "攀爬时无法使用", "攀爬時無法使用", "何かを掴んでいるので使えません", "등반 중에는 사용할 수 없습니다", "Nie możesz tego zrobić podczas wspinaczki", "Tırmanırken bunu yapamazsın");
internal static string NotFound => Pick("Bing Bong not found", "Bing Bong introuvable", "Bing Bong non trovato", "Bing Bong nicht gefunden", "No se encontró a Bing Bong", "No se encontró a Bing Bong", "Bing Bong não encontrado", "Бинг Бонг не найден", "Бінг Бонга не знайдено", "找不到Bing Bong", "找不到Bing Bong", "BingBongが見つかりません", "빙봉을 찾을 수 없습니다", "Nie znaleziono Bing Bonga", "Bing Bong bulunamadı");
private static string Pick(params string[] byLanguage)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected I4, but got Unknown
int num = (int)LocalizedText.CURRENT_LANGUAGE;
if (num < 0 || num >= byLanguage.Length)
{
return byLanguage[0];
}
return byLanguage[num];
}
}
[HarmonyPatch]
internal static class Patches
{
[HarmonyPostfix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static void WheelActivePostfix(ref bool __result)
{
if (BingBongWheel.IsOpen)
{
__result = true;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CharacterItems), "DoDropping")]
private static bool DoDroppingPrefix(CharacterItems __instance)
{
if (!((Object)(object)BingBongController.Instance == (Object)null))
{
return BingBongController.Instance.HandleDropping(__instance);
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CharacterItems), "EquipSlot")]
private static bool EquipSlotPrefix(CharacterItems __instance)
{
if (!((Object)(object)BingBongController.Instance == (Object)null))
{
return BingBongController.Instance.OnEquipSlot(__instance);
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Item), "StartUsePrimary")]
private static void StartUsePrimaryPrefix(Item __instance)
{
BingBongController.Instance?.OnItemUsed(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Item), "StartUseSecondary")]
private static void StartUseSecondaryPrefix(Item __instance)
{
BingBongController.Instance?.OnItemUsed(__instance);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("BingBongCommunication", "BingBongCommunication", "0.1.1")]
public class Plugin : BaseUnityPlugin
{
public const string Id = "BingBongCommunication";
internal static ManualLogSource Log { get; private set; }
public static string Name => "BingBongCommunication";
public static string Version => "0.1.1";
private void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
PluginConfig.Init(((BaseUnityPlugin)this).Config);
new Harmony("BingBongCommunication").PatchAll(typeof(Patches));
GameObject val = new GameObject("BingBongCommunication");
Object.DontDestroyOnLoad((Object)(object)val);
((Object)val).hideFlags = (HideFlags)61;
val.AddComponent<BingBongController>();
Log.LogInfo((object)("Plugin " + Name + " v" + Version + " is loaded!"));
}
}
internal enum ReopenPage
{
FirstPage,
LastOpenedPage
}
internal static class PluginConfig
{
internal static ConfigEntry<KeyCode> WheelKey;
internal static ConfigEntry<ReopenPage> Reopen;
internal static ConfigEntry<float> DestroyDelay;
internal static ConfigEntry<string> PrefabName;
internal static ConfigEntry<bool> DebugLogging;
internal static void Init(ConfigFile cfg)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
WheelKey = cfg.Bind<KeyCode>("General", "WheelKey", (KeyCode)116, "Hold to take out a BingBong and open the line wheel. Release to make it say the hovered line. While holding: right click = next page, left click = previous page.");
Reopen = cfg.Bind<ReopenPage>("General", "Reopen", ReopenPage.LastOpenedPage, "Which page the wheel opens on. FirstPage: always page 1. LastOpenedPage: the page you were on last time.");
DestroyDelay = cfg.Bind<float>("General", "DestroyDelay", 0f, new ConfigDescription("Seconds to wait after BingBong finishes talking before it is removed from your hands.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
PrefabName = cfg.Bind<string>("Advanced", "PrefabName", "BingBong_Prop Variant", "Prefab name (under Resources/0_Items) of the BingBong to spawn. 'BingBong_Prop Variant' is the airport one that faces outward; 'BingBong' is the shore / item spawner one that faces you.");
DebugLogging = cfg.Bind<bool>("Advanced", "DebugLogging", false, "Log spawn / speak / destroy events to the BepInEx console.");
}
}
internal sealed class Toast : MonoBehaviour
{
private const float ShowSeconds = 2f;
private const float FadeSeconds = 0.5f;
private TextMeshProUGUI? text;
private float remaining;
internal void Show(string message)
{
if ((Object)(object)text == (Object)null && !Build())
{
Plugin.Log.LogWarning((object)message);
return;
}
((TMP_Text)text).text = message;
((TMP_Text)text).alpha = 1f;
remaining = 2.5f;
((Component)text).gameObject.SetActive(true);
}
private void Update()
{
if (!((Object)(object)text == (Object)null) && !(remaining <= 0f))
{
remaining -= Time.unscaledDeltaTime;
((TMP_Text)text).alpha = Mathf.Clamp01(remaining / 0.5f);
if (remaining <= 0f)
{
((Component)text).gameObject.SetActive(false);
}
}
}
private bool Build()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00cc: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: 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_018c: Unknown result type (might be due to invalid IL or missing references)
GUIManager instance = GUIManager.instance;
EmoteWheel val = (((Object)(object)instance != (Object)null && (Object)(object)instance.emoteWheel != (Object)null) ? instance.emoteWheel.GetComponent<EmoteWheel>() : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
GameObject val2 = new GameObject("BingBongCommunicationToast", new Type[1] { typeof(RectTransform) });
val2.transform.SetParent(((Component)this).transform, false);
Canvas val3 = val2.AddComponent<Canvas>();
val3.renderMode = (RenderMode)0;
val3.sortingOrder = 500;
GameObject val4 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
val4.transform.SetParent(val2.transform, false);
RectTransform val5 = (RectTransform)val4.transform;
val5.anchorMin = new Vector2(0f, 1f);
val5.anchorMax = new Vector2(0f, 1f);
val5.pivot = new Vector2(0f, 1f);
val5.anchoredPosition = new Vector2(30f, -30f);
val5.sizeDelta = new Vector2(900f, 60f);
text = val4.AddComponent<TextMeshProUGUI>();
((TMP_Text)text).font = ((TMP_Text)val.selectedEmoteName).font;
((TMP_Text)text).fontSharedMaterial = ((TMP_Text)val.selectedEmoteName).fontSharedMaterial;
((TMP_Text)text).fontSize = 30f;
((Graphic)text).color = new Color(1f, 0.45f, 0.4f);
((TMP_Text)text).alignment = (TextAlignmentOptions)257;
((Graphic)text).raycastTarget = false;
return true;
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}