Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ServersideQoL PhoenixPersons v2.1.0
ServersideQoL.PhoenixPersons.dll
Decompiled 17 hours agousing System; using System.Collections.Generic; 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 Microsoft.CodeAnalysis; using ServersideQoL.Processors; using ServersideQoL.Utilities; 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("ArgusMagnus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("ArgusMagnus")] [assembly: AssemblyDescription("Resurrect your fallen friends and let them rise from the ashes of defeat and despair")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+204f9f33466a3fbfe830fe172b162a96aaba64cd")] [assembly: AssemblyProduct("ServersideQoL.PhoenixPersons")] [assembly: AssemblyTitle("ServersideQoL.PhoenixPersons")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.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.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; } } } namespace ServersideQoL.PhoenixPersons { public sealed class Config : ConfigBase<Config> { public sealed class AdvancedConfig { public float TombStoneProcessingIntervalSeconds { get; init; } = 1f; } public sealed class LocalizationConfig { private string SummoningMessage { get; init; } = "Summoning ready in {0:F0}"; private string AwaitingAcceptanceMessage { get; init; } = "Waiting for {0} to accept the summon"; private string BeingSummonedMessage { get; init; } = "You're being summoned to your tombstone by {0} in {1:F0}"; private string AcceptSummonMessage { get; init; } = "{0} is trying to summon you to your tombstone. {1} to accept"; public string FormatSummoningMessage(float delay) { return string.Format(SummoningMessage, delay); } public string FormatAwaitingAcceptanceMessage(string playerName) { return string.Format(AwaitingAcceptanceMessage, playerName); } public string FormatBeingSummonedMessage(string summonerName, float delay) { return string.Format(BeingSummonedMessage, summonerName, delay); } public string FormatAcceptSummonMessage(string summonerName, Emotes emote) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return string.Format(AcceptSummonMessage, summonerName, emote); } } public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated<Config>)null, "Enabled"); public ConfigEntry<float> SummoningRange { get; } = ConfigBase<Config>.BindEx<float>(cfg, 10f, "A player must be withint this range around a tombstone to be able to summon the tombstone's owner", (AcceptableValueBase)null, (Deprecated<Config>)null, "SummoningRange"); public ConfigEntry<float> SummoningDurationSeconds { get; } = ConfigBase<Config>.BindEx<float>(cfg, 3f, "How long it takes (seconds) to summon the tombstone's owner", (AcceptableValueBase)null, (Deprecated<Config>)null, "SummoningDurationSeconds"); public ConfigEntry<Emotes> SummoningEmote { get; } = ConfigBase<Config>.BindEx<Emotes>(cfg, (Emotes)1, "The summoner needs to perform this emote near the tombstone,\r\nthe player being summoned needs to perform this emote to accept.", (AcceptableValueBase)(object)new AcceptableEnum<Emotes>(typeof(Emotes).GetFields(BindingFlags.Static | BindingFlags.Public).Where(delegate(FieldInfo x) { Emote customAttribute = ((MemberInfo)x).GetCustomAttribute<Emote>(); return customAttribute != null && !customAttribute.OneShot; }).Select((Func<FieldInfo, Emotes>)((FieldInfo x) => (Emotes)x.GetRawConstantValue()))), (Deprecated<Config>)null, "SummoningEmote"); public YamlConfigEntry<AdvancedConfig> Advanced { get; } = ConfigBase<Config>.BindYaml<AdvancedConfig>(cfg, "Advanced"); public YamlConfigEntry<LocalizationConfig> Localization { get; } = ConfigBase<Config>.BindYaml<LocalizationConfig>(cfg, "Localization"); public Config(ConfigFile cfg, Logger logger) : base(cfg, logger) { } } [BepInPlugin("ArgusMagnus.ServersideQoL.PhoenixPersons", "ServersideQoL.PhoenixPersons", "2.1.0")] public sealed class PhoenixPersonsPlugin : ServersideQoLPluginBase<PhoenixPersonsPlugin, Config> { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.PhoenixPersons"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.PhoenixPersons"; public const string PluginVersion = "2.1.0"; public const string PluginInformationalVersion = "2.1.0"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639259375552903875L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.Add<TombStoneProcessor>(); } private void Awake() { } } [Processor("ad7d3aa5-07a0-4618-a762-19697365e75c")] [DependsOn<PlayerRegistryProcessor>] public sealed class TombStoneProcessor : Processor<ProcessorPrefabInfo<TombStone>> { private sealed class State(Timestamp summoningFinished) { public Timestamp SummoningFinished { get; } = summoningFinished; } public const string Id = "ad7d3aa5-07a0-4618-a762-19697365e75c"; private readonly Dictionary<ServersideQoLZDO, State> _summoningPlayers = new Dictionary<ServersideQoLZDO, State>(); protected override void Initialize() { _summoningPlayers.Clear(); Processor.Instance<PlayerRegistryProcessor>().EmoteDetected -= OnEmoteDetected; Processor.Instance<PlayerRegistryProcessor>().EmoteDetected += OnEmoteDetected; } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, ProcessorPrefabInfo<TombStone> prefabInfo) { //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) //IL_0025: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008a: 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_0362: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) float num = ConfigBase<Config>.Instance.Advanced.Value.TombStoneProcessingIntervalSeconds; PlayerRegistryProcessor obj = Processor.Instance<PlayerRegistryProcessor>(); ZDOVars vars = zdo.Vars; PlayerState stateForPlayerID = obj.GetStateForPlayerID(((ZDOVars)(ref vars)).GetOwner(default(PlayerID))); if (stateForPlayerID == null) { return ((Processor)this).ScheduleReprocessing(num); } if (Utils.DistanceXZ(zdo.ZDO.GetPosition(), stateForPlayerID.ZDO.ZDO.GetPosition()) <= ConfigBase<Config>.Instance.SummoningRange.Value) { return ((Processor)this).ScheduleReprocessing(num); } Enumerator<Peer> enumerator = ListExtensions.Enumerate<Peer>(peers).GetEnumerator(); try { while (enumerator.MoveNext()) { Peer current = enumerator.Current; PlayerState playerState = current.PlayerState; if (playerState == null || !_summoningPlayers.TryGetValue(playerState.ZDO, out State value)) { continue; } vars = playerState.ZDO.Vars; if (((ZDOVars)(ref vars)).GetEmote((Emotes)(-1)) != ConfigBase<Config>.Instance.SummoningEmote.Value) { _summoningPlayers.Remove(playerState.ZDO); playerState.ZDO.Destroyed -= OnPlayerDestroyed; } else { if (Utils.DistanceXZ(zdo.ZDO.GetPosition(), playerState.ZDO.ZDO.GetPosition()) > ConfigBase<Config>.Instance.SummoningRange.Value) { continue; } Timestamp val = value.SummoningFinished; float seconds = ((Timestamp)(ref val)).Seconds; val = Timestamp.Now; float num2 = seconds - ((Timestamp)(ref val)).Seconds; if (num2 > 0f) { num = Mathf.Min(1f, Mathf.Min(num, num2)); RPC.ShowMessage(current, (MessageType)2, ConfigBase<Config>.Instance.Localization.Value.FormatSummoningMessage(num2)); vars = stateForPlayerID.ZDO.Vars; if (((ZDOVars)(ref vars)).GetEmote((Emotes)(-1)) == ConfigBase<Config>.Instance.SummoningEmote.Value) { RPC.ShowMessage(stateForPlayerID.Owner, (MessageType)2, ConfigBase<Config>.Instance.Localization.Value.FormatBeingSummonedMessage(playerState.PlayerName, num2)); } else { RPC.ShowMessage(stateForPlayerID.Owner, (MessageType)2, ConfigBase<Config>.Instance.Localization.Value.FormatAcceptSummonMessage(playerState.PlayerName, ConfigBase<Config>.Instance.SummoningEmote.Value)); } continue; } vars = stateForPlayerID.ZDO.Vars; if (((ZDOVars)(ref vars)).GetEmote((Emotes)(-1)) != ConfigBase<Config>.Instance.SummoningEmote.Value) { num = Mathf.Min(1f, num); RPC.ShowMessage(stateForPlayerID.Owner, (MessageType)2, ConfigBase<Config>.Instance.Localization.Value.FormatAcceptSummonMessage(playerState.PlayerName, ConfigBase<Config>.Instance.SummoningEmote.Value)); RPC.ShowMessage(current, (MessageType)2, ConfigBase<Config>.Instance.Localization.Value.FormatAwaitingAcceptanceMessage(stateForPlayerID.PlayerName)); continue; } Vector3 position = playerState.ZDO.ZDO.GetPosition(); position.y += 2f; ZDORpc rPC = stateForPlayerID.ZDO.RPC; PlayerRpc player = ((ZDORpc)(ref rPC)).Player; ((PlayerRpc)(ref player)).TeleportTo(position, playerState.ZDO.ZDO.GetRotation(), false); _summoningPlayers.Remove(playerState.ZDO); playerState.ZDO.Destroyed -= OnPlayerDestroyed; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return ((Processor)this).ScheduleReprocessing(num); } private void OnEmoteDetected(PlayerState playerState, Emotes emote) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) if (ConfigBase<Config>.Instance.SummoningEmote.Value != emote) { _summoningPlayers.Remove(playerState.ZDO); playerState.ZDO.Destroyed -= OnPlayerDestroyed; return; } Dictionary<ServersideQoLZDO, State> summoningPlayers = _summoningPlayers; ServersideQoLZDO zDO = playerState.ZDO; Timestamp now = Timestamp.Now; if (summoningPlayers.TryAdd(zDO, new State(((Timestamp)(ref now)).AddSeconds(ConfigBase<Config>.Instance.SummoningDurationSeconds.Value)))) { playerState.ZDO.Destroyed += OnPlayerDestroyed; } } private void OnPlayerDestroyed(ServersideQoLZDO zdo) { _summoningPlayers.Remove(zdo); } } }