using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; 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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArgusMagnus")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("ArgusMagnus")] [assembly: AssemblyDescription("Configure some apsects around the player (e.g. infinite stamina for various activities, methods to permanently unlock item effects such as increased carry weight)")] [assembly: AssemblyFileVersion("1.99.4.0")] [assembly: AssemblyInformationalVersion("1.99.4-beta+80c81ad250a0109e44b175db632e72dae9da8db5")] [assembly: AssemblyProduct("ServersideQoL.Player")] [assembly: AssemblyTitle("ServersideQoL.Player")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("1.99.4.0")] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlyList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Count; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Count; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Count; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyList(List items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return _items.Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return _items.IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } 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.Player { public sealed class Config : ConfigBase { public sealed class LocalizationConfig { public string SacrificedMegingjord { get; init; } = "You were permanently granted increased carrying weight"; public string SacrificedCryptKey { get; init; } = "You were permanently granted the ability to open sunken crypt doors"; public string SacrificedWishbone { get; init; } = "You were permanently granted the ability to sense hidden objects"; public string SacrificedTornSpirit { get; init; } = "You were permanently granted a wisp companion"; } private const string Section = "Player"; public override ConfigEntry Enabled { get; } = ConfigBase.BindEx(cfg, "Player", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated)null, "Enabled"); public ConfigEntry InfiniteBuildingStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("building"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteBuildingStamina"); public ConfigEntry InfiniteFarmingStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("farming"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteFarmingStamina"); public ConfigEntry InfiniteMiningStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("mining"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteMiningStamina"); public ConfigEntry InfiniteWoodCuttingStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("cutting wood"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteWoodCuttingStamina"); public ConfigEntry InfiniteEncumberedStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("encumbered"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteEncumberedStamina"); public ConfigEntry InfiniteSneakingStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("sneaking"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteSneakingStamina"); public ConfigEntry InfiniteSwimmingStamina { get; } = ConfigBase.BindEx(cfg, "Player", false, GetInfiniteXDescription("swimming"), (AcceptableValueBase)null, (Deprecated)null, "InfiniteSwimmingStamina"); public ConfigEntry OpenCartEmote { get; } public ConfigEntry CanSacrificeMegingjord { get; } public ConfigEntry CanSacrificeCryptKey { get; } public ConfigEntry CanSacrificeWishbone { get; } public ConfigEntry CanSacrificeTornSpirit { get; } public YamlConfigEntry Localization { get; } public Config(ConfigFile cfg, Logger logger) { string text = $"Emote to open the inventory of an attached cart.\r\n{(object)(Emotes)(-1)} to disable this feature, {(object)(Emotes)(-2)} to use any emote as trigger.\r\nYou can bind emotes to buttons with chat commands.\r\nFor example, on xbox you can bind the Y-Button to the wave-emote by entering \"/bind JoystickButton3 {(object)(Emotes)0}\" in the in-game chat.\r\nIf you use emotes exclusively for this feature, it is recommended to set the value to {(object)(Emotes)(-2)} as it is more reliably detected than specific emotes, especially on bad connection/with crossplay."; List list = new List(); list.Add((Emotes)(-1)); list.Add((Emotes)(-2)); list.AddRange(Enum.GetValues(typeof(Emotes)).Cast()); OpenCartEmote = ConfigBase.BindEx(cfg, "Player", (Emotes)(-1), text, (AcceptableValueBase)(object)new AcceptableEnum((IEnumerable)new <>z__ReadOnlyList(list)), (Deprecated)null, "OpenCartEmote"); CanSacrificeMegingjord = ConfigBase.BindEx(cfg, "Player", false, "If true, players can permanently unlock increased carrying weight by sacrificing a megingjord in an obliterator", (AcceptableValueBase)null, (Deprecated)null, "CanSacrificeMegingjord"); CanSacrificeCryptKey = ConfigBase.BindEx(cfg, "Player", false, "If true, players can permanently unlock the ability to open sunken crypt doors by sacrificing a crypt key in an obliterator", (AcceptableValueBase)null, (Deprecated)null, "CanSacrificeCryptKey"); CanSacrificeWishbone = ConfigBase.BindEx(cfg, "Player", false, "If true, players can permanently unlock the ability to sense hidden objects by sacrificing a wishbone in an obliterator", (AcceptableValueBase)null, (Deprecated)null, "CanSacrificeWishbone"); CanSacrificeTornSpirit = ConfigBase.BindEx(cfg, "Player", false, "If true, players can permanently unlock a wisp companion by sacrificing a torn spirit in an obliterator. WARNING: Wisp companion cannot be unsummoned and will stay as long as this setting is enabled.", (AcceptableValueBase)null, (Deprecated)null, "CanSacrificeTornSpirit"); Localization = ConfigBase.BindYaml(cfg, "Localization"); base..ctor(cfg, logger); } private static string GetInfiniteXDescription(string action) { return FormattableString.Invariant(FormattableStringFactory.Create("True to give players infinite stamina when {0}.\r\nPlayer stamina will still be drained, but when nearly depleted, just enough stamina will be restored to continue indefinitely.\r\nIf you want infinite stamina in general, set the global key '{1}' to 0.", action, "StaminaRate")); } } [Processor("28b93edf-6ede-4dbe-92ed-99275be3915f")] public sealed class CryptDoorProcessor : Processor { public sealed record PrefabInfo(Door Door) : ProcessorPrefabInfo() { [CompilerGenerated] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("PrefabInfo"); stringBuilder.Append(" { "); if (((ProcessorPrefabInfo)this).PrintMembers(stringBuilder)) { stringBuilder.Append(' '); } stringBuilder.Append('}'); return stringBuilder.ToString(); } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { if (((ProcessorPrefabInfo)this).PrintMembers(builder)) { builder.Append(", "); } builder.Append("Door = "); builder.Append(Door); return true; } [CompilerGenerated] public override int GetHashCode() { return ((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer.Default.GetHashCode(Door); } [CompilerGenerated] public sealed override bool Equals(ProcessorPrefabInfo? other) { return ((object)this).Equals((object?)other); } [CompilerGenerated] public bool Equals(PrefabInfo? other) { return (object)this == other || (((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other) && EqualityComparer.Default.Equals(Door, other.Door)); } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { Door = original.Door; } } private readonly List _allowedPlayers = new List(); private readonly Dictionary _keyItemWeightByHash = new Dictionary(); private readonly IEnumerable _visEquipmentVars = new <>z__ReadOnlyArray(new int[9] { ZDOVars.s_helmetItem, ZDOVars.s_chestItem, ZDOVars.s_legItem, ZDOVars.s_shoulderItem, ZDOVars.s_utilityItem, ZDOVars.s_leftItem, ZDOVars.s_rightItem, ZDOVars.s_leftBackItem, ZDOVars.s_rightBackItem }); protected override void Initialize() { _allowedPlayers.Clear(); _keyItemWeightByHash.Clear(); } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, PrefabInfo prefabInfo) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_032d: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) ItemDrop keyItem = prefabInfo.Door.m_keyItem; if (keyItem != null && ((Object)keyItem).name == "CryptKey") { ZDOVars vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetState(0) == 0) { ComponentFieldAccessor val = zdo.Fields(); if (!ConfigBase.Instance.CanSacrificeCryptKey.Value) { val.Reset((Func>>)(() => (Door x) => x.m_keyItem), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Player\\CryptDoorProcessor.cs", 33); return (ProcessResult)2; } _allowedPlayers.Clear(); if (ZoneSystem.instance.GetGlobalKey((GlobalKeys)36)) { foreach (Peer peer in peers) { if (!(Vector3.Distance(peer.RefPos, zdo.ZDO.GetPosition()) > 16f)) { PlayerState playerState = peer.PlayerState; if (playerState != null && PlayerProcessor.GetSacrifiedCryptKey(playerState.PlayerID)) { _allowedPlayers.Add(playerState.ZDO); } } } } if (_allowedPlayers.Count == 0) { if (val.UpdateResetValue((Func>>)(() => (Door x) => x.m_keyItem), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Player\\CryptDoorProcessor.cs", 51)) { return (ProcessResult)8; } } else { int num = 0; int num2 = 0; _keyItemWeightByHash.Clear(); foreach (int visEquipmentVar in _visEquipmentVars) { foreach (ServersideQoLZDO allowedPlayer in _allowedPlayers) { int num3 = allowedPlayer.ZDO.GetInt(visEquipmentVar, 0); if (num3 != 0) { int value = ((!_keyItemWeightByHash.TryGetValue(num3, out value)) ? 1 : (value + 1)); _keyItemWeightByHash[num3] = value; if (value > num) { num = value; num2 = num3; } } } } _keyItemWeightByHash.Clear(); _allowedPlayers.Clear(); if (num2 != 0) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(num2); ItemDrop val2 = ((itemPrefab != null) ? itemPrefab.GetComponent() : null); if (val2 != null) { if (val.UpdateValue((Func>>)(() => (Door x) => x.m_keyItem), val2, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Player\\CryptDoorProcessor.cs", 83)) { return (ProcessResult)8; } goto IL_0328; } } ((Processor)this).Logger.LogWarning((object)$"Item {num2} was chosen as key, but it's not a valid ItemDrop"); } goto IL_0328; } } return (ProcessResult)2; IL_0328: return (ProcessResult)0; } } [BepInPlugin("ArgusMagnus.ServersideQoL.Player", "ServersideQoL.Player", "1.99.4")] public sealed class PlayerPlugin : ServersideQoLPluginBase { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.Player"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.Player"; public const string PluginVersion = "1.99.4"; public const string PluginInformationalVersion = "1.99.4-beta"; internal const string DependencyDirectory = "C:\\repos\\Valheim.ServersideQoL\\Dependencies\\"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639209323753416586L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.Add().Add().Add(); } private void Awake() { bool flag = true; ServersideQoLPluginBase.Logger.LogWarning((object)string.Format("You are running a pre-release version: {0} ({1})", "1.99.4-beta", BuildTimestamp.LocalDateTime)); } } [Processor("7b156eea-3364-40ca-83ad-417a55fa6e4b")] [DependsOn] public sealed class PlayerProcessor : Processor { private readonly Dictionary _attachedCartsByPlayer = new Dictionary(); protected override void Initialize() { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Invalid comparison between Unknown and I4 //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown bool flag = false; if (Game.m_staminaRate > 0f) { flag = ConfigBase.Instance.InfiniteBuildingStamina.Value || ConfigBase.Instance.InfiniteFarmingStamina.Value || ConfigBase.Instance.InfiniteMiningStamina.Value || ConfigBase.Instance.InfiniteWoodCuttingStamina.Value; } Intercept.UpdateInterception("SetTrigger", (Delegate)new Action(OnZSyncAnimationSetTrigger), flag); Intercept.UpdateInterception("RPC_AnimateLever", (Delegate)new Action(RPC_AnimateLever), ConfigBase.Instance.CanSacrificeMegingjord.Value || ConfigBase.Instance.CanSacrificeCryptKey.Value || ConfigBase.Instance.CanSacrificeWishbone.Value || ConfigBase.Instance.CanSacrificeTornSpirit.Value); Processor.Instance().StaminaUpdated -= new StaminaUpdatedHandler(OnPlayerStaminaUpdated); if (ConfigBase.Instance.InfiniteEncumberedStamina.Value || ConfigBase.Instance.InfiniteSneakingStamina.Value || ConfigBase.Instance.InfiniteSwimmingStamina.Value) { Processor.Instance().StaminaUpdated += new StaminaUpdatedHandler(OnPlayerStaminaUpdated); } Processor.Instance().EmoteDetected -= OnEmoteDetected; if ((int)ConfigBase.Instance.OpenCartEmote.Value != -1) { Processor.Instance().EmoteDetected += OnEmoteDetected; } _attachedCartsByPlayer.Clear(); } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, PrefabInfo prefabInfo) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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) PlayerState state = Processor.Instance().GetState(zdo); if (state == null) { return (ProcessResult)2; } if (ConfigBase.Instance.CanSacrificeMegingjord.Value && GetSacrifiedMegingjord(state.PlayerID)) { RPC.AddStatusEffect(zdo, StatusEffects.Megingjord, false, 0, 0f); } if (ConfigBase.Instance.CanSacrificeWishbone.Value && GetSacrifiedWishbone(state.PlayerID)) { RPC.AddStatusEffect(zdo, StatusEffects.Wishbone, false, 0, 0f); } if (ConfigBase.Instance.CanSacrificeTornSpirit.Value && GetSacrifiedTornSpirit(state.PlayerID)) { RPC.AddStatusEffect(zdo, StatusEffects.Demister, false, 0, 0f); } RPC.AddStatusEffect(zdo, StringExtensionMethods.GetStableHashCode("Rested", true), false, 0, 0f); return (ProcessResult)2; } private void OnPlayerStaminaUpdated(ServersideQoLZDO zdo, PlayerState state, bool staminaValueChanged) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (staminaValueChanged) { return; } ZDOVars vars; if ((float)state.Stamina < state.PrefabInfo.Player.m_encumberedStaminaDrain && ConfigBase.Instance.InfiniteEncumberedStamina.Value) { vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetAnimationIsEncumbered(false)) { RPC.UseStamina(zdo, 0f - state.PrefabInfo.Player.m_encumberedStaminaDrain); return; } } if ((float)state.Stamina < state.PrefabInfo.Player.m_sneakStaminaDrain && ConfigBase.Instance.InfiniteSneakingStamina.Value) { vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetAnimationIsCrouching(false)) { RPC.UseStamina(zdo, 0f - state.PrefabInfo.Player.m_sneakStaminaDrain); return; } } if ((float)state.Stamina < state.PrefabInfo.Player.m_swimStaminaDrainMinSkill && ConfigBase.Instance.InfiniteSwimmingStamina.Value) { vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetAnimationInWater(false)) { RPC.UseStamina(zdo, 0f - state.PrefabInfo.Player.m_swimStaminaDrainMinSkill); } } } private void OnZSyncAnimationSetTrigger(RoutedRPCData data, string name) { //IL_0007: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) PlayerState stateForCharacterID = Processor.Instance().GetStateForCharacterID(data.m_targetZDO); if (stateForCharacterID == null) { return; } ItemDrop val = null; ZDOVars vars = stateForCharacterID.ZDO.Vars; int rightItem = ((ZDOVars)(ref vars)).GetRightItem(0); if (rightItem != 0) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(rightItem); val = ((itemPrefab != null) ? itemPrefab.GetComponent() : null); if (val == null) { ((Processor)this).Logger.LogWarning((object)$"Player {stateForCharacterID.PlayerName}: SetTrigger({name}): Right item prefab '{rightItem}' not found"); } } if (val != null && CheckStamina(name)) { float attackStamina = val.m_itemData.m_shared.m_attack.m_attackStamina; vars = stateForCharacterID.ZDO.Vars; if (((ZDOVars)(ref vars)).GetStamina(0f) < 2f * attackStamina) { RPC.UseStamina(stateForCharacterID.ZDO, 0f - attackStamina); } } static bool CheckStamina(string triggerName) { switch (triggerName) { case "swing_pickaxe": return ConfigBase.Instance.InfiniteMiningStamina.Value; case "swing_hammer": return ConfigBase.Instance.InfiniteBuildingStamina.Value; case "swing_hoe": case "scything": return ConfigBase.Instance.InfiniteFarmingStamina.Value; case "swing_axe0": case "battleaxe_attack0": case "dualaxes0": return ConfigBase.Instance.InfiniteWoodCuttingStamina.Value; default: return false; } } } private void RPC_AnimateLever(ServersideQoLZDO zdo, RoutedRPCData data) { ContainerState state = Processor.Instance().GetState(zdo); if (state == null) { return; } PrefabInfo prefabInfo = state.PrefabInfo; if (prefabInfo == null || prefabInfo.Incinerator == null) { return; } PlayerState val = null; IInventory val2 = null; if (ConfigBase.Instance.CanSacrificeMegingjord.Value && (val2 ?? (val2 = state.GetInventory())).Items.Any(delegate(ItemData x) { GameObject dropPrefab = x.m_dropPrefab; return ((dropPrefab != null) ? ((Object)dropPrefab).name : null) == "BeltStrength"; })) { if (val == null) { val = Processor.Instance().GetStateForPeerID(data.m_senderPeerID); } if (val == null) { ((Processor)this).Logger.LogError((object)$"Player ZDO with peer ID {data.m_senderPeerID} not found"); } else { SetSacrifiedMegingjord(val.PlayerID, value: true); RPC.AddStatusEffect(val.ZDO, StatusEffects.Megingjord, false, 0, 0f); RPC.ShowMessage(data.m_senderPeerID, (MessageType)2, ConfigBase.Instance.Localization.Value.SacrificedMegingjord); } } if (ConfigBase.Instance.CanSacrificeCryptKey.Value && (val2 ?? (val2 = state.GetInventory())).Items.Any(delegate(ItemData x) { GameObject dropPrefab = x.m_dropPrefab; return ((dropPrefab != null) ? ((Object)dropPrefab).name : null) == "CryptKey"; })) { if (val == null) { val = Processor.Instance().GetStateForPeerID(data.m_senderPeerID); } if (val == null) { ((Processor)this).Logger.LogError((object)$"Player ZDO with peer ID {data.m_senderPeerID} not found"); } else { SetSacrifiedCryptKey(val.PlayerID, value: true); RPC.ShowMessage(data.m_senderPeerID, (MessageType)2, ConfigBase.Instance.Localization.Value.SacrificedCryptKey); } } if (ConfigBase.Instance.CanSacrificeWishbone.Value && (val2 ?? (val2 = state.GetInventory())).Items.Any(delegate(ItemData x) { GameObject dropPrefab = x.m_dropPrefab; return ((dropPrefab != null) ? ((Object)dropPrefab).name : null) == "Wishbone"; })) { if (val == null) { val = Processor.Instance().GetStateForPeerID(data.m_senderPeerID); } if (val == null) { ((Processor)this).Logger.LogError((object)$"Player ZDO with peer ID {data.m_senderPeerID} not found"); } else { SetSacrifiedWishbone(val.PlayerID, value: true); RPC.AddStatusEffect(val.ZDO, StatusEffects.Wishbone, false, 0, 0f); RPC.ShowMessage(data.m_senderPeerID, (MessageType)2, ConfigBase.Instance.Localization.Value.SacrificedWishbone); } } if (ConfigBase.Instance.CanSacrificeTornSpirit.Value && (val2 ?? (val2 = state.GetInventory())).Items.Any(delegate(ItemData x) { GameObject dropPrefab = x.m_dropPrefab; return ((dropPrefab != null) ? ((Object)dropPrefab).name : null) == "YagluthDrop"; })) { if (val == null) { val = Processor.Instance().GetStateForPeerID(data.m_senderPeerID); } if (val == null) { ((Processor)this).Logger.LogError((object)$"Player ZDO with peer ID {data.m_senderPeerID} not found"); return; } SetSacrifiedTornSpirit(val.PlayerID, value: true); RPC.AddStatusEffect(val.ZDO, StatusEffects.Demister, false, 0, 0f); RPC.ShowMessage(data.m_senderPeerID, (MessageType)2, ConfigBase.Instance.Localization.Value.SacrificedTornSpirit); } } private void OnEmoteDetected(ServersideQoLZDO zdo, PlayerState state, Emotes emote) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (((int)ConfigBase.Instance.OpenCartEmote.Value == -2 || ConfigBase.Instance.OpenCartEmote.Value == emote) && _attachedCartsByPlayer.TryGetValue(zdo, out ServersideQoLZDO value) && value.ZDO.GetOwner() == state.Owner) { ZDOVars vars = value.Vars; if (((ZDOVars)(ref vars)).GetAttachJoint(false)) { RPC.OpenResponse(value, true); } } } internal void UpdateAttachedCart(ServersideQoLZDO cart) { //IL_002f: 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) cart.AssertIsAll(); PlayerState stateForPeerID = Processor.Instance().GetStateForPeerID(cart.ZDO.GetOwner()); if (stateForPeerID != null) { ZDOVars vars = cart.Vars; if (!((ZDOVars)(ref vars)).GetAttachJoint(false)) { _attachedCartsByPlayer.Remove(stateForPeerID.ZDO); return; } if (!_attachedCartsByPlayer.TryAdd(stateForPeerID.ZDO, cart)) { _attachedCartsByPlayer[stateForPeerID.ZDO] = cart; return; } stateForPeerID.ZDO.Destroyed += OnPlayerDestroyed; cart.Destroyed += OnCartDestroyed; } } private void OnPlayerDestroyed(ServersideQoLZDO zdo) { if (_attachedCartsByPlayer.Remove(zdo, out ServersideQoLZDO value)) { value.Destroyed -= OnCartDestroyed; } } private void OnCartDestroyed(ServersideQoLZDO zdo) { List list = null; foreach (var (item, val3) in _attachedCartsByPlayer) { if (val3 == zdo) { (list ?? (list = new List())).Add(item); } } if (list == null) { return; } foreach (ServersideQoLZDO item2 in list) { if (_attachedCartsByPlayer.Remove(item2, out ServersideQoLZDO _)) { item2.Destroyed -= OnPlayerDestroyed; } } } private static bool GetSacrifiedMegingjord(long playerID, bool defaultValue = false) { return Processor.DataZDO.ZDO.GetBool($"player{playerID}_SacrifiedMegingjord", defaultValue); } private static void SetSacrifiedMegingjord(long playerID, bool value) { Processor.DataZDO.ZDO.Set($"player{playerID}_SacrifiedMegingjord", value); } internal static bool GetSacrifiedCryptKey(long playerID, bool defaultValue = false) { return Processor.DataZDO.ZDO.GetBool($"player{playerID}_SacrifiedCryptKey", defaultValue); } private static void SetSacrifiedCryptKey(long playerID, bool value) { Processor.DataZDO.ZDO.Set($"player{playerID}_SacrifiedCryptKey", value); } private static bool GetSacrifiedWishbone(long playerID, bool defaultValue = false) { return Processor.DataZDO.ZDO.GetBool($"player{playerID}_SacrifiedWishbone", defaultValue); } private static void SetSacrifiedWishbone(long playerID, bool value) { Processor.DataZDO.ZDO.Set($"player{playerID}_SacrifiedWishbone", value); } private static bool GetSacrifiedTornSpirit(long playerID, bool defaultValue = false) { return Processor.DataZDO.ZDO.GetBool($"player{playerID}_SacrifiedTornSpirit", defaultValue); } private static void SetSacrifiedTornSpirit(long playerID, bool value) { Processor.DataZDO.ZDO.Set($"player{playerID}_SacrifiedTornSpirit", value); } } [Processor("8a10c73e-67db-4dc2-8b0c-3242aac82e3b")] public sealed class VagonProcessor : Processor { public sealed record PrefabInfo(Vagon Vagon, Piece Piece, Container Container) : ProcessorPrefabInfo() { [CompilerGenerated] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("PrefabInfo"); stringBuilder.Append(" { "); if (((ProcessorPrefabInfo)this).PrintMembers(stringBuilder)) { stringBuilder.Append(' '); } stringBuilder.Append('}'); return stringBuilder.ToString(); } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { if (((ProcessorPrefabInfo)this).PrintMembers(builder)) { builder.Append(", "); } builder.Append("Vagon = "); builder.Append(Vagon); builder.Append(", Piece = "); builder.Append(Piece); builder.Append(", Container = "); builder.Append(Container); return true; } [CompilerGenerated] public override int GetHashCode() { return ((((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer.Default.GetHashCode(Vagon)) * -1521134295 + EqualityComparer.Default.GetHashCode(Piece)) * -1521134295 + EqualityComparer.Default.GetHashCode(Container); } [CompilerGenerated] public sealed override bool Equals(ProcessorPrefabInfo? other) { return ((object)this).Equals((object?)other); } [CompilerGenerated] public bool Equals(PrefabInfo? other) { return (object)this == other || (((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other) && EqualityComparer.Default.Equals(Vagon, other.Vagon) && EqualityComparer.Default.Equals(Piece, other.Piece) && EqualityComparer.Default.Equals(Container, other.Container)); } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { Vagon = original.Vagon; Piece = original.Piece; Container = original.Container; } } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, PrefabInfo prefabInfo) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0028: 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_002b: Unknown result type (might be due to invalid IL or missing references) if ((int)ConfigBase.Instance.OpenCartEmote.Value == -1) { return (ProcessResult)2; } Processor.Instance().UpdateAttachedCart(zdo); return (ProcessResult)0; } } }