using System;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Andy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+b846d044ebf7f4b4cb9edd439298854056f00ebc")]
[assembly: AssemblyProduct("ShadyRepoMod")]
[assembly: AssemblyTitle("ShadyRepoMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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 ShadyMod
{
[HarmonyPatch(typeof(PlayerController))]
public static class PlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
}
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void Start_Postfix(PlayerController __instance)
{
}
}
[HarmonyPatch(typeof(PlayerHealthGrab))]
public static class PlayerHealthGrabpatch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(PlayerHealthGrab), "Update")]
public static bool OnPlayerHealthGrabPrefix()
{
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerHealthGrab), "Update")]
public static void OnPlayerHealthGrabNew(PlayerHealthGrab __instance)
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: 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_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
if (__instance.playerAvatar.isTumbling || SemiFunc.RunIsShop() || SemiFunc.RunIsArena())
{
if (__instance.hideLerp < 1f)
{
__instance.hideLerp += Time.deltaTime * 5f;
__instance.hideLerp = Mathf.Clamp(__instance.hideLerp, 0f, 1f);
__instance.hideTransform.localScale = new Vector3(1f, __instance.hideCurve.Evaluate(__instance.hideLerp), 1f);
if (__instance.hideLerp >= 1f)
{
((Component)__instance.hideTransform).gameObject.SetActive(false);
}
}
}
else if (__instance.hideLerp > 0f)
{
if (!((Component)__instance.hideTransform).gameObject.activeSelf)
{
((Component)__instance.hideTransform).gameObject.SetActive(true);
}
__instance.hideLerp -= Time.deltaTime * 2f;
__instance.hideLerp = Mathf.Clamp(__instance.hideLerp, 0f, 1f);
__instance.hideTransform.localScale = new Vector3(1f, __instance.hideCurve.Evaluate(__instance.hideLerp), 1f);
}
bool flag = true;
if (__instance.playerAvatar.isDisabled || __instance.hideLerp > 0f)
{
flag = false;
}
if (__instance.colliderActive != flag)
{
__instance.colliderActive = flag;
__instance.physCollider.enabled = __instance.colliderActive;
}
((Component)__instance).transform.position = __instance.followTransform.position;
((Component)__instance).transform.rotation = __instance.followTransform.rotation;
if (!__instance.colliderActive || (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient))
{
return;
}
if (__instance.staticGrabObject.playerGrabbing.Count > 0)
{
__instance.grabbingTimer += Time.deltaTime;
bool flag2 = false;
foreach (PhysGrabber item in __instance.staticGrabObject.playerGrabbing)
{
if (__instance.grabbingTimer >= 1f)
{
PlayerAvatar playerAvatar = item.playerAvatar;
if (__instance.playerAvatar.playerHealth.health != __instance.playerAvatar.playerHealth.maxHealth && playerAvatar.playerHealth.health > 10)
{
ShadyMod.Logger.LogDebug((object)("Executing almost original game code: Player " + playerAvatar.playerName + " heals " + __instance.playerAvatar.playerName + " with 10 HP!"));
__instance.playerAvatar.playerHealth.HealOther(10, true);
playerAvatar.playerHealth.HurtOther(10, Vector3.zero, false, -1);
playerAvatar.HealedOther();
flag2 = true;
}
}
}
if (!flag2)
{
TryStealHealthFromOtherPlayer(__instance, __instance.staticGrabObject.playerGrabbing);
}
if (__instance.grabbingTimer >= 1f)
{
__instance.grabbingTimer = 0f;
}
}
else
{
__instance.grabbingTimer = 0f;
}
}
private static void TryStealHealthFromOtherPlayer(PlayerHealthGrab __instance, List<PhysGrabber> physicsGrabs)
{
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
foreach (PhysGrabber item in __instance.staticGrabObject.playerGrabbing)
{
if (!(__instance.grabbingTimer >= 1f))
{
continue;
}
PlayerAvatar playerAvatar = item.playerAvatar;
PlayerAvatar playerAvatar2 = __instance.playerAvatar;
int num = ShadyMod.MaxPlayerHpConfig?.Value ?? 9;
int num2 = ShadyMod.MinPlayerHpConfig?.Value ?? 20;
if (num <= 0)
{
num = 1;
}
if (num > 9)
{
num = 9;
}
if (num2 < 15)
{
num2 = 15;
}
else if (num2 > 100)
{
num2 = 100;
}
if (playerAvatar.playerHealth.health <= num && playerAvatar2.playerHealth.health >= num2)
{
int num3 = playerAvatar2.playerHealth.health / 2;
ShadyMod.Logger.LogDebug((object)$"Stealing health from player (Amount: {num3}) ...");
ConfigEntry<bool>? enableTalkConfig = ShadyMod.EnableTalkConfig;
if (enableTalkConfig == null || enableTalkConfig.Value)
{
SpeakHelper.SpeakHealMessage(playerAvatar, playerAvatar2, ShadyMod.UseShadyLanguageConfig?.Value ?? true);
}
playerAvatar.playerHealth.HealOther(num3, true);
playerAvatar2.playerHealth.HurtOther(num3, Vector3.zero, false, -1);
}
}
}
}
[BepInPlugin("Andy.ShadyMod", "ShadyMod", "1.0.4")]
public class ShadyMod : BaseUnityPlugin
{
internal static ShadyMod Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
public static ConfigEntry<int>? MinPlayerHpConfig { get; private set; }
public static ConfigEntry<int>? MaxPlayerHpConfig { get; private set; }
public static ConfigEntry<bool>? EnableTalkConfig { get; private set; }
public static ConfigEntry<bool>? UseShadyLanguageConfig { get; private set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
MinPlayerHpConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Health", "MinPlayerHealth", 20, "Required minimum health of the target player to steal (Min: 15 | Max: 100).");
MaxPlayerHpConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Health", "MaxPlayerHealth", 9, "Maximum health you can have to steal from the target (Min: 1 | Max: 9).");
EnableTalkConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Health", "Speak", true, "Enable players to talk when their life is stolen.");
UseShadyLanguageConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Health", "SpeakShadyLanguage", true, "If false, [shady] insiders are excluded, and only English is used.");
}
internal void Patch()
{
//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_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
public static class SpeakHelper
{
private static readonly string[] shadyMessagesOther = new string[17]
{
"Was soll das {self}?", "Spinnst du?", "Hast du noch all Tassen im Schrank?", "Please leave me alone!", "Neieieiein! Kochen Sie mir keinen!", "Wer war das?", "Das war aber nicht nett", "Warum machst du sowas?", "Outsch!", "Das ist beschissen!",
"Bist du dumm?", "Lass das", "Willst du Stress?", "Ich habe dir das verboten.", "Das ist nicht fair", "Das habe ich gesehen", "Was machst du denn?"
};
private static readonly string[] shadyMessagesSelf = new string[7] { "Danke für das Healing {other}.", "shady >> suple", "HOOHOOHHOOOHHOHOHOH", "Du bist toll!", "Selber schuld", "Das hast du jetzt davon", "Huhoh, jetzt bist du dran!" };
private static readonly string[] messagesOther = new string[13]
{
"What are you doing {self}?", "Are you crazy?", "Please leave me alone!", "Who was that?", "That was not nice!", "Why are you doing this?", "Ouch!", "That's not fair!", "Are you stupid?", "Stop it!",
"Do you want to fight?", "I told you not to do that.", "I saw that!"
};
private static readonly string[] messagesSelf = new string[7] { "Thanks for the healing {other}.", "HOOHOOHHOOOHHOHOHOH", "You are great, thanks!", "You are so nice!", "You are so generous!", "You are so kind!", "Huoh, gotcha!" };
public static void SpeakHealMessage(PlayerAvatar self, PlayerAvatar other, bool useShadyInsiders = true)
{
int num = Random.Range(1, 2);
string[] array = ((!useShadyInsiders) ? ((num == 1) ? messagesSelf : messagesOther) : ((num == 1) ? shadyMessagesSelf : shadyMessagesOther));
PlayerAvatar val = ((num == 1) ? self : other);
int num2 = Random.Range(0, array.Length);
string text = array[num2].Replace("{self}", self.playerName).Replace("{other}", other.playerName);
if (!string.IsNullOrEmpty(text))
{
ShadyMod.Logger.LogDebug((object)("Sending message: " + text + " to " + val?.playerName));
if (val != null)
{
val.ChatMessageSend(text, val.isCrouching);
}
}
}
}
}