using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Impeakster_Among_Us.Patches;
using Impeakster_Among_Us.Properties;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Photon.Pun;
using TMPro;
using UnityEngine;
[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.keveloper-yt.ImpeaksterAmongUs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.5.0")]
[assembly: AssemblyInformationalVersion("0.1.5+9c73488b3604d6970201f4879e146fa95249af08")]
[assembly: AssemblyProduct("com.github.keveloper-yt.ImpeaksterAmongUs")]
[assembly: AssemblyTitle("Impeakster_Among_Us")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.5.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 Impeakster_Among_Us
{
[BepInPlugin("com.github.keveloper-yt.ImpeaksterAmongUs", "Impeakster_Among_Us", "0.1.5")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("com.github.keveloper-yt.ImpeaksterAmongUs");
public const string Id = "com.github.keveloper-yt.ImpeaksterAmongUs";
internal static ManualLogSource Log { get; private set; }
public static string Name => "Impeakster_Among_Us";
public static string Version => "0.1.5";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
_harmony.PatchAll(Assembly.GetExecutingAssembly());
Harmony.CreateAndPatchAll(typeof(LocalizedTextPatch), (string)null);
}
}
}
namespace Impeakster_Among_Us.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("Impeakster_Among_Us.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static string Localized_Text => ResourceManager.GetString("Localized_Text", resourceCulture);
internal Resources()
{
}
}
}
namespace Impeakster_Among_Us.Patches
{
[HarmonyPatch(typeof(Ascents))]
public class AscentsPatch
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
private static void CantRevive(ref bool __result)
{
}
}
[HarmonyPatch(typeof(AscentUI))]
public class AscentUIPatch
{
public static AscentUI UIRef;
[HarmonyPatch(typeof(AscentUI), "Update")]
[HarmonyPrefix]
private static bool GetUIInstance(AscentUI __instance)
{
UIRef = __instance;
return false;
}
}
public class ImpostorData
{
public static bool isImpostor = false;
public static List<string> impostorList = new List<string>();
public static bool isSet = false;
public static bool isRead = false;
}
public class ImpostorManager : MonoBehaviour
{
[PunRPC]
public static void SetImpostorRPC(List<string> chosenImpostors)
{
ImpostorData.impostorList = chosenImpostors;
ImpostorData.isSet = true;
if (chosenImpostors.Contains(Player.localPlayer.character.characterName))
{
ImpostorData.isImpostor = true;
}
else
{
ImpostorData.isImpostor = false;
}
}
}
[HarmonyPatch(typeof(Item))]
public class ItemPatch
{
[HarmonyPatch("Consume")]
[HarmonyPostfix]
private static void ImposterFood(Item __instance)
{
if (ImpostorData.isImpostor)
{
__instance.holderCharacter.AddExtraStamina(0.15f);
}
}
}
[HarmonyPatch(typeof(LocalizedText))]
[HarmonyWrapSafe]
public static class LocalizedTextPatch
{
[HarmonyPostfix]
[HarmonyPatch("LoadMainTable")]
public static void LoadMainTable()
{
LoadLocalizedText();
}
public static void LoadLocalizedText()
{
Dictionary<string, List<string>> dictionary = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(Resources.Localized_Text);
if (dictionary == null)
{
return;
}
Debug.Log((object)$"Loaded {dictionary.Count} localized text entries from embedded resource.");
foreach (KeyValuePair<string, List<string>> item in dictionary)
{
List<string> value = item.Value;
string firstValue = value[0];
value = value.Select((string x) => (!string.IsNullOrEmpty(x)) ? x : firstValue).ToList();
string key = ("Mod_Impeakster_" + item.Key).ToUpper();
if (LocalizedText.MAIN_TABLE.ContainsKey(key))
{
LocalizedText.MAIN_TABLE[key] = value;
}
else
{
LocalizedText.MAIN_TABLE.Add(key, value);
}
}
}
}
[HarmonyPatch(typeof(MountainProgressHandler))]
internal class MountainProgressPatch
{
[HarmonyPatch("TriggerReached")]
[HarmonyPrefix]
private static void PatchTitleText(MountainProgressHandler __instance)
{
if (!ImpostorData.isSet)
{
ImpostorData.isRead = false;
Random seededRandom = new Random(DateTime.UtcNow.Year + DateTime.UtcNow.Day + DateTime.UtcNow.Hour + DateTime.UtcNow.Minute / 10);
List<string> list = new List<string>();
foreach (Character allCharacter in Character.AllCharacters)
{
if (!allCharacter.data.dead)
{
list.Add(allCharacter.characterName);
}
}
list.Sort();
int count = Math.Max(1, list.Count / 4);
List<string> impostorRPC = list.OrderBy((string x) => seededRandom.Next()).Take(count).ToList();
ImpostorManager.SetImpostorRPC(impostorRPC);
}
if (ImpostorData.isRead)
{
return;
}
ImpostorData.isSet = false;
if (ImpostorData.isImpostor)
{
if (ImpostorData.impostorList.Count > 1)
{
((TMP_Text)AscentUIPatch.UIRef.text).text = "Impostors: " + string.Join(", ", ImpostorData.impostorList.ToArray());
}
else
{
((TMP_Text)AscentUIPatch.UIRef.text).text = "Role: IMPOSTOR";
}
for (int i = 0; i < 6; i++)
{
__instance.progressPoints[i].title = "Mod_Impeakster_Impostor";
}
}
else
{
((TMP_Text)AscentUIPatch.UIRef.text).text = "Role: SCOUT";
for (int j = 0; j < 6; j++)
{
__instance.progressPoints[j].title = "Scout";
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}