using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
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("com.github.SniffRx.FriendsInfo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("com.github.SniffRx.FriendsInfo")]
[assembly: AssemblyTitle("FriendsInfo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.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]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
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")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace FriendsInfo
{
internal sealed class CharacterBarAffliction : MonoBehaviour
{
internal AfflictionType afflictionType;
private RectTransform rectTransform;
private CharacterStaminaBar characterStaminaBar;
private float size;
internal void FetchReferences()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
rectTransform = (RectTransform)((Component)this).transform;
Transform obj = ((Component)this).transform.Find("Icon");
if (obj != null)
{
((Component)obj).gameObject.SetActive(false);
}
characterStaminaBar = ((Component)this).GetComponentInParent<CharacterStaminaBar>();
characterStaminaBar.AddCharacterBarAffliction(this);
}
internal void FetchDesiredSize()
{
//IL_0026: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)characterStaminaBar == (Object)null)
{
return;
}
Character observedCharacter = characterStaminaBar.observedCharacter;
if ((Object)(object)observedCharacter == (Object)null)
{
return;
}
STATUSTYPE val = (STATUSTYPE)afflictionType;
float currentStatus = observedCharacter.refs.afflictions.GetCurrentStatus(val);
size = characterStaminaBar.fullBarRectTransform.sizeDelta.x * currentStatus;
if (currentStatus > 0.01f)
{
if (size < 15f)
{
size = 15f;
}
((Component)this).gameObject.SetActive(true);
}
else
{
((Component)this).gameObject.SetActive(false);
}
}
internal void UpdateVisual()
{
//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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
Vector2 sizeDelta = rectTransform.sizeDelta;
sizeDelta.x = Mathf.Lerp(rectTransform.sizeDelta.x, size, Mathf.Min(Time.deltaTime * 10f, 0.1f));
rectTransform.sizeDelta = sizeDelta;
}
}
internal sealed class CharacterStaminaBar : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DisableIEnumerator>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CharacterStaminaBar <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisableIEnumerator>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0024: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
int num = <>1__state;
CharacterStaminaBar characterStaminaBar = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
((Component)characterStaminaBar).transform.localScale = Vector3.one * 0.72f;
TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)characterStaminaBar).transform, 0f, 0.5f), (Ease)17);
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((Component)characterStaminaBar).gameObject.SetActive(false);
characterStaminaBar.animateDisableCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <EnableIEnumerator>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CharacterStaminaBar <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <EnableIEnumerator>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0024: 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_005b: Expected O, but got Unknown
int num = <>1__state;
CharacterStaminaBar characterStaminaBar = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
((Component)characterStaminaBar).transform.localScale = Vector3.zero;
TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)characterStaminaBar).transform, 0.72f, 0.5f), (Ease)24);
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
characterStaminaBar.animateDisableCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly Color defaultBarColor = new Color(0.1035f, 0.2656f, 0.3019f, 1f);
private static readonly Color outOfStaminaColor = new Color(0.566f, 0.0089f, 0.0089f, 1f);
internal RectTransform fullBarRectTransform;
internal RectTransform staminaBarRectTransform;
internal RectTransform maxStaminaBarRectTransform;
internal RectTransform staminaBarOutlineRectTransform;
internal RectTransform staminaBarOutlineOverflowBar;
private Image barImage;
private Image glowImage;
private RectTransform extraBar;
private RectTransform extraBarStamina;
private RectTransform extraBarOutline;
private float staminaBarOffset;
private readonly List<CharacterBarAffliction> characterBarAfflictions = new List<CharacterBarAffliction>();
private Coroutine? animateDisableCoroutine;
private Character? _observedCharacter;
private bool hadObservedCharacter;
private bool outOfStamina;
private bool sequencingExtraBar;
internal bool isEnabled;
private float sinTime;
private readonly float TAU = MathF.PI * 2f;
private float desiredExtraStaminaSize;
private float extraOutlineMaxWidth;
private readonly List<RawImage> inventorySlotImages = new List<RawImage>();
private const int InventorySlotCount = 3;
private readonly List<InventorySlotUI> inventorySlots = new List<InventorySlotUI>();
private InventorySlotUI? heldItemSlot;
internal Character? observedCharacter
{
get
{
return _observedCharacter;
}
set
{
if ((Object)(object)value != (Object)null)
{
hadObservedCharacter = true;
}
_observedCharacter = value;
}
}
internal void AnimateEnable()
{
if (!isEnabled && animateDisableCoroutine == null)
{
isEnabled = true;
((Component)this).gameObject.SetActive(true);
animateDisableCoroutine = ((MonoBehaviour)this).StartCoroutine(EnableIEnumerator());
}
}
internal void AnimateDisable()
{
if (isEnabled && animateDisableCoroutine == null)
{
isEnabled = false;
animateDisableCoroutine = ((MonoBehaviour)this).StartCoroutine(DisableIEnumerator());
}
}
[IteratorStateMachine(typeof(<EnableIEnumerator>d__2))]
private IEnumerator EnableIEnumerator()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EnableIEnumerator>d__2(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<DisableIEnumerator>d__3))]
private IEnumerator DisableIEnumerator()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableIEnumerator>d__3(0)
{
<>4__this = this
};
}
private void Awake()
{
Debug.Log((object)"CharacterStaminaBar Awake");
StaminaBar val = default(StaminaBar);
if (((Component)this).TryGetComponent<StaminaBar>(ref val))
{
staminaBarOffset = val.staminaBarOffset;
}
FixBarGroupPosition();
CacheStaminaBarReferences();
CreateInventorySlots();
CreateExtraStaminaBar();
if ((Object)(object)val?.extraBar != (Object)null)
{
((Component)val.extraBar).gameObject.SetActive(false);
}
}
private void CacheStaminaBarReferences()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Expected O, but got Unknown
fullBarRectTransform = (RectTransform)((Component)this).transform.Find("FullBar");
maxStaminaBarRectTransform = (RectTransform)((Component)this).transform.Find("LayoutGroup/MaxStamina");
staminaBarOutlineRectTransform = (RectTransform)((Component)this).transform.Find("OutlineMask/Outline");
staminaBarOutlineOverflowBar = (RectTransform)((Component)this).transform.Find("OutlineOverflowLine");
barImage = ((Component)((Transform)maxStaminaBarRectTransform).Find("Back")).GetComponent<Image>();
staminaBarRectTransform = (RectTransform)((Component)barImage).transform.Find("Stamina");
glowImage = ((Component)((Transform)staminaBarRectTransform).Find("Glow")).GetComponent<Image>();
}
private void CreateExtraStaminaBar()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0066: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: 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_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)fullBarRectTransform == (Object)null)
{
Debug.LogError((object)"FullBar not found");
return;
}
StaminaBar component = ((Component)this).GetComponent<StaminaBar>();
GameObject val = new GameObject("FriendExtraBar");
val.transform.SetParent(((Component)this).transform, false);
extraBar = val.AddComponent<RectTransform>();
RectTransform obj = extraBar;
RectTransform obj2 = extraBar;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0f, 0.5f);
obj2.anchorMax = val2;
obj.anchorMin = val2;
extraBar.pivot = new Vector2(0f, 0.5f);
Vector2 anchoredPosition = fullBarRectTransform.anchoredPosition;
extraBar.anchoredPosition = new Vector2(anchoredPosition.x, anchoredPosition.y - 31f);
extraBar.sizeDelta = new Vector2(28f, 28f);
if ((Object)(object)component?.extraBarOutline != (Object)null)
{
GameObject val3 = Object.Instantiate<GameObject>(((Component)component.extraBarOutline).gameObject, val.transform, false);
((Object)val3).name = "FriendExtraBarOutline";
extraBarOutline = val3.GetComponent<RectTransform>();
Vector2 anchoredPosition2 = extraBarOutline.anchoredPosition;
extraBarOutline.anchoredPosition = new Vector2(anchoredPosition2.x - 46f, anchoredPosition2.y - 1f);
extraOutlineMaxWidth = fullBarRectTransform.sizeDelta.x * 0.7f + 12f;
extraBarOutline.sizeDelta = new Vector2(extraOutlineMaxWidth, extraBarOutline.sizeDelta.y);
RemoveAllScriptsExcept<Image, RectTransform>(val3);
}
if ((Object)(object)component?.extraBarStamina != (Object)null)
{
GameObject val4 = Object.Instantiate<GameObject>(((Component)component.extraBarStamina).gameObject, val.transform, false);
((Object)val4).name = "FriendExtraBarStamina";
extraBarStamina = val4.GetComponent<RectTransform>();
extraBarStamina.sizeDelta = new Vector2(extraBarStamina.sizeDelta.x, extraBarStamina.sizeDelta.y * 0.5f);
RemoveAllScriptsExcept<Image, RectTransform>(val4);
}
val.SetActive(false);
}
private void UpdateExtraStaminaBar()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: 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_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Expected O, but got Unknown
if ((Object)(object)extraBar == (Object)null || (Object)(object)extraBarStamina == (Object)null || (Object)(object)extraBarOutline == (Object)null || (Object)(object)observedCharacter == (Object)null)
{
return;
}
float extraStamina = observedCharacter.data.extraStamina;
bool flag = extraStamina > 0f;
if (!((Component)extraBar).gameObject.activeSelf && flag)
{
extraBar.sizeDelta = Vector2.zero;
ShortcutExtensions.DOKill((Component)(object)extraBar, false);
TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(extraBar, new Vector2(28f, 28f), 0.25f, false), (Ease)9);
((Component)extraBar).gameObject.SetActive(true);
}
if (((Component)extraBar).gameObject.activeSelf)
{
desiredExtraStaminaSize = Mathf.Max(0f, extraStamina * fullBarRectTransform.sizeDelta.x * 0.7f);
extraBarStamina.sizeDelta = new Vector2(extraBarStamina.sizeDelta.x.MathfLerp(Mathf.Max(4f, desiredExtraStaminaSize), Time.deltaTime * 10f), extraBarStamina.sizeDelta.y);
extraBarOutline.sizeDelta = new Vector2(extraOutlineMaxWidth, extraBarOutline.sizeDelta.y);
if (!flag && !sequencingExtraBar)
{
sequencingExtraBar = true;
TweenSettingsExtensions.OnComplete<Sequence>(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)DOTweenModuleUI.DOSizeDelta(extraBar, new Vector2(extraBar.sizeDelta.x, 0f), 0.2f, false)), new TweenCallback(DisableExtraBar));
}
}
}
private void DisableExtraBar()
{
((Component)extraBar).gameObject.SetActive(false);
sequencingExtraBar = false;
}
private static void RemoveAllScriptsExcept<T1, T2>(GameObject go)
{
MonoBehaviour[] components = go.GetComponents<MonoBehaviour>();
foreach (MonoBehaviour val in components)
{
if (((object)val).GetType() != typeof(T1) && ((object)val).GetType() != typeof(T2))
{
Object.DestroyImmediate((Object)(object)val);
}
}
}
internal void AddCharacterBarAffliction(CharacterBarAffliction aff)
{
characterBarAfflictions.Add(aff);
}
private void FixBarGroupPosition()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = (RectTransform)((Component)this).transform.parent;
if (!((Object)(object)val == (Object)null))
{
val.sizeDelta = new Vector2(600f, 600f);
val.anchoredPosition = new Vector2(val.anchoredPosition.x, 353f);
VerticalLayoutGroup val2 = default(VerticalLayoutGroup);
if (((Component)val).TryGetComponent<VerticalLayoutGroup>(ref val2))
{
((HorizontalOrVerticalLayoutGroup)val2).spacing = 25f;
}
}
}
private void CreateInventorySlots()
{
//IL_0026: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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)
GUIManager instance = GUIManager.instance;
Sprite sprite = instance.items[0].selectedSlotIcon.sprite;
Color color = ((Graphic)instance.items[0].selectedSlotIcon).color;
Transform label = FindNicknameLabel();
float num = GetNicknameLabelWidth(label) + 115f;
for (int i = 0; i < 3; i++)
{
InventorySlotUI item = CreateInventorySlot($"InvSlot_{i}", new Vector2(32f, 32f), new Vector2(num + (float)(i * 38), 43f), sprite, color);
inventorySlots.Add(item);
}
heldItemSlot = CreateInventorySlot("HoldingItemSlot", new Vector2(38f, 38f), new Vector2(num + 114f - 5f, 43f), sprite, color);
}
private void UpdateInventorySlots()
{
//IL_0048: 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_00bc: 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_00ca: Expected O, but got Unknown
Character? obj = observedCharacter;
if (((obj == null) ? null : obj.player?.itemSlots) == null)
{
ClearInventorySlots();
return;
}
ItemSlot[] itemSlots = observedCharacter.player.itemSlots;
Optionable<byte> currentSelectedSlot = observedCharacter.refs.items.currentSelectedSlot;
for (int i = 0; i < inventorySlots.Count && i < itemSlots.Length; i++)
{
bool selected = currentSelectedSlot.IsSome && currentSelectedSlot.Value == i;
inventorySlots[i].SetItem(itemSlots[i], selected);
}
Item currentItem = observedCharacter.data.currentItem;
if ((Object)(object)heldItemSlot != (Object)null)
{
ItemSlot slot = new ItemSlot(byte.MaxValue)
{
prefab = currentItem
};
heldItemSlot.SetItem(slot, selected: true);
}
}
private void ClearInventorySlots()
{
foreach (InventorySlotUI inventorySlot in inventorySlots)
{
inventorySlot.Clear();
}
heldItemSlot?.Clear();
}
private InventorySlotUI CreateInventorySlot(string name, Vector2 size, Vector2 position, Sprite borderSprite, Color borderColor)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0034: 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_0053: 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_006f: 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)
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)this).transform, false);
RectTransform component = val.GetComponent<RectTransform>();
component.sizeDelta = size;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0f, 0.5f);
component.anchorMax = val2;
component.anchorMin = val2;
component.pivot = new Vector2(0f, 0.5f);
component.anchoredPosition = position;
InventorySlotUI inventorySlotUI = val.AddComponent<InventorySlotUI>();
inventorySlotUI.Initialize(borderSprite, borderColor);
return inventorySlotUI;
}
private Transform? FindNicknameLabel()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
foreach (Transform item in ((Component)this).transform)
{
Transform val = item;
if (((Object)val).name.StartsWith("Label: "))
{
return val;
}
}
return null;
}
private float GetNicknameLabelWidth(Transform? label)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)label))
{
return 100f;
}
return ((Component)label).GetComponent<RectTransform>().sizeDelta.x;
}
private void UpdateStaminaBar()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)observedCharacter == (Object)null)
{
return;
}
foreach (CharacterBarAffliction characterBarAffliction in characterBarAfflictions)
{
characterBarAffliction.FetchDesiredSize();
characterBarAffliction.UpdateVisual();
}
float num = Mathf.Max(0f, observedCharacter.data.currentStamina * fullBarRectTransform.sizeDelta.x + staminaBarOffset);
if (observedCharacter.data.currentStamina <= 0.005f && !outOfStamina)
{
outOfStamina = true;
OutOfStaminaPulse();
}
else if (observedCharacter.data.currentStamina > 0.005f)
{
outOfStamina = false;
}
float num2 = Time.deltaTime * 10f;
staminaBarRectTransform.sizeDelta = new Vector2(staminaBarRectTransform.sizeDelta.x.MathfLerp(num, num2), staminaBarRectTransform.sizeDelta.y);
float num3 = Mathf.Clamp01((staminaBarRectTransform.sizeDelta.x - num) * 0.5f);
sinTime += num2 * num3;
Color color = ((Graphic)glowImage).color;
color.a = num3 * 0.4f - Mathf.Abs(Mathf.Sin(sinTime)) * 0.2f;
((Graphic)glowImage).color = color;
float to = Mathf.Max(0f, observedCharacter.GetMaxStamina() * fullBarRectTransform.sizeDelta.x + staminaBarOffset);
maxStaminaBarRectTransform.sizeDelta = new Vector2(maxStaminaBarRectTransform.sizeDelta.x.MathfLerp(to, num2), maxStaminaBarRectTransform.sizeDelta.y);
float statusSum = observedCharacter.refs.afflictions.statusSum;
staminaBarOutlineRectTransform.sizeDelta = new Vector2(14f + Mathf.Max(1f, statusSum) * fullBarRectTransform.sizeDelta.x, staminaBarOutlineRectTransform.sizeDelta.y);
((Component)staminaBarOutlineOverflowBar).gameObject.SetActive(statusSum > 1.005f);
((Component)staminaBarRectTransform).gameObject.SetActive(staminaBarRectTransform.sizeDelta.x > 0f);
((Component)maxStaminaBarRectTransform).gameObject.SetActive(maxStaminaBarRectTransform.sizeDelta.x > 0f);
if (sinTime > TAU)
{
sinTime -= TAU;
}
}
private void OutOfStaminaPulse()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
((Graphic)barImage).color = outOfStaminaColor;
DOTweenModuleUI.DOColor(barImage, defaultBarColor, 0.5f);
}
private void Update()
{
if (!Object.op_Implicit((Object)(object)observedCharacter) || !((Component)observedCharacter).gameObject.activeSelf)
{
if (hadObservedCharacter)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
else
{
UpdateStaminaBar();
UpdateExtraStaminaBar();
UpdateInventorySlots();
}
}
}
public class InventorySlotUI : MonoBehaviour
{
private RectTransform rectTransform;
private RawImage icon;
private Image fill;
private GameObject? fuelBar;
private Image? fuelBarFill;
private TextMeshProUGUI? nameText;
private Vector2 startingSizeDelta;
private Item? currentItem;
private ItemInstanceData? currentData;
public void Initialize(Sprite selectedSprite, Color selectedColor)
{
//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_004e: 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)
rectTransform = ((Component)this).GetComponent<RectTransform>();
startingSizeDelta = rectTransform.sizeDelta;
CreateFuelBar();
icon = ((Component)this).gameObject.AddComponent<RawImage>();
((Graphic)icon).color = new Color(1f, 1f, 1f, 0f);
((Graphic)icon).raycastTarget = false;
fill = CreateFillImage("Fill", selectedSprite, selectedColor);
((Behaviour)fill).enabled = false;
if (Plugin.showItemNames.Value)
{
CreateNameText();
}
}
public void SetItem(ItemSlot slot, bool selected)
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
if (!slot.IsEmpty() && slot.prefab?.UIData != null)
{
currentItem = slot.prefab;
currentData = slot.data;
if (currentItem?.UIData != null)
{
icon.texture = (Texture)(object)currentItem.UIData.GetIcon();
((Behaviour)icon).enabled = true;
((Graphic)icon).color = Color.white;
}
UpdateCookedColor();
UpdateFuelBar();
if (Plugin.showItemNames.Value)
{
UpdateNameText();
}
}
else
{
Clear();
}
SetSelected(selected);
}
public void Clear()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)fill).enabled = false;
((Behaviour)icon).enabled = false;
icon.texture = null;
((Graphic)icon).color = new Color(1f, 1f, 1f, 0f);
currentItem = null;
currentData = null;
if (Object.op_Implicit((Object)(object)fuelBar))
{
fuelBar.SetActive(false);
}
if (Object.op_Implicit((Object)(object)nameText))
{
((Behaviour)nameText).enabled = false;
((TMP_Text)nameText).text = "";
}
}
private void SetSelected(bool isSelected)
{
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0066: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)currentItem != (Object)null || isSelected)
{
if (isSelected)
{
ShortcutExtensions.DOKill((Component)(object)rectTransform, false);
TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta * 1.2f, 0.5f, false), (Ease)24);
((Behaviour)fill).enabled = true;
((Component)fill).transform.localScale = Vector3.zero;
ShortcutExtensions.DOKill((Component)(object)((Component)fill).transform, false);
TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)fill).transform, 1f, 0.25f), (Ease)9);
if (Plugin.showItemNames.Value && Object.op_Implicit((Object)(object)nameText))
{
((Behaviour)nameText).enabled = true;
}
}
else
{
ShortcutExtensions.DOKill((Component)(object)rectTransform, false);
TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta, 0.2f, false), (Ease)9);
((Behaviour)fill).enabled = false;
if (Object.op_Implicit((Object)(object)nameText))
{
((Behaviour)nameText).enabled = false;
}
}
}
else if (isSelected)
{
ShortcutExtensions.DOKill((Component)(object)rectTransform, false);
Sequence val = DOTween.Sequence();
TweenSettingsExtensions.Append(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta * 1.2f, 0.075f, false), (Ease)9));
TweenSettingsExtensions.Append(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta, 0.125f, false), (Ease)2));
}
else
{
ShortcutExtensions.DOKill((Component)(object)rectTransform, false);
rectTransform.sizeDelta = startingSizeDelta;
}
}
private void UpdateCookedColor()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
ItemInstanceData? obj = currentData;
IntItemData val = default(IntItemData);
if (obj != null && obj.TryGetDataEntry<IntItemData>((DataEntryKey)1, ref val))
{
((Graphic)icon).color = ItemCooking.GetCookColor(val.Value);
}
}
private void UpdateFuelBar()
{
if ((Object)(object)fuelBar == (Object)null)
{
return;
}
if ((Object)(object)Character.observedCharacter != (Object)(object)Character.localCharacter)
{
fuelBar.SetActive(false);
return;
}
ItemInstanceData? obj = currentData;
FloatItemData val = default(FloatItemData);
if (obj != null && obj.HasData((DataEntryKey)11) && currentData.TryGetDataEntry<FloatItemData>((DataEntryKey)11, ref val))
{
fuelBar.SetActive(true);
if ((Object)(object)fuelBarFill != (Object)null)
{
fuelBarFill.fillAmount = val.Value;
}
}
else
{
fuelBar.SetActive(false);
if ((Object)(object)fuelBarFill != (Object)null)
{
fuelBarFill.fillAmount = 1f;
}
}
}
private void UpdateNameText()
{
if (Object.op_Implicit((Object)(object)nameText) && Object.op_Implicit((Object)(object)currentItem))
{
((TMP_Text)nameText).text = currentItem.GetItemName(currentData);
}
}
private Image CreateFillImage(string name, Sprite sprite, Color color)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_0075: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)this).transform, false);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
component.anchoredPosition = Vector2.zero;
Image val2 = val.AddComponent<Image>();
val2.sprite = sprite;
val2.type = (Type)1;
((Graphic)val2).color = color;
((Graphic)val2).raycastTarget = false;
return val2;
}
private void CreateFuelBar()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b2: 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_00da: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("FuelBar", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)this).transform, false);
val.transform.SetAsFirstSibling();
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 0f);
component.sizeDelta = new Vector2(0f, 4f);
component.anchoredPosition = new Vector2(0f, 2f);
Image val2 = val.AddComponent<Image>();
((Graphic)val2).color = new Color(0f, 0f, 0f, 0.5f);
GameObject val3 = new GameObject("Fill", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(val.transform, false);
RectTransform component2 = val3.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.sizeDelta = Vector2.zero;
component2.anchoredPosition = Vector2.zero;
fuelBarFill = val3.AddComponent<Image>();
((Graphic)fuelBarFill).color = Color.yellow;
fuelBarFill.type = (Type)3;
fuelBarFill.fillMethod = (FillMethod)0;
fuelBar = val;
fuelBar.SetActive(false);
}
private void CreateNameText()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("NameText", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)this).transform, false);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 1f);
component.anchorMax = new Vector2(1f, 1f);
component.sizeDelta = new Vector2(0f, 20f);
component.anchoredPosition = new Vector2(0f, 10f);
nameText = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)nameText).text = "";
((TMP_Text)nameText).fontSize = 8f;
((Graphic)nameText).color = Color.white;
((TMP_Text)nameText).alignment = (TextAlignmentOptions)514;
((Behaviour)nameText).enabled = false;
}
private void OnDisable()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = rectTransform;
if (obj != null)
{
ShortcutExtensions.DOKill((Component)(object)obj, false);
}
Image obj2 = fill;
if (obj2 != null)
{
Transform transform = ((Component)obj2).transform;
if (transform != null)
{
ShortcutExtensions.DOKill((Component)(object)transform, false);
}
}
if (Object.op_Implicit((Object)(object)rectTransform))
{
rectTransform.sizeDelta = startingSizeDelta;
}
if (Object.op_Implicit((Object)(object)fill))
{
((Behaviour)fill).enabled = false;
}
if (Object.op_Implicit((Object)(object)nameText))
{
((Behaviour)nameText).enabled = false;
((TMP_Text)nameText).text = "";
}
}
}
internal static class FloatExtensions
{
public static float MathfLerp(this float from, float to, float t)
{
return Mathf.Lerp(from, to, t);
}
}
public static class PlayerInfoHelper
{
public static string GetPlayerName(Character character)
{
try
{
Player owner = character.refs.view.Owner;
if (!string.IsNullOrEmpty(owner.NickName))
{
return owner.NickName;
}
}
catch
{
}
try
{
string name = ((Object)((Component)character).gameObject).name;
if (!string.IsNullOrEmpty(name))
{
int num = name.IndexOf('[');
int num2 = name.IndexOf(':');
if (num >= 0 && num2 > num)
{
return name.Substring(num + 1, num2 - num - 1).Trim();
}
num2 = name.IndexOf(']');
if (num >= 0 && num2 > num)
{
string text = name.Substring(num + 1, num2 - num - 1).Trim();
string[] array = text.Split(' ');
if (array.Length != 0)
{
return array[0];
}
return text;
}
}
return name ?? "Unknown";
}
catch
{
return "Unknown";
}
}
public static string GetDetailedPlayerStatus(Character character)
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
try
{
if (character.data.dead)
{
return "мертв";
}
if (character.data.passedOut)
{
return "без сознания";
}
CharacterClimbing component = ((Component)character).GetComponent<CharacterClimbing>();
if ((Object)(object)component != (Object)null)
{
Type type = ((object)component).GetType();
FieldInfo field = type.GetField("isClimbing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null && (bool)field.GetValue(component))
{
return "карабкается";
}
}
Rigidbody component2 = ((Component)character).GetComponent<Rigidbody>();
if ((Object)(object)component2 != (Object)null)
{
Vector3 linearVelocity = component2.linearVelocity;
if (((Vector3)(ref linearVelocity)).magnitude > 1f)
{
return "движется";
}
}
return "стоит";
}
catch
{
return "неизвестно";
}
}
public static string GetRelativeHeightArrow(Character character)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)Character.localCharacter == (Object)null || (Object)(object)character == (Object)(object)Character.localCharacter)
{
return " ";
}
Vector3 position = ((Component)Character.localCharacter).transform.position;
Vector3 position2 = ((Component)character).transform.position;
float num = position2.y - position.y;
if (num > 0.5f)
{
return "↑";
}
if (num < -0.5f)
{
return "↓";
}
return "→";
}
catch
{
return " ";
}
}
}
[BepInPlugin("com.github.SniffRx.FriendsInfo", "FriendsInfo", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Logger { get; private set; }
public static ConfigEntry<bool> displayTeammateStaminaBars { get; private set; }
public static ConfigEntry<float> teammateStaminaBarProximity { get; private set; }
public static ConfigEntry<bool> showItemNames { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"FriendsInfo mod loading...");
displayTeammateStaminaBars = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Display Teammate Stamina Bars", true, "Displays your teammates' stamina bars");
teammateStaminaBarProximity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Teammate Stamina Bar Proximity", 30f, "How close you need to be to your teammate to see their stamina bar");
showItemNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "Show Item Names", false, "Show item names when inventory slots are selected");
PlayerHandler.OnCharacterRegistered = (Action<Character>)Delegate.Combine(PlayerHandler.OnCharacterRegistered, new Action<Character>(OnCharacterRegistered));
Logger.LogInfo((object)"FriendsInfo mod initialized successfully!");
}
private void OnCharacterRegistered(Character character)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if (((MonoBehaviourPun)character).photonView.IsMine)
{
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "Airport")
{
Logger.LogInfo((object)("Adding ProximityStaminaManager to local character: " + character.characterName));
((Component)character).gameObject.AddComponent<ProximityStaminaManager>();
}
}
}
}
internal sealed class ProximityStaminaManager : MonoBehaviour
{
private readonly Dictionary<Character, CharacterStaminaBar> staminaBars = new Dictionary<Character, CharacterStaminaBar>();
private static CharacterStaminaBar CreateStaminaBar(Character observedCharacter)
{
//IL_0068: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: 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_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)GUIManager.instance.bar).transform;
Transform val = Object.Instantiate<Transform>(transform, transform.parent);
val.SetAsFirstSibling();
Object.Destroy((Object)(object)((Component)val).GetComponent<StaminaBar>());
CharacterStaminaBar characterStaminaBar = ((Component)val).gameObject.AddComponent<CharacterStaminaBar>();
characterStaminaBar.observedCharacter = observedCharacter;
BarAffliction[] componentsInChildren = ((Component)val).GetComponentsInChildren<BarAffliction>(true);
foreach (BarAffliction val2 in componentsInChildren)
{
CharacterBarAffliction characterBarAffliction = ((Component)val2).gameObject.AddComponent<CharacterBarAffliction>();
characterBarAffliction.afflictionType = (AfflictionType)(object)val2.afflictionType;
characterBarAffliction.FetchReferences();
Object.Destroy((Object)(object)val2);
}
RectTransform val3 = (RectTransform)Object.Instantiate<Transform>(((Component)((Component)GUIManager.instance).GetComponentInChildren<AscentUI>()).transform, val);
AscentUI component = ((Component)val3).GetComponent<AscentUI>();
TextMeshProUGUI text = component.text;
Object.Destroy((Object)(object)component);
string text2 = (((TMP_Text)text).text = observedCharacter.characterName);
((Object)val3).name = "Label: " + text2;
((TMP_Text)text).textWrappingMode = (TextWrappingModes)0;
((TMP_Text)text).fontSize = 32f;
((TMP_Text)text).autoSizeTextContainer = true;
((Graphic)text).color = observedCharacter.refs.customization.PlayerColor;
((TMP_Text)text).outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue);
((TMP_Text)text).outlineWidth = 0.055f;
Vector2 val4 = default(Vector2);
((Vector2)(ref val4))..ctor(0f, 1f);
val3.anchorMin = val4;
val3.anchorMax = val4;
val3.pivot = Vector2.zero;
val3.anchoredPosition = Vector2.zero;
return characterStaminaBar;
}
private void Update()
{
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)Character.localCharacter) || !Plugin.displayTeammateStaminaBars.Value)
{
foreach (KeyValuePair<Character, CharacterStaminaBar> staminaBar in staminaBars)
{
staminaBar.Value.AnimateDisable();
}
return;
}
foreach (Character allCharacter in Character.AllCharacters)
{
if (!allCharacter.IsLocal)
{
if (!staminaBars.TryGetValue(allCharacter, out CharacterStaminaBar value))
{
staminaBars.TryAdd(allCharacter, value = CreateStaminaBar(allCharacter));
}
if (Vector3.Distance(Character.localCharacter.Center, allCharacter.Center) < Plugin.teammateStaminaBarProximity.Value)
{
value.AnimateEnable();
}
else
{
value.AnimateDisable();
}
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}