using System;
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 ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
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.chouja.DrinkWithBingBong")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.chouja.DrinkWithBingBong")]
[assembly: AssemblyTitle("DrinkWithBingBong")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 TextChatMod
{
[BepInPlugin("com.chouja.DrinkWithBingBong", "DrinkWithBingBong", "1.0.0")]
public class DrinkWithBingBongPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(Action_AskBingBong), "Ask")]
public static class AskBingBongPatch
{
private static readonly string[] PositiveResponses = new string[9] { "BB_Yes", "BB_Yeah", "BB_IGuessSo", "BB_Sure", "BB_IfYouWanna", "BB_Okay", "BB_IfISayYes", "BB_Definitely", "BB_Fine" };
private static readonly string[] NegativeResponses = new string[9] { "BB_PleaseDont", "BB_Nah", "BB_IntenseNo", "BB_DontDoIt", "BB_BadIdea", "BB_No", "BB_NuhUh", "BB_DefinitelyNot", "BB_NoNoNo" };
private static readonly string[] UncertainResponses = new string[5] { "BB_ImNotSure", "BB_IDunno", "BB_NotComfortable", "BB_Uh", "BB_Maybe" };
private static readonly string AskFriendsResponse = "BB_AskYourFriends";
private static readonly string MissWifeResponse = "BB_IMissMyWife";
private static readonly string ImBingBongResponse = "BB_ImBingBong";
private static void Postfix(Action_AskBingBong __instance, int index)
{
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: 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_0254: Expected O, but got Unknown
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: 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)
if (!PhotonNetwork.IsMasterClient)
{
return;
}
int dayCount = DayNightManager.instance.dayCount;
timesAskedToday++;
if (!Character.localCharacter.inAirport && dayCount == lastDayAsked)
{
if (timesAskedToday <= 5)
{
string nickName = ((MonoBehaviourPun)((ItemActionBase)__instance).item.holderCharacter).photonView.Owner.NickName;
string text = "Pace yourself, " + nickName + "! Ask me again tomorrow.";
if (timesAskedToday > 4)
{
text = "Are you an alcoholic, " + nickName + "? Ask me again tomorrow!";
}
object[] array = new object[4] { "Bing Bong", text, "0", "0" };
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)81, (object)array, val, SendOptions.SendReliable);
}
return;
}
string subtitleID = __instance.responses[index].subtitleID;
string text2 = LocalizedText.GetText(subtitleID, true);
if (PositiveResponses.Contains(subtitleID))
{
text2 = "Drink!";
}
else if (NegativeResponses.Contains(subtitleID))
{
text2 = "No drinking!";
}
else if (UncertainResponses.Contains(subtitleID))
{
Character random = ListExtensions.GetRandom<Character>(Character.AllCharacters);
text2 = ((MonoBehaviourPun)random).photonView.Owner.NickName + " can decide if we're drinking!";
}
else if (subtitleID == AskFriendsResponse)
{
Character val2 = Character.localCharacter;
float num = float.MaxValue;
foreach (Character allCharacter in Character.AllCharacters)
{
float num2 = Vector3.Distance(Character.localCharacter.Head, allCharacter.Head);
if (num2 < num)
{
num = num2;
val2 = allCharacter;
}
}
text2 = ((!val2.IsLocal) ? ("You should ask your friend " + ((MonoBehaviourPun)val2).photonView.Owner.NickName + " if we're drinking!") : "If you had friends here, you could ask them if we're drinking!");
}
else if (subtitleID == MissWifeResponse)
{
text2 = "I miss my wife... maybe a drink will help.";
}
else if (subtitleID == ImBingBongResponse)
{
text2 = "Try again!";
}
object[] array2 = new object[4] { "Bing Bong", text2, "0", "0" };
RaiseEventOptions val3 = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)81, (object)array2, val3, SendOptions.SendReliable);
}
}
[HarmonyPatch(typeof(Spawner), "GetObjectsToSpawn")]
public static class LuggagePatch
{
public static void Postfix(List<GameObject> __result)
{
//IL_0056: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient && __result.Any((GameObject obj) => ((Object)obj).name == "Antidote"))
{
object[] array = new object[4] { "Bing Bong", "Antidote found, drink!", "0", "0" };
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)81, (object)array, val, SendOptions.SendReliable);
}
}
}
[HarmonyPatch(typeof(Campfire), "Light_Rpc")]
public static class CampfirePatch
{
public static void Postfix()
{
//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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient)
{
object[] array = new object[4] { "Bing Bong", "Campfire lit, drink!", "0", "0" };
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)81, (object)array, val, SendOptions.SendReliable);
}
}
}
[HarmonyPatch(typeof(Character), "StartPassedOutOnTheBeach")]
public static class StartPassedOutOnTheBeachPatch
{
public static void Postfix()
{
//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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient)
{
object[] array = new object[4] { "Bing Bong", "Game started, drink!", "0", "0" };
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)81, (object)array, val, SendOptions.SendReliable);
lastDayAsked = DayNightManager.instance.dayCount;
timesAskedToday = 1;
}
}
}
private const int PEAK_TEXTCHAT_EVENT_CODE = 81;
public static DrinkWithBingBongPlugin Instance;
private static bool eventHandlerRegistered;
private static int lastDayAsked;
private static int timesAskedToday;
private void Awake()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
Instance = this;
Harmony val = new Harmony("com.chouja.DrinkWithBingBong");
val.PatchAll();
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
private void Start()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"DrinkWithBingBong Start() called");
if (!eventHandlerRegistered && PhotonNetwork.NetworkingClient != null)
{
PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
eventHandlerRegistered = true;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Registered Photon event handler");
}
}
private static void OnEvent(EventData ev)
{
if (ev.Code == 81)
{
object[] array = (object[])ev.CustomData;
string text = array[0]?.ToString() ?? "???";
string text2 = array[2]?.ToString() ?? "";
if (text2 == "0" && text == "Bing Bong")
{
lastDayAsked = DayNightManager.instance.dayCount;
}
}
}
private void OnDestroy()
{
if (eventHandlerRegistered && PhotonNetwork.NetworkingClient != null)
{
PhotonNetwork.NetworkingClient.EventReceived -= OnEvent;
eventHandlerRegistered = false;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}