using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using HowToFish.BossMaker;
using Microsoft.CodeAnalysis;
using SkyLiN3.Configuration;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SkyLiN3")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Host edits affect new catches and bosses; active bosses keep their balance. Clients edit local preferences. Valid legacy values outside menu ranges are retained until edited. Testing controls are local and disabled by default.")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyInformationalVersion("1.3.2")]
[assembly: AssemblyProduct("Voltfin")]
[assembly: AssemblyTitle("Voltfin")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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;
}
}
}
[BepInPlugin("example.howtofish.voltfin", "Voltfin", "1.3.2")]
[BepInDependency("com.skylin3.howtofish.bossmakerapi", "0.10.4")]
public sealed class VoltfinPlugin : BaseUnityPlugin
{
private const string PluginVersion = "1.3.2";
private const string DefinitionVersion = "1.1.0";
private const string PluginGuid = "example.howtofish.voltfin";
private const string BossId = "example.my_pack.voltfin";
private BossRegistrationHandle? _handle;
private bool _attempted;
private ConfigEntry<int> _health;
private ConfigEntry<float> _chancePercent;
private ConfigEntry<int> _lanceDamage;
private ConfigEntry<float> _normalCooldown;
private ConfigEntry<float> _overchargeCooldown;
private ConfigEntry<bool> _enableTestSummon;
private ConfigEntry<KeyboardShortcut> _testSummonKey;
private ConfigEntry<float> _testSummonDistance;
private int _settingsRevision;
private int _observedRevision;
private bool _settingsPending;
private float _applyAfter;
private void Awake()
{
BindConfiguration(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Config.SettingChanged += OnSettingChanged;
BossRegistry.RegistryReady += OnRegistryReady;
if (BossRegistry.IsReady)
{
RegisterContent();
}
}
private void BindConfiguration(ConfigFile config)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Expected O, but got Unknown
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Expected O, but got Unknown
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Expected O, but got Unknown
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
_health = config.Bind<int>("Balance", "BaseHealth", 2500, new ConfigDescription("Base health before game difficulty scaling. Menu choices: 500–10,000, step 100. Valid legacy values outside the menu's narrower controls are retained until you edit them. Host edits apply to future catches and newly spawned bosses after validation and synchronization; active encounters keep their values. Client edits change local preferences only, not the host's effective settings. Your CFG is never overwritten by the host. Check the log for accepted, queued or rejected status.", (AcceptableValueBase)(object)new MenuValueChoices<int>(HealthChoices(), (AcceptableValueBase?)(object)new AcceptableValueRange<int>(1, 100000)), Array.Empty<object>()));
_chancePercent = config.Bind<float>("Encounter", "SpawnChancePercent", 10f, new ConfigDescription("Chance per server-confirmed eligible Eel catch, in percent. Host edits apply to future catches and newly spawned bosses after validation and synchronization; active encounters keep their values. Client edits change local preferences only, not the host's effective settings. Your CFG is never overwritten by the host. Check the log for accepted, queued or rejected status.", (AcceptableValueBase)(object)new MenuValueRange<float>(0f, 100f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), 1.0), Array.Empty<object>()));
_lanceDamage = config.Bind<int>("Balance", "LanceDamage", 8, new ConfigDescription("Damage per Static Lance hit in either phase; native contact damage is unchanged. Valid legacy values outside the menu's narrower controls are retained until you edit them. Host edits apply to future catches and newly spawned bosses after validation and synchronization; active encounters keep their values. Client edits change local preferences only, not the host's effective settings. Your CFG is never overwritten by the host. Check the log for accepted, queued or rejected status.", (AcceptableValueBase)(object)new MenuValueRange<int>(1, 50, (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000)), Array.Empty<object>()));
_normalCooldown = config.Bind<float>("Abilities", "NormalCooldownSeconds", 6f, new ConfigDescription("Wait after recovery before the next Charged warning. Default cadence is about 8 seconds including the 2-second timeline. Menu: 3–15 seconds, step 0.5. Valid legacy values outside the menu's narrower controls are retained until you edit them. Host edits apply to future catches and newly spawned bosses after validation and synchronization; active encounters keep their values. Client edits change local preferences only, not the host's effective settings. Your CFG is never overwritten by the host. Check the log for accepted, queued or rejected status.", (AcceptableValueBase)(object)new MenuValueRange<float>(3f, 15f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 30f), 0.5), Array.Empty<object>()));
_overchargeCooldown = config.Bind<float>("Abilities", "OverchargeCooldownSeconds", 3f, new ConfigDescription("Wait after recovery before the next Overcharge warning. Default cadence is about 5 seconds; keep below NormalCooldownSeconds for a faster second phase. Menu: 3–15 seconds, step 0.5. Valid legacy values outside the menu's narrower controls are retained until you edit them. Host edits apply to future catches and newly spawned bosses after validation and synchronization; active encounters keep their values. Client edits change local preferences only, not the host's effective settings. Your CFG is never overwritten by the host. Check the log for accepted, queued or rejected status.", (AcceptableValueBase)(object)new MenuValueRange<float>(3f, 15f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 30f), 0.5), Array.Empty<object>()));
_enableTestSummon = config.Bind<bool>("Testing", "EnableTestSummon", false, "Enable this tutorial's local test shortcut. Disabled in public defaults. Only the host may summon; fishing probability and rod replacement are not tested by this shortcut.");
_testSummonKey = config.Bind<KeyboardShortcut>("Testing", "TestSummonKey", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Local keyboard shortcut for a host-only Voltfin test summon when EnableTestSummon is true.");
_testSummonDistance = config.Bind<float>("Testing", "TestSummonDistance", 8f, new ConfigDescription("Distance ahead of the local camera for test summoning, in metres. Face clear shallow water near sea level. This is not the fishing surface-entry transaction.", (AcceptableValueBase)(object)new MenuValueRange<float>(2f, 20f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 20f), 1.0), Array.Empty<object>()));
EnableMenuStepping(_chancePercent);
EnableMenuStepping(_normalCooldown);
EnableMenuStepping(_overchargeCooldown);
EnableMenuStepping(_testSummonDistance);
}
private static int[] HealthChoices()
{
int[] array = new int[96];
for (int i = 0; i < array.Length; i++)
{
array[i] = 500 + i * 100;
}
return array;
}
private static void EnableMenuStepping(ConfigEntry<float> entry)
{
if (((ConfigEntryBase)entry).Description.AcceptableValues is MenuValueRange<float> menuValueRange)
{
menuValueRange.EnableQuantization();
}
}
private void OnRegistryReady(object? sender, EventArgs args)
{
RegisterContent();
}
private void OnSettingChanged(object? sender, SettingChangedEventArgs args)
{
ConfigEntryBase changedSetting = args.ChangedSetting;
if ((object)changedSetting == _health || (object)changedSetting == _chancePercent || (object)changedSetting == _lanceDamage || (object)changedSetting == _normalCooldown || (object)changedSetting == _overchargeCooldown)
{
Interlocked.Increment(ref _settingsRevision);
}
}
private void Update()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Invalid comparison between Unknown and I4
TryTestSummon();
int num = Volatile.Read(in _settingsRevision);
if (num != _observedRevision)
{
_observedRevision = num;
_settingsPending = true;
_applyAfter = Time.realtimeSinceStartup + 0.35f;
}
if (!_settingsPending || Time.realtimeSinceStartup < _applyAfter || _handle == null || (int)_handle.State != 1)
{
return;
}
_settingsPending = false;
IReadOnlyList<BossSessionSettingUpdate> readOnlyList = CaptureUpdates();
if (Volatile.Read(in _settingsRevision) == num)
{
string text = default(string);
if (BossSessionSettings.TryUpdateLocal("example.my_pack.voltfin", readOnlyList, ref text))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Voltfin settings: " + text));
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Voltfin settings were not applied: " + text));
}
}
}
private void TryTestSummon()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
if (!_enableTestSummon.Value)
{
return;
}
KeyboardShortcut value = _testSummonKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
BossSpawnResult val = BossDebugSpawner.TrySpawn("example.my_pack.voltfin", _testSummonDistance.Value);
string text = "Voltfin test summon: " + ((object)val.FailureReason/*cast due to .constrained prefix*/).ToString() + " - " + val.Message;
if (val.Success)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)text);
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)text);
}
}
}
private IReadOnlyList<BossSessionSettingUpdate> CaptureUpdates()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
return (IReadOnlyList<BossSessionSettingUpdate>)(object)new BossSessionSettingUpdate[5]
{
BossSessionSettingUpdate.Int32("base_health", _health.Value),
BossSessionSettingUpdate.Float32("spawn_chance_percent", _chancePercent.Value),
BossSessionSettingUpdate.Int32("lance_damage", _lanceDamage.Value),
BossSessionSettingUpdate.Float32("normal_cooldown", _normalCooldown.Value),
BossSessionSettingUpdate.Float32("overcharge_cooldown", _overchargeCooldown.Value)
};
}
private void RegisterContent()
{
if (_attempted)
{
return;
}
_attempted = true;
BossRegistry.RegistryReady -= OnRegistryReady;
if (BossRegistry.IsRegistrationSealed)
{
((BaseUnityPlugin)this).Logger.LogError((object)"BossMakerAPI registration is sealed. Restart with this plugin loaded before creating a session.");
return;
}
BossTemplateDescriptor val = default(BossTemplateDescriptor);
if (!BossTemplateCatalog.TryGet("Eel", ref val) || val.IsBoss || !val.SupportsCatchTriggers || !val.SupportsVanillaRewardPreservation)
{
((BaseUnityPlugin)this).Logger.LogError((object)"A non-boss Eel with catch-adapter and reward-preservation support is required.");
return;
}
try
{
string templateName = val.TemplateName;
_handle = BossSessionSettings.Register(DeclareSettings(), (Func<BossSessionValues, BossDefinition>)((BossSessionValues values) => CreateDefinition(templateName, values)));
_handle.Changed += OnRegistrationChanged;
ReportRegistration(_handle);
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Voltfin session settings could not be registered safely: " + ex));
}
}
private IReadOnlyList<BossSessionSetting> DeclareSettings()
{
return (IReadOnlyList<BossSessionSetting>)(object)new BossSessionSetting[5]
{
BossSessionSetting.Int32("base_health", _health.Value, 2500, 1, 100000),
BossSessionSetting.Float32("spawn_chance_percent", _chancePercent.Value, 10f, 0f, 100f),
BossSessionSetting.Int32("lance_damage", _lanceDamage.Value, 8, 1, 1000),
BossSessionSetting.Float32("normal_cooldown", _normalCooldown.Value, 6f, 3f, 30f),
BossSessionSetting.Float32("overcharge_cooldown", _overchargeCooldown.Value, 3f, 3f, 30f)
};
}
private static BossDefinition CreateDefinition(string templateName, BossSessionValues values)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//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_005c: 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_0081: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_00ce: 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)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Expected O, but got Unknown
//IL_01a4: Expected O, but got Unknown
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Expected O, but got Unknown
BossDefinition val = new BossDefinition();
val.Id = "example.my_pack.voltfin";
val.ContentVersion = "1.1.0";
val.DisplayName = "Voltfin";
val.Persistence = new BossPersistenceDefinition
{
Mode = (BossPersistenceMode)2
};
val.Template = templateName;
val.Stats = new BossStatOverrides
{
MaxHealth = values.GetInt32("base_health"),
ScaleMultiplier = 1.2f,
VanillaCorpseValueMultiplier = 2f
};
val.ShowBossBar = true;
val.VanillaIntegration = new BossVanillaIntegrationDefinition
{
Mode = (BossVanillaMode)1,
DurationSeconds = 900f
};
val.RewardPolicy = (RewardPolicy)1;
BossEncounterDefinition val2 = new BossEncounterDefinition();
val2.MaximumOwnedMinions = 0;
val2.MaximumOwnedHazards = 0;
val2.MaximumConcurrentAbilities = 1;
val2.AquaticRecovery = new BossAquaticRecoveryDefinition
{
Enabled = true,
IgnoreHorizontalProgress = true
};
val2.CatchTriggers = (IReadOnlyList<BossCatchTriggerDefinition>)(object)new BossCatchTriggerDefinition[1]
{
new BossCatchTriggerDefinition
{
Id = "caught_eel",
CaughtTemplate = templateName,
Probability = values.GetFloat32("spawn_chance_percent") / 100f,
CooldownSeconds = 0f,
MaxActivations = 0,
ReplaceCatch = true,
ResetRodAfterReplacement = true,
IntroductionGraceSeconds = 3.5f,
MinimumSpawnDistance = 8f,
MaximumSpawnDistance = 12f,
RequireWater = true,
Placement = new BossPlacementDefinition
{
Mode = (BossPlacementMode)2,
UseBossBodyClearance = true,
LocalOffset = Vector3.zero,
ClearanceRadius = 0.35f,
MaximumAttempts = 12,
FailurePolicy = (BossPlacementFailurePolicy)0
}
}
};
val.Encounter = val2;
val.Abilities = Array.Empty<BossAbilityDefinition>();
BossPhaseDefinition[] array = new BossPhaseDefinition[2];
BossPhaseDefinition val3 = new BossPhaseDefinition();
val3.Id = "charged";
val3.DisplayName = "Charged";
val3.TriggerHealthFraction = 1f;
val3.Abilities = (IReadOnlyList<BossAbilityDefinition>)(object)new BossAbilityDefinition[1] { CreateStaticLance("static_lance", 4f, values.GetFloat32("normal_cooldown"), values.GetInt32("lance_damage")) };
array[0] = val3;
val3 = new BossPhaseDefinition();
val3.Id = "overcharge";
val3.DisplayName = "Overcharge";
val3.TriggerHealthFraction = 0.5f;
val3.Abilities = (IReadOnlyList<BossAbilityDefinition>)(object)new BossAbilityDefinition[1] { CreateStaticLance("static_lance_overcharged", 3f, values.GetFloat32("overcharge_cooldown"), values.GetInt32("lance_damage")) };
array[1] = val3;
val.Phases = (IReadOnlyList<BossPhaseDefinition>)(object)array;
val.Rewards = Array.Empty<BossRewardDefinition>();
return val;
}
private static BossAbilityDefinition CreateStaticLance(string id, float initialDelay, float cooldown, int damage)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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_0059: 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_0066: 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_007d: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_009f: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
BossAbilityDefinition val = new BossAbilityDefinition();
val.Id = id;
val.Trigger = (BossAbilityTrigger)3;
val.InitialDelaySeconds = initialDelay;
val.CooldownSeconds = cooldown;
val.MaxRepeats = 511;
val.Timeline = new BossAbilityTimelineDefinition
{
TelegraphDurationSeconds = 1.2f,
ResolveDurationSeconds = 0f,
RecoveryDurationSeconds = 0.8f
};
val.TargetSelector = new BossTargetSelectorDefinition
{
Kind = (BossTargetSelectorKind)1,
MaximumRange = 12f,
LockPositionAtTelegraph = true
};
val.Geometry = (BossAbilityGeometryDefinition)new LineGeometryDefinition
{
Length = 12f,
Width = 2f
};
val.Telegraph = new BossTelegraphDefinition
{
Color = new Color(0.1f, 0.8f, 1f, 0.65f),
BorderColor = Color.white,
PulseFrequency = 2f,
UseColorBlindPattern = true
};
val.Actions = (IReadOnlyList<BossActionDefinition>)(object)new BossActionDefinition[1] { (BossActionDefinition)new AreaDamageAction
{
Id = id + "_damage",
Damage = damage,
DurationSeconds = 0f,
MaxHitsPerTarget = 1,
VerticalTolerance = 4f
} };
return val;
}
private void OnRegistrationChanged(object? sender, BossRegistrationChangedEventArgs args)
{
ReportRegistration(args.Handle);
}
private void ReportRegistration(BossRegistrationHandle handle)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
((BaseUnityPlugin)this).Logger.LogInfo((object)(handle.Definition.Id + ": " + ((object)handle.State/*cast due to .constrained prefix*/).ToString() + " - " + handle.Message));
}
private void OnDestroy()
{
((BaseUnityPlugin)this).Config.SettingChanged -= OnSettingChanged;
BossRegistry.RegistryReady -= OnRegistryReady;
if (_handle != null)
{
_handle.Changed -= OnRegistrationChanged;
}
}
}
namespace SkyLiN3.Configuration
{
internal sealed class MenuValueRange<T> : AcceptableValueBase where T : struct, IComparable
{
private readonly double _minimum;
private readonly double _maximum;
private readonly double _step;
private bool _quantizationEnabled;
public T MinValue { get; }
public T MaxValue { get; }
internal AcceptableValueBase TechnicalRange { get; }
internal MenuValueRange(T minimum, T maximum, AcceptableValueBase technicalRange, double step = 0.0)
: base(typeof(T))
{
if (!IsNumericType(typeof(T)))
{
throw new ArgumentException("Menu ranges require a supported numeric type.");
}
TechnicalRange = technicalRange ?? throw new ArgumentNullException("technicalRange");
if (technicalRange.ValueType != typeof(T))
{
throw new ArgumentException("The technical range must validate the same value type.", "technicalRange");
}
_minimum = Convert.ToDouble(minimum, CultureInfo.InvariantCulture);
_maximum = Convert.ToDouble(maximum, CultureInfo.InvariantCulture);
if (!IsFinite(_minimum) || !IsFinite(_maximum) || !IsFinite(_maximum - _minimum) || _maximum <= _minimum || !technicalRange.IsValid((object)minimum) || !technicalRange.IsValid((object)maximum))
{
throw new ArgumentException("Menu endpoints must be finite, ordered and technically valid.");
}
if (!IsFinite(step) || step < 0.0 || step > _maximum - _minimum || (step > 0.0 && !IsFinite((_maximum - _minimum) / step)) || (IsIntegralType(typeof(T)) && step != Math.Truncate(step)))
{
throw new ArgumentOutOfRangeException("step", "The step must be finite, nonnegative and fit the menu range and value type.");
}
MinValue = minimum;
MaxValue = maximum;
_step = step;
}
internal void EnableQuantization()
{
_quantizationEnabled = true;
}
public override object Clamp(object value)
{
object obj = TechnicalRange.Clamp(value);
if (!_quantizationEnabled || _step == 0.0 || !(obj is T))
{
return obj;
}
double num = Convert.ToDouble(obj, CultureInfo.InvariantCulture);
if (!IsFinite(num) || num < _minimum || num > _maximum)
{
return obj;
}
double val = _minimum + Math.Round((num - _minimum) / _step, MidpointRounding.AwayFromZero) * _step;
val = Math.Max(_minimum, Math.Min(_maximum, val));
object obj2 = Convert.ChangeType(val, typeof(T), CultureInfo.InvariantCulture);
return TechnicalRange.Clamp(obj2);
}
public override bool IsValid(object value)
{
return TechnicalRange.IsValid(value);
}
public override string ToDescriptionString()
{
return TechnicalRange.ToDescriptionString() + "\n# Suggested menu range: " + Convert.ToString(MinValue, CultureInfo.InvariantCulture) + " to " + Convert.ToString(MaxValue, CultureInfo.InvariantCulture) + ". Technically valid saved values outside this range are preserved.";
}
private static bool IsFinite(double value)
{
if (!double.IsNaN(value))
{
return !double.IsInfinity(value);
}
return false;
}
private static bool IsIntegralType(Type type)
{
if (!(type == typeof(byte)) && !(type == typeof(short)) && !(type == typeof(int)))
{
return type == typeof(long);
}
return true;
}
private static bool IsNumericType(Type type)
{
if (!IsIntegralType(type) && !(type == typeof(float)) && !(type == typeof(double)))
{
return type == typeof(decimal);
}
return true;
}
}
internal sealed class MenuValueChoices<T> : AcceptableValueBase
{
private readonly T[] _choices;
private readonly AcceptableValueBase? _technicalValidation;
public T[] AcceptableValues => (T[])_choices.Clone();
internal MenuValueChoices(T[] choices, AcceptableValueBase? technicalValidation = null)
: base(typeof(T))
{
if (choices == null)
{
throw new ArgumentNullException("choices");
}
if (choices.Length == 0 || choices.Length > 256)
{
throw new ArgumentException("Supply between 1 and 256 menu choices.", "choices");
}
if (technicalValidation != null && technicalValidation.ValueType != typeof(T))
{
throw new ArgumentException("Technical validation must use the same value type.", "technicalValidation");
}
HashSet<T> hashSet = new HashSet<T>();
foreach (T val in choices)
{
if (val == null || !hashSet.Add(val) || (val is float f && (float.IsNaN(f) || float.IsInfinity(f))) || (val is double d && (double.IsNaN(d) || double.IsInfinity(d))) || (technicalValidation != null && !technicalValidation.IsValid((object)val)))
{
throw new ArgumentException("Menu choices must be non-null, distinct and technically valid.", "choices");
}
}
_choices = (T[])choices.Clone();
_technicalValidation = technicalValidation;
}
public override object Clamp(object value)
{
if (_technicalValidation != null)
{
return _technicalValidation.Clamp(value);
}
if (!(value is T))
{
throw new ArgumentException("Unexpected configuration value type.", "value");
}
return value;
}
public override bool IsValid(object value)
{
AcceptableValueBase? technicalValidation = _technicalValidation;
if (technicalValidation == null)
{
return value is T;
}
return technicalValidation.IsValid(value);
}
public override string ToDescriptionString()
{
AcceptableValueBase? technicalValidation = _technicalValidation;
return (((technicalValidation != null) ? technicalValidation.ToDescriptionString() : null) ?? "# Values use the setting's own runtime validation.") + "\n# Suggested menu choices: " + string.Join(", ", Array.ConvertAll(_choices, (T value) => Convert.ToString(value, CultureInfo.InvariantCulture))) + ". Saved values outside this list are preserved by the technical validation policy.";
}
}
}