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 BepInEx.Configuration;
using BepInEx.Logging;
using MathiolContentWarningModTest.Localization;
using MathiolContentWarningModTest.Patches;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour.HookGen;
using MyceliumNetworking;
using On;
using Steamworks;
using UnityEngine;
using VoiceRecognitionAPI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("me.mathiol.dumbmod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyInformationalVersion("0.0.2")]
[assembly: AssemblyProduct("MathiolContentWarningModTest")]
[assembly: AssemblyTitle("me.mathiol.dumbmod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.2.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 MathiolContentWarningDumbMod
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "me.mathiol.dumbmod";
public const string PLUGIN_NAME = "MathiolContentWarningModTest";
public const string PLUGIN_VERSION = "0.0.2";
}
}
namespace MathiolContentWarningModTest
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[ContentWarningPlugin("RugbugRedfern.MyceliumNetworking", "1.0.14", true)]
[BepInPlugin("RugbugRedfern.MyceliumNetworking", "Mycelium Networking", "1.0.14")]
public class MathiolContentWarningDumbMod : BaseUnityPlugin
{
public const uint modId = 748511571u;
private ConfigEntry<string> configLocalizationLanguage = null;
private string[]? swearWords;
private string[]? youtuberPhrases;
private string[]? sponsorPhrases;
public static MathiolContentWarningDumbMod Instance { get; private set; }
internal static ManualLogSource Debug { get; private set; }
internal static ConfigEntry<float> sprintMultipliyer { get; private set; }
internal static ConfigEntry<float> sprintRechargeMultiplayer { get; private set; }
internal static ConfigEntry<bool> infinitBattery { get; private set; }
internal static ConfigEntry<bool> freeShop { get; private set; }
private void Awake()
{
Debug = ((BaseUnityPlugin)this).Logger;
Instance = this;
sprintMultipliyer = ((BaseUnityPlugin)this).Config.Bind<float>("Sprint", "sprintMultiplier", 3f, "Max stamina default (10) multiplied by sprint multiplier");
sprintRechargeMultiplayer = ((BaseUnityPlugin)this).Config.Bind<float>("Sprint", "sprintRechargeMultiplayer", 2f, "How quickly the stamina regen");
infinitBattery = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "infinitBattery", true, "Is Battery infinit?");
freeShop = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "freeShop", true, "Is shop free?");
configLocalizationLanguage = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Language", "fr", "Which language should the VoiceContent mod uses for its localization. \n (Available for Windows API: fr)");
swearWords = LocalizationData.GetLocalizedList(configLocalizationLanguage.Value, "swearWords").ToArray();
youtuberPhrases = LocalizationData.GetLocalizedList(configLocalizationLanguage.Value, "youtuberPhrases").ToArray();
sponsorPhrases = LocalizationData.GetLocalizedList(configLocalizationLanguage.Value, "sponsorPhrases").ToArray();
MyceliumNetwork.RegisterNetworkObject((object)this, 748511571u, 0);
HookAll();
string text = "RugbugRedfern.MyceliumNetworking v1.0.14 has loaded!";
Debug.LogInfo((object)string.Concat(string.Concat(Enumerable.Repeat("=", text.Length / 2)), " Mathiol ", string.Concat(Enumerable.Repeat("=", text.Length / 2))));
Debug.LogInfo((object)text);
Debug.LogInfo((object)string.Concat(Enumerable.Repeat("=", text.Length + 9)));
Voice.ListenForPhrase("J'aime le Fromage", 0.2f, (Action<string>)delegate
{
Debug.LogDebug((object)"Oui, baguette, baguette !");
});
Voice.ListenForPhrases(swearWords, 0.68f, (Action<string>)delegate(string message)
{
Debug.LogDebug((object)"SwearWords phrase was said");
HandlePhrase(message);
});
Voice.ListenForPhrases(youtuberPhrases, 0.68f, (Action<string>)delegate(string message)
{
Debug.LogDebug((object)"Youtuber segment phrase was said");
HandlePhrase(message);
});
}
internal static void HookAll()
{
Debug.LogDebug((object)"Hooking...");
ExampleShoppingCartPatch.Init();
PlayerControllerPatch.Init();
BatteryPatch.Init();
Debug.LogDebug((object)"Finished Hooking!");
}
internal static void UnhookAll()
{
Debug.LogDebug((object)"Unhooking...");
HookEndpointManager.RemoveAllOwnedBy((object)Assembly.GetExecutingAssembly());
Debug.LogDebug((object)"Finished Unhooking!");
}
private void OnDestroy()
{
MyceliumNetwork.DeregisterNetworkObject((object)this, 748511571u, 0);
}
private void HandlePhrase(string phraseType)
{
MyceliumNetwork.RPC(748511571u, "CensurePlayer", (ReliableType)1, new object[1] { phraseType });
Debug.LogInfo((object)("Send message " + phraseType));
}
[CustomRPC]
private void CensurePlayer(string message, RPCInfo info)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
CSteamID senderSteamID = info.SenderSteamID;
string friendPersonaName = SteamFriends.GetFriendPersonaName(senderSteamID);
Debug.LogInfo((object)("Received chat message from " + friendPersonaName + ": " + message));
}
}
}
namespace MathiolContentWarningModTest.Localization
{
public class LocalizationData
{
private static readonly Dictionary<string, Dictionary<string, List<string>>> data = new Dictionary<string, Dictionary<string, List<string>>> { ["fr"] = new Dictionary<string, List<string>>
{
["swearWords"] = new List<string>
{
"fromage", "pute", "salope", "salaud", "salopiaud", "conne", "con", "connard", "connasse", "pétasse",
"fesse", "bite", "zizi", "caca", "merde", "suce bite", "enculée", "fuck", "chatte", "vagin",
"sucide toi", "nigger", "négre", "négrié", "bougnoule", "sale arabe", "Adrien fait moi les fesses", "fils de pute", "chinetoque", "fuck",
"shit", "bitch", "kill yourself"
},
["youtuberPhrases"] = new List<string>
{
"like and subscribe", "don't forget to share", "hit that subscribe button", "like comment and subscribe", "don't forget to subscribe", "let's jump right into it", "give this video a thumbs up", "that like button", "the like button", "that notification bell",
"the notification bell", "that subscribe button", "the subscribe button", "before starting this video", "kakou kakou", "abonnez-vous"
}
} };
public static List<string> GetLocalizedList(string languageCode, string key)
{
if (data.TryGetValue(languageCode, out Dictionary<string, List<string>> value) && value.TryGetValue(key, out var value2))
{
return value2;
}
return new List<string>();
}
}
}
namespace MathiolContentWarningModTest.Patches
{
public class BatteryPatch
{
[CompilerGenerated]
private static class <>O
{
public static hook_Update <0>__ShockStick_Update;
public static hook_Update <1>__RescueHook_Update;
public static hook_Update <2>__Flashlight_Update;
}
internal static void Init()
{
//IL_0011: 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)
//IL_001c: Expected O, but got Unknown
//IL_0032: 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_003d: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
object obj = <>O.<0>__ShockStick_Update;
if (obj == null)
{
hook_Update val = ShockStick_Update;
<>O.<0>__ShockStick_Update = val;
obj = (object)val;
}
ShockStick.Update += (hook_Update)obj;
object obj2 = <>O.<1>__RescueHook_Update;
if (obj2 == null)
{
hook_Update val2 = RescueHook_Update;
<>O.<1>__RescueHook_Update = val2;
obj2 = (object)val2;
}
RescueHook.Update += (hook_Update)obj2;
object obj3 = <>O.<2>__Flashlight_Update;
if (obj3 == null)
{
hook_Update val3 = Flashlight_Update;
<>O.<2>__Flashlight_Update = val3;
obj3 = (object)val3;
}
Flashlight.Update += (hook_Update)obj3;
}
private static void Flashlight_Update(orig_Update orig, Flashlight self)
{
if (MathiolContentWarningDumbMod.infinitBattery.Value)
{
BatteryEntry batteryEntry = self.m_batteryEntry;
batteryEntry.m_charge = batteryEntry.m_maxCharge;
}
orig.Invoke(self);
}
private static void RescueHook_Update(orig_Update orig, RescueHook self)
{
if (MathiolContentWarningDumbMod.infinitBattery.Value)
{
BatteryEntry batteryEntry = self.m_batteryEntry;
batteryEntry.m_charge = batteryEntry.m_maxCharge;
}
orig.Invoke(self);
}
private static void ShockStick_Update(orig_Update orig, ShockStick self)
{
if (MathiolContentWarningDumbMod.infinitBattery.Value)
{
BatteryEntry batteryEntry = self.m_batteryEntry;
batteryEntry.m_charge = batteryEntry.m_maxCharge;
}
orig.Invoke(self);
}
}
public class ExampleShoppingCartPatch
{
[CompilerGenerated]
private static class <>O
{
public static hook_CanAfford <0>__RoomStatsHolder_CanAfford;
public static hook_AddItemToCart <1>__ShoppingCart_AddItemToCart;
}
internal static void Init()
{
//IL_0011: 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)
//IL_001c: Expected O, but got Unknown
//IL_0032: 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_003d: Expected O, but got Unknown
object obj = <>O.<0>__RoomStatsHolder_CanAfford;
if (obj == null)
{
hook_CanAfford val = RoomStatsHolder_CanAfford;
<>O.<0>__RoomStatsHolder_CanAfford = val;
obj = (object)val;
}
RoomStatsHolder.CanAfford += (hook_CanAfford)obj;
object obj2 = <>O.<1>__ShoppingCart_AddItemToCart;
if (obj2 == null)
{
hook_AddItemToCart val2 = ShoppingCart_AddItemToCart;
<>O.<1>__ShoppingCart_AddItemToCart = val2;
obj2 = (object)val2;
}
ShoppingCart.AddItemToCart += (hook_AddItemToCart)obj2;
}
private static bool RoomStatsHolder_CanAfford(orig_CanAfford orig, RoomStatsHolder self, int cost)
{
if (MathiolContentWarningDumbMod.freeShop.Value)
{
MathiolContentWarningDumbMod.Debug.LogDebug((object)$"Item original price: {cost}$");
cost = 0;
MathiolContentWarningDumbMod.Debug.LogDebug((object)$"Item price spoofed ! ({cost}$)");
}
return orig.Invoke(self, cost);
}
private static void ShoppingCart_AddItemToCart(orig_AddItemToCart orig, ShoppingCart self, ShopItem item)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, item);
if (MathiolContentWarningDumbMod.freeShop.Value)
{
MathiolContentWarningDumbMod.Debug.LogDebug((object)("Item (" + ((ShopItem)(ref item)).DisplayName + ") added !"));
self.CartValue = 0;
MathiolContentWarningDumbMod.Debug.LogDebug((object)$"CartValue ({self.CartValue}$) was spoofed ! ");
}
}
}
public class PlayerControllerPatch
{
[CompilerGenerated]
private static class <>O
{
public static hook_Start <0>__PlayerController_Start;
public static hook_Update <1>__PlayerController_Update;
}
internal static void Init()
{
//IL_0011: 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)
//IL_001c: Expected O, but got Unknown
//IL_0032: 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_003d: Expected O, but got Unknown
object obj = <>O.<0>__PlayerController_Start;
if (obj == null)
{
hook_Start val = PlayerController_Start;
<>O.<0>__PlayerController_Start = val;
obj = (object)val;
}
PlayerController.Start += (hook_Start)obj;
object obj2 = <>O.<1>__PlayerController_Update;
if (obj2 == null)
{
hook_Update val2 = PlayerController_Update;
<>O.<1>__PlayerController_Update = val2;
obj2 = (object)val2;
}
PlayerController.Update += (hook_Update)obj2;
}
private static void PlayerController_Update(orig_Update orig, PlayerController self)
{
orig.Invoke(self);
PlayerData data = self.player.data;
if ((double)data.sinceSprint > 1.0 && data.currentStamina < self.maxStamina)
{
data.currentStamina += MathiolContentWarningDumbMod.sprintRechargeMultiplayer.Value * Time.deltaTime;
data.currentStamina = Mathf.Clamp(data.currentStamina, 0f, self.maxStamina);
}
}
private static void PlayerController_Start(orig_Start orig, PlayerController self)
{
self.maxStamina *= MathiolContentWarningDumbMod.sprintMultipliyer.Value;
orig.Invoke(self);
MathiolContentWarningDumbMod.Debug.LogDebug((object)self.maxStamina);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}