using System;
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 EntityStates;
using EntityStates.Missions.BrotherEncounter;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Missions.BrotherEncounter;
using On.RoR2;
using R2API.Utils;
using RoR2;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("TweaksForDaltonGoesFast")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TweaksForDaltonGoesFast")]
[assembly: AssemblyTitle("TweaksForDaltonGoesFast")]
[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 TweaksForDaltonGoesFast
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("GiGaGon.TweaksForDaltonGoesFast", "TweaksForDaltonGoesFast", "1.0.5")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class TweaksForDaltonGoesFast : BaseUnityPlugin
{
internal class ModConfig
{
public static ConfigEntry<bool> blockPortalInteraction;
public static ConfigEntry<bool> blockSeerInteraction;
public static ConfigEntry<bool> blockTeleporterInteraction;
public static ConfigEntry<bool> blockSafeWardInteraction;
public static ConfigEntry<string> trustedPlayerList;
public static ConfigEntry<float> simulacrumRewardVectorMultiplyer;
public static ConfigEntry<string> interactionBlockMessage;
public static void InitConfig(ConfigFile config)
{
blockPortalInteraction = config.Bind<bool>("General", "Block Portal Interaction", true, "Block non-trusted players from interacting with Portals");
blockSeerInteraction = config.Bind<bool>("General", "Block Seer Interaction", true, "Block non-trusted players from interacting with Lunar Seers");
blockTeleporterInteraction = config.Bind<bool>("General", "Block Teleporter Interaction", true, "Block non-trusted players from interacting with Teleporters");
blockSafeWardInteraction = config.Bind<bool>("General", "Block SafeWard Interaction", true, "Block non-trusted players from interacting with the Safe Ward");
trustedPlayerList = config.Bind<string>("General", "Trusted Player List", "", "Comma seperated list of trusted player ids. Will get copied when installed from modpack code, so watch out.");
simulacrumRewardVectorMultiplyer = config.Bind<float>("General", "Simulacrum Reward Vector Multiplyer", 1f, "Float to multiply the velocity of Simularcum reward item droplets by.");
interactionBlockMessage = config.Bind<string>("General", "Interaction Blocked Message", "Non-trusted player {player_name} tried to activate {interactable_name}, interaction blocked.", "Message to send when an interaction is blocked. The special strings {player_name} and {interactable_name} will be replaced with the relevent details when sent.");
}
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<Instruction, bool> <>9__6_23;
public static Func<Instruction, bool> <>9__6_24;
public static Func<Instruction, bool> <>9__6_25;
public static Func<Vector3, int, Vector3> <>9__6_26;
public static Func<string, bool> <>9__6_30;
public static hook_OnEnter <>9__6_9;
internal bool <Awake>b__6_23(Instruction x)
{
return ILPatternMatchingExt.MatchLdloc(x, 6);
}
internal bool <Awake>b__6_24(Instruction x)
{
return ILPatternMatchingExt.MatchLdloc(x, 4);
}
internal bool <Awake>b__6_25(Instruction x)
{
return ILPatternMatchingExt.MatchLdloc(x, 2);
}
internal Vector3 <Awake>b__6_26(Vector3 loc4, int loc5)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"TweaksForDaltonGoesFast - 1a");
if (loc5 < PlayerCharacterMasterController.instances.Count)
{
Debug.Log((object)"TweaksForDaltonGoesFast - 2a");
PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[loc5];
Debug.Log((object)"TweaksForDaltonGoesFast - 3a");
if (!val.master.IsDeadAndOutOfLivesServer())
{
Debug.Log((object)"TweaksForDaltonGoesFast - 4a");
_ = val.master.GetBody().transform.position;
if (true)
{
Debug.Log((object)"TweaksForDaltonGoesFast - 5a");
return val.master.GetBody().transform.position;
}
}
}
return loc4;
}
internal bool <Awake>b__6_30(string x)
{
return x != "";
}
internal void <Awake>b__6_9(orig_OnEnter orig, EncounterFinished self)
{
((EntityState)self).outer.SetNextState((EntityState)(object)new BrotherEncounterLowerWalls());
}
}
private static Harmony test;
public const string PluginGUID = "GiGaGon.TweaksForDaltonGoesFast";
public const string PluginAuthor = "GiGaGon";
public const string PluginName = "TweaksForDaltonGoesFast";
public const string PluginVersion = "1.0.5";
public void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
test = Harmony.CreateAndPatchAll(typeof(MonoBehaviourCallbackHooks), (string)null);
CommandHelper.AddToConsoleWhenReady();
ModConfig.InitConfig(((BaseUnityPlugin)this).Config);
InfiniteTowerWaveController.DropRewards += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
ILCursor val4 = new ILCursor(il);
val4.GotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 6),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2)
});
val4.Index += 2;
val4.Emit(OpCodes.Ldloc, 5);
val4.EmitDelegate<Func<Vector3, int, Vector3>>((Func<Vector3, int, Vector3>)delegate(Vector3 loc4, int loc5)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"TweaksForDaltonGoesFast - 1a");
if (loc5 < PlayerCharacterMasterController.instances.Count)
{
Debug.Log((object)"TweaksForDaltonGoesFast - 2a");
PlayerCharacterMasterController val6 = PlayerCharacterMasterController.instances[loc5];
Debug.Log((object)"TweaksForDaltonGoesFast - 3a");
if (!val6.master.IsDeadAndOutOfLivesServer())
{
Debug.Log((object)"TweaksForDaltonGoesFast - 4a");
_ = val6.master.GetBody().transform.position;
if (true)
{
Debug.Log((object)"TweaksForDaltonGoesFast - 5a");
return val6.master.GetBody().transform.position;
}
}
}
return loc4;
});
val4.Index += 1;
val4.Emit(OpCodes.Ldloc, 5);
val4.EmitDelegate<Func<Vector3, int, Vector3>>((Func<Vector3, int, Vector3>)delegate(Vector3 loc2, int loc5)
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"TweaksForDaltonGoesFast - 1b");
if (loc5 < PlayerCharacterMasterController.instances.Count)
{
Debug.Log((object)"TweaksForDaltonGoesFast - 2b");
}
PlayerCharacterMasterController val5 = PlayerCharacterMasterController.instances[loc5];
Debug.Log((object)"TweaksForDaltonGoesFast - 3b");
if (!val5.master.IsDeadAndOutOfLivesServer())
{
Debug.Log((object)"TweaksForDaltonGoesFast - 4b");
_ = val5.master.GetBody().transform.position;
if (true)
{
Debug.Log((object)"TweaksForDaltonGoesFast - 5b");
return new Vector3(0f, 0f, 0f);
}
}
((BaseUnityPlugin)this).Config.Reload();
return loc2 * ModConfig.simulacrumRewardVectorMultiplyer.Value;
});
};
Interactor.PerformInteraction += (hook_PerformInteraction)delegate(orig_PerformInteraction orig, Interactor self, GameObject interactableObject)
{
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Expected O, but got Unknown
((BaseUnityPlugin)this).Config.Reload();
string[] source = new string[4] { "Portal", "Seer", "Teleporter", "SafeWard" };
if ((Object)(object)interactableObject == (Object)null)
{
orig.Invoke(self, interactableObject);
}
else
{
string[] array = source.Where((string x) => ((Object)interactableObject).name.Contains(x)).ToArray();
if (array.Length == 0)
{
orig.Invoke(self, interactableObject);
}
else
{
ConfigEntry<bool> val2 = default(ConfigEntry<bool>);
((BaseUnityPlugin)this).Config.TryGetEntry<bool>("General", "Block " + array[0] + " Interaction", ref val2);
if (!val2.Value)
{
orig.Invoke(self, interactableObject);
}
else if ((Object)(object)((Component)self).GetComponent<CharacterBody>() == (Object)(object)PlayerCharacterMasterController.instances[0].master.GetBody())
{
orig.Invoke(self, interactableObject);
}
else
{
string[] array2 = (from x in ModConfig.trustedPlayerList.Value.Split(new char[1] { ',' })
where x != ""
select x).ToArray();
if (array2.Length != 0)
{
string[] array3 = array2;
foreach (string value in array3)
{
if (((Component)self).GetComponent<CharacterBody>().GetUserName().Contains(value))
{
orig.Invoke(self, interactableObject);
return;
}
}
}
SimpleChatMessage val3 = new SimpleChatMessage();
val3.baseToken = "<color=#ff0000>{0}</color>";
val3.paramTokens = new string[1] { ModConfig.interactionBlockMessage.Value.Replace("{player_name}", ((Component)self).GetComponent<CharacterBody>().GetUserName()).Replace("{interactable_name}", array[0]) };
Chat.SendBroadcastChat((ChatMessageBase)(object)val3);
}
}
}
};
object obj = <>c.<>9__6_9;
if (obj == null)
{
hook_OnEnter val = delegate(orig_OnEnter orig, EncounterFinished self)
{
((EntityState)self).outer.SetNextState((EntityState)(object)new BrotherEncounterLowerWalls());
};
<>c.<>9__6_9 = val;
obj = (object)val;
}
EncounterFinished.OnEnter += (hook_OnEnter)obj;
}
private void OnDestroy()
{
test.UnpatchSelf();
}
}
public class BrotherEncounterLowerWalls : BrotherEncounterBaseState
{
public override bool shouldEnableArenaWalls => false;
public override void OnEnter()
{
((BrotherEncounterBaseState)this).OnEnter();
}
}
}