using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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.Logging;
using Fusion;
using HarmonyLib;
using LycansQoL.Patch;
using LycansQoL.RPC;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Scripting;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LycansQoL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2e0a60f23afc644a370896ed9167edff677448ee")]
[assembly: AssemblyProduct("LycansQoL")]
[assembly: AssemblyTitle("LycansQoL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LycansQoL
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInPlugin("RedTenZ.LycansQoL", "LycansQoL", "1.2.1")]
[BepInProcess("Lycans.exe")]
public class LycansQoL : BaseUnityPlugin
{
public const string PLUGIN_GUID = "RedTenZ.LycansQoL";
public const string PLUGIN_AUTHOR = "RedTenZ";
public const string PLUGIN_NAME = "LycansQoL";
public const string PLUGIN_VERSION = "1.2.1";
private void Awake()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
Log.Info("Plugin LycansQoL version 1.2.1 loaded successfully!");
Harmony val = new Harmony("lycans.redtenzplugin");
val.PatchAll();
Log.Info("Harmony patches applied successfully!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "LycansQoL";
public const string PLUGIN_NAME = "LycansQoL";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LycansQoL.RPC
{
[NetworkBehaviourWeaved(20)]
public class CancelVoteRPC : NetworkBehaviour
{
[Rpc]
public unsafe static void Rpc_RequestCancelVote(NetworkRunner runner, int playerIndex)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Invalid comparison between Unknown and I4
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
try
{
if (NetworkBehaviourUtils.InvokeRpc)
{
NetworkBehaviourUtils.InvokeRpc = false;
}
else
{
if ((Object)(object)runner == (Object)null)
{
throw new ArgumentNullException("runner");
}
if ((int)runner.Stage == 4)
{
return;
}
if (runner.HasAnyActiveConnections())
{
int num = 24;
SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num);
byte* data = SimulationMessage.GetData(ptr);
int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void LycansModTemplate.Patch.CancelVoteRPC::Rpc_RequestCancelVote(Fusion.NetworkRunner,System.Int32)")), data);
*(int*)(data + num2) = playerIndex;
num2 += 4;
((SimulationMessage)ptr).Offset = num2 * 8;
((SimulationMessage)ptr).SetStatic();
runner.SendRpc(ptr);
}
}
Execute(playerIndex);
}
catch (Exception ex)
{
string text = "Rpc_CancelVote error: ";
Log.Info(text + ex);
}
}
[NetworkRpcStaticWeavedInvoker("System.Void LycansModTemplate.Patch.CancelVoteRPC::Rpc_RequestCancelVote(Fusion.NetworkRunner,System.Int32)")]
[Preserve]
protected unsafe static void Rpc_RequestCancelVote_0040Invoker(NetworkRunner runner, SimulationMessage* message)
{
byte* data = SimulationMessage.GetData(message);
int num = (RpcHeader.ReadSize(data) + 3) & -4;
int playerIndex = *(int*)(data + num);
num += 4;
NetworkBehaviourUtils.InvokeRpc = true;
Rpc_RequestCancelVote(runner, playerIndex);
}
public static void Execute(int playerId)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayerController player = PlayerRegistry.GetPlayer(PlayerRef.op_Implicit(playerId));
if (!((Object)(object)player == (Object)null) && player.IdVoted != -1)
{
if (((SimulationBehaviour)player).HasStateAuthority)
{
GameManager.Instance.gameUI.ShowSkipVote(true);
}
player.IdVoted = -1;
player.UpdateVoting(false);
}
}
}
[NetworkBehaviourWeaved(20)]
public class StartVoteRPC : NetworkBehaviour
{
private static readonly HashSet<int> _startGameVoters = new HashSet<int>();
internal static int GetReadyVotesCount()
{
return _startGameVoters.Count;
}
internal static void ResetStartGameVotes()
{
_startGameVoters.Clear();
int count = PlayerRegistry.Count;
int neededForMajority = ((count > 0) ? (count / 2 + 1) : 0);
UIReadyPlayerCountPatch.UpdateReadyCountUI(0, neededForMajority, localPlayerVoted: false);
}
[Rpc]
public unsafe static void Rpc_RequestStartVote(NetworkRunner runner, int playerIndex)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Invalid comparison between Unknown and I4
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: 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_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Invalid comparison between Unknown and I4
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
try
{
if (NetworkBehaviourUtils.InvokeRpc)
{
NetworkBehaviourUtils.InvokeRpc = false;
}
else
{
if ((Object)(object)runner == (Object)null)
{
throw new ArgumentNullException("runner");
}
if ((int)runner.Stage == 4)
{
return;
}
if (runner.HasAnyActiveConnections())
{
int num = 24;
SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num);
byte* data = SimulationMessage.GetData(ptr);
int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void LycansQoL.RPC.StartVoteRPC::Rpc_RequestStartVote(Fusion.NetworkRunner,System.Int32)")), data);
*(int*)(data + num2) = playerIndex;
num2 += 4;
((SimulationMessage)ptr).Offset = num2 * 8;
((SimulationMessage)ptr).SetStatic();
runner.SendRpc(ptr);
}
}
PlayerRef val;
if (!_startGameVoters.Contains(playerIndex))
{
_startGameVoters.Add(playerIndex);
val = runner.LocalPlayer;
if (playerIndex == ((PlayerRef)(ref val)).PlayerId)
{
PlayerController.Local.MovementAction = 1;
}
}
int count = PlayerRegistry.Count;
if (count <= 0)
{
return;
}
int num3 = count / 2 + 1;
HashSet<int> startGameVoters = _startGameVoters;
val = PlayerController.Local.Ref;
bool localPlayerVoted = startGameVoters.Contains(((PlayerRef)(ref val)).PlayerId);
UIReadyPlayerCountPatch.UpdateReadyCountUI(_startGameVoters.Count, num3, localPlayerVoted);
if (runner.IsServer && (int)GameManager.LocalGameState == 1 && !((Object)(object)GameManager.Instance == (Object)null) && !NetworkBool.op_Implicit(GameManager.Instance.IsStarted) && GameManager.Instance.IsHost)
{
GameUI gameUI = GameManager.Instance.gameUI;
if (_startGameVoters.Count >= num3 && !gameUI.IsSettingMenuOpen && !gameUI.IsGameSettingMenuOpen)
{
GameManager.Instance.StartGame();
}
}
}
catch (Exception ex)
{
string text = "Rpc_StartVote error: ";
Log.Info(text + ex);
}
}
[NetworkRpcStaticWeavedInvoker("System.Void LycansQoL.RPC.StartVoteRPC::Rpc_RequestStartVote(Fusion.NetworkRunner,System.Int32)")]
[Preserve]
protected unsafe static void Rpc_RequestStartVote_0040Invoker(NetworkRunner runner, SimulationMessage* message)
{
byte* data = SimulationMessage.GetData(message);
int num = (RpcHeader.ReadSize(data) + 3) & -4;
int playerIndex = *(int*)(data + num);
num += 4;
NetworkBehaviourUtils.InvokeRpc = true;
Rpc_RequestStartVote(runner, playerIndex);
}
[Rpc]
public unsafe static void Rpc_ResetStartVoteCounter(NetworkRunner runner)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Invalid comparison between Unknown and I4
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
try
{
if (NetworkBehaviourUtils.InvokeRpc)
{
NetworkBehaviourUtils.InvokeRpc = false;
}
else
{
if ((Object)(object)runner == (Object)null)
{
throw new ArgumentNullException("runner");
}
if ((int)runner.Stage == 4)
{
return;
}
if (runner.HasAnyActiveConnections())
{
int num = 8;
SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num);
byte* data = SimulationMessage.GetData(ptr);
int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void LycansQoL.RPC.StartVoteRPC::Rpc_ResetStartVoteCounter(Fusion.NetworkRunner)")), data);
((SimulationMessage)ptr).Offset = num2 * 8;
((SimulationMessage)ptr).SetStatic();
runner.SendRpc(ptr);
}
}
}
catch (Exception ex)
{
Log.Info("Rpc_ResetStartVoteCounter error: " + ex);
}
_startGameVoters.Clear();
int count = PlayerRegistry.Count;
int neededForMajority = count / 2 + 1;
bool localPlayerVoted = false;
UIReadyPlayerCountPatch.UpdateReadyCountUI(0, neededForMajority, localPlayerVoted);
}
[NetworkRpcStaticWeavedInvoker("System.Void LycansQoL.RPC.StartVoteRPC::Rpc_ResetStartVoteCounter(Fusion.NetworkRunner)")]
[Preserve]
protected unsafe static void Rpc_ResetStartVoteCounter_0040Invoker(NetworkRunner runner, SimulationMessage* message)
{
NetworkBehaviourUtils.InvokeRpc = true;
Rpc_ResetStartVoteCounter(runner);
}
}
}
namespace LycansQoL.Patch
{
[HarmonyPatch(typeof(GameUI), "Update")]
internal class GameUI_Update_CopyGameCodeHotkey
{
[CompilerGenerated]
private sealed class <Toast>d__5 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameUI ui;
public string message;
private Transform <anchor>5__1;
private Canvas <canvas>5__2;
private GameObject <root>5__3;
private RectTransform <rt>5__4;
private GameObject <bg>5__5;
private RectTransform <bgRt>5__6;
private Image <img>5__7;
private GameObject <labelGo>5__8;
private RectTransform <labelRt>5__9;
private TextMeshProUGUI <text>5__10;
private float <t>5__11;
private float <f>5__12;
private float <a>5__13;
private Color <c>5__14;
private Color <ic>5__15;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Toast>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<anchor>5__1 = null;
<canvas>5__2 = null;
<root>5__3 = null;
<rt>5__4 = null;
<bg>5__5 = null;
<bgRt>5__6 = null;
<img>5__7 = null;
<labelGo>5__8 = null;
<labelRt>5__9 = null;
<text>5__10 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0406: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_0440: 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_00bc: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: 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: Expected O, but got Unknown
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Expected O, but got Unknown
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
_toastBusy = true;
<anchor>5__1 = (((Object)(object)ui != (Object)null && (Object)(object)ui.gameCodeText != (Object)null) ? ((TMP_Text)ui.gameCodeText).transform : null);
<canvas>5__2 = (((Object)(object)<anchor>5__1 != (Object)null) ? ((Component)<anchor>5__1).GetComponentInParent<Canvas>() : null);
if ((Object)(object)<canvas>5__2 == (Object)null)
{
_toastBusy = false;
return false;
}
<root>5__3 = new GameObject("LycansQoL_CopyCodeToast");
<root>5__3.transform.SetParent(((Component)<canvas>5__2).transform, false);
Object.Destroy((Object)(object)<root>5__3, 3f);
<rt>5__4 = <root>5__3.AddComponent<RectTransform>();
<rt>5__4.anchorMin = new Vector2(0.5f, 0.5f);
<rt>5__4.anchorMax = new Vector2(0.5f, 0.5f);
<rt>5__4.pivot = new Vector2(0.5f, 0.5f);
<rt>5__4.anchoredPosition = new Vector2(0f, 0f);
<rt>5__4.sizeDelta = new Vector2(820f, 140f);
<bg>5__5 = new GameObject("Bg");
<bg>5__5.transform.SetParent(<root>5__3.transform, false);
<bgRt>5__6 = <bg>5__5.AddComponent<RectTransform>();
<bgRt>5__6.anchorMin = Vector2.zero;
<bgRt>5__6.anchorMax = Vector2.one;
<bgRt>5__6.offsetMin = Vector2.zero;
<bgRt>5__6.offsetMax = Vector2.zero;
<img>5__7 = <bg>5__5.AddComponent<Image>();
((Graphic)<img>5__7).color = new Color(0f, 0f, 0f, 0.6f);
((Graphic)<img>5__7).raycastTarget = false;
<labelGo>5__8 = new GameObject("Label");
<labelGo>5__8.transform.SetParent(<root>5__3.transform, false);
<labelRt>5__9 = <labelGo>5__8.AddComponent<RectTransform>();
<labelRt>5__9.anchorMin = Vector2.zero;
<labelRt>5__9.anchorMax = Vector2.one;
<labelRt>5__9.offsetMin = new Vector2(20f, 20f);
<labelRt>5__9.offsetMax = new Vector2(-20f, -20f);
<text>5__10 = <labelGo>5__8.AddComponent<TextMeshProUGUI>();
((TMP_Text)<text>5__10).text = message;
((TMP_Text)<text>5__10).alignment = (TextAlignmentOptions)514;
((TMP_Text)<text>5__10).fontSize = 64f;
((Graphic)<text>5__10).color = new Color(1f, 1f, 1f, 1f);
((Graphic)<text>5__10).raycastTarget = false;
<t>5__11 = 0f;
goto IL_038c;
case 1:
<>1__state = -1;
goto IL_038c;
case 2:
{
<>1__state = -1;
break;
}
IL_038c:
if (<t>5__11 < 1.2f)
{
<t>5__11 += Time.unscaledDeltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<f>5__12 = 0f;
break;
}
if (<f>5__12 < 0.25f)
{
<f>5__12 += Time.unscaledDeltaTime;
<a>5__13 = Mathf.Clamp01(1f - <f>5__12 / 0.25f);
<c>5__14 = ((Graphic)<text>5__10).color;
<c>5__14.a = <a>5__13;
((Graphic)<text>5__10).color = <c>5__14;
<ic>5__15 = ((Graphic)<img>5__7).color;
<ic>5__15.a = 0.55f * <a>5__13;
((Graphic)<img>5__7).color = <ic>5__15;
<>2__current = null;
<>1__state = 2;
return true;
}
Object.Destroy((Object)(object)<root>5__3);
_toastBusy = false;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static bool _toastBusy;
private static bool _hintCreated;
private static TextMeshProUGUI _hintLabel;
private static void Postfix(GameUI __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
if ((Object)(object)__instance == (Object)null)
{
return;
}
bool show = (int)GameManager.LocalGameState == 1;
EnsureHint(__instance, show);
if ((int)GameManager.LocalGameState != 1)
{
}
if ((!Input.GetKey((KeyCode)306) && !Input.GetKey((KeyCode)305)) || !Input.GetKeyDown((KeyCode)99))
{
return;
}
TextMeshProUGUI gameCodeText = __instance.gameCodeText;
if (!((Object)(object)gameCodeText == (Object)null) && !string.IsNullOrWhiteSpace(((TMP_Text)gameCodeText).text))
{
GUIUtility.systemCopyBuffer = ((TMP_Text)gameCodeText).text.Trim();
if (!_toastBusy)
{
((MonoBehaviour)__instance).StartCoroutine(Toast(__instance, "Code copié"));
}
}
}
private static void EnsureHint(GameUI ui, bool show)
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
if (!show)
{
if ((Object)(object)_hintLabel != (Object)null)
{
Object.Destroy((Object)(object)((Component)_hintLabel).gameObject);
}
_hintLabel = null;
_hintCreated = false;
return;
}
if (_hintCreated)
{
if (!((Object)(object)_hintLabel == (Object)null))
{
return;
}
_hintCreated = false;
}
if ((Object)(object)ui == (Object)null || (Object)(object)ui.gameCodeText == (Object)null)
{
return;
}
Canvas componentInParent = ((Component)ui.gameCodeText).GetComponentInParent<Canvas>();
if (!((Object)(object)componentInParent == (Object)null))
{
GameObject val = new GameObject("LycansQoL_CopyCodeHint");
val.transform.SetParent(((Component)componentInParent).transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
RectTransform component = ((Component)ui.gameCodeText).GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null)
{
val2.anchorMin = component.anchorMin;
val2.anchorMax = component.anchorMax;
val2.pivot = component.pivot;
val2.anchoredPosition = component.anchoredPosition + new Vector2(0f, -40f);
}
else
{
val2.anchorMin = new Vector2(0.5f, 1f);
val2.anchorMax = new Vector2(0.5f, 1f);
val2.pivot = new Vector2(0.5f, 1f);
val2.anchoredPosition = new Vector2(0f, -120f);
}
val2.sizeDelta = new Vector2(800f, 40f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = "Ctrl + C pour copier le code";
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
((TMP_Text)val3).fontSize = 22f;
((Graphic)val3).color = new Color(1f, 1f, 1f, 0.85f);
((Graphic)val3).raycastTarget = false;
_hintLabel = val3;
_hintCreated = true;
}
}
[IteratorStateMachine(typeof(<Toast>d__5))]
private static IEnumerator Toast(GameUI ui, string message)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Toast>d__5(0)
{
ui = ui,
message = message
};
}
}
[HarmonyPatch(typeof(GameUI), "Awake")]
internal class GameVersionPatch
{
private static void Postfix(GameUI __instance)
{
TextMeshProUGUI value = Traverse.Create((object)__instance).Field<TextMeshProUGUI>("mmVersionText").Value;
((TMP_Text)value).text = ((TMP_Text)value).text + "\nLycansQoL 1.2.1";
}
}
[HarmonyPatch(typeof(PlayerController), "Interact")]
internal class InteractPatch
{
private static bool Prefix(PlayerController __instance, bool isPrimary)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Invalid comparison between Unknown and I4
//IL_001a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
PlayerRef @ref;
if ((int)GameManager.State.Current == 4 && isPrimary)
{
TickTimer voteTimer = GameManager.Instance.VoteTimer;
float valueOrDefault = ((TickTimer)(ref voteTimer)).RemainingTime(((SimulationBehaviour)GameManager.Instance).Runner).GetValueOrDefault();
if (valueOrDefault > 10f && __instance.IdVoted != -1)
{
NetworkRunner runner = ((SimulationBehaviour)GameManager.Instance).Runner;
@ref = __instance.Ref;
CancelVoteRPC.Rpc_RequestCancelVote(runner, ((PlayerRef)(ref @ref)).PlayerId);
return false;
}
}
if ((int)GameManager.State.Current == 1 && isPrimary && !GameManager.Instance.gameUI.IsGameSettingMenuOpen && !GameManager.Instance.gameUI.IsSettingMenuOpen && !GameManager.Instance.previewCamera.IsPreviewCameraActive)
{
NetworkRunner runner2 = ((SimulationBehaviour)GameManager.Instance).Runner;
@ref = __instance.Ref;
StartVoteRPC.Rpc_RequestStartVote(runner2, ((PlayerRef)(ref @ref)).PlayerId);
}
return true;
}
}
[HarmonyPatch(typeof(PlayerController), "OnVoteChanged")]
internal class OnVoteChangedPatch
{
private static void Postfix(Changed<PlayerController> changed)
{
PlayerRegistry.Where((Predicate<PlayerController>)((PlayerController p) => !NetworkBool.op_Implicit(p.IsDead))).ToList().ForEach(delegate(PlayerController p)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
int count2 = PlayerRegistry.Where((Predicate<PlayerController>)delegate(PlayerController v)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
int idVoted = v.IdVoted;
PlayerRef @ref = p.Ref;
return idVoted == ((PlayerRef)(ref @ref)).PlayerId;
}).ToList().Count;
GameManager.Instance.gameUI.UpdatePlayerVotesCount(p.Ref, count2);
});
int count = PlayerRegistry.Where((Predicate<PlayerController>)((PlayerController p) => !NetworkBool.op_Implicit(p.IsDead) && p.IdVoted == -2)).ToList().Count;
GameManager.Instance.gameUI.UpdateSkippedVotesCount(count);
}
}
[HarmonyPatch(typeof(GameManager), "StartGame")]
internal static class StartGamePatch
{
private static void Postfix(GameManager __instance)
{
StartVoteRPC.Rpc_ResetStartVoteCounter(((SimulationBehaviour)__instance).Runner);
}
}
[HarmonyPatch(typeof(GameUI), "Awake")]
public class GameUI_Awake_AddJoinFromClipboardButton
{
[CompilerGenerated]
private sealed class <ForceButtonLabelOverFrames>d__2 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameObject buttonObj;
public string label;
private MonoBehaviour[] <>s__1;
private int <>s__2;
private MonoBehaviour <mb>5__3;
private string <n>5__4;
private int <i>5__5;
private TextMeshProUGUI[] <>s__6;
private int <>s__7;
private TextMeshProUGUI <tmp>5__8;
private Text[] <>s__9;
private int <>s__10;
private Text <txt>5__11;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ForceButtonLabelOverFrames>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = null;
<mb>5__3 = null;
<n>5__4 = null;
<>s__6 = null;
<tmp>5__8 = null;
<>s__9 = null;
<txt>5__11 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if ((Object)(object)buttonObj == (Object)null)
{
return false;
}
<>s__1 = buttonObj.GetComponentsInChildren<MonoBehaviour>(true);
for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
{
<mb>5__3 = <>s__1[<>s__2];
if (!((Object)(object)<mb>5__3 == (Object)null))
{
<n>5__4 = ((object)<mb>5__3).GetType().Name;
if (<n>5__4.IndexOf("Localize", StringComparison.OrdinalIgnoreCase) >= 0 || <n>5__4.IndexOf("Localization", StringComparison.OrdinalIgnoreCase) >= 0)
{
((Behaviour)<mb>5__3).enabled = false;
}
<n>5__4 = null;
<mb>5__3 = null;
}
}
<>s__1 = null;
<i>5__5 = 0;
break;
case 1:
<>1__state = -1;
if ((Object)(object)buttonObj == (Object)null)
{
return false;
}
<>s__6 = buttonObj.GetComponentsInChildren<TextMeshProUGUI>(true);
for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++)
{
<tmp>5__8 = <>s__6[<>s__7];
((TMP_Text)<tmp>5__8).text = label;
<tmp>5__8 = null;
}
<>s__6 = null;
<>s__9 = buttonObj.GetComponentsInChildren<Text>(true);
for (<>s__10 = 0; <>s__10 < <>s__9.Length; <>s__10++)
{
<txt>5__11 = <>s__9[<>s__10];
<txt>5__11.text = label;
<txt>5__11 = null;
}
<>s__9 = null;
<i>5__5++;
break;
}
if (<i>5__5 < 15)
{
<>2__current = null;
<>1__state = 1;
return true;
}
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 <JoinFromClipboard>d__1 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameUI ui;
public Button mmJoinButton;
private string <code>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <JoinFromClipboard>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<code>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if ((Object)(object)ui == (Object)null)
{
return false;
}
<code>5__1 = GUIUtility.systemCopyBuffer;
if (string.IsNullOrWhiteSpace(<code>5__1))
{
return false;
}
if ((Object)(object)ui.pmCodeText != (Object)null && (Object)(object)ui.pmJoinButton != (Object)null)
{
ui.pmCodeText.text = <code>5__1.Trim();
((UnityEvent)ui.pmJoinButton.onClick).Invoke();
return false;
}
if ((Object)(object)mmJoinButton != (Object)null)
{
((UnityEvent)mmJoinButton.onClick).Invoke();
}
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)ui.pmCodeText != (Object)null)
{
ui.pmCodeText.text = <code>5__1.Trim();
}
if ((Object)(object)ui.pmJoinButton != (Object)null)
{
((UnityEvent)ui.pmJoinButton.onClick).Invoke();
}
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 void Postfix(GameUI __instance)
{
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Expected O, but got Unknown
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
try
{
Button mmJoinButton = default(Button);
ref Button reference = ref mmJoinButton;
object? obj = AccessTools.Field(typeof(GameUI), "mmJoinButton")?.GetValue(__instance);
reference = (Button)((obj is Button) ? obj : null);
if ((Object)(object)mmJoinButton == (Object)null)
{
return;
}
Transform parent = ((Component)mmJoinButton).transform.parent;
GameObject val = Object.Instantiate<GameObject>(((Component)mmJoinButton).gameObject, parent);
((Object)val).name = "MmJoinFromClipboardButton";
val.transform.SetAsLastSibling();
RectTransform component = ((Component)mmJoinButton).GetComponent<RectTransform>();
RectTransform component2 = val.GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
{
component2.anchorMin = component.anchorMin;
component2.anchorMax = component.anchorMax;
component2.pivot = component.pivot;
Rect rect = component.rect;
float num;
if (!(((Rect)(ref rect)).width > 0f))
{
num = component.sizeDelta.x;
}
else
{
rect = component.rect;
num = ((Rect)(ref rect)).width;
}
float num2 = num;
Vector2 anchoredPosition = component.anchoredPosition;
anchoredPosition.x += ((num2 > 0f) ? num2 : 120f) + 12f;
component2.anchoredPosition = anchoredPosition;
}
((MonoBehaviour)__instance).StartCoroutine(ForceButtonLabelOverFrames(val, "Rejoindre (coller)"));
Button component3 = val.GetComponent<Button>();
if (!((Object)(object)component3 == (Object)null))
{
((UnityEventBase)component3.onClick).RemoveAllListeners();
((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
{
((MonoBehaviour)__instance).StartCoroutine(JoinFromClipboard(__instance, mmJoinButton));
});
}
}
catch
{
}
}
[IteratorStateMachine(typeof(<JoinFromClipboard>d__1))]
private static IEnumerator JoinFromClipboard(GameUI ui, Button mmJoinButton)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <JoinFromClipboard>d__1(0)
{
ui = ui,
mmJoinButton = mmJoinButton
};
}
[IteratorStateMachine(typeof(<ForceButtonLabelOverFrames>d__2))]
private static IEnumerator ForceButtonLabelOverFrames(GameObject buttonObj, string label)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ForceButtonLabelOverFrames>d__2(0)
{
buttonObj = buttonObj,
label = label
};
}
}
[HarmonyPatch(typeof(GameUI), "Awake")]
internal static class UIReadyPlayerCountPatch
{
private static TextMeshProUGUI _readyPlayerCount;
private static TextMeshProUGUI _readyPlayerKey;
private static void Postfix(GameUI __instance, TextMeshProUGUI ___playerCount)
{
//IL_0066: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)___playerCount == (Object)null)
{
return;
}
GameObject gameObject = ((Component)___playerCount).gameObject;
GameObject val = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
((Object)val).name = "ReadyPlayerCount";
_readyPlayerCount = val.GetComponent<TextMeshProUGUI>();
if (!((Object)(object)_readyPlayerCount == (Object)null))
{
RectTransform rectTransform = ((TMP_Text)_readyPlayerCount).rectTransform;
rectTransform.anchoredPosition += new Vector2(0f, 900f);
((Graphic)_readyPlayerCount).color = Color.red;
((TMP_Text)_readyPlayerCount).text = "Joueur prêt : 0/0";
GameObject val2 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
((Object)val2).name = "ReadyPlayerKey";
_readyPlayerKey = val2.GetComponent<TextMeshProUGUI>();
if (!((Object)(object)_readyPlayerKey == (Object)null))
{
RectTransform rectTransform2 = ((TMP_Text)_readyPlayerKey).rectTransform;
rectTransform2.anchoredPosition += new Vector2(0f, 200f);
rectTransform2.sizeDelta = new Vector2(rectTransform2.sizeDelta.x + 300f, rectTransform2.sizeDelta.y);
((TMP_Text)_readyPlayerKey).text = "<sprite name=\"leftButton\"> - Voter pour démarrer";
}
}
}
internal static void UpdateReadyCountUI(int readyVotes, int neededForMajority, bool localPlayerVoted)
{
//IL_0052: 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)
if (!((Object)(object)_readyPlayerCount == (Object)null))
{
((TMP_Text)_readyPlayerCount).text = $"Joueur prêt : {readyVotes}/{neededForMajority}";
if (localPlayerVoted)
{
((Graphic)_readyPlayerCount).color = Color.green;
}
else
{
((Graphic)_readyPlayerCount).color = Color.red;
}
}
}
}
[HarmonyPatch(typeof(GameUI), "UpdatePlayerCount")]
internal static class ReadyPlayerCount_OnPlayerCountChanged
{
private static void Postfix(int count)
{
int neededForMajority = ((count > 0) ? (count / 2 + 1) : 0);
int readyVotesCount = StartVoteRPC.GetReadyVotesCount();
UIReadyPlayerCountPatch.UpdateReadyCountUI(readyVotesCount, neededForMajority, localPlayerVoted: false);
}
}
}