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 RavenstoneShrine v0.0.1
RavenstoneShrine/RavenstoneShrine.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.UI; using ValheimAudio; [assembly: AssemblyFileVersion("0.0.1")] [assembly: Guid("E74EB49A-461D-48EA-85BC-F462D60C98C4")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyProduct("RavenstoneShrine")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("RavenstoneShrine")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Marlthon")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] [module: <27369764-bd22-48e8-ab70-230bf6054bad>RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<cc781bb3-44da-4b1f-a67e-9e961541ebc0>Embedded] internal sealed class <cc781bb3-44da-4b1f-a67e-9e961541ebc0>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<cc781bb3-44da-4b1f-a67e-9e961541ebc0>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <93f2343e-9870-4934-b5d5-9cfa27acbd0d>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <93f2343e-9870-4934-b5d5-9cfa27acbd0d>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <93f2343e-9870-4934-b5d5-9cfa27acbd0d>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<cc781bb3-44da-4b1f-a67e-9e961541ebc0>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContextAttribute : Attribute { public readonly byte Flag; public <75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContextAttribute(byte P_0) { Flag = P_0; } } [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [<cc781bb3-44da-4b1f-a67e-9e961541ebc0>Embedded] [CompilerGenerated] internal sealed class <27369764-bd22-48e8-ab70-230bf6054bad>RefSafetyRulesAttribute : Attribute { public readonly int Version; public <27369764-bd22-48e8-ab70-230bf6054bad>RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ValheimAudio { [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(1)] [<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(0)] public static class ValheimSfxMixerFix { public static void RouteEmbeddedBundlesToSfx(BaseUnityPlugin plugin) { if ((Object)(object)plugin == (Object)null || Application.isBatchMode) { return; } Assembly assembly = ((object)plugin).GetType().Assembly; string value = assembly.GetName().Name + ".assets."; string[] manifestResourceNames = assembly.GetManifestResourceNames(); for (int i = 0; i < manifestResourceNames.Length; i++) { if (manifestResourceNames[i].StartsWith(value, StringComparison.Ordinal)) { AssetBundle val = AssetBundle.LoadFromStream(assembly.GetManifestResourceStream(manifestResourceNames[i])); if ((Object)(object)val != (Object)null) { RouteBundleToSfx(plugin, val); } } } } public static void RouteBundleToSfx(BaseUnityPlugin plugin, AssetBundle assetBundle) { if (!((Object)(object)plugin == (Object)null) && !((Object)(object)assetBundle == (Object)null) && !Application.isBatchMode) { ((MonoBehaviour)plugin).StartCoroutine(RouteBundleWhenAudioManIsReady(plugin, assetBundle)); } } private static IEnumerator RouteBundleWhenAudioManIsReady(BaseUnityPlugin plugin, AssetBundle assetBundle) { while ((Object)(object)AudioMan.instance == (Object)null || (Object)(object)AudioMan.instance.m_masterMixer == (Object)null) { yield return null; } AudioMixerGroup sfxMixerGroup = FindSfxMixerGroup(AudioMan.instance.m_masterMixer); if ((Object)(object)sfxMixerGroup == (Object)null) { Debug.LogWarning((object)"Valheim SFX mixer group was not found. Custom audio was not reassigned."); yield break; } GameObject[] prefabs = assetBundle.LoadAllAssets<GameObject>(); int i = 0; while (i < prefabs.Length) { int num; if (!((Object)(object)prefabs[i] == (Object)null)) { AudioSource[] audioSources = prefabs[i].GetComponentsInChildren<AudioSource>(true); for (int j = 0; j < audioSources.Length; j = num) { if ((Object)(object)audioSources[j] != (Object)null) { audioSources[j].outputAudioMixerGroup = sfxMixerGroup; } num = j + 1; } } num = i + 1; i = num; } } private static AudioMixerGroup FindSfxMixerGroup(AudioMixer masterMixer) { AudioMixerGroup[] array = masterMixer.FindMatchingGroups("SFX"); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((Object)array[i]).name == "SFX") { return array[i]; } } return null; } } } namespace RavenstoneShrine { [<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(0)] [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(1)] [BepInPlugin("marlthon.RavenstoneShrine", "RavenstoneShrine", "0.0.1")] public class RavenstoneShrinePlugin : BaseUnityPlugin { [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(0)] private class ConfigurationManagerAttributes { public bool? Browsable = false; } internal const string ModName = "RavenstoneShrine"; internal const string ModVersion = "0.0.1"; internal const string Author = "marlthon"; internal const string ModGUID = "marlthon.RavenstoneShrine"; private static string ConfigFileName = "marlthon.RavenstoneShrine.cfg"; private static string ConfigFileFullPath; private readonly Harmony _harmony = new Harmony("marlthon.RavenstoneShrine"); public static readonly ManualLogSource RavenstoneShrine; private static readonly ConfigSync ConfigSync; internal const string PrefabName = "RavenstoneShrine"; internal const string ReturnPoint = "returnpoint"; internal static readonly int ShrineHash; internal static readonly int Placed; internal ConfigEntry<string> FeePrefab = null; internal ConfigEntry<int> FeeAmount = null; internal ConfigEntry<int> ReturnSeconds = null; private static ConfigEntry<bool> _serverConfigLocked; internal static RavenstoneShrinePlugin Instance { get; private set; } internal static bool IsLocalAdmin => Object.op_Implicit((Object)(object)ZNet.instance) && (ZNet.instance.IsServer() || ConfigSync.IsAdmin); public void Awake() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown Instance = this; ValheimSfxMixerFix.RouteEmbeddedBundlesToSfx((BaseUnityPlugin)(object)this); _serverConfigLocked = config("General", "Force Server Config", value: true, "Force Server Config"); ConfigSync.AddLockingConfigEntry<bool>(_serverConfigLocked); FeePrefab = config("Offering", "ItemPrefab", "Coins", "Item prefab used as the offering."); FeeAmount = config("Offering", "Amount", 25, new ConfigDescription("Cost per gravestone. Set to zero for free recovery.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100000), Array.Empty<object>())); ReturnSeconds = config("Offering", "ReturnTimeSeconds", 60, new ConfigDescription("Seconds to loot a summoned gravestone before it returns. Set to zero to keep it at the shrine.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 86400), Array.Empty<object>())); BuildPiece buildPiece = new BuildPiece("mar_ravenstoneshine", "RavenstoneShrine"); buildPiece.Name.Portuguese_Brazilian("Santuário Ravenstone").English("Ravenstone Shrine").German("Ravenstone-Schrein") .Italian("Santuario di Ravenstone") .Russian("Святилище Рейвенстоуна") .Spanish("Santuario de Ravenstone") .French("Sanctuaire de Ravenstone"); buildPiece.Description.Portuguese_Brazilian("Faça uma oferenda para trazer sua lápide mais recente.").English("Make an offering to call your latest gravestone.").German("Bringe eine Opfergabe dar, um deinen jüngsten Grabstein herbeizurufen.") .Italian("Fai un'offerta per richiamare la tua lapide più recente.") .Russian("Сделайте подношение, чтобы призвать своё последнее надгробие.") .Spanish("Haz una ofrenda para invocar tu lápida más reciente.") .French("Faites une offrande pour faire venir votre pierre tombale la plus récente."); buildPiece.Category.Set(BuildPieceCategory.Misc); buildPiece.Usage.Set((UsageTagFlags)1); buildPiece.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece.RequiredItems.Add("Stone", 50, recover: true); buildPiece.RequiredItems.Add("SurtlingCore", 4, recover: true); buildPiece.SpecialProperties.AdminOnly = true; ShrinePresentation.ConfigurePrefab(buildPiece.Prefab); PrefabManager.RegisterPrefab("mar_ravenstoneshine", "sfx_build_hammer_stone_ravenstoneshine"); PrefabManager.RegisterPrefab("mar_ravenstoneshine", "sfx_rock_destroyed_ravenstoneshine"); PrefabManager.RegisterPrefab("mar_ravenstoneshine", "sfx_rock_hit_ravenstoneshine"); PrefabManager.RegisterPrefab("mar_ravenstoneshine", "vfx_Place_ravenstoneshine"); PrefabManager.RegisterPrefab("mar_ravenstoneshine", "vfx_RockHit_ravenstoneshine"); PrefabManager.RegisterPrefab("mar_ravenstoneshine", "vfx_stone_destroyed_ravenstoneshine"); SetupWatcher(); _harmony.PatchAll(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { RavenstoneShrine.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { RavenstoneShrine.LogError((object)("There was an issue loading your " + ConfigFileName)); RavenstoneShrine.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<[<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> config<[<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } static RavenstoneShrinePlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; RavenstoneShrine = Logger.CreateLogSource("RavenstoneShrine"); ConfigSync = new ConfigSync("marlthon.RavenstoneShrine") { DisplayName = "RavenstoneShrine", CurrentVersion = "0.0.1", MinimumRequiredVersion = "0.0.1", ModRequired = true }; ShrineHash = StringExtensionMethods.GetStableHashCode("RavenstoneShrine"); Placed = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.placed"); Instance = null; _serverConfigLocked = null; } } internal static class ShrineRecovery { private sealed class Quote { internal long Token; internal ZDOID Shrine; internal ZDOID Tomb; internal ZDOID Character; internal float Expires; internal int Price; internal string Item; } private sealed class Payment { internal long Token; internal Player Player; internal List<ItemData> Stacks; } private const string BeginRpc = "Ravenstone_Begin"; private const string QuoteRpc = "Ravenstone_Quote"; private const string CommitRpc = "Ravenstone_Commit"; private const string SummonEffectRpc = "Ravenstone_SummonEffect"; private const string ShrineBusyMessage = "The shrine is already calling a gravestone."; private const string GraveInUseMessage = "Your latest gravestone is in an active area or in use. Try again when the area unloads."; private static readonly Dictionary<ZDOID, Quote> SummonsInProgress = new Dictionary<ZDOID, Quote>(); private const string ResultRpc = "Ravenstone_Result"; private const string PlacementRpc = "Ravenstone_Placed"; private const string DismantleRpc = "Ravenstone_Dismantle"; private const float DismantleRange = 8f; private const long NoticeToken = -1L; private static readonly SimulationDistance ReturnPointSectors = new SimulationDistance(1, 0, true); private const float UseRange = 5f; private static readonly int Returned = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.returned"); internal static readonly int SummonedAt = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.summonedAt"); private static readonly Dictionary<long, Quote> Quotes = new Dictionary<long, Quote>(); private static readonly Dictionary<ZRpc, float> LastRequest = new Dictionary<ZRpc, float>(); private static readonly FieldRef<Player, GameObject> TombPrefab = AccessTools.FieldRefAccess<Player, GameObject>("m_tombstone"); private static readonly Func<ZNetScene, ZDO, GameObject> CreateExistingObject = AccessTools.MethodDelegate<Func<ZNetScene, ZDO, GameObject>>(AccessTools.DeclaredMethod(typeof(ZNetScene), "CreateObject", new Type[1] { typeof(ZDO) }, (Type[])null), (object)null, true); private static readonly Action<WearNTear, HitData, bool> DestroyShrine = AccessTools.MethodDelegate<Action<WearNTear, HitData, bool>>(AccessTools.DeclaredMethod(typeof(WearNTear), "Destroy", new Type[2] { typeof(HitData), typeof(bool) }, (Type[])null), (object)null, true); private const string ReturnExpiredRpc = "Ravenstone_ReturnExpired"; private const string MapPinsRequestRpc = "Ravenstone_RequestMapPins"; private const string MapPinsSnapshotRpc = "Ravenstone_MapPins"; private static readonly int PinOrigin = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.pinOrigin"); private static readonly HashSet<ZDOID> MapGraves = new HashSet<ZDOID>(); private static bool mapGravesLoaded; private static readonly int ReturnDeadline = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.returnDeadline"); private static readonly int OriginPosition = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.originPosition"); private static readonly int AltarRotation = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.altarRotation"); private static readonly int OriginRotation = StringExtensionMethods.GetStableHashCode("marlthon.RavenstoneShrine.originRotation"); private static readonly HashSet<ZDOID> PendingReturns = new HashSet<ZDOID>(); private static bool returnsLoaded; private static float nextReturnCheck; private static long nextQuote; private static float waitingUntil; private static Payment payment; internal static void Clear() { Quotes.Clear(); SummonsInProgress.Clear(); LastRequest.Clear(); PendingReturns.Clear(); MapGraves.Clear(); mapGravesLoaded = false; if (!Application.isBatchMode) { ShrineMapPins.Clear(); } returnsLoaded = false; nextReturnCheck = 0f; waitingUntil = 0f; payment = null; } internal static void Connect(ZNet net, ZNetPeer peer) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (net.IsServer()) { float nextMapRequest = 0f; peer.m_rpc.Register("Ravenstone_RequestMapPins", (Method)delegate(ZRpc rpc) { if (Active(peer, rpc) && !(Time.realtimeSinceStartup < nextMapRequest)) { nextMapRequest = Time.realtimeSinceStartup + 2f; SendMapPins(peer); } }); peer.m_rpc.Register<ZDOID>("Ravenstone_Begin", (Action<ZRpc, ZDOID>)delegate(ZRpc rpc, ZDOID shrine) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (Active(peer, rpc)) { float realtimeSinceStartup = Time.realtimeSinceStartup; if (!LastRequest.TryGetValue(rpc, out var value) || !(realtimeSinceStartup - value < 1.5f)) { LastRequest[rpc] = realtimeSinceStartup; Begin(peer, shrine); } } }); peer.m_rpc.Register<long, bool>("Ravenstone_Commit", (Action<ZRpc, long, bool>)delegate(ZRpc rpc, long token, bool paid) { if (Active(peer, rpc)) { Commit(peer, token, paid); } }); peer.m_rpc.Register<ZDOID, bool>("Ravenstone_Dismantle", (Action<ZRpc, ZDOID, bool>)delegate(ZRpc rpc, ZDOID shrine, bool blockDrop) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Active(peer, rpc)) { Dismantle(peer, shrine, blockDrop); } }); peer.m_rpc.Register<ZDOID>("Ravenstone_Placed", (Action<ZRpc, ZDOID>)delegate(ZRpc rpc, ZDOID shrine) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (Active(peer, rpc) && ZNet.instance.IsAdmin(peer.m_socket.GetHostName())) { ((MonoBehaviour)RavenstoneShrinePlugin.Instance).StartCoroutine(ConfirmPlacement(peer, shrine)); } }); } else { if (!peer.m_server) { return; } peer.m_rpc.Register<ZPackage>("Ravenstone_MapPins", (Action<ZRpc, ZPackage>)delegate(ZRpc rpc, ZPackage snapshot) { if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.GetServerRPC() == rpc) { ShrineMapPins.Apply(snapshot); } }); peer.m_rpc.Register<ZDOID, long>("Ravenstone_ReturnExpired", (Action<ZRpc, ZDOID, long>)delegate(ZRpc rpc, ZDOID id, long deadline) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)ZNet.instance) && Object.op_Implicit((Object)(object)ZNetScene.instance) && ZNet.instance.GetServerRPC() == rpc) { ZDOMan instance = ZDOMan.instance; TryReturnOwned((instance != null) ? instance.GetZDO(id) : null, deadline); } }); peer.m_rpc.Register<ZDOID>("Ravenstone_SummonEffect", (Action<ZRpc, ZDOID>)delegate(ZRpc rpc, ZDOID shrine) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.GetServerRPC() == rpc) { ShrinePresentation.PlaySummonEffect(shrine); } }); peer.m_rpc.Register<long, string, int>("Ravenstone_Quote", (Action<ZRpc, long, string, int>)delegate(ZRpc rpc, long token, string item, int price) { if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.GetServerRPC() == rpc) { Pay(token, item, price, rpc); } }); peer.m_rpc.Register<long, string>("Ravenstone_Result", (Action<ZRpc, long, string>)delegate(ZRpc rpc, long token, string message) { if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.GetServerRPC() == rpc) { Result(token, message); } }); } } private static bool Active(ZNetPeer peer, ZRpc rpc) { return Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer() && peer.IsReady() && peer.m_rpc == rpc && ZNet.instance.GetPeer(peer.m_uid) == peer; } private static ZDO FindCharacter(ZNetPeer peer) { //IL_002a: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (ZDOMan.instance == null || !Object.op_Implicit((Object)(object)ZNetScene.instance)) { return null; } ZDOID val = peer?.m_characterID ?? (Object.op_Implicit((Object)(object)Player.m_localPlayer) ? ((Character)Player.m_localPlayer).GetZDOID() : ZDOID.None); long num = peer?.m_uid ?? ZNet.GetUID(); ZDO zDO = ZDOMan.instance.GetZDO(val); if (zDO == null || zDO.GetOwner() != num || zDO.GetBool(ZDOVars.s_dead, false)) { return null; } GameObject prefab = ZNetScene.instance.GetPrefab(zDO.GetPrefab()); return (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab.GetComponent<Player>())) ? zDO : null; } internal static void Request(ZDOID shrine) { //IL_0048: 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) if (!Object.op_Implicit((Object)(object)ZNet.instance) || payment != null || Time.realtimeSinceStartup < waitingUntil) { return; } waitingUntil = Time.realtimeSinceStartup + 8f; if (ZNet.instance.IsServer()) { Begin(null, shrine); return; } ZRpc serverRPC = ZNet.instance.GetServerRPC(); if (serverRPC != null) { serverRPC.Invoke("Ravenstone_Begin", new object[1] { shrine }); } } private static void Begin(ZNetPeer peer, ZDOID shrine) { //IL_0108: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) long key = peer?.m_uid ?? ZNet.GetUID(); foreach (long item in new List<long>(Quotes.Keys)) { if (Quotes[item].Expires < Time.realtimeSinceStartup) { Quotes.Remove(item); } } foreach (ZRpc item2 in new List<ZRpc>(LastRequest.Keys)) { if (!item2.IsConnected()) { LastRequest.Remove(item2); } } if (Quotes.TryGetValue(key, out var value) && value.Expires >= Time.realtimeSinceStartup) { return; } if (SummonsInProgress.ContainsKey(shrine)) { Reply(peer, 0L, "The shrine is already calling a gravestone."); return; } ZDO val = FindCharacter(peer); if (!TryDestination(val, shrine, out var point, out var _, out var message)) { Reply(peer, 0L, message); return; } ZDO val2 = FindLatest(val, point, out message); if (val2 == null) { Reply(peer, 0L, message); return; } if (IsReserved(val2.m_uid)) { Reply(peer, 0L, "The shrine is already calling a gravestone."); return; } string text = RavenstoneShrinePlugin.Instance.FeePrefab.Value.Trim(); int value2 = RavenstoneShrinePlugin.Instance.FeeAmount.Value; if (value2 > 0 && !Object.op_Implicit((Object)(object)FindItem(text))) { Reply(peer, 0L, "The shrine's payment item is unavailable."); return; } Quote quote = new Quote { Token = ++nextQuote, Shrine = shrine, Tomb = val2.m_uid, Character = val.m_uid, Expires = Time.realtimeSinceStartup + 10f, Item = text, Price = value2 }; Quotes[key] = quote; if (peer == null) { Pay(quote.Token, text, value2, null); return; } peer.m_rpc.Invoke("Ravenstone_Quote", new object[3] { quote.Token, text, value2 }); } private static ItemDrop FindItem(string name) { GameObject val = (Object.op_Implicit((Object)(object)ObjectDB.instance) ? ObjectDB.instance.GetItemPrefab(name) : null); return Object.op_Implicit((Object)(object)val) ? val.GetComponent<ItemDrop>() : null; } private static bool TryDestination(ZDO character, ZDOID id, out Vector3 point, out Quaternion rotation, out string message) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0079: Unknown result type (might be due to invalid IL or missing references) //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) point = default(Vector3); rotation = default(Quaternion); message = "Move closer to an active shrine."; if (character == null || !Object.op_Implicit((Object)(object)ZNetScene.instance)) { return false; } ZDO zDO = ZDOMan.instance.GetZDO(id); if (zDO == null || zDO.GetPrefab() != RavenstoneShrinePlugin.ShrineHash || !zDO.GetBool(RavenstoneShrinePlugin.Placed, false)) { return false; } int result; if (TryGetReturnPoint(zDO, out point, out rotation)) { Vector3 val = character.GetPosition() - point; result = ((((Vector3)(ref val)).sqrMagnitude <= 25f) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } private static bool TryGetReturnPoint(ZDO shrine, out Vector3 point, out Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0057: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_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_008f: Unknown result type (might be due to invalid IL or missing references) point = default(Vector3); rotation = default(Quaternion); GameObject prefab = ZNetScene.instance.GetPrefab(shrine.GetPrefab()); Transform val = (Object.op_Implicit((Object)(object)prefab) ? prefab.transform.Find("returnpoint") : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } Quaternion rotation2 = shrine.GetRotation(); point = shrine.GetPosition() + rotation2 * Vector3.Scale(prefab.transform.localScale, val.localPosition); rotation = rotation2 * val.localRotation; return true; } internal static ZDO FindGraveAtReturnPoint(Vector3 point, List<ZDO> candidates) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) ZDOMan.instance.FindSectorObjects(ZoneSystem.GetZone(point), ReturnPointSectors, candidates, (List<ZDO>)null); ZDO result = null; foreach (ZDO candidate in candidates) { if (IsAtReturnPoint(candidate, point)) { GameObject prefab = ZNetScene.instance.GetPrefab(candidate.GetPrefab()); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab.GetComponent<TombStone>()) && IsNonEmpty(candidate)) { result = candidate; break; } } } candidates.Clear(); return result; } internal static bool IsAtReturnPoint(ZDO tomb, Vector3 point) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = tomb.GetPosition() - point; return ((Vector3)(ref val)).sqrMagnitude < 1f; } internal static bool IsNonEmpty(ZDO tomb) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown byte[] byteArray = tomb.GetByteArray(ZDOVars.s_items, (byte[])null); if (byteArray == null || byteArray.Length < 6) { return false; } ZPackage val = new ZPackage(byteArray); int num = val.ReadInt(); if (num >= 108) { return val.ReadUShort() > 0; } return byteArray.Length >= 8 && val.ReadInt() > 0; } private static ZDO FindLatest(ZDO character, Vector3 point, out string message) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) message = "You have no remaining gravestones to call."; GameObject prefab = ZNetScene.instance.GetPrefab(character.GetPrefab()); GameObject val = TombPrefab.Invoke(prefab.GetComponent<Player>()); long num = character.GetLong(ZDOVars.s_playerID, 0L); if (!Object.op_Implicit((Object)(object)val) || num == 0) { return null; } List<ZDO> list = new List<ZDO>(); int num2 = 0; while (!ZDOMan.instance.GetAllZDOsWithPrefabIterative(((Object)val).name, list, ref num2)) { } ZDO val2 = null; long num3 = long.MinValue; foreach (ZDO item in list) { if (!IsNonEmpty(item)) { continue; } if (IsAtReturnPoint(item, point)) { message = "Clear the gravestone at the shrine first."; return null; } if (item.GetLong(ZDOVars.s_owner, 0L) == num && !item.GetBool(Returned, false)) { long num4 = item.GetLong(ZDOVars.s_timeOfDeath, 0L); if (val2 == null || num4 > num3) { val2 = item; num3 = num4; } } } if (val2 != null && !CanMoveGrave(val2)) { message = "Your latest gravestone is in an active area or in use. Try again when the area unloads."; return null; } return val2; } private static bool CanMoveGrave(ZDO grave) { long owner = grave.GetOwner(); if ((owner != 0L && owner != ZNet.GetUID()) || grave.GetInt(ZDOVars.s_inUse, 0) != 0) { return false; } ZNetView val = ZNetScene.instance.FindInstance(grave); Container val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Container>() : null); return !Object.op_Implicit((Object)(object)val2) || !val2.IsInUse(); } private static void Pay(long token, string item, int price, ZRpc server) { bool flag = false; Player localPlayer = Player.m_localPlayer; if (Time.realtimeSinceStartup <= waitingUntil && waitingUntil > 0f && payment == null && Object.op_Implicit((Object)(object)localPlayer) && !((Character)localPlayer).IsDead()) { ItemDrop val = ((price > 0) ? FindItem(item) : null); if (price >= 0 && (price == 0 || Object.op_Implicit((Object)(object)val))) { Inventory inventory = ((Humanoid)localPlayer).GetInventory(); List<ItemData> list = new List<ItemData>(); List<ItemData> list2 = new List<ItemData>(); int num = price; foreach (ItemData allItem in inventory.GetAllItems()) { if (num == 0) { break; } if (Object.op_Implicit((Object)(object)allItem.m_dropPrefab) && !(Utils.GetPrefabName(allItem.m_dropPrefab) != item)) { ItemData val2 = allItem.Clone(); val2.m_stack = Mathf.Min(num, allItem.m_stack); list2.Add(allItem); list.Add(val2); num -= val2.m_stack; } } if (num == 0) { for (int i = 0; i < list2.Count; i++) { inventory.RemoveItem(list2[i], list[i].m_stack); } payment = new Payment { Token = token, Player = localPlayer, Stacks = list }; flag = true; } } } if (server == null) { Commit(null, token, flag); return; } server.Invoke("Ravenstone_Commit", new object[2] { token, flag }); } private static void Commit(ZNetPeer peer, long token, bool paid) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) long key = peer?.m_uid ?? ZNet.GetUID(); if (!Quotes.TryGetValue(key, out var value) || value.Token != token) { foreach (Quote value2 in SummonsInProgress.Values) { if (value2.Token == token) { return; } } Reply(peer, token, "The shrine request expired."); return; } Quotes.Remove(key); if (!paid) { Reply(peer, token, (value.Price > 0) ? string.Format("{0}{1} x {2}.", "Offering required: ", value.Price, value.Item) : "Recovery cancelled."); return; } ZDO val = FindCharacter(peer); if (val == null || val.m_uid != value.Character || Time.realtimeSinceStartup > value.Expires) { Reply(peer, token, "The shrine request expired."); return; } if (!TryDestination(val, value.Shrine, out var point, out var rotation, out var message)) { Reply(peer, token, message); return; } ZDO val2 = FindLatest(val, point, out message); if (val2 == null || val2.m_uid != value.Tomb) { Reply(peer, token, (val2 == null) ? message : "Your latest gravestone changed. Try again."); return; } if (SummonsInProgress.ContainsKey(value.Shrine) || IsReserved(val2.m_uid)) { Reply(peer, token, "The shrine is already calling a gravestone."); return; } GameObject prefab = ZNetScene.instance.GetPrefab(RavenstoneShrinePlugin.ShrineHash); if (!Object.op_Implicit((Object)(object)prefab) || !Object.op_Implicit((Object)(object)prefab.transform.Find("FireEnchant"))) { CompleteSummon(peer, value, val2, point, rotation); return; } SummonsInProgress.Add(value.Shrine, value); ((MonoBehaviour)RavenstoneShrinePlugin.Instance).StartCoroutine(FinishSummonAfterEffect(peer, value)); BeginSummonEffect(peer, value.Shrine, point); } private static IEnumerator FinishSummonAfterEffect(ZNetPeer peer, Quote quote) { yield return (object)new WaitForSeconds(0.85f); if (!SummonsInProgress.TryGetValue(quote.Shrine, out var current) || current != quote) { yield break; } SummonsInProgress.Remove(quote.Shrine); if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer() || (peer != null && !Active(peer, peer.m_rpc))) { yield break; } ZDO character = FindCharacter(peer); if (character == null || character.m_uid != quote.Character) { Reply(peer, quote.Token, "The shrine request expired."); yield break; } if (!TryDestination(character, quote.Shrine, out var point, out var rotation, out var error)) { Reply(peer, quote.Token, error); yield break; } if (FindGraveAtReturnPoint(point, new List<ZDO>()) != null) { Reply(peer, quote.Token, "Clear the gravestone at the shrine first."); yield break; } ZDO grave = ZDOMan.instance.GetZDO(quote.Tomb); if (grave == null || grave.GetLong(ZDOVars.s_owner, 0L) != character.GetLong(ZDOVars.s_playerID, 0L) || grave.GetBool(Returned, false) || !IsNonEmpty(grave)) { Reply(peer, quote.Token, "Your latest gravestone changed. Try again."); } else if (!CanMoveGrave(grave)) { Reply(peer, quote.Token, "Your latest gravestone is in an active area or in use. Try again when the area unloads."); } else { CompleteSummon(peer, quote, grave, point, rotation); } } private static void CompleteSummon(ZNetPeer peer, Quote quote, ZDO tomb, Vector3 point, Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) Summon(tomb, point, rotation); Reply(peer, quote.Token, ""); SendMapPins(peer); } private static void BeginSummonEffect(ZNetPeer requester, ZDOID shrine, Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_006b: Unknown result type (might be due to invalid IL or missing references) ShrinePresentation.PlaySummonEffect(shrine); foreach (ZNetPeer peer in ZNet.instance.GetPeers()) { if (!peer.IsReady()) { continue; } if (peer != requester) { Vector3 val = peer.GetRefPos() - point; if (!(((Vector3)(ref val)).sqrMagnitude <= 6400f)) { continue; } } peer.m_rpc.Invoke("Ravenstone_SummonEffect", new object[1] { shrine }); } } private static bool IsReserved(ZDOID tomb) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) foreach (Quote value in SummonsInProgress.Values) { if (value.Tomb == tomb) { return true; } } return false; } private static void Summon(ZDO tomb, Vector3 point, Quaternion rotation) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_00bb: Unknown result type (might be due to invalid IL or missing references) tomb.SetOwner(ZNet.GetUID()); Vector3 val = default(Vector3); if (!tomb.GetVec3(PinOrigin, ref val)) { tomb.Set(PinOrigin, tomb.GetVec3(ZDOVars.s_spawnPoint, tomb.GetPosition())); } MapGraves.Add(tomb.m_uid); int value = RavenstoneShrinePlugin.Instance.ReturnSeconds.Value; if (value > 0) { tomb.Set(OriginPosition, tomb.GetPosition()); tomb.Set(OriginRotation, tomb.GetRotation()); tomb.Set(ReturnDeadline, ZNet.instance.GetTime().Ticks + (long)value * 10000000L); PendingReturns.Add(tomb.m_uid); } tomb.Set(AltarRotation, rotation); tomb.Set(Returned, true); tomb.Set(SummonedAt, ZNet.instance.GetTime().Ticks); MoveOwned(tomb, point, rotation); } internal static bool IsExpired(ZDO tomb) { long num = tomb.GetLong(ReturnDeadline, 0L); return num > 0 && Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.GetTime().Ticks >= num; } internal static void CheckReturns() { //IL_0083: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer() || ZDOMan.instance == null || !Object.op_Implicit((Object)(object)ZNetScene.instance) || !Object.op_Implicit((Object)(object)ZoneSystem.instance) || Time.realtimeSinceStartup < nextReturnCheck) { return; } nextReturnCheck = Time.realtimeSinceStartup + 1f; if (!returnsLoaded) { foreach (ZDOID item in ZDOExtraData.GetAllZDOIDsWithHash((Type)4, ReturnDeadline)) { ZDO zDO = ZDOMan.instance.GetZDO(item); if (zDO != null && zDO.GetLong(ReturnDeadline, 0L) > 0) { PendingReturns.Add(item); } } returnsLoaded = true; } RepairAltarPositions(); if (PendingReturns.Count == 0) { return; } PendingReturns.RemoveWhere(delegate(ZDOID id) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ZDO zDO3 = ZDOMan.instance.GetZDO(id); return zDO3 == null || zDO3.GetLong(ReturnDeadline, 0L) <= 0; }); foreach (ZDOID pendingReturn in PendingReturns) { ZDO zDO2 = ZDOMan.instance.GetZDO(pendingReturn); if (!IsExpired(zDO2) || !IsNonEmpty(zDO2)) { continue; } long num = zDO2.GetLong(ReturnDeadline, 0L); long owner = zDO2.GetOwner(); if (owner == 0L || owner == ZNet.GetUID()) { if (!zDO2.IsOwner()) { zDO2.SetOwner(ZNet.GetUID()); } TryReturnOwned(zDO2, num); continue; } ZNetPeer peer = ZNet.instance.GetPeer(owner); if (peer != null && peer.IsReady()) { peer.m_rpc.Invoke("Ravenstone_ReturnExpired", new object[2] { pendingReturn, num }); } } } private static void TryReturnOwned(ZDO tomb, long deadline) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (tomb != null && tomb.IsOwner() && deadline > 0 && tomb.GetLong(ReturnDeadline, 0L) == deadline && tomb.GetBool(Returned, false) && IsNonEmpty(tomb)) { ZNetView val = ZNetScene.instance.FindInstance(tomb); Container val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Container>() : null); if (!Object.op_Implicit((Object)(object)val2) || !val2.IsInUse()) { Vector3 vec = tomb.GetVec3(OriginPosition, tomb.GetPosition()); Quaternion quaternion = tomb.GetQuaternion(OriginRotation, tomb.GetRotation()); tomb.Set(ReturnDeadline, 0L); tomb.Set(Returned, false); tomb.Set(SummonedAt, 0L); MoveOwned(tomb, vec, quaternion); } } } internal static bool TryGetAltarPose(ZDO tomb, out Vector3 position, out Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_005a: Unknown result type (might be due to invalid IL or missing references) position = default(Vector3); rotation = default(Quaternion); if (!tomb.GetBool(Returned, false) || tomb.GetLong(SummonedAt, 0L) <= 0 || !tomb.GetVec3(ZDOVars.s_spawnPoint, ref position)) { return false; } rotation = tomb.GetQuaternion(AltarRotation, tomb.GetRotation()); return true; } private static void RepairAltarPositions() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_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_0053: 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_0092: 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) PrepareMapGraves(); foreach (ZDOID mapGrafe in MapGraves) { ZDO zDO = ZDOMan.instance.GetZDO(mapGrafe); if (zDO == null || (zDO.HasOwner() && !zDO.IsOwner()) || !TryGetAltarPose(zDO, out var position, out var rotation)) { continue; } Vector3 val = zDO.GetPosition() - position; if (!(((Vector3)(ref val)).sqrMagnitude <= 0.0025f)) { if (!zDO.IsOwner()) { zDO.SetOwner(ZNet.GetUID()); } MoveOwned(zDO, position, rotation); } } } private static void MoveOwned(ZDO tomb, Vector3 point, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0074: 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) tomb.Set(ZDOVars.s_spawnPoint, point); tomb.Set(ZDOVars.s_velHash, Vector3.zero); tomb.Set(ZDOVars.s_bodyVelHash, Vector3.zero); tomb.Set(ZDOVars.s_bodyAVelHash, Vector3.zero); tomb.SetRotation(rotation); tomb.SetPosition(point); ZNetView val = ZNetScene.instance.FindInstance(tomb); if (Object.op_Implicit((Object)(object)val)) { ShrineGraveAnchor.Place(((Component)val).transform, ((Component)val).GetComponent<Rigidbody>(), point, rotation); ((Component)val).GetComponent<ShrineGraveAnchor>()?.Refresh(); } ZDOMan.instance.ForceSendZDO(tomb.m_uid); } internal static void RequestMapPins() { if (!Object.op_Implicit((Object)(object)ZNet.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } if (ZNet.instance.IsServer()) { SendMapPins(null); return; } ZRpc serverRPC = ZNet.instance.GetServerRPC(); if (serverRPC != null) { serverRPC.Invoke("Ravenstone_RequestMapPins", Array.Empty<object>()); } } private static void SendMapPins(ZNetPeer peer) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0053: 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_0060: 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_00c7: Unknown result type (might be due to invalid IL or missing references) ZDO val = FindCharacter(peer); if (val == null) { return; } long num = val.GetLong(ZDOVars.s_playerID, 0L); if (num == 0) { return; } PrepareMapGraves(); ZPackage val2 = new ZPackage(); Vector3 val3 = default(Vector3); foreach (ZDOID mapGrafe in MapGraves) { ZDO zDO = ZDOMan.instance.GetZDO(mapGrafe); if (zDO.GetLong(ZDOVars.s_owner, 0L) == num && IsNonEmpty(zDO) && (zDO.GetVec3(PinOrigin, ref val3) || zDO.GetVec3(OriginPosition, ref val3))) { val2.Write(val3); val2.Write(zDO.GetPosition()); val2.Write(zDO.GetLong(ZDOVars.s_timeOfDeath, 0L)); } } if (peer == null) { ShrineMapPins.Apply(val2); return; } peer.m_rpc.Invoke("Ravenstone_MapPins", new object[1] { val2 }); } private static void PrepareMapGraves() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) if (!mapGravesLoaded) { foreach (ZDOID item in ZDOExtraData.GetAllZDOIDsWithHash((Type)4, SummonedAt)) { MapGraves.Add(item); } mapGravesLoaded = true; } MapGraves.RemoveWhere(delegate(ZDOID id) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ZDO zDO = ZDOMan.instance.GetZDO(id); return zDO == null || !zDO.GetBool(Returned, false) || zDO.GetLong(SummonedAt, 0L) == 0; }); } internal static string Countdown(ZDO tomb) { if (tomb == null || !Object.op_Implicit((Object)(object)ZNet.instance)) { return null; } long num = tomb.GetLong(ReturnDeadline, 0L); if (num <= 0) { return null; } long num2 = Math.Max(0L, num - ZNet.instance.GetTime().Ticks); long num3 = (num2 + 10000000 - 1) / 10000000; string text = ((num3 >= 3600) ? $"{num3 / 3600:00}:{num3 / 60 % 60:00}:{num3 % 60:00}" : $"{num3 / 60:00}:{num3 % 60:00}"); Localization instance = Localization.instance; string text2 = ((instance != null) ? instance.GetSelectedLanguage() : null); if (1 == 0) { } string text3 = text2 switch { "Portuguese_Brazilian" => "Retorno em", "German" => "Rückkehr in", "Italian" => "Ritorno tra", "Russian" => "Возврат через", "Spanish" => "Regresa en", "French" => "Retour dans", _ => "Returns in", }; if (1 == 0) { } string text4 = text3; return text4 + " " + text; } private static void Reply(ZNetPeer peer, long token, string message) { if (peer == null) { Result(token, message); return; } peer.m_rpc.Invoke("Ravenstone_Result", new object[2] { token, message }); } private static void Result(long token, string message) { if (token == -1) { Show(message); } else { if (ShrineRecovery.payment != null && ShrineRecovery.payment.Token != token && token != 0) { return; } if (ShrineRecovery.payment != null && ShrineRecovery.payment.Token == token) { Payment payment = ShrineRecovery.payment; ShrineRecovery.payment = null; if (message.Length != 0 && Object.op_Implicit((Object)(object)payment.Player)) { Refund(payment); } } waitingUntil = 0f; Show((message.Length == 0) ? "Your gravestone has been called." : message); } } private static void Refund(Payment completed) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0061: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = ((Humanoid)completed.Player).GetInventory(); foreach (ItemData stack in completed.Stacks) { if (!inventory.CanAddItem(stack, -1) || !inventory.AddItem(stack)) { ItemDrop.DropItem(stack, stack.m_stack, ((Component)completed.Player).transform.position + Vector3.up, Quaternion.identity); } } } internal static void RequestDismantle(WearNTear shrine, bool blockDrop) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!RavenstoneShrinePlugin.IsLocalAdmin) { Show("Only server administrators can dismantle the shrine."); return; } ZNetView component = ((Component)shrine).GetComponent<ZNetView>(); if (!Object.op_Implicit((Object)(object)component) || !component.IsValid()) { return; } ZDOID uid = component.GetZDO().m_uid; if (ZNet.instance.IsServer()) { Dismantle(null, uid, blockDrop); return; } ZRpc serverRPC = ZNet.instance.GetServerRPC(); if (serverRPC != null) { serverRPC.Invoke("Ravenstone_Dismantle", new object[2] { uid, blockDrop }); } } private static void Dismantle(ZNetPeer peer, ZDOID id, bool blockDrop) { //IL_0075: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer() || (peer != null && (!Active(peer, peer.m_rpc) || !ZNet.instance.IsAdmin(peer.m_socket.GetHostName())))) { return; } ZDO val = FindCharacter(peer); ZDOMan instance = ZDOMan.instance; ZDO val2 = ((instance != null) ? instance.GetZDO(id) : null); if (val == null || val2 == null || val2.GetPrefab() != RavenstoneShrinePlugin.ShrineHash) { return; } Vector3 val3 = val.GetPosition() - val2.GetPosition(); if (((Vector3)(ref val3)).sqrMagnitude > 64f) { return; } Vector3 point; Quaternion rotation; if (SummonsInProgress.ContainsKey(id)) { Reply(peer, -1L, "The shrine is already calling a gravestone."); } else if (Object.op_Implicit((Object)(object)ZoneSystem.instance) && TryGetReturnPoint(val2, out point, out rotation) && FindGraveAtReturnPoint(point, new List<ZDO>()) != null) { string message = "Empty the gravestone or wait for it to return before dismantling the shrine."; Reply(peer, -1L, message); } else { if (val2.GetFloat(ZDOVars.s_health, 1f) <= 0f) { return; } ZNetScene instance2 = ZNetScene.instance; ZNetView val4 = instance2.FindInstance(val2); GameObject val5 = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).gameObject : CreateExistingObject(instance2, val2)); if (Object.op_Implicit((Object)(object)val5)) { val4 = val5.GetComponent<ZNetView>(); Piece component = val5.GetComponent<Piece>(); WearNTear component2 = val5.GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)val4) && val4.IsValid() && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component.m_canBeRemoved && component.CanBeRemoved()) { val2.SetOwner(ZNet.GetUID()); DestroyShrine(component2, null, blockDrop); } } } } internal static void RegisterPlacement(ZDOID id) { //IL_0046: 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_006a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNet.instance) || !RavenstoneShrinePlugin.IsLocalAdmin) { return; } if (ZNet.instance.IsServer()) { ((MonoBehaviour)RavenstoneShrinePlugin.Instance).StartCoroutine(ConfirmPlacement(null, id)); return; } ZDOMan.instance.ForceSendZDO(id); ZRpc serverRPC = ZNet.instance.GetServerRPC(); if (serverRPC != null) { serverRPC.Invoke("Ravenstone_Placed", new object[1] { id }); } } private static IEnumerator ConfirmPlacement(ZNetPeer peer, ZDOID id) { //IL_000e: 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) float deadline = Time.realtimeSinceStartup + 5f; while (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer() && Time.realtimeSinceStartup < deadline && (peer == null || (Active(peer, peer.m_rpc) && ZNet.instance.IsAdmin(peer.m_socket.GetHostName())))) { ZDO character = FindCharacter(peer); ZDOMan instance = ZDOMan.instance; ZDO shrine = ((instance != null) ? instance.GetZDO(id) : null); if (character != null && shrine != null) { long player = character.GetLong(ZDOVars.s_playerID, 0L); if (shrine.GetPrefab() != RavenstoneShrinePlugin.ShrineHash || shrine.GetBool(RavenstoneShrinePlugin.Placed, false)) { break; } int num; if (player != 0L && shrine.GetLong(ZDOVars.s_creator, 0L) == player && shrine.GetOwner() == character.GetOwner()) { Vector3 val = character.GetPosition() - shrine.GetPosition(); num = ((((Vector3)(ref val)).sqrMagnitude <= 225f) ? 1 : 0); } else { num = 0; } if (num != 0) { shrine.SetOwner(ZNet.GetUID()); shrine.Set(RavenstoneShrinePlugin.Placed, true); ZDOMan.instance.ForceSendZDO(id); break; } } yield return null; } } private static void Show(string text) { if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { ((Character)Player.m_localPlayer).Message((MessageType)2, ShrineMessages.Translate(text), 0, (Sprite)null, false); } } } internal static class ShrinePresentation { private const string InteractionPoint = "interactionpoint"; internal static void ConfigurePrefab(GameObject prefab) { ShrineMessages.Register(); Transform val = prefab.transform.Find("interactionpoint"); SphereCollider val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<SphereCollider>() : null); if (Object.op_Implicit((Object)(object)val2)) { ((Collider)val2).isTrigger = true; int num = LayerMask.NameToLayer("piece_nonsolid"); if (num >= 0) { ((Component)val).gameObject.layer = num; } ((Component)val).gameObject.AddComponent<ShrineInteraction>(); } else { if (Object.op_Implicit((Object)(object)val)) { RavenstoneShrinePlugin.RavenstoneShrine.LogWarning((object)"interactionpoint needs a SphereCollider."); } prefab.AddComponent<ShrineInteraction>(); } HideEffect(prefab, "AreaFire"); HideEffect(prefab, "FireEnchant"); HideEffect(prefab, "FireShield"); if (!Application.isBatchMode) { Transform val3 = prefab.transform.Find("AreaFire/AreaDamage"); if (!Object.op_Implicit((Object)(object)val3)) { val3 = prefab.transform.Find("AreaDamage"); } if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.AddComponent<ShrineAreaFireRotation>(); } Transform val4 = prefab.transform.Find("FireShield/AreaDamageShield"); if (Object.op_Implicit((Object)(object)val4)) { ((Component)val4).gameObject.AddComponent<ShrineAreaFireRotation>(); } prefab.AddComponent<ShrineVisuals>(); } } private static void HideEffect(GameObject prefab, string name) { Transform val = prefab.transform.Find(name); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.SetActive(false); } } internal static bool IsShrine(GameObject root) { return Object.op_Implicit((Object)(object)root.GetComponentInChildren<ShrineInteraction>(true)); } internal static void PlaySummonEffect(ZDOID shrine) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!Application.isBatchMode && Object.op_Implicit((Object)(object)ZNetScene.instance)) { GameObject val = ZNetScene.instance.FindInstance(shrine); ShrineVisuals shrineVisuals = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ShrineVisuals>() : null); if (Object.op_Implicit((Object)(object)shrineVisuals)) { shrineVisuals.PlaySummonEffect(); } } } } internal sealed class ShrineAreaFireRotation : MonoBehaviour { private void Update() { ((Component)this).transform.Rotate(0f, 7.5f * Time.deltaTime, 0f, (Space)1); } } internal sealed class ShrineVisuals : MonoBehaviour { private readonly List<ZDO> candidates = new List<ZDO>(); private Transform returnPoint; private Transform areaFire; private Transform fireEnchant; private Transform fireShield; private ZNetView view; private ZDOID lastGrave; private void Start() { returnPoint = ((Component)this).transform.Find("returnpoint"); areaFire = ((Component)this).transform.Find("AreaFire"); fireEnchant = ((Component)this).transform.Find("FireEnchant"); fireShield = ((Component)this).transform.Find("FireShield"); view = ((Component)this).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)returnPoint) && Object.op_Implicit((Object)(object)view) && view.IsValid()) { Refresh(); ((MonoBehaviour)this).InvokeRepeating("Refresh", 0.25f, 0.5f); } } private void Refresh() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a0: Unknown result type (might be due to invalid IL or missing references) if (view.IsValid() && Object.op_Implicit((Object)(object)ZNetScene.instance) && Object.op_Implicit((Object)(object)ZoneSystem.instance) && ZDOMan.instance != null && view.GetZDO().GetBool(RavenstoneShrinePlugin.Placed, false)) { ZDO val = ShrineRecovery.FindGraveAtReturnPoint(returnPoint.position, candidates); bool flag = val != null; SetActive(areaFire, flag); SetActive(fireShield, !flag); lastGrave = (flag ? val.m_uid : ZDOID.None); } } internal void PlaySummonEffect() { if (!Object.op_Implicit((Object)(object)fireEnchant)) { fireEnchant = ((Component)this).transform.Find("FireEnchant"); } SetActive(fireEnchant, active: false); SetActive(fireEnchant, active: true); } internal string GetCountdown() { //IL_0027: 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) if (((ZDOID)(ref lastGrave)).IsNone() || ZDOMan.instance == null) { return null; } ZDO zDO = ZDOMan.instance.GetZDO(lastGrave); return (zDO != null && ShrineRecovery.IsAtReturnPoint(zDO, returnPoint.position)) ? ShrineRecovery.Countdown(zDO) : null; } private static void SetActive(Transform effect, bool active) { if (Object.op_Implicit((Object)(object)effect) && ((Component)effect).gameObject.activeSelf != active) { ((Component)effect).gameObject.SetActive(active); } } } internal sealed class ShrineInteraction : MonoBehaviour, Hoverable, Interactable { private Piece shrine; private ShrineVisuals visuals; private ZNetView view; private void Awake() { shrine = ((Component)this).GetComponentInParent<Piece>(); visuals = ((Component)this).GetComponentInParent<ShrineVisuals>(); view = ((Component)this).GetComponentInParent<ZNetView>(); } public string GetHoverName() { return shrine.m_name; } public string GetHoverText() { string text = (Object.op_Implicit((Object)(object)visuals) ? visuals.GetCountdown() : null); return Localization.instance.Localize(GetHoverName() + "\n" + (text ?? "[<color=yellow><b>$KEY_Use</b></color>] $ravenstone_call_grave")); } public float GetHoverOffset() { return 0f; } public bool UseItem(Humanoid user, ItemData item) { return false; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (hold || alt || (Object)(object)user != (Object)(object)Player.m_localPlayer || !Object.op_Implicit((Object)(object)view) || !view.IsValid()) { return false; } ShrineRecovery.Request(view.GetZDO().m_uid); return true; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] internal static class ShrineConnectionPatch { private static void Postfix(ZNet __instance, ZNetPeer peer) { ShrineRecovery.Connect(__instance, peer); } } [HarmonyPatch(typeof(ZNetScene), "OnDestroy")] internal static class ShrineWorldExitPatch { private static void Prefix() { ShrineRecovery.Clear(); } } [HarmonyPatch(typeof(Player), "TryPlacePiece")] internal static class ShrinePlacementPermissionPatch { private static bool Prefix(Piece piece, ref bool __result) { if (!Object.op_Implicit((Object)(object)piece) || !ShrinePresentation.IsShrine(((Component)piece).gameObject) || RavenstoneShrinePlugin.IsLocalAdmin) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Piece), "SetCreator")] internal static class ShrinePlacementPatch { private static void Postfix(Piece __instance, long uid) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (ShrinePresentation.IsShrine(((Component)__instance).gameObject) && Object.op_Implicit((Object)(object)Player.m_localPlayer) && Player.m_localPlayer.GetPlayerID() == uid && __instance.GetCreator() == uid) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if (component.IsOwner()) { ShrineRecovery.RegisterPlacement(component.GetZDO().m_uid); } } } } [HarmonyPatch(typeof(WearNTear), "Remove")] internal static class ShrineDismantlePatch { private static bool Prefix(WearNTear __instance, bool blockDrop) { if (!ShrinePresentation.IsShrine(((Component)__instance).gameObject)) { return true; } ShrineRecovery.RequestDismantle(__instance, blockDrop); return false; } } [HarmonyPatch(typeof(WearNTear), "RPC_Remove")] internal static class ShrineVanillaRemoveRpcPatch { private static bool Prefix(WearNTear __instance) { return !ShrinePresentation.IsShrine(((Component)__instance).gameObject); } } [HarmonyPatch(typeof(ZNetScene), "Update")] internal static class ShrineReturnTimerPatch { private static void Postfix() { ShrineRecovery.CheckReturns(); } } [HarmonyPatch(typeof(TombStone), "Interact")] internal static class ShrineExpiredGravestonePatch { private static bool Prefix(TombStone __instance, Humanoid character, bool hold, ref bool __result) { if (hold || (Object)(object)character != (Object)(object)Player.m_localPlayer) { return true; } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if (!Object.op_Implicit((Object)(object)component) || !component.IsValid() || !ShrineRecovery.IsExpired(component.GetZDO())) { return true; } ((Character)character).Message((MessageType)2, ShrineMessages.Translate("The offering expired. Your gravestone is returning."), 0, (Sprite)null, false); __result = false; return false; } } internal static class ShrineMapPins { private sealed class PinMove { internal PinData Pin; internal Vector3 Origin; internal Vector3 Destination; } private const int RecordBytes = 32; private static readonly FieldRef<Minimap, List<PinData>> Pins = AccessTools.FieldRefAccess<Minimap, List<PinData>>("m_pins"); private static readonly List<PinMove> Moves = new List<PinMove>(); private static float nextRefresh; internal static void Clear() { ShowOrigins(); Moves.Clear(); nextRefresh = 0f; } internal static void Refresh() { if (!(Time.realtimeSinceStartup < nextRefresh)) { nextRefresh = Time.realtimeSinceStartup + 3f; ShrineRecovery.RequestMapPins(); } } internal static void Apply(ZPackage snapshot) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Invalid comparison between Unknown and I4 //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_01f7: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Minimap.instance) || !Object.op_Implicit((Object)(object)EnvMan.instance)) { return; } snapshot.SetPos(0); if (snapshot.Size() % 32 != 0) { return; } ShowOrigins(); Moves.Clear(); List<PinData> list = Pins.Invoke(Minimap.instance); HashSet<PinData> hashSet = new HashSet<PinData>(); int num = snapshot.Size() / 32; for (int i = 0; i < num; i++) { Vector3 val = snapshot.ReadVector3(); Vector3 destination = snapshot.ReadVector3(); long num2 = snapshot.ReadLong(); string text = ((num2 > 0) ? ("$hud_mapday " + EnvMan.instance.GetDay((double)num2 / 10000000.0)) : null); PinData val2 = null; float num3 = 16f; int num4 = 0; foreach (PinData item in list) { if ((int)item.m_type != 4 || !item.m_save || item.m_ownerID != 0L || hashSet.Contains(item) || (text != null && item.m_name != text)) { continue; } Vector3 val3 = item.m_pos - val; float num5 = val3.x * val3.x + val3.z * val3.z; if (!(num5 > 16f)) { num4++; if (val2 == null || num5 < num3) { val2 = item; num3 = num5; } } } if (val2 != null && (text != null || num4 == 1)) { hashSet.Add(val2); Moves.Add(new PinMove { Pin = val2, Origin = val2.m_pos, Destination = destination }); } } ShowDestinations(); } internal static void ShowOrigins() { //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) foreach (PinMove move in Moves) { move.Pin.m_pos = move.Origin; } } internal static void ShowDestinations() { //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) foreach (PinMove move in Moves) { move.Pin.m_pos = move.Destination; } } } [HarmonyPatch(typeof(Minimap), "Update")] internal static class ShrineMapUpdatePatch { private static void Postfix(bool ___m_hasGenerated) { if (___m_hasGenerated && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { ShrineMapPins.Refresh(); } } } [HarmonyPatch(typeof(Minimap), "GetMapData")] internal static class ShrineMapSavePatch { private static void Prefix() { ShrineMapPins.ShowOrigins(); } private static void Finalizer() { ShrineMapPins.ShowDestinations(); } } [HarmonyPatch(typeof(TombStone), "GetHoverText")] internal static class ShrineGravestoneCountdownPatch { private static void Postfix(TombStone __instance, ref string __result) { if (!string.IsNullOrEmpty(__result)) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); string text = ((Object.op_Implicit((Object)(object)component) && component.IsValid()) ? ShrineRecovery.Countdown(component.GetZDO()) : null); if (text != null) { __result = __result + "\n" + text; } } } } [HarmonyPatch(typeof(InventoryGui), "UpdateContainer")] internal static class ShrineContainerCountdownPatch { private static void Postfix(InventoryGui __instance, Container ___m_currentContainer, Animator ___m_animator) { if (Object.op_Implicit((Object)(object)___m_currentContainer) && ___m_currentContainer.IsOwner() && ___m_animator.GetBool("visible") && Object.op_Implicit((Object)(object)__instance.m_containerName)) { ZNetView component = ((Component)___m_currentContainer).GetComponent<ZNetView>(); string text = ((Object.op_Implicit((Object)(object)component) && component.IsValid()) ? ShrineRecovery.Countdown(component.GetZDO()) : null); if (text != null) { TMP_Text containerName = __instance.m_containerName; containerName.text = containerName.text + " (" + text + ")"; } } } } internal sealed class ShrineGraveAnchor : MonoBehaviour { private ZNetView view; private ZSyncTransform sync; private Floating floating; private Rigidbody body; private bool anchored; private bool previousSync; private bool previousFloating; private bool previousKinematic; private bool previousGravity; private void Awake() { view = ((Component)this).GetComponent<ZNetView>(); sync = ((Component)this).GetComponent<ZSyncTransform>(); floating = ((Component)this).GetComponent<Floating>(); body = ((Component)this).GetComponent<Rigidbody>(); } private void LateUpdate() { Refresh(); } internal void Refresh() { //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: 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_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)view) || !view.IsValid()) { return; } ZDO zDO = view.GetZDO(); if (!ShrineRecovery.TryGetAltarPose(zDO, out var position, out var rotation)) { if (anchored) { Place(((Component)this).transform, body, zDO.GetPosition(), zDO.GetRotation()); if (Object.op_Implicit((Object)(object)body)) { body.isKinematic = previousKinematic; body.useGravity = previousGravity; } if (Object.op_Implicit((Object)(object)sync)) { ((Behaviour)sync).enabled = previousSync; } if (Object.op_Implicit((Object)(object)floating)) { ((Behaviour)floating).enabled = previousFloating; } anchored = false; } return; } if (!anchored) { previousSync = Object.op_Implicit((Object)(object)sync) && ((Behaviour)sync).enabled; previousFloating = Object.op_Implicit((Object)(object)floating) && ((Behaviour)floating).enabled; if (Object.op_Implicit((Object)(object)sync)) { ((Behaviour)sync).enabled = false; } if (Object.op_Implicit((Object)(object)floating)) { ((Behaviour)floating).enabled = false; } if (Object.op_Implicit((Object)(object)body)) { previousKinematic = body.isKinematic; previousGravity = body.useGravity; if (!body.isKinematic) { body.linearVelocity = Vector3.zero; body.angularVelocity = Vector3.zero; } body.useGravity = false; body.isKinematic = true; } anchored = true; Place(((Component)this).transform, body, position, rotation); goto IL_02c5; } Vector3 val = ((Component)this).transform.position - position; if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { if (Object.op_Implicit((Object)(object)body)) { val = body.position - position; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { goto IL_02af; } } if (!(Quaternion.Angle(((Component)this).transform.rotation, rotation) > 0.1f)) { goto IL_02c5; } } goto IL_02af; IL_02af: Place(((Component)this).transform, body, position, rotation); goto IL_02c5; IL_02c5: if (zDO.IsOwner()) { val = zDO.GetPosition() - position; if (((Vector3)(ref val)).sqrMagnitude > 0.0025f) { zDO.SetPosition(position); zDO.SetRotation(rotation); ZDOMan.instance.ForceSendZDO(zDO.m_uid); } } } internal static void Place(Transform root, Rigidbody body, Vector3 point, Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0040: Unknown result type (might be due to invalid IL or missing references) root.SetPositionAndRotation(point, rotation); if (Object.op_Implicit((Object)(object)body)) { body.position = point; body.rotation = rotation; if (!body.isKinematic) { body.linearVelocity = Vector3.zero; body.angularVelocity = Vector3.zero; } Physics.SyncTransforms(); } } } [HarmonyPatch(typeof(TombStone), "Awake")] internal static class ShrineGraveAnchorSetupPatch { private static void Postfix(TombStone __instance) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component) && component.IsValid()) { ((Component)__instance).gameObject.AddComponent<ShrineGraveAnchor>(); } } } [HarmonyPatch(typeof(TombStone), "PositionCheck")] internal static class ShrineGravePositionPatch { private static bool Prefix(ZNetView ___m_nview) { Vector3 position; Quaternion rotation; return !Object.op_Implicit((Object)(object)___m_nview) || !___m_nview.IsValid() || !ShrineRecovery.TryGetAltarPose(___m_nview.GetZDO(), out position, out rotation); } } internal static class ShrineMessages { internal const string OfferingPrefix = "Offering required: "; internal const string CallGraveKey = "$ravenstone_call_grave"; private static readonly Dictionary<string, string> Keys = new Dictionary<string, string>(StringComparer.Ordinal); internal static void Register() { if (Keys.Count == 0) { Register("approach", "Aproxime-se de um santuário ativo.", "Move closer to an active shrine.", "Geh näher an einen aktiven Schrein heran.", "Avvicinati a un santuario attivo.", "Подойдите ближе к действующему святилищу.", "Acércate a un santuario activo.", "Approchez-vous d'un sanctuaire actif."); Register("no_graves", "Você não tem mais lápides para invocar.", "You have no remaining gravestones to call.", "Du hast keine weiteren Grabsteine, die du herbeirufen kannst.", "Non hai altre lapidi da richiamare.", "У вас больше нет надгробий, которые можно призвать.", "No te quedan lápidas que invocar.", "Vous n'avez plus de pierres tombales à faire venir."); Register("occupied", "Esvazie primeiro a lápide que está no santuário.", "Clear the gravestone at the shrine first.", "Leere zuerst den Grabstein am Schrein.", "Svuota prima la lapide che si trova al santuario.", "Сначала заберите все предметы из надгробия у святилища.", "Vacía primero la lápida que está en el santuario.", "Videz d'abord la pierre tombale qui se trouve au sanctuaire."); Register("busy", "Sua lápide mais recente está em uso ou em uma área ativa. Tente de novo quando a área for descarregada.", "Your latest gravestone is in an active area or in use. Try again when the area unloads.", "Dein jüngster Grabstein wird benutzt oder befindet sich in einem aktiven Gebiet. Versuche es erneut, sobald das Gebiet nicht mehr geladen ist.", "La tua ultima lapide è in uso o si trova in una zona attiva. Riprova quando la zona non sarà più caricata.", "Ваше последнее надгробие используется или находится в активной области. Попробуйте снова, когда игра выгрузит эту область.", "Tu lápida más reciente está en uso o en una zona activa. Inténtalo de nuevo cuando se descargue la zona.", "Votre pierre tombale la plus récente est en cours d'utilisation ou se trouve dans une zone active. Réessayez lorsque la zone ne sera plus chargée."); Register("item_unavailable", "O item da oferenda do santuário não está disponível.", "The shrine's payment item is unavailable.", "Der Gegenstand für die Opfergabe ist nicht verfügbar.", "L'oggetto richiesto per l'offerta del santuario non è disponibile.", "Предмет для подношения святилищу недоступен.", "El objeto de la ofrenda del santuario no está disponible.", "L'objet requis pour l'offrande du sanctuaire est indisponible."); Register("busy_summoning", "O santuário já está invocando uma lápide.", "The shrine is already calling a gravestone.", "Der Schrein ruft bereits einen Grabstein herbei.", "Il santuario sta già richiamando una lapide.", "Святилище уже призывает надгробие.", "El santuario ya está invocando una lápida.", "Le sanctuaire invoque déjà une pierre tombale."); Register("request_expired", "O pedido de invocação expirou.", "The shrine request expired.", "Die Anfrage am Schrein ist abgelaufen.", "La richiesta al santuario è scaduta.", "Время запроса к святилищу истекло.", "La solicitud al santuario ha caducado.", "La demande au sanctuaire a expiré."); Register("offering", "Oferenda necessária: $1 × $2.", "Offering required: $1 × $2.", "Benötigte Opfergabe: $1 × $2.", "Offerta richiesta: $1 × $2.", "Требуемое подношение: $1 × $2.", "Ofrenda necesaria: $1 × $2.", "Offrande requise : $1 × $2."); Register("cancelled", "Invocação cancelada.", "Recovery cancelled.", "Herbeirufen abgebrochen.", "Richiamo annullato.", "Призыв отменён.", "Invocación cancelada.", "Invocation annulée."); Register("changed", "Sua lápide mais recente mudou. Tente de novo.", "Your latest gravestone changed. Try again.", "Dein jüngster Grabstein hat sich geändert. Versuche es erneut.", "La tua ultima lapide è cambiata. Riprova.", "Ваше последнее надгробие изменилось. Попробуйте ещё раз.", "Tu lápida más reciente ha cambiado. Inténtalo de nuevo.", "Votre pierre tombale la plus récente a changé. Réessayez."); Register("called", "Sua lápide foi invocada.", "Your gravestone has been called.", "Dein Grabstein wurde herbeigerufen.", "La tua lapide è stata richiamata.", "Ваше надгробие призвано.", "Tu lápida ha sido invocada.", "Votre pierre tombale a été invoquée."); Register("admin", "Só administradores do servidor podem desmontar o santuário.", "Only server administrators can dismantle the shrine.", "Nur Serveradministratoren dürfen den Schrein abbauen.", "Solo gli amministratori del server possono smantellare il santuario.", "Только администраторы сервера могут разобрать святилище.", "Solo los administradores del servidor pueden desmontar el santuario.", "Seuls les administrateurs du serveur peuvent démonter le sanctuaire."); Register("dismantle_occupied", "Esvazie a lápide ou espere que ela volte à origem antes de desmontar o santuário.", "Empty the gravestone or wait for it to return before dismantling the shrine.", "Leere den Grabstein oder warte, bis er zurückkehrt, bevor du den Schrein abbaust.", "Svuota la lapide o attendi che torni al suo posto prima di smantellare il santuario.", "Прежде чем разобрать святилище, заберите все предметы из надгробия или дождитесь его возвращения.", "Vacía la lápida o espera a que regrese antes de desmontar el santuario.", "Videz la pierre tombale ou attendez son retour avant de démonter le sanctuaire."); Register("returning", "O prazo da oferenda venceu. Sua lápide está voltando à origem.", "The offering expired. Your gravestone is returning.", "Die Frist für die Opfergabe ist abgelaufen. Dein Grabstein kehrt zurück.", "Il tempo dell'offerta è scaduto. La tua lapide sta tornando al suo posto.", "Срок подношения истёк. Ваше надгробие возвращается.", "El plazo de la ofrenda ha vencido. Tu lápida está regresando.", "Le délai de l'offrande a expiré. Votre pierre tombale retourne à son emplacement d'origine."); Register("call_grave", "Invocar sua lápide", "Call your gravestone", "Deinen Grabstein herbeirufen", "Richiama la tua lapide", "Призвать надгробие", "Invocar tu lápida", "Faire venir votre pierre tombale"); } } private static void Register(string key, string pt, string en, string de, string it, string ru, string es, string fr) { string text = "$ravenstone_" + key; Keys.Add(en, text); new PieceManager.LocalizeKey(text).Portuguese_Brazilian(pt).English(en).German(de) .Italian(it) .Russian(ru) .Spanish(es) .French(fr); } internal static string Translate(string message) { Localization instance = Localization.instance; if (instance == null) { return message; } if (Keys.TryGetValue(message, out var value)) { return instance.Localize(value); } if (message.StartsWith("Offering required: ", StringComparison.Ordinal) && message.EndsWith(".", StringComparison.Ordinal)) { int num = message.IndexOf(" x ", "Offering required: ".Length, StringComparison.Ordinal); if (num > "Offering required: ".Length && num + 3 < message.Length - 1) { string text = message.Substring("Offering required: ".Length, num - "Offering required: ".Length); string text2 = message.Substring(num + 3, message.Length - num - 4); GameObject val = (Object.op_Implicit((Object)(object)ObjectDB.instance) ? ObjectDB.instance.GetItemPrefab(text2) : null); ItemDrop val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ItemDrop>() : null); string text3 = (Object.op_Implicit((Object)(object)val2) ? instance.Localize(val2.m_itemData.m_shared.m_name) : text2); return instance.Localize("$ravenstone_offering", new string[2] { text, text3 }); } } return instance.Localize(message); } } } namespace PieceManager { [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(1)] [<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(0)] [PublicAPI] public static class MaterialReplacer { [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(0)] public enum ShaderType { PieceShader, VegetationShader, RockShader, RugShader, GrassShader, CustomCreature, UseUnityShader } private static readonly Dictionary<GameObject, bool> ObjectToSwap; private static readonly Dictionary<string, Material> OriginalMaterials; private static readonly Dictionary<GameObject, ShaderType> ObjectsForShaderReplace; private static readonly HashSet<Shader> CachedShaders; private static bool hasRun; static MaterialReplacer() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown CachedShaders = new HashSet<Shader>(); hasRun = false; OriginalMaterials = new Dictionary<string, Material>(); ObjectToSwap = new Dictionary<GameObject, bool>(); ObjectsForShaderReplace = new Dictionary<GameObject, ShaderType>(); Harmony val = new Harmony("org.bepinex.helpers.PieceManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type) { if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, type); } } public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false) { if (!((Object)(object)go == (Object)null) && !ObjectToSwap.ContainsKey(go)) { ObjectToSwap.Add(go, isJotunnMock); } } private static void GetAllMaterials() { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val in array) { OriginalMaterials[((Object)val).name] = val; } } [HarmonyPriority(700)] private static void ReplaceAllMaterialsWithOriginal() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun) { return; } if (OriginalMaterials.Count == 0) { GetAllMaterials(); } foreach (KeyValuePair<GameObject, bool> item in ObjectToSwap) { GameObject key = item.Key; bool value = item.Value; ProcessGameObjectMaterials(key, value); } AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { IEnumerable<Shader> enumerable3; try { IEnumerable<Shader> enumerable2; if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val)) { IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>(); enumerable2 = enumerable; } else { enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>) where (Object)(object)shader != (Object)null select shader; } enumerable3 = enumerable2; } catch (Exception) { continue; } if (enumerable3 == null) { continue; } foreach (Shader item2 in enumerable3) { CachedShaders.Add(item2); } } foreach (KeyValuePair<GameObject, ShaderType> item3 in ObjectsForShaderReplace) { GameObject key2 = item3.Key; ShaderType value2 = item3.Value; ProcessGameObjectShaders(key2, value2); } hasRun = true; } private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials.Select([<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(0)] (Material material) => ((Object)(object)material == (Object)null) ? null : ReplaceMaterial(material, isJotunnMock)).ToArray(); val.sharedMaterials = sharedMaterials; } } private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock) { if ((Object)(object)originalMaterial == (Object)null) { return null; } string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_"); if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal)) { return originalMaterial; } string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, ""); if (OriginalMaterials.TryGetValue(text2, out var value)) { return value; } Debug.LogWarning((object)("No suitable material found to replace: " + text2)); return originalMaterial; } private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null) { val2.shader = GetShaderForType(val2.shader, shaderType, ((Object)val2.shader).name); } } } } private static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName) { return (Shader)(shaderType switch { ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)(object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), _ => FindShaderWithName(orig, "Standard"), }); } public static Shader FindShaderWithName(Shader origShader, string name) { foreach (Shader cachedShader in CachedShaders) { if (((Object)cachedShader).name == name) { return cachedShader; } } return origShader; } } [PublicAPI] public enum CraftingTable { None, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("blackforge")] BlackForge, [InternalName("piece_preptable")] FoodPreparationTable, [InternalName("piece_MeadCauldron")] MeadKetill, Custom } [<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(0)] [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(1)] public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [<75a3466e-06a3-4104-ac8a-5b027ab62754>NullableContext(1)] [<93f2343e-9870-4934-b5d5-9cfa27acbd0d>Nullable(0)] [PublicAPI] public class ExtensionList { public readonly List<ExtensionConfig> ExtensionStations = new List<ExtensionConfig>(); public void Set(CraftingTable table, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = table, maxStationDistance = maxStationDistance }); } public void Set(string customTable, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = CraftingTable.Custom, custom = customTable, maxStationDistance = maxStationDistance }); } } public struct ExtensionConfi