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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FishNet;
using FishNet.Connection;
using FishNet.Object;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SpongeMods.Cheats.Features;
using SpongeMods.ModMenu;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("FishNet.Runtime")]
[assembly: AssemblyCompany("SpongeMods")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Cheats: invincibility, lethal fists, a rigged roulette, no duplicate skins, mid-air jumps, fast swimming and the hidden dev island.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+807d10f48f8cb6ab8847e83ac88f880327f00494")]
[assembly: AssemblyProduct("SpongesCheats")]
[assembly: AssemblyTitle("SpongeMods.Cheats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 SpongeMods.Cheats
{
[BepInPlugin("SpongeMods.Cheats", "Sponge's Cheats", "1.0.0")]
[BepInProcess("How to Fish.exe")]
[BepInDependency("SpongeMods.ModMenu", "1.0.0")]
public sealed class OverridePlugin : BaseUnityPlugin
{
public const string PluginGuid = "SpongeMods.Cheats";
public const string PluginName = "Sponge's Cheats";
public const string PluginVersion = "1.0.0";
internal static ConfigEntry<bool> GodMode;
internal static ConfigEntry<bool> LethalFists;
internal static ConfigEntry<int> FistDamage;
internal static ConfigEntry<bool> AlwaysGreen;
internal static ConfigEntry<bool> FairSlots;
internal static ConfigEntry<bool> DevIslandEnabled;
internal static ConfigEntry<bool> DevIslandPinkDot;
internal static ConfigEntry<KeyCode> DevIslandKey;
internal static ConfigEntry<bool> MultiJump;
internal static ConfigEntry<int> MaxJumps;
internal static ConfigEntry<bool> FastSwim;
internal static ConfigEntry<bool> YieldSwimSpeed;
internal static ConfigEntry<float> SwimSpeedMultiple;
private Harmony _harmony;
internal static OverridePlugin Instance { get; private set; }
internal static ManualLogSource Log { get; private set; }
private void Awake()
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Expected O, but got Unknown
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Expected O, but got Unknown
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet;
((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
GodMode = ((BaseUnityPlugin)this).Config.Bind<bool>("God Mode", "Enabled", true, "Make every player invincible. Applied on the host, so it protects everyone in the session.");
LethalFists = ((BaseUnityPlugin)this).Config.Bind<bool>("Fists", "Enabled", true, "Make bare-handed punches deal massive damage.");
FistDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Fists", "Damage", 999999, new ConfigDescription("Damage a punch deals.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999999), Array.Empty<object>()));
AlwaysGreen = ((BaseUnityPlugin)this).Config.Bind<bool>("Roulette", "AlwaysGreen", true, "The casino ball always lands on green. Decided by the host, so payouts are consistent for everyone.");
FairSlots = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin machine", "No duplicates", true, "When the skin machine lands on something you already own, swap it for one of the same rarity that you are missing. Other players briefly see the original on the reel, because what you own is only known on your own machine.");
DevIslandEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev Island", "Enabled", true, "Re-enable the hidden developer island that ships with the game but is unreachable in normal play.");
DevIslandPinkDot = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev Island", "PinkRadarDot", true, "Show the dev island on the boat radar as a bright pink dot. Skipped automatically if another island already uses a similar colour.");
DevIslandKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Dev Island", "TravelKey", (KeyCode)288, "Host-only hotkey that sends the whole session to the dev island. The island is also reachable by sailing past the last normal island.");
MultiJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement", "MultiJump", true, "Allow jumping repeatedly in mid-air.");
MaxJumps = ((BaseUnityPlugin)this).Config.Bind<int>("Movement", "MaxJumps", 10, new ConfigDescription("Total jumps before touching the ground again, including the first.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
FastSwim = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement", "FastSwim", true, "Move faster in water.");
YieldSwimSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement", "YieldSwimSpeed", true, "Stand down from swim speed when a dedicated movement mod is installed, so the two do not multiply together. Turn this off to keep this mod's faster speed instead -- the movement mod tunes swimming for comfort, which is slower than a cheat.");
SwimSpeedMultiple = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "SwimSpeedMultiple", 5f, new ConfigDescription("Water movement speed as a multiple of normal walking speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>()));
_harmony = new Harmony("SpongeMods.Cheats");
try
{
_harmony.PatchAll(typeof(GodModePatches));
_harmony.PatchAll(typeof(FistDamagePatch));
_harmony.PatchAll(typeof(RouletteGreenPatch));
_harmony.PatchAll(typeof(DevIslandPatches));
_harmony.PatchAll(typeof(RadarDotPatch));
_harmony.PatchAll(typeof(MultiJumpPatch));
_harmony.PatchAll(typeof(GroundedResetPatch));
_harmony.PatchAll(typeof(FastSwimPatch));
}
catch (Exception ex)
{
Log.LogError((object)("Failed to apply patches: " + ex));
}
if (saveOnConfigSet)
{
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
((BaseUnityPlugin)this).Config.Save();
}
Tabs.Register();
Log.LogInfo((object)("Sponge's Cheats 1.0.0 loaded. " + $"GodMode={GodMode.Value} Fists={LethalFists.Value} Green={AlwaysGreen.Value} " + $"DevIsland={DevIslandEnabled.Value} " + $"MultiJump={MaxJumps.Value} SwimSpeed={SwimSpeedMultiple.Value}x"));
}
private void Update()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
DevIslandAccess.Tick();
if (DevIslandEnabled.Value && Input.GetKeyDown(DevIslandKey.Value))
{
DevIslandAccess.TravelToDevIsland();
}
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
((BaseUnityPlugin)this).Config.Save();
Instance = null;
}
}
internal static class Tabs
{
public static void Register()
{
SpongeMenu.Tab("SpongeMods.Cheats", "Cheats", 90).Heading("Survival").Toggle("Invincible", OverridePlugin.GodMode)
.OnlyHost()
.Note("Applied on the host, so it protects everyone in the session rather than one player.")
.Heading("Fists")
.Toggle("Lethal punches", OverridePlugin.LethalFists)
.OnlyHost()
.Number("Damage", OverridePlugin.FistDamage)
.OnlyHost()
.Heading("Luck")
.Toggle("Roulette always lands green", OverridePlugin.AlwaysGreen)
.OnlyHost()
.Toggle("No duplicate skins", OverridePlugin.FairSlots)
.Note("A duplicate is swapped for one of the same rarity you are missing. Other players briefly see the original on the reel, because what you own is only known on your own machine.")
.Heading("Movement")
.Toggle("Jump in mid-air", OverridePlugin.MultiJump)
.Number("Jumps before landing", OverridePlugin.MaxJumps)
.Toggle("Swim fast", OverridePlugin.FastSwim)
.Number("Swim speed", OverridePlugin.SwimSpeedMultiple)
.Toggle("Stand down for a movement mod", OverridePlugin.YieldSwimSpeed)
.Note("A movement mod tunes swimming for comfort, which is slower than a cheat. Standing down stops the two multiplying together; turn it off to keep this speed instead.")
.Heading("Dev island")
.Toggle("Reachable", OverridePlugin.DevIslandEnabled)
.OnlyHost()
.Toggle("Pink dot on the radar", OverridePlugin.DevIslandPinkDot)
.Press("Take everyone there", (Action)delegate
{
SpongeMenu.Close();
DevIslandAccess.TravelToDevIsland();
})
.OnlyHost()
.Note("The island ships with the game but is unreachable in normal play. It is also reachable by sailing past the last island.");
}
}
}
namespace SpongeMods.Cheats.Features
{
[HarmonyPatch(typeof(PlayerVitals), "TakeDamage")]
internal static class GodModePatches
{
private static bool Prefix()
{
return !OverridePlugin.GodMode.Value;
}
}
[HarmonyPatch(typeof(PlayerPunching), "HitTarget")]
internal static class FistDamagePatch
{
private static void Prefix(PlayerPunching __instance, out int __state)
{
__state = __instance._damage;
if (OverridePlugin.LethalFists.Value)
{
__instance._damage = OverridePlugin.FistDamage.Value;
}
}
private static Exception Finalizer(PlayerPunching __instance, int __state, Exception __exception)
{
__instance._damage = __state;
return __exception;
}
}
[HarmonyPatch(typeof(LocalCasino), "GetRouletteColorFromBall")]
internal static class RouletteGreenPatch
{
private static void Postfix(ref BetColor __result)
{
if (OverridePlugin.AlwaysGreen.Value)
{
__result = (BetColor)2;
}
}
}
internal static class DevIslandAccess
{
internal const byte DevIslandIndex = 5;
private static bool _loggedAvailability;
private static readonly FieldInfo CurIslandField = AccessTools.Field(typeof(OnlineIslandManager), "_curIsland");
internal static bool DevIslandExists => SceneManager.sceneCountInBuildSettings > 6;
internal static bool IsOnDevIsland
{
get
{
try
{
return (Object)(object)OnlineIslandManager.Instance != (Object)null && CurrentIsland() == 5;
}
catch
{
return false;
}
}
}
internal static byte CurrentIsland()
{
if (CurIslandField == null || (Object)(object)OnlineIslandManager.Instance == (Object)null)
{
return byte.MaxValue;
}
try
{
object value = CurIslandField.GetValue(OnlineIslandManager.Instance);
PropertyInfo propertyInfo = value?.GetType().GetProperty("Value");
return (propertyInfo == null) ? byte.MaxValue : Convert.ToByte(propertyInfo.GetValue(value));
}
catch
{
return byte.MaxValue;
}
}
internal static void Tick()
{
if (OverridePlugin.DevIslandEnabled.Value && !_loggedAvailability && !((Object)(object)OnlineIslandManager.Instance == (Object)null))
{
_loggedAvailability = true;
OverridePlugin.Log.LogInfo((object)(DevIslandExists ? ($"Dev island available at island index {(byte)5}. " + "Sail past the last island to reach it, or use the config hotkey.") : "This build does not contain a dev island scene; that feature is inactive."));
}
}
internal static void TravelToDevIsland()
{
if (OverridePlugin.DevIslandEnabled.Value && DevIslandExists)
{
if (!InstanceFinder.IsServerStarted)
{
OverridePlugin.Log.LogInfo((object)"Only the host can move the world to the dev island.");
return;
}
OnlineIslandManager.TpToSpecificIsland((byte)5);
OverridePlugin.Log.LogInfo((object)"Travelling to the dev island; all players follow via the island SyncVar.");
}
}
}
[HarmonyPatch(typeof(OnlineIslandManager), "NextIslandInBuild")]
internal static class DevIslandPatches
{
private static bool Prefix(OnlineIslandManager __instance, bool backwards)
{
if (!OverridePlugin.DevIslandEnabled.Value || !DevIslandAccess.DevIslandExists)
{
return true;
}
byte b = DevIslandAccess.CurrentIsland();
if (b == byte.MaxValue)
{
return true;
}
int num = 5;
int num2 = (backwards ? (b - 1) : (b + 1));
if (num2 > num)
{
num2 = 0;
}
else if (num2 < 0)
{
num2 = num;
}
__instance.SpawnIsland((byte)num2);
return false;
}
}
internal static class FairSlots
{
private const byte BoatId = byte.MaxValue;
private static List<byte> Unowned(SkinPreset preset, byte itemId, Rarity rarity)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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)
List<byte> list = new List<byte>();
if ((Object)(object)preset == (Object)null)
{
return list;
}
IReadOnlyList<ItemSkin> skins = preset.Skins;
for (int i = 0; i < skins.Count; i++)
{
ItemSkin val = skins[i];
if (((ItemSkin)(ref val)).Rarity == rarity && !Owns(itemId, (byte)i))
{
list.Add((byte)i);
}
}
return list;
}
private static bool Owns(byte itemId, byte skinIndex)
{
LocalSaveObject curLocalSave = SaveManager._curLocalSave;
if (curLocalSave == null)
{
return false;
}
if (itemId == byte.MaxValue)
{
if (curLocalSave.UnlockedBoatSkins != null)
{
return curLocalSave.UnlockedBoatSkins.Contains(skinIndex);
}
return false;
}
if (curLocalSave.UnlockedItemSkins == null)
{
return false;
}
for (int i = 0; i < curLocalSave.UnlockedItemSkins.Count; i++)
{
SavedItemSkin val = curLocalSave.UnlockedItemSkins[i];
if (val != null && val.ID == itemId)
{
if (val.SkinsUnlocked != null)
{
return val.SkinsUnlocked.Contains(skinIndex);
}
return false;
}
}
return false;
}
private static SkinPreset PresetFor(byte itemId)
{
if (itemId == byte.MaxValue)
{
if (!((Object)(object)BoatManager.Boat != (Object)null))
{
return null;
}
return BoatManager.Boat.SkinPreset;
}
Item val = GameInfo.IDToItem(itemId);
if (!((Object)(object)val != (Object)null))
{
return null;
}
return val.SkinPreset;
}
public static void Improve(byte[] itemIds, byte[] itemSkins, byte rolled)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if (itemIds == null || itemSkins == null || rolled >= itemIds.Length || rolled >= itemSkins.Length)
{
return;
}
byte itemId = itemIds[rolled];
byte b = itemSkins[rolled];
if (!Owns(itemId, b))
{
return;
}
SkinPreset val = PresetFor(itemId);
if ((Object)(object)val == (Object)null || b >= val.Skins.Count)
{
return;
}
ItemSkin val2 = val.Skins[b];
List<byte> list = Unowned(val, itemId, ((ItemSkin)(ref val2)).Rarity);
if (list.Count != 0)
{
byte b2 = (itemSkins[rolled] = list[Random.Range(0, list.Count)]);
ManualLogSource log = OverridePlugin.Log;
if (log != null)
{
log.LogInfo((object)$"Swapped a duplicate skin for one you were missing ({b} -> {b2}).");
}
}
}
}
[HarmonyPatch(typeof(SlotMachine), "Roll")]
internal static class FairSlotsPatch
{
private static void Prefix(Player roller, byte[] itemIDs, byte[] itemSkins, byte rolled)
{
if (OverridePlugin.FairSlots.Value && !((Object)(object)roller == (Object)null) && !(((NetworkBehaviour)roller).Owner == (NetworkConnection)null) && ((NetworkBehaviour)roller).Owner.IsLocalClient)
{
FairSlots.Improve(itemIDs, itemSkins, rolled);
}
}
}
internal static class MovementTuning
{
private static readonly FieldInfo IsSwimmingField = AccessTools.Field(typeof(PlayerMovement), "_isSwimming");
private static readonly FieldInfo PlayerField = AccessTools.Field(typeof(PlayerMovement), "_player");
private static int _airJumpsUsed;
internal static bool HasLocal(PlayerMovement movement)
{
if ((Object)(object)Player.LocalPlayer == (Object)null || PlayerField == null)
{
return false;
}
object? value = PlayerField.GetValue(movement);
return (Object)((value is Player) ? value : null) == (Object)(object)Player.LocalPlayer;
}
internal static bool IsSwimming(PlayerMovement movement)
{
if (IsSwimmingField == null)
{
return false;
}
try
{
return (bool)IsSwimmingField.GetValue(movement);
}
catch
{
return false;
}
}
internal static bool TryConsumeAirJump(PlayerMovement movement)
{
if (!OverridePlugin.MultiJump.Value || !HasLocal(movement))
{
return false;
}
if (movement.Grounded || IsSwimming(movement))
{
return false;
}
int num = Mathf.Max(0, OverridePlugin.MaxJumps.Value - 1);
if (_airJumpsUsed >= num)
{
return false;
}
_airJumpsUsed++;
return true;
}
internal static void NotifyGrounded()
{
_airJumpsUsed = 0;
}
}
[HarmonyPatch(typeof(PlayerMovement), "JumpInput")]
internal static class MultiJumpPatch
{
private static bool Prefix(PlayerMovement __instance)
{
if (!OverridePlugin.MultiJump.Value)
{
return true;
}
if (__instance.Grounded || MovementTuning.IsSwimming(__instance) || __instance.OnBoat)
{
return true;
}
if (!MovementTuning.TryConsumeAirJump(__instance))
{
return true;
}
__instance.Jump();
return false;
}
}
[HarmonyPatch(typeof(PlayerMovement), "GroundCheck")]
internal static class GroundedResetPatch
{
private static void Postfix(PlayerMovement __instance)
{
if (MovementTuning.HasLocal(__instance) && __instance.Grounded)
{
MovementTuning.NotifyGrounded();
}
}
}
[HarmonyPatch(typeof(PlayerMovement), "LateUpdate")]
internal static class FastSwimPatch
{
private static void Postfix(PlayerMovement __instance)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if (OverridePlugin.FastSwim.Value && MovementTuning.HasLocal(__instance) && !WaterOwnership.Deferring && MovementTuning.IsSwimming(__instance) && !__instance.OnBoat)
{
float value = OverridePlugin.SwimSpeedMultiple.Value;
Rigidbody rig = __instance._rig;
Vector3 linearVelocity = rig.linearVelocity;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(linearVelocity.x, 0f, linearVelocity.z);
float num = __instance._walkSpeed * value;
if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f) && !(((Vector3)(ref val)).magnitude >= num))
{
val = ((Vector3)(ref val)).normalized * num;
rig.linearVelocity = new Vector3(val.x, linearVelocity.y, val.z);
}
}
}
}
[HarmonyPatch(typeof(RadarUI), "UpdateIslandDots")]
internal static class RadarDotPatch
{
private static readonly Color DevIslandPink = new Color(1f, 0.16f, 0.72f, 1f);
private const float HueTolerance = 0.06f;
private static readonly FieldInfo IslandDotsField = AccessTools.Field(typeof(RadarUI), "_islandDots");
private static readonly FieldInfo DotImageField = AccessTools.Field(typeof(MapDot), "_dot");
private static Action<MapDot, Vector3> _updateDot;
private static RadarUI _boundRadar;
private static bool _evaluated;
private static bool _pinkIsAvailable;
private static MapDot _devDot;
private static void Postfix(RadarUI __instance)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
if (OverridePlugin.DevIslandEnabled.Value && OverridePlugin.DevIslandPinkDot.Value && DevIslandAccess.DevIslandExists && IslandDotsField?.GetValue(__instance) is MapDot[] array && array.Length != 0)
{
if (!_evaluated)
{
EvaluatePinkAvailability(array);
}
if (_pinkIsAvailable && TryGetDevIslandPosition(out var position))
{
EnsureDevDot(__instance, array, position);
}
}
}
private static void EvaluatePinkAvailability(MapDot[] dots)
{
//IL_002f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
_evaluated = true;
_pinkIsAvailable = true;
if (DotImageField == null)
{
_pinkIsAvailable = false;
OverridePlugin.Log.LogWarning((object)"Could not read radar dot colours, so the pink dev island dot was skipped.");
return;
}
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(DevIslandPink, ref num, ref num2, ref num3);
List<string> list = new List<string>();
float num4 = default(float);
float num5 = default(float);
float num6 = default(float);
for (int i = 0; i < dots.Length; i++)
{
object? value = DotImageField.GetValue(dots[i]);
Image val = (Image)((value is Image) ? value : null);
if ((Object)(object)val == (Object)null)
{
continue;
}
Color color = ((Graphic)val).color;
Color.RGBToHSV(color, ref num4, ref num5, ref num6);
if (!(num5 < 0.25f) && !(num6 < 0.2f))
{
float num7 = Mathf.Abs(num4 - num);
if (num7 > 0.5f)
{
num7 = 1f - num7;
}
if (num7 <= 0.06f && num5 >= num2 * 0.5f)
{
list.Add($"dot {i} (#{ColorUtility.ToHtmlStringRGB(color)})");
}
}
}
if (list.Count == 0)
{
OverridePlugin.Log.LogInfo((object)"Pink is unused by other islands; the dev island will use it.");
return;
}
_pinkIsAvailable = false;
OverridePlugin.Log.LogInfo((object)("Skipping the pink dev island dot because these radar dots already use a similar colour: " + string.Join(", ", list.ToArray()) + "."));
}
private static bool TryGetDevIslandPosition(out Vector3 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
position = Vector3.zero;
try
{
IslandInfo islandInfo = IslandManager.GetIslandInfo(5);
if (islandInfo == null)
{
return false;
}
position = islandInfo.IslandPosition;
return true;
}
catch
{
return false;
}
}
private static void EnsureDevDot(RadarUI radar, MapDot[] dots, Vector3 position)
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
if (_devDot != null)
{
object? value = DotImageField.GetValue(_devDot);
Image val = (Image)((value is Image) ? value : null);
if (val == null || !((Object)(object)val != (Object)null))
{
_devDot = null;
_updateDot = null;
_boundRadar = null;
}
}
if (_devDot == null)
{
object? value2 = DotImageField.GetValue(dots[0]);
Image val2 = (Image)((value2 is Image) ? value2 : null);
if ((Object)(object)val2 == (Object)null)
{
return;
}
Image val3 = Object.Instantiate<Image>(val2, ((Component)val2).transform.parent);
((Object)((Component)val3).gameObject).name = "SpongeMods_DevIslandDot";
((Graphic)val3).color = DevIslandPink;
_devDot = new MapDot();
DotImageField.SetValue(_devDot, val3);
OverridePlugin.Log.LogInfo((object)"Added a bright pink radar dot for the dev island.");
}
if (_updateDot == null || (Object)(object)_boundRadar != (Object)(object)radar)
{
MethodInfo methodInfo = AccessTools.Method(typeof(RadarUI), "UpdateDot", (Type[])null, (Type[])null);
if (methodInfo == null)
{
return;
}
try
{
_updateDot = (Action<MapDot, Vector3>)Delegate.CreateDelegate(typeof(Action<MapDot, Vector3>), radar, methodInfo);
_boundRadar = radar;
}
catch (Exception ex)
{
OverridePlugin.Log.LogWarning((object)("Could not bind the radar dot updater: " + ex.Message));
return;
}
}
_updateDot(_devDot, position);
}
}
internal static class WaterOwnership
{
private const string MovementModId = "SpongeMods.MovementTweaks";
private static bool _resolved;
private static bool _deferring;
public static bool Deferring
{
get
{
if (_resolved)
{
return _deferring;
}
_resolved = true;
bool flag = Chainloader.PluginInfos.ContainsKey("SpongeMods.MovementTweaks");
_deferring = flag && OverridePlugin.YieldSwimSpeed.Value;
if (_deferring)
{
ManualLogSource log = OverridePlugin.Log;
if (log != null)
{
log.LogInfo((object)("A movement mod is installed, so it owns swim speed and this mod's " + OverridePlugin.SwimSpeedMultiple.Value + "x cheat is standing down. That mod tunes swimming for comfort, so water will feel slower than this cheat alone. Raise its speed multiplier, or set YieldSwimSpeed = false here."));
}
}
else if (flag)
{
ManualLogSource log2 = OverridePlugin.Log;
if (log2 != null)
{
log2.LogInfo((object)"A movement mod is installed but YieldSwimSpeed is off, so this mod keeps swim speed. Set that mod's multiplier to 1 to stop the two compounding.");
}
}
else
{
ManualLogSource log3 = OverridePlugin.Log;
if (log3 != null)
{
log3.LogInfo((object)"No movement mod detected; this mod owns swim speed.");
}
}
return _deferring;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}