using System; 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 ServerSync; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BoatMapExploreRadiusServerSync")] [assembly: AssemblyDescription("Server-authoritative BoatExploreRadius for nearbear's BiggerBoatMapExploreRadius")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCompany("JG224")] [assembly: AssemblyProduct("BoatMapExploreRadiusServerSync")] [assembly: AssemblyCopyright("Public domain")] [assembly: AssemblyTrademark("")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace BoatMapExploreRadiusSync; [BepInPlugin("JG224_BoatMapExploreRadiusServerSync", "BoatMapExploreRadiusServerSync", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string MODNAME = "BoatMapExploreRadiusServerSync"; public const string AUTHOR = "JG224"; public const string GUID = "JG224_BoatMapExploreRadiusServerSync"; public const string VERSION = "1.0.0"; internal static ManualLogSource Log; internal static ConfigSync ConfigSync; internal static ConfigEntry BoatExploreRadius; internal static ConfigEntry LockConfiguration; private static FieldInfo _nearbearField; private static float _lastApplied = -1f; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ConfigSync = new ConfigSync("JG224_BoatMapExploreRadiusServerSync") { DisplayName = "BoatMapExploreRadiusServerSync", CurrentVersion = "1.0.0", MinimumRequiredVersion = "1.0.0" }; LockConfiguration = ((BaseUnityPlugin)this).Config.Bind("General", "LockConfiguration", true, new ConfigDescription("If true, the server's BoatExploreRadius is authoritative and clients cannot change it locally. Set this on the dedicated server.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { ReadOnly = false } })); BoatExploreRadius = ((BaseUnityPlugin)this).Config.Bind("General", "BoatExploreRadius", 200f, new ConfigDescription("The radius in meters that your map reveal extends out to while driving a boat. Synced from the server when LockConfiguration is true.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 10000f), new object[1] { (object)new ConfigurationManagerAttributes { ReadOnly = false } })); ConfigSync.AddLockingConfigEntry(LockConfiguration); ConfigSync.AddConfigEntry(BoatExploreRadius); BoatExploreRadius.SettingChanged += delegate { ApplyToNearbear(); }; ApplyToNearbear(); Log.LogInfo((object)"BoatMapExploreRadiusServerSync 1.0.0 loaded."); } private static FieldInfo ResolveNearbearField() { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (!(assembly.GetName().Name != "BiggerBoatMapExploreRadius")) { Type type = assembly.GetType("BiggerBoatMapExploreRadius.Main"); if (!(type == null)) { return type.GetField("boatExploreRadius", BindingFlags.Static | BindingFlags.Public); } } } return null; } private static void ApplyToNearbear() { if (_nearbearField == null) { _nearbearField = ResolveNearbearField(); if (_nearbearField == null) { Log.LogError((object)"Could not locate BiggerBoatMapExploreRadius.Main.boatExploreRadius - is nearbear's mod installed?"); return; } } if (!(_nearbearField.GetValue(null) is ConfigEntry val)) { Log.LogWarning((object)"nearbear's boatExploreRadius field was null - mod may not have initialized yet."); return; } float value = BoatExploreRadius.Value; if (!(_lastApplied >= 0f) || !(Math.Abs(_lastApplied - value) < 0.001f)) { _lastApplied = value; val.Value = value; Log.LogInfo((object)$"Applied BoatExploreRadius={value} to nearbear's config."); } } }