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 Deadheim v12.0.5
DonationShop.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Managers; using Jotunn.Utils; using Splatform; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace DonationShop; [BepInPlugin("Detalhes.DonationShop", "Detalhes.DonationShop", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class DonationShop : BaseUnityPlugin { public const string PluginGUID = "Detalhes.DonationShop"; public const string Name = "DonationShop"; public const string Version = "2.0.0"; public static bool IsBuying = false; public static string PlayerName = ""; public static Dictionary<string, GameObject> menuItems = new Dictionary<string, GameObject>(); private Harmony harmony = new Harmony("Detalhes.DonationShop"); public static GameObject Menu; public static ConfigEntry<KeyCode> KeyboardShortcut; public static ConfigEntry<string> ShopItems; public void Awake() { InitConfigs(); SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr) { if (attr.InitialSynchronization) { Logger.LogMessage((object)"Initial Config sync event received"); } else { Logger.LogMessage((object)"Config sync event received"); } }; harmony.PatchAll(); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (Input.GetKeyDown(KeyboardShortcut.Value)) { Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && !((Character)localPlayer).IsDead() && !((Character)localPlayer).InCutscene() && !((Character)localPlayer).IsTeleporting()) { GUI.ToggleMenu(); ZPackage val = new ZPackage(); val.Write(((object)(PlatformUserID)(ref PlayFabManager.m_customId)).ToString()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "GetGoldServer", new object[1] { val }); } } } public void InitConfigs() { //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_003f: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; KeyboardShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Client config", "KeyboardShortcutConfig", (KeyCode)278, new ConfigDescription("Client side KeyboardShortcut", (AcceptableValueBase)null, new object[2] { null, (object)new ConfigurationManagerAttributes { IsAdminOnly = false } })); ShopItems = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "ShopItems", "prefabs=Blueberriesamount=50;price=150|prefab=Raspberry;amount=50;price=150|prefab=Thistle;amount=50;price=200|prefab=Cloudberry;amount=50;price=100|prefab=Wood;amount=50;price=100|prefab=Stone;amount=50;price=100|prefab=RoundLog;amount=50;price=100|prefab=FineWood;amount=50;price=150|prefab=IronNails;amount=10;price=110|prefab=IronOre;amount=50;price=700|prefab=SilverOre;amount=50;price=1000|prefab=GreydwarfEye;amount=500;price=250|prefab=SurtlingCore;amount=100;price=100|prefab=PortalToken;amount=1;price=750|prefab=ResetToken;amount=1;price=250|prefab=Coins;amount=1000;price=500", new ConfigDescription("ShopItems", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } internal class GUI { public static void ToggleMenu() { if (!Object.op_Implicit((Object)(object)DonationShop.Menu) && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { if (GUIManager.Instance == null) { Debug.LogError((object)"GUIManager instance is null"); return; } if (!Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { Debug.LogError((object)"GUIManager CustomGUI is null"); return; } LoadMenu(); } bool active = !DonationShop.Menu.activeSelf; DonationShop.Menu.SetActive(active); } public static void DestroyMenu() { DonationShop.Menu.SetActive(false); } public static void LoadMenu() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown if (!((Object)(object)Player.m_localPlayer == (Object)null)) { DonationShop.Menu = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 600f, 700f, true); DonationShop.Menu.SetActive(false); GameObject val = GUIManager.Instance.CreateScrollView(DonationShop.Menu.transform, false, true, 8f, 50f, GUIManager.Instance.ValheimScrollbarHandleColorBlock, new Color(0.1568628f, 0.1019608f, 0.0627451f, 1f), 500f, 450f); RectTransform val2 = (RectTransform)val.transform; val2.anchoredPosition = new Vector2(0f, 25f); val.SetActive(true); GameObject value = GUIManager.Instance.CreateText("Deadcoins : 0", DonationShop.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(-85f, -100f), GUIManager.Instance.AveriaSerifBold, 25, GUIManager.Instance.ValheimOrange, true, Color.black, 350f, 80f, false); DonationShop.menuItems.Add("coinText", value); CreateItems(val); ((Component)val.transform.Find("Scroll View")).GetComponent<ScrollRect>().verticalNormalizedPosition = 1f; GameObject val3 = GUIManager.Instance.CreateButton("Close", DonationShop.Menu.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -300f), 170f, 45f); val3.SetActive(true); GameObject value2 = GUIManager.Instance.CreateText("", DonationShop.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -600f), GUIManager.Instance.AveriaSerifBold, 14, Color.red, true, Color.black, 500f, 30f, false); DonationShop.menuItems.Add("errorText", value2); Button component = val3.GetComponent<Button>(); ((UnityEvent)component.onClick).AddListener(new UnityAction(DestroyMenu)); } } private static void CreateItems(GameObject scrollView) { //IL_0025: 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_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) GameObject val = GUIManager.Instance.CreateText("\n", scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f), GUIManager.Instance.AveriaSerifBold, 10, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 30f, false); string[] array = DonationShop.ShopItems.Value.Trim(new char[1] { ' ' }).Split(new char[1] { '|' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ';' }); string text2 = array2[0].Split(new char[1] { '=' })[1]; string amount = array2[1].Split(new char[1] { '=' })[1]; string price = array2[2].Split(new char[1] { '=' })[1]; GameObject originalPrefab = PrefabManager.Instance.GetPrefab(text2); if (originalPrefab == null) { Debug.LogError((object)("prefab cagado" + text2)); continue; } GameObject val2 = GUIManager.Instance.CreateText(text2.ToString(), scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f), GUIManager.Instance.AveriaSerifBold, 14, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 18f, false); GameObject val3 = GUIManager.Instance.CreateText(amount + "x", scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f), GUIManager.Instance.AveriaSerifBold, 14, GUIManager.Instance.ValheimOrange, true, Color.black, 60f, 18f, false); GameObject value = GUIManager.Instance.CreateText(price + " Deadcoins", scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f), GUIManager.Instance.AveriaSerifBold, 14, GUIManager.Instance.ValheimOrange, true, Color.black, 250f, 18f, false); GameObject val4 = GUIManager.Instance.CreateButton(" Comprar ", val2.transform, new Vector2(0.5f, -0.8f), new Vector2(0.5f, -0.8f), new Vector2(220f, 0f), 80f, 50f); val4.SetActive(true); Button component = val4.GetComponent<Button>(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { Shopper.BuyItem(originalPrefab, Convert.ToInt32(amount), Convert.ToInt32(price)); }); DonationShop.menuItems.Add(text2 + "Text", value); GameObject val5 = GUIManager.Instance.CreateText("", scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0.5f, -5f), new Vector2(0.5f, -5f), new Vector2(0f, -20f), GUIManager.Instance.AveriaSerifBold, 10, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 10f, false); } } } [HarmonyPatch] public class RPC { public static string Folder = "/DonationShop/"; [HarmonyPatch(typeof(Game), "Start")] [HarmonyPrefix] public static void Prefix() { ZRoutedRpc.instance.Register<ZPackage>("GetGoldServer", (Action<long, ZPackage>)RPC_GetGoldServer); ZRoutedRpc.instance.Register<ZPackage>("GetGoldClient", (Action<long, ZPackage>)RPC_GetGoldClient); ZRoutedRpc.instance.Register<ZPackage>("BuyItemServer", (Action<long, ZPackage>)RPC_BuyItemServer); ZRoutedRpc.instance.Register<ZPackage>("BuyItemClient", (Action<long, ZPackage>)RPC_BuyItemClient); ZRoutedRpc.instance.Register<ZPackage>("DontHaveGold", (Action<long, ZPackage>)RPC_DontHaveGold); } public static void RPC_GetGoldServer(long sender, ZPackage pkg) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown if (!ZNet.instance.IsServer()) { return; } ZNetPeer peer = ZNet.instance.GetPeer(sender); Debug.LogError((object)"RPC_GetGoldServer"); if (peer != null) { string[] array = pkg.ReadString().Split(new char[1] { ',' }); string text = array[0]; string playerName = peer.m_playerName; string path = Paths.ConfigPath + Folder + playerName + "-" + text + ".json"; ZPackage val = new ZPackage(); if (!File.Exists(path)) { Directory.CreateDirectory(Paths.ConfigPath + Folder); File.WriteAllText(path, "0"); val.Write("0"); } val.Write(File.ReadAllText(path)); ZRoutedRpc.instance.InvokeRoutedRPC(sender, "GetGoldClient", new object[1] { val }); } } public static void RPC_GetGoldClient(long sender, ZPackage pkg) { if (DonationShop.menuItems.TryGetValue("coinText", out var value)) { value.GetComponent<Text>().text = "Deadcoins: " + pkg.ReadString(); } } public static void RPC_DontHaveGold(long sender, ZPackage pkg) { if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { if (DonationShop.menuItems.TryGetValue("errorText", out var value)) { value.GetComponent<Text>().text = "Erro: você não tem deadcoins suficientes"; } DonationShop.IsBuying = false; } } public static void RPC_BuyItemServer(long sender, ZPackage pkg) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown if (ZNet.instance.IsServer()) { ZNetPeer peer = ZNet.instance.GetPeer(sender); string[] array = pkg.ReadString().Split(new char[1] { ',' }); int num = Convert.ToInt32(array[0]); int num2 = Convert.ToInt32(array[1]); string text = array[2]; string text2 = array[3]; string playerName = peer.m_playerName; string path = Paths.ConfigPath + Folder + playerName + "-" + text2 + ".json"; int num3 = Convert.ToInt32(File.ReadAllText(path)); if (num > num3) { ZRoutedRpc.instance.InvokeRoutedRPC(sender, "DontHaveGold", new object[1] { (object)new ZPackage() }); return; } File.WriteAllText(path, (num3 - num).ToString()); Directory.CreateDirectory(Paths.ConfigPath + Folder + "/log/"); File.AppendAllText(Paths.ConfigPath + Folder + "/log/log.txt", text2 + "-" + playerName + "buyed " + num2 + " " + text + "for " + num + " coins"); ZRoutedRpc.instance.InvokeRoutedRPC(sender, "BuyItemClient", new object[1] { pkg }); } } public static void RPC_BuyItemClient(long sender, ZPackage pkg) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) ZPackage val = new ZPackage(); val.Write(((object)(PlatformUserID)(ref PlayFabManager.m_customId)).ToString()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "GetGoldServer", new object[1] { val }); string[] array = pkg.ReadString().Split(new char[1] { ',' }); int num = Convert.ToInt32(array[0]); int num2 = Convert.ToInt32(array[1]); string text = array[2]; GameObject prefab = PrefabManager.Instance.GetPrefab(text); if ((Object)(object)prefab.GetComponent<ItemDrop>() != (Object)null) { ((Humanoid)Player.m_localPlayer).m_inventory.AddItem(prefab, num2); } else { Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity); } DonationShop.IsBuying = false; } } internal class Shopper { public static void BuyItem(GameObject prefab, int amount, int price) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (DonationShop.menuItems.TryGetValue("errorText", out var value)) { value.GetComponent<Text>().text = ""; } if (DonationShop.IsBuying) { value.GetComponent<Text>().text = "Aguarde o processamento da última compra."; } DonationShop.IsBuying = true; ZPackage val = new ZPackage(); string[] obj = new string[7] { price.ToString(), ",", amount.ToString(), ",", ((Object)prefab).name, ",", null }; PlatformUserID customId = PlayFabManager.m_customId; obj[6] = ((object)(PlatformUserID)(ref customId)).ToString(); val.Write(string.Concat(obj)); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "BuyItemServer", new object[1] { val }); } }
Deadheim.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using Groups; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Splatform; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Deadheim { [HarmonyPatch(typeof(Container), "Awake")] public static class Container_Awake_Patch { private const int woodChestRows = 4; private const int woodChestColumns = 5; private const int personalChestRows = 6; private const int personalChestColumns = 6; private const int ironChestRows = 8; private const int ironChestColumns = 6; private const int karveInventoryRows = 4; private const int karveInventoryColumns = 2; private const int longboatInventoryRows = 6; private const int longboatInventoryColumns = 6; private const int cartInventoryRows = 5; private const int cartInventoryColumns = 6; private const int aesirRows = 8; private static void Postfix(Container __instance, ref Inventory ___m_inventory) { if (((Object)(object)__instance == (Object)null || ___m_inventory == null || !Object.op_Implicit((Object)(object)((Component)__instance).transform.parent)) && ___m_inventory != null && ((Object)((Component)__instance).gameObject).name.Contains("AesirChest")) { ___m_inventory.m_width = 6; ___m_inventory.m_height = 6; } } } internal class CraftingStations { [HarmonyPatch(typeof(CraftingStation), "CheckUsable")] public static class WorkbenchRemoveRestrictions { private static bool Prefix(ref CraftingStation __instance) { __instance.m_craftRequireRoof = false; return true; } } [HarmonyPatch(typeof(PrivateArea), "Awake")] public static class PrivateAreaAwake { public static void Postfix(ref PrivateArea __instance) { int num = Plugin.WardRadius.Value; if (__instance.m_name.Contains("AdminWard")) { num = 50; } if (__instance.m_name.Contains("RaidWard")) { num = 50; } __instance.m_areaMarker.m_radius = num; __instance.m_radius = num; } } } public static class EpicMMOApi { private enum API_State { NotReady, NotInstalled, Ready } private static string pluginKey = "EpicMMOSystem"; private static API_State state = API_State.NotReady; private static MethodInfo eGetLevel; private static MethodInfo eAddExp; private static MethodInfo eGetAttribute; public static int GetLevel() { int result = 0; Init(); if (eGetLevel != null) { result = (int)eGetLevel.Invoke(null, null); } return result; } public static int GetAttribute(string attribute) { string value = 0.ToString(); Player.m_localPlayer.m_knownTexts.TryGetValue(pluginKey + "_LevelSystem_" + attribute, out value); return Convert.ToInt32(value); } public static void AddExp(int value) { Init(); eAddExp?.Invoke(null, new object[1] { value }); } private static void Init() { API_State aPI_State = state; if (aPI_State != API_State.Ready && aPI_State != API_State.NotInstalled) { if (Type.GetType("EpicMMOSystem.EpicMMOSystem, EpicMMOSystem") == null) { state = API_State.NotInstalled; return; } state = API_State.Ready; Type type = Type.GetType("API.EMMOS_API, EpicMMOSystem"); eGetLevel = type.GetMethod("GetLevel", BindingFlags.Static | BindingFlags.Public); eAddExp = type.GetMethod("AddExp", BindingFlags.Static | BindingFlags.Public); eGetAttribute = type.GetMethod("GetAttribute", BindingFlags.Static | BindingFlags.Public); } } } internal class ItemService { public static void ModifyItemsCost() { GameObject prefab = PrefabManager.Instance.GetPrefab("piece_cartographytable"); prefab.GetComponent<Piece>().m_resources[0].m_amount = 100; prefab.GetComponent<Piece>().m_resources[1].m_amount = 100; prefab.GetComponent<Piece>().m_resources[2].m_amount = 100; prefab.GetComponent<Piece>().m_resources[3].m_amount = 100; prefab.GetComponent<Piece>().m_resources[4].m_amount = 100; GameObject prefab2 = PrefabManager.Instance.GetPrefab("portal_wood"); Piece component = prefab2.GetComponent<Piece>(); component.m_resources[0].m_amount = 200; component.m_resources[1].m_amount = 1; component.m_resources[1].m_resItem = PrefabManager.Instance.GetPrefab("PortalToken").GetComponent<ItemDrop>(); component.m_resources[2].m_amount = 50; } public static void OnlyAdminPieces() { GameObject val = ((IEnumerable<GameObject>)ObjectDB.instance.m_items).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "Hammer")); PieceTable buildPieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces; string[] array = Plugin.OnlyAdminPieces.Value.Split(new char[1] { ',' }); foreach (string text in array) { GameObject prefab = PrefabManager.Instance.GetPrefab(text); if (prefab != null) { Piece component = prefab.GetComponent<Piece>(); Requirement[] resources = component.m_resources; foreach (Requirement val2 in resources) { val2.m_resItem = PrefabManager.Instance.GetPrefab("SwordCheat").GetComponent<ItemDrop>(); val2.m_recover = false; } if (!SynchronizationManager.Instance.PlayerIsAdmin) { buildPieces.m_pieces.Remove(prefab); } } } } public static void SetWardFirePlace() { GameObject prefab = PrefabManager.Instance.GetPrefab("guard_stone"); Fireplace val = prefab.AddComponent<Fireplace>(); val.m_fuelItem = PrefabManager.Instance.GetPrefab("GreydwarfEye").GetComponent<ItemDrop>(); } public static void NerfRunicCape() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("rae_CapeHorseHide"); if (Object.op_Implicit((Object)(object)itemPrefab)) { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); SE_Stats val = (SE_Stats)component.m_itemData.m_shared.m_equipStatusEffect; val.m_mods = new List<DamageModPair>(); } } public static void WolvesTameable() { if (!Plugin.WolvesAreTameable.Value) { GameObject prefab = PrefabManager.Instance.GetPrefab("Wolf"); if (Object.op_Implicit((Object)(object)prefab)) { Tameable component = prefab.GetComponent<Tameable>(); Procreation component2 = prefab.GetComponent<Procreation>(); Object.Destroy((Object)(object)component); Object.Destroy((Object)(object)component2); } } } public static void LoxTameable() { if (!Plugin.LoxTameable.Value) { GameObject prefab = PrefabManager.Instance.GetPrefab("Lox"); if (Object.op_Implicit((Object)(object)prefab)) { Tameable component = prefab.GetComponent<Tameable>(); Procreation component2 = prefab.GetComponent<Procreation>(); Object.Destroy((Object)(object)component); Object.Destroy((Object)(object)component2); } } } public static void StubNoLife() { List<GameObject> list = new List<GameObject>(); list.Add(PrefabManager.Instance.GetPrefab("Pinetree_01_Stub")); list.Add(PrefabManager.Instance.GetPrefab("SwampTree1_Stub")); list.Add(PrefabManager.Instance.GetPrefab("BirchStub")); list.Add(PrefabManager.Instance.GetPrefab("FirTree_Stub")); list.Add(PrefabManager.Instance.GetPrefab("OakStub")); list.Add(PrefabManager.Instance.GetPrefab("Beech_Stub")); foreach (GameObject item in list) { Destructible component = item.GetComponent<Destructible>(); component.m_health = 1f; } } } [HarmonyPatch] internal class Portal { [HarmonyPatch(typeof(Player), "PlacePiece")] public static class NoBuild_Patch { [HarmonyPriority(800)] private static bool Prefix(Piece piece, Player __instance) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown if (SynchronizationManager.Instance.PlayerIsAdmin) { return true; } if (!((Object)((Component)piece).gameObject).name.Contains("portal_wood")) { return true; } int portalCount = GetPortalCount(); if (Plugin.Vip.Value.Contains(Plugin.steamId)) { if (portalCount >= Plugin.PortalLimitVip.Value) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Você não pode mais colocar portais.", 0, (Sprite)null); return false; } } else if (portalCount >= Plugin.PortalLimit.Value) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Você não pode mais colocar portais.", 0, (Sprite)null); return false; } ZPackage val = new ZPackage(); val.Write(Player.m_localPlayer.GetPlayerID()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "DeadheimPortalAndTotemCountServer", new object[1] { val }); return true; } } private static int GetPortalCount() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (SynchronizationManager.Instance.PlayerIsAdmin) { return 0; } ZPackage val = new ZPackage(); val.Write(Player.m_localPlayer.GetPlayerID()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "DeadheimPortalAndTotemCountServer", new object[1] { val }); return Plugin.PlayerPortalCount; } } [HarmonyPatch] public class Retreat { [HarmonyPatch(typeof(Terminal), "InitTerminal")] public class AddChatCommands { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <Postfix>b__0_0(ConsoleEventArgs args) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!((Humanoid)Player.m_localPlayer).IsTeleportable()) { args.Context.AddString("Can't teleport"); return; } Vector3 hearthStonePosition = GetHearthStonePosition(); if (hearthStonePosition == Vector3.zero) { args.Context.AddString("You need to set hearthstone spawn point"); } else { ((Character)Player.m_localPlayer).TeleportTo(hearthStonePosition, ((Component)Player.m_localPlayer).transform.rotation, true); } } } private static void Postfix() { //IL_0033: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!((Humanoid)Player.m_localPlayer).IsTeleportable()) { args.Context.AddString("Can't teleport"); } else { Vector3 hearthStonePosition = GetHearthStonePosition(); if (hearthStonePosition == Vector3.zero) { args.Context.AddString("You need to set hearthstone spawn point"); } else { ((Character)Player.m_localPlayer).TeleportTo(hearthStonePosition, ((Component)Player.m_localPlayer).transform.rotation, true); } } }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("retreat", "go back home", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [HarmonyPatch(typeof(Chat), "Awake")] public class AddGroupChat { private static void Postfix(Chat __instance) { int index = Math.Max(0, ((Terminal)__instance).m_chatBuffer.Count - 5); ((Terminal)__instance).m_chatBuffer.Insert(index, "/retreat go back home"); ((Terminal)__instance).UpdateChat(); } } [HarmonyPatch(typeof(Bed), "GetHoverText")] private static class Bed_GetHoverText_Patch { private static void Postfix(Bed __instance, ref string __result, ZNetView ___m_nview) { if ((__instance.IsMine() && ___m_nview.GetZDO().GetLong("owner", 0L) != 0L) || Traverse.Create((object)__instance).Method("IsCurrent", Array.Empty<object>()).GetValue<bool>()) { __result += Localization.instance.Localize("\n[<color=yellow><b>P</b></color>] Definir ponto de retreat"); } } } public static Vector3 GetHearthStonePosition() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!Player.m_localPlayer.m_knownTexts.ContainsKey("positionX")) { return Vector3.zero; } Vector3 result = default(Vector3); result.x = float.Parse(Player.m_localPlayer.m_knownTexts["positionX"]); result.y = float.Parse(Player.m_localPlayer.m_knownTexts["positionY"]); result.z = float.Parse(Player.m_localPlayer.m_knownTexts["positionZ"]); return result; } public static void SetHearthStonePosition() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) if (!Player.m_localPlayer.m_knownTexts.ContainsKey("positionX")) { Dictionary<string, string> knownTexts = Player.m_localPlayer.m_knownTexts; string key = "positionX"; knownTexts.Add(key, ((Component)Player.m_localPlayer).transform.position.x.ToString()); } else { Dictionary<string, string> knownTexts2 = Player.m_localPlayer.m_knownTexts; string key2 = "positionX"; knownTexts2[key2] = ((Component)Player.m_localPlayer).transform.position.x.ToString(); } if (!Player.m_localPlayer.m_knownTexts.ContainsKey("positionY")) { Dictionary<string, string> knownTexts3 = Player.m_localPlayer.m_knownTexts; string key3 = "positionY"; knownTexts3.Add(key3, ((Component)Player.m_localPlayer).transform.position.y.ToString()); } else { Dictionary<string, string> knownTexts4 = Player.m_localPlayer.m_knownTexts; string key4 = "positionY"; knownTexts4[key4] = ((Component)Player.m_localPlayer).transform.position.y.ToString(); } if (!Player.m_localPlayer.m_knownTexts.ContainsKey("positionZ")) { Dictionary<string, string> knownTexts5 = Player.m_localPlayer.m_knownTexts; string key5 = "positionZ"; knownTexts5.Add(key5, ((Component)Player.m_localPlayer).transform.position.z.ToString()); } else { Dictionary<string, string> knownTexts6 = Player.m_localPlayer.m_knownTexts; string key6 = "positionZ"; knownTexts6[key6] = ((Component)Player.m_localPlayer).transform.position.z.ToString(); } } } [HarmonyPatch] internal class RPC { [HarmonyPatch(typeof(Player), "OnSpawned")] public static class OnSpawned { public static void Postfix() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write(Player.m_localPlayer.GetPlayerID()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "DeadheimPortalAndTotemCountServer", new object[1] { val }); } } [HarmonyPatch(typeof(Game), "Start")] public static class GameStart { public static void Postfix() { if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register<ZPackage>("DeadheimPortalAndTotemCountServer", (Action<long, ZPackage>)RPC_PortalAndTotemCountServer); ZRoutedRpc.instance.Register<ZPackage>("DeadheimPortalAndTotemCountClient", (Action<long, ZPackage>)RPC_PortalAndTotemCountClient); } } } public static void RPC_PortalAndTotemCountServer(long sender, ZPackage pkg) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (ZNet.instance.IsServer()) { long creatorId = pkg.ReadLong(); string creatorWardAndPortalCount = Util.GetCreatorWardAndPortalCount(creatorId); ZPackage val = new ZPackage(); val.Write(creatorWardAndPortalCount); ZRoutedRpc.instance.InvokeRoutedRPC(sender, "DeadheimPortalAndTotemCountClient", new object[1] { val }); } } public static void RPC_PortalAndTotemCountClient(long sender, ZPackage pkg) { string text = pkg.ReadString(); Plugin.PlayerPortalCount = Convert.ToInt32(text.Split(new char[1] { ',' })[0]); Plugin.PlayerWardCount = Convert.ToInt32(text.Split(new char[1] { ',' })[1]); } } public static class Util { public static int CREATORHASH = StringExtensionMethods.GetStableHashCode("creator"); public static string GetCreatorWardAndPortalCount(long creatorId) { int creatorPrefabCount = GetCreatorPrefabCount(StringExtensionMethods.GetStableHashCode("portal_wood"), creatorId); int creatorPrefabCount2 = GetCreatorPrefabCount(StringExtensionMethods.GetStableHashCode("guard_stone"), creatorId); return $"{creatorPrefabCount},{creatorPrefabCount2}"; } private static int GetCreatorPrefabCount(int prefabHash, long creatorId) { int num = 0; List<ZDO>[] objectsBySector = ZDOMan.instance.m_objectsBySector; foreach (List<ZDO> list in objectsBySector) { if (list == null) { continue; } for (int j = 0; j < list.Count; j++) { ZDO val = list[j]; if (val.GetPrefab() == prefabHash) { long @long = val.GetLong(CREATORHASH, 0L); if (@long != 0 && @long == creatorId) { num++; } } } } return num; } private static byte[] ReadEmbeddedFileBytes(string name) { using MemoryStream memoryStream = new MemoryStream(); Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + "." + name).CopyTo(memoryStream); return memoryStream.ToArray(); } private static Texture2D LoadTexture(string name) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D val = new Texture2D(0, 0); ImageConversion.LoadImage(val, ReadEmbeddedFileBytes("assets." + name)); return val; } public static Sprite LoadSprite(string name, int width, int height) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return Sprite.Create(LoadTexture(name), new Rect(0f, 0f, (float)width, (float)height), Vector2.zero); } } [HarmonyPatch] public class FasterBoats { [HarmonyPatch(typeof(Ship), "GetSailForce")] private class ChangeShipBaseSpeed { private static void Postfix(ref Vector3 __result) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) __result *= Plugin.BoatWindSpeedmultiplier.Value; } } } [BepInPlugin("Detalhes.Deadheim", "Detalhes.Deadheim", "6.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Version = "6.0.0"; public const string PluginGUID = "Detalhes.Deadheim"; public static string steamId = ""; public static ConfigEntry<string> Vip; public static ConfigEntry<string> AdminList; public static ConfigEntry<string> OnlyAdminPieces; public static ConfigEntry<string> VipPortalNames; public static ConfigEntry<int> WardRadius; public static ConfigEntry<string> StaffMessage; public static ConfigEntry<string> DungeonPrefabs; public static ConfigEntry<string> BlockedBosses; public static ConfigEntry<float> SkillMultiplier; public static ConfigEntry<float> BoatWindSpeedmultiplier; public static ConfigEntry<float> BoatRudderSpeedmultiplier; public static ConfigEntry<float> CapeRunicSpeed; public static ConfigEntry<float> CapeRunicRegen; public static ConfigEntry<float> SkillDeathFactor; public static ConfigEntry<int> SafeArea; public static ConfigEntry<int> WardLimit; public static ConfigEntry<int> WardLimitVip; public static ConfigEntry<int> PortalLimit; public static ConfigEntry<int> PortalLimitVip; public static ConfigEntry<int> DropPercentagePerItem; public static ConfigEntry<int> WardChargeDurationInSec; public static ConfigEntry<bool> ResetWorldDay; public static ConfigEntry<bool> WolvesAreTameable; public static ConfigEntry<bool> LoxTameable; public static ConfigEntry<int> SkillCap; public static ConfigEntry<string> dropTypes; public static string PlayerName = ""; public static bool IsAdmin = false; public static int PlayerWardCount = 999; public static int PlayerPortalCount = 999; public static int maxPlayers = 50; public static List<ZRpc> validatedUsers = new List<ZRpc>(); public static bool hasSpawned = false; private Harmony _harmony = new Harmony("Detalhes.deadheim"); private void Update() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown Player localPlayer = Player.m_localPlayer; if ((Object)(object)Player.m_localPlayer == (Object)null || !Object.op_Implicit((Object)(object)localPlayer.m_hovering)) { return; } Interactable componentInParent = localPlayer.m_hovering.GetComponentInParent<Interactable>(); if (componentInParent != null && componentInParent is Bed) { Bed val = (Bed)componentInParent; if (val.IsMine() && Input.GetKeyDown((KeyCode)112)) { Retreat.SetHearthStonePosition(); ((Character)Player.m_localPlayer).Message((MessageType)2, "Seu novo ponto de Retreat", 0, (Sprite)null); } } } private void Awake() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //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_00a4: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0225: 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_0233: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Expected O, but got Unknown //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Expected O, but got Unknown //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Expected O, but got Unknown //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Expected O, but got Unknown //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Expected O, but got Unknown //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Expected O, but got Unknown //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Expected O, but got Unknown //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Expected O, but got Unknown //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Expected O, but got Unknown //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Expected O, but got Unknown //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Expected O, but got Unknown //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Expected O, but got Unknown //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Expected O, but got Unknown //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Expected O, but got Unknown //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Expected O, but got Unknown //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Expected O, but got Unknown //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Expected O, but got Unknown //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Expected O, but got Unknown //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Expected O, but got Unknown //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Expected O, but got Unknown SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr) { if (attr.InitialSynchronization) { ItemService.SetWardFirePlace(); ItemService.ModifyItemsCost(); ItemService.LoxTameable(); ItemService.WolvesTameable(); ItemService.StubNoLife(); ItemService.OnlyAdminPieces(); IsAdmin = AdminList.Value.Contains(steamId); } else { Logger.LogMessage((object)"Config sync event received"); } }; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; OnlyAdminPieces = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "OnlyAdminPieces", "SHGateHouse,SHWallMusteringHall,SHTowerSquareTwoFloorCenter,SHTowerSquareTwoFloorCorner,SHTowerSquareTwoFloorJunction,SHWallOpenTwoFloorCapped,SHWallOpenTwoFloorWithNest,SHWallOpenTwoFloorWithNestCapped,SHWallOpenTwoFloor,SHEnclosedTower,SHBunkhouse,SHWell,SHOuterWallCovered,SHOuterWallOpenCapped,SHOuterWallOpen,SHOuterWallTowerSquareCenter,SHOuterWallTowerTransition,SHOuterWallTowerRound,SHOuterWallGate,SHWatchtower,SHTowerRoundWallEnd,SHOuterWallCoverdCapped,SHWallInnerArch,SHWallInnerPillar,SHWallInnerPlain,SHWallInnerPosh,SHHouseSmall,SHHouseMedium,SHHouseLarge,SHHayBarn,SHOldBarn,SHStorageBarn,SHMainHall", new ConfigDescription("OnlyAdminPieces", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); VipPortalNames = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "VipPortalNames", "cavalinho,eguinha", new ConfigDescription("VipPortalNames", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SkillCap = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "SkillCap", 100, new ConfigDescription("SkillCap", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); AdminList = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "AdminList", "76561198053330247 76561197961128381 76561198111650012 76561197993642177 76V561198993982965", new ConfigDescription("AdminList", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); Vip = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "Vip", "76561198053330247", new ConfigDescription("VipList", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SkillDeathFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "SkillDeathFactor", 0.05f, new ConfigDescription("SkillDeathFactor", (AcceptableValueBase)null, new object[3] { new AcceptableValueRange<float>(0f, 0.1f), null, (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); StaffMessage = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "StaffMessage", "", new ConfigDescription("StaffMessage", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); DungeonPrefabs = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "DungeonPrefabs", "dungeon_forestcrypt_door,dungeon_sunkencrypt_irongate", new ConfigDescription("DungeonPrefabs", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); BlockedBosses = ((BaseUnityPlugin)this).Config.Bind<string>("Server config", "BlockedBosses", "batata banana", new ConfigDescription("BlockedBosses", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); WolvesAreTameable = ((BaseUnityPlugin)this).Config.Bind<bool>("Server config", "WolvesAreTameable", false, new ConfigDescription("WolvesAreTameable", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); LoxTameable = ((BaseUnityPlugin)this).Config.Bind<bool>("Server config", "LoxTameable", false, new ConfigDescription("LoxTameable", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SafeArea = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "SafeArea", 1500, new ConfigDescription("SafeArea", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); WardChargeDurationInSec = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "WardChargeDurationInSec", 86400, new ConfigDescription("WardChargeDurationInSec", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); PortalLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "PortalLimit", 2, new ConfigDescription("PortalLimit", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); PortalLimitVip = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "PortalLimitVip", 6, new ConfigDescription("PortalLimitVip", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); WardLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "WardLimit", 3, new ConfigDescription("WardLimit", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); WardLimitVip = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "WardLimitVip", 5, new ConfigDescription("WardLimitVip", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); DropPercentagePerItem = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "DropPercentagePerItem", 5, new ConfigDescription("DropPercentagePerItem", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); WardRadius = ((BaseUnityPlugin)this).Config.Bind<int>("Server config", "WardRadius", 150, new ConfigDescription("WardRadius", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); BoatWindSpeedmultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "boatWindSpeedmultiplier", 1f, new ConfigDescription("boatWindSpeedmultiplier", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); BoatRudderSpeedmultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "BoatRudderSpeedmultiplier", 1f, new ConfigDescription("BoatRudderSpeedmultiplier", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); CapeRunicRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "CapeRunicRegen", 1.25f, new ConfigDescription("CapeRunicRegen", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); CapeRunicSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "CapeRunicSpeed", 0.05f, new ConfigDescription("CapeRunicSpeed", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SkillMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "SkillMultiplier", 0.5f, new ConfigDescription("SkillMultiplier", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); ResetWorldDay = ((BaseUnityPlugin)this).Config.Bind<bool>("Server config", "ResetWorldDay", false, new ConfigDescription("ResetWorldDay", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); _harmony.PatchAll(); ClonedItems.LoadAssets(); } } [HarmonyPatch] public class ClonedItems { [HarmonyPatch(typeof(ItemDrop), "DropItem")] public static class DropItem { [HarmonyPriority(800)] private static void Prefix(ItemDrop __instance, ItemData item) { if (!((Object)(object)item.m_dropPrefab != (Object)null)) { if (item != null && item.m_shared != null && item.m_shared.m_name.Equals(" Basic Armor Kit I", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("ArmorKit1"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Good Armor Kit II", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("ArmorKit2"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Great Armor Kit III", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("ArmorKit3"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Superior Armor Kit IV", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("ArmorKit4"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Basic Weapon Kit I", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("WeaponKit1"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Good Weapon Kit II", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("WeaponKit2"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Great Weapon Kit III", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("WeaponKit3"); } if (item != null && item.m_shared != null && item.m_shared.m_name.Equals("Superior Weapon Kit IV", StringComparison.CurrentCultureIgnoreCase)) { item.m_dropPrefab = PrefabManager.Instance.GetPrefab("WeaponKit4"); } } } } public static void LoadAssets() { PrefabManager.OnPrefabsRegistered += AddClonedItems; PieceManager.OnPiecesRegistered += AddClonedPieces; CreatureManager.OnVanillaCreaturesAvailable += AddVanillaClonedCreatures; } private static void AddClonedItems() { AddPortalToken(); AddEsqueletaoItems(); AddItemKits(); PrefabManager.OnPrefabsRegistered -= AddClonedItems; } private static void AddClonedPieces() { AddAesirChest(); AddAdminWards(); PieceManager.OnPiecesRegistered -= AddClonedPieces; } private static void AddVanillaClonedCreatures() { AddBatzao(); AddNomTameableWolf(); AddPorcoLox(); AddSkeletao(); CreatureManager.OnVanillaCreaturesAvailable -= AddVanillaClonedCreatures; } private static void AddAdminWards() { AddBigdminWard(); AddSmallAdminWard(); AddRaidWard(); } private static void AddItemKits() { AddArmorKit("ArmorKit1", "piece_chest_wood", "Basic Armor Kit I", "Kit de itens utilizados para fabricar armaduras de menor qualidade pertencente a era do bronze.", "Wood", "Guck", "armorkit1.png"); AddArmorKit("ArmorKit2", "piece_chest_wood", "Good Armor Kit II", "Kit de itens utilizados para fabricar armaduras de refinadas de qualidade pertencente a era do ferro.", "Wood", "Blueberries", "armorkit2.png"); AddArmorKit("ArmorKit3", "piece_chest_wood", "Great Armor Kit III", "Kit de itens utilizados para fabricar armaduras reluzentes beirando a perfeição, sua qualidade pertence a era da prata.", "Wood", "Amber", "armorkit3.png"); AddArmorKit("ArmorKit4", "piece_chest_wood", "Superior Armor Kit IV", "Kit de itens utilizados para fabricar armaduras de maior qualidade dentro os mortais beirando o divino pertencentes a era do linho.", "Wood", "Ruby", "armorkit4.png"); AddArmorKit("WeaponKit1", "piece_chest_wood", "Basic Weapon Kit I", "Kit de itens utilizados para fabricar armas mais simples de qualidade duvidosa, muito utilizada na era do bronze.", "FineWood", "Guck", "weaponkit1.png"); AddArmorKit("WeaponKit2", "piece_chest_wood", "Good Weapon Kit II", "Kit de itens utilizados para fabricar armas maior refinaria, muito utilizada na era do ferro.", "FineWood", "Blueberries", "weaponkit2.png"); AddArmorKit("WeaponKit3", "piece_chest_wood", "Great Weapon Kit III", "Kit de itens utilizados para fabricar armas prateadas com brilhos que afligem os olhos, muito utilizada na era da prata.", "FineWood", "Amber", "weaponkit3.png"); AddArmorKit("WeaponKit4", "piece_chest_wood", "Superior Weapon Kit IV", "Kit de itens utilizados para fabricar armas negras, extremamente laminadas capazes de perfurar a grossa pele de um Lox utilizada por aqueles que chegaram na era do metal negro.", "FineWood", "Ruby", "weaponkit4.png"); } private static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } return (T)(object)((val is T) ? val : null); } private static void AddArmorKit(string prefabName, string prefabToCopy, string name, string description, string firstShaderPrefabName, string secondShaderPrefabName, string icon) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) ItemDrop component = PrefabManager.Instance.GetPrefab("Resin").GetComponent<ItemDrop>(); GameObject val = PrefabManager.Instance.CreateClonedPrefab(prefabName, prefabToCopy); Object.Destroy((Object)(object)val.GetComponent<Piece>()); Object.Destroy((Object)(object)val.GetComponent<Container>()); Object.Destroy((Object)(object)val.GetComponent<WearNTear>()); Object.Destroy((Object)(object)val.GetComponent<ZNetView>()); val.AddComponent<ZNetView>(); ItemDrop val2 = val.AddComponent<ItemDrop>(); val2.m_floating = val.AddComponent<Floating>(); val2.m_body = val.AddComponent<Rigidbody>(); val2.m_itemData.m_shared = new SharedData(); val2.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { Util.LoadSprite(icon, 64, 64) }; val2.m_itemData.m_shared.m_name = name; val2.m_itemData.m_shared.m_description = description; val2.m_itemData.m_shared.m_maxStackSize = 25; Vector3 localScale = val.transform.localScale; localScale.x *= 0.3f; localScale.y *= 0.3f; localScale.z *= 0.3f; val.transform.localScale = localScale; MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val3 in array) { List<Material> list = new List<Material>(); if ((Object)(object)val3 == (Object)(object)componentsInChildren[0]) { list.Add(((Renderer)PrefabManager.Instance.GetPrefab(firstShaderPrefabName).GetComponentInChildren<MeshRenderer>()).materials[0]); } else { list.Add(((Renderer)PrefabManager.Instance.GetPrefab(secondShaderPrefabName).GetComponentInChildren<MeshRenderer>()).materials[0]); } ((Renderer)val3).materials = list.ToArray(); } val.GetComponent<ItemDrop>().m_itemData.m_dropPrefab = val; ItemManager.Instance.RegisterItemInObjectDB(val); } private static void AddRaidWard() { GameObject val = PrefabManager.Instance.CreateClonedPrefab("RaidWard", "guard_stone"); Piece component = val.GetComponent<Piece>(); component.m_resources[0].m_resItem = PrefabManager.Instance.GetPrefab("SwordCheat").GetComponent<ItemDrop>(); component.m_resources[0].m_recover = false; component.m_description = "Raid Ward"; component.m_name = "RaidWard"; PrivateArea component2 = ((Component)component).GetComponent<PrivateArea>(); component2.m_radius = 80f; component2.m_name = "RaidWard"; MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(); List<Material> list = new List<Material>(); list.Add(((Renderer)PrefabManager.Instance.GetPrefab("Stone").GetComponentInChildren<MeshRenderer>()).materials[0]); list.Add(((Renderer)PrefabManager.Instance.GetPrefab("Stone").GetComponentInChildren<MeshRenderer>()).materials[0]); ((Renderer)componentInChildren).materials = list.ToArray(); PieceManager.Instance.RegisterPieceInPieceTable(val, "Hammer", "Misc"); } private static void AddSmallAdminWard() { GameObject val = PrefabManager.Instance.CreateClonedPrefab("AdminWardSmall", "guard_stone"); Piece component = val.GetComponent<Piece>(); component.m_resources[0].m_resItem = PrefabManager.Instance.GetPrefab("SwordCheat").GetComponent<ItemDrop>(); component.m_resources[0].m_recover = false; component.m_description = "Admin Ward small"; component.m_name = "Admin Ward small"; PrivateArea component2 = ((Component)component).GetComponent<PrivateArea>(); component2.m_radius = 40f; component2.m_name = "AdminWardSmall"; MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(); List<Material> list = new List<Material>(); list.Add(((Renderer)PrefabManager.Instance.GetPrefab("FreezeGland").GetComponentInChildren<MeshRenderer>()).materials[0]); list.Add(((Renderer)PrefabManager.Instance.GetPrefab("FreezeGland").GetComponentInChildren<MeshRenderer>()).materials[0]); ((Renderer)componentInChildren).materials = list.ToArray(); PieceManager.Instance.RegisterPieceInPieceTable(val, "Hammer", "Misc"); } private static void AddBigdminWard() { GameObject val = PrefabManager.Instance.CreateClonedPrefab("AdminWard", "guard_stone"); Piece component = val.GetComponent<Piece>(); component.m_resources[0].m_resItem = PrefabManager.Instance.GetPrefab("SwordCheat").GetComponent<ItemDrop>(); component.m_resources[0].m_recover = false; component.m_description = "Admin Ward"; component.m_name = "Admin Ward"; PrivateArea component2 = ((Component)component).GetComponent<PrivateArea>(); component2.m_radius = 150f; component2.m_name = "AdminWard"; MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(); List<Material> list = new List<Material>(); list.Add(((Renderer)PrefabManager.Instance.GetPrefab("Tar").GetComponentInChildren<MeshRenderer>()).materials[0]); list.Add(((Renderer)PrefabManager.Instance.GetPrefab("SurtlingCore").GetComponentInChildren<MeshRenderer>()).materials[0]); ((Renderer)componentInChildren).materials = list.ToArray(); PieceManager.Instance.RegisterPieceInPieceTable(val, "Hammer", "Misc"); } private static void AddAesirChest() { GameObject val = PrefabManager.Instance.CreateClonedPrefab("AesirChest", "piece_chest_private"); Piece component = val.GetComponent<Piece>(); component.m_resources[0].m_resItem = PrefabManager.Instance.GetPrefab("Bronze").GetComponent<ItemDrop>(); component.m_resources[1].m_resItem = PrefabManager.Instance.GetPrefab("Wood").GetComponent<ItemDrop>(); component.m_description = "Aesir Chest"; component.m_name = "Aesir Chest"; PieceManager.Instance.RegisterPieceInPieceTable(val, "Hammer", "Furniture"); } private static void AddEsqueletaoItems() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Name = "Espadada do esqueletão."; val.Description = "Espadada do esqueletão."; val.Icons = (Sprite[])(object)new Sprite[1] { Util.LoadSprite("esqueletaosword.png", 64, 64) }; val.RepairStation = "forge"; val.MinStationLevel = 1; val.CraftingStation = "forge"; CustomItem val2 = new CustomItem("SkeletaoSword", "SwordBronze", val); val2.ItemDrop.m_itemData.m_shared.m_damages.m_slash = 56f; ((Renderer)val2.ItemPrefab.GetComponentInChildren<MeshRenderer>()).materials = ((Renderer)PrefabManager.Instance.GetPrefab("Tar").GetComponentInChildren<MeshRenderer>()).materials; val = new ItemConfig(); val.Name = "Escudo do esqueletão."; val.Description = "Escudo do esqueletão."; val.Icons = (Sprite[])(object)new Sprite[1] { Util.LoadSprite("esqueletaoshield.png", 64, 64) }; val.RepairStation = "forge"; val.MinStationLevel = 1; val.CraftingStation = "forge"; CustomItem val3 = new CustomItem("SkeletaoShield", "ShieldBoneTower", val); val3.ItemDrop.m_itemData.m_shared.m_blockPower = 49f; ((Renderer)val3.ItemPrefab.GetComponentInChildren<MeshRenderer>()).materials = ((Renderer)PrefabManager.Instance.GetPrefab("Tar").GetComponentInChildren<MeshRenderer>()).materials; ItemManager.Instance.AddItem(val2); ItemManager.Instance.AddItem(val3); } private static void AddPortalToken() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CustomItem val = new CustomItem("PortalToken", "Thunderstone"); ItemDrop itemDrop = val.ItemDrop; itemDrop.m_itemData.m_shared.m_name = "Portal Token"; itemDrop.m_itemData.m_shared.m_description = "Me compre para o Detalhes poder manter seu vício."; itemDrop.m_itemData.m_shared.m_maxStackSize = 10; ItemManager.Instance.AddItem(val); } private static void AddNomTameableWolf() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown CustomCreature val = new CustomCreature("LoboNaoDomavel", "Wolf", new CreatureConfig()); Humanoid component = val.Prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Lobo nao domavel"; CreatureManager.Instance.AddCreature(val); Object.Destroy((Object)(object)val.Prefab.GetComponent<Tameable>()); Object.Destroy((Object)(object)val.Prefab.GetComponent<Procreation>()); } private static void AddSkeletao() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) CustomCreature val = new CustomCreature("Skeletao", "Skeleton", new CreatureConfig { Faction = (Faction)3 }); Humanoid component = val.Prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Esqueletão"; ((Character)component).m_boss = true; ((Character)component).m_health = 500f; SkinnedMeshRenderer[] componentsInChildren = val.Prefab.GetComponentsInChildren<SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val2 in array) { ((Renderer)val2).material.color = Color.black; ((Renderer)val2).sharedMaterial.color = Color.black; } Vector3 localScale = val.Prefab.transform.localScale; localScale.x *= 1.3f; localScale.y *= 1.3f; localScale.z *= 1.3f; val.Prefab.transform.localScale = localScale; CreatureManager.Instance.AddCreature(val); Object.Destroy((Object)(object)val.Prefab.GetComponent<Tameable>()); Object.Destroy((Object)(object)val.Prefab.GetComponent<Procreation>()); } private static void AddPorcoLox() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0067: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) CustomCreature val = new CustomCreature("PorcoLox", "Lox", new CreatureConfig { Faction = (Faction)2 }); Humanoid component = val.Prefab.GetComponent<Humanoid>(); GameObject val2 = PrefabManager.Instance.CreateClonedPrefab("PorcoLoxRagDoll", "lox_ragdoll"); ((Character)component).m_name = "PorcoLox"; ((Character)component).m_boss = true; ((Character)component).m_health = 300f; ColorRenderers(val.Prefab, Color.black); Vector3 localScale = val.Prefab.transform.localScale; localScale.x *= 0.5f; localScale.y *= 0.5f; localScale.z *= 0.5f; val2.transform.localScale = localScale; int index = ((Character)component).m_deathEffects.m_effectPrefabs.ToList().FindIndex((EffectData x) => ((Object)x.m_prefab).name == "lox_ragdoll"); ((Character)val.Prefab.GetComponent<Humanoid>()).m_deathEffects.m_effectPrefabs.ToList()[index].m_prefab = val2; ColorRenderers(val2, Color.black); val.Prefab.transform.localScale = localScale; CreatureManager.Instance.AddCreature(val); Object.Destroy((Object)(object)val.Prefab.GetComponent<Tameable>()); Object.Destroy((Object)(object)val.Prefab.GetComponent<Procreation>()); } public static void ColorRenderers(GameObject gameObject, Color color) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { ((Renderer)val).material.color = color; ((Renderer)val).sharedMaterial.color = color; } } private static void AddBatzao() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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_002b: 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_0040: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) CreatureConfig val = new CreatureConfig(); val.DropConfigs = (DropConfig[])(object)new DropConfig[1] { new DropConfig { Item = "Coins", Chance = 100f, MinAmount = 50, MaxAmount = 100, OnePerPlayer = false, LevelMultiplier = false } }; val.Faction = (Faction)3; CustomCreature val2 = new CustomCreature("Morcegao", "Bat", val); Vector3 localScale = val2.Prefab.transform.localScale; localScale.x *= 3f; localScale.y *= 3f; localScale.z *= 3f; val2.Prefab.transform.localScale = localScale; Humanoid component = val2.Prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Morcegão"; ((Character)component).m_health = 500f; ((Character)component).m_boss = true; CreatureManager.Instance.AddCreature(val2); } } [HarmonyPatch] public class Patches : MonoBehaviour { [HarmonyPatch(typeof(Player), "SetPlayerID")] internal class SetPlayerID { private static void Postfix(long playerID, string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) try { if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { Plugin.steamId = ((IUser)PlatformManager.DistributionPlatform.LocalUser).PlatformUserID.m_userID; Plugin.PlayerName = ((Character)Player.m_localPlayer).m_nview.GetZDO().GetString("playerName", ""); Debug.Log((object)("steamId: " + Plugin.steamId)); } } catch { } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class Inventory_Constructor_Patch { public static void Prefix(string name, ref int w, ref int h) { if ((h == 4 && w == 8) || name == "Inventory") { h = 6; } } } [HarmonyPatch(typeof(InventoryGui), "Show")] public class InventoryGui_Show_Patch { private const float oneRowSize = 70.5f; private const float containerOriginalY = -90f; private const float containerHeight = -340f; private static float lastValue; public static void Postfix(ref InventoryGui __instance) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) //IL_0116: Unknown result type (might be due to invalid IL or missing references) RectTransform container = __instance.m_container; RectTransform player = __instance.m_player; GameObject gameObject = ((Component)InventoryGui.instance.m_playerGrid).gameObject; int num = Math.Min(6, Math.Max(4, 8)); float num2 = -90f - 70.5f * (float)num; player.SetSizeWithCurrentAnchors((Axis)1, (float)num * 70.5f); container.offsetMax = new Vector2(610f, num2); container.offsetMin = new Vector2(40f, num2 + -340f); if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<InventoryGrid>().m_scrollbar)) { GameObject val = Object.Instantiate<GameObject>(((Component)InventoryGui.instance.m_containerGrid.m_scrollbar).gameObject, gameObject.transform.parent); ((Object)val).name = "PlayerScroll"; ((Behaviour)gameObject.GetComponent<RectMask2D>()).enabled = true; ScrollRect val2 = gameObject.AddComponent<ScrollRect>(); gameObject.GetComponent<RectTransform>().offsetMax = new Vector2(800f, gameObject.GetComponent<RectTransform>().offsetMax.y); gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 1f); val2.content = gameObject.GetComponent<InventoryGrid>().m_gridRoot; val2.viewport = ((Component)__instance.m_player).GetComponentInChildren<RectTransform>(); val2.verticalScrollbar = val.GetComponent<Scrollbar>(); gameObject.GetComponent<InventoryGrid>().m_scrollbar = val.GetComponent<Scrollbar>(); val2.horizontal = false; val2.movementType = (MovementType)2; val2.scrollSensitivity = 70.5f; val2.inertia = false; val2.verticalScrollbarVisibility = (ScrollbarVisibility)1; Scrollbar component = val.GetComponent<Scrollbar>(); lastValue = component.value; } } } [HarmonyPatch(typeof(Chat), "OnNewChatMessage")] internal class OnNewChatMessage { private static bool Prefix(string text) { if (text.ToLower().Contains("i have arrived")) { return false; } return true; } } [HarmonyPatch(typeof(Player), "HaveSeenTutorial")] public class Player_HaveSeenTutorial_Patch { [HarmonyPrefix] private static void Prefix(Player __instance, ref string name) { if (!__instance.m_shownTutorials.Contains(name)) { __instance.m_shownTutorials.Add(name); } } } [HarmonyPatch(typeof(SE_Stats), "Setup")] public static class SE_Stats_Setup_Patch { private static void Postfix(ref SE_Stats __instance) { int num = 200; if (__instance.m_addMaxCarryWeight > 0f) { __instance.m_addMaxCarryWeight = __instance.m_addMaxCarryWeight - 150f + (float)num; } } } [HarmonyPatch(typeof(Player), "Update")] public static class PlayerUpdate { [HarmonyPriority(0)] private static void Postfix(Player __instance) { if (Plugin.StaffMessage.Value != "") { ((Character)Player.m_localPlayer).Message((MessageType)2, Plugin.StaffMessage.Value, 0, (Sprite)null); } } } [HarmonyPatch(typeof(Minimap), "UpdatePlayerPins")] private class UpdatePlayerPins { [HarmonyPriority(0)] private static void Postfix(Minimap __instance) { if (SynchronizationManager.Instance.PlayerIsAdmin) { return; } foreach (PinData playerPin in __instance.m_playerPins) { List<PlayerReference> list = API.GroupPlayers(); if (!list.Exists((PlayerReference x) => x.name == playerPin.m_name)) { __instance.RemovePin(playerPin); } } } } [HarmonyPatch(typeof(CraftingStation), "Start")] public static class WorkbenchRangeIncrease { public static void Prefix(ref CraftingStation __instance, ref float ___m_rangeBuild, GameObject ___m_areaMarker) { try { ___m_rangeBuild = 30f; ___m_areaMarker.GetComponent<CircleProjector>().m_radius = ___m_rangeBuild; } catch { } } } [HarmonyPatch(typeof(Skills), "RaiseSkill")] public static class RaiseSkill { private static bool Prefix(ref Skills __instance, ref SkillType skillType, ref float factor) { Skill skill = __instance.GetSkill(skillType); if (skill.m_level >= (float)Plugin.SkillCap.Value) { return false; } factor *= Plugin.SkillMultiplier.Value; return true; } } [HarmonyPatch(typeof(InventoryGui), "CanRepair")] public static class CanRepair { private static void Postfix(InventoryGui __instance, ref bool __result, ItemData item) { if (((Object)item.m_dropPrefab).name.Contains("SkeletaoSword") || ((Object)item.m_dropPrefab).name.Contains("SkeletaoShield")) { CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if (((Object)((Component)currentCraftingStation).gameObject).name.Contains("forge")) { __result = true; } } } } [HarmonyPatch(typeof(Player), "PlacePiece")] public static class NoBuild_Patch { [HarmonyPriority(0)] private static bool Prefix(Piece piece, Player __instance) { if (Plugin.Vip.Value.Contains(Plugin.steamId)) { return true; } if (((Object)((Component)piece).gameObject).name == "AesirChest") { ((Character)__instance).Message((MessageType)2, "Esse báu é apenas para Aesir's", 0, (Sprite)null); return false; } return true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Game), "Update")] private static void GameUpdate() { if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { ZNet.instance.SetPublicReferencePosition(true); ((Selectable)InventoryGui.instance.m_pvp).interactable = false; } } [HarmonyPatch(typeof(Player), "OnSpawned")] [HarmonyPostfix] public static void Awake_Postfix(ref Player __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (ZRoutedRpc.instance != null) { ItemService.SetWardFirePlace(); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "Sync", new object[1] { (object)new ZPackage() }); } } [HarmonyPatch(typeof(Player), "EdgeOfWorldKill")] [HarmonyPrefix] public static bool EdgeOfWorldKill() { return false; } public static void setDeathStat(HitData ___m_lastHit) { //IL_0002: 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_0008: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected I4, but got Unknown HitType hitType = ___m_lastHit.m_hitType; HitType val = hitType; switch ((int)val) { case 0: Game.instance.IncrementPlayerStat((PlayerStatType)55, 1f); break; case 1: Game.instance.IncrementPlayerStat((PlayerStatType)56, 1f); break; case 2: Game.instance.IncrementPlayerStat((PlayerStatType)57, 1f); break; case 3: Game.instance.IncrementPlayerStat((PlayerStatType)58, 1f); break; case 4: Game.instance.IncrementPlayerStat((PlayerStatType)59, 1f); break; case 5: Game.instance.IncrementPlayerStat((PlayerStatType)60, 1f); break; case 6: Game.instance.IncrementPlayerStat((PlayerStatType)61, 1f); break; case 7: Game.instance.IncrementPlayerStat((PlayerStatType)62, 1f); break; case 8: Game.instance.IncrementPlayerStat((PlayerStatType)64, 1f); break; case 9: Game.instance.IncrementPlayerStat((PlayerStatType)63, 1f); break; case 10: Game.instance.IncrementPlayerStat((PlayerStatType)65, 1f); break; case 11: Game.instance.IncrementPlayerStat((PlayerStatType)66, 1f); break; case 12: Game.instance.IncrementPlayerStat((PlayerStatType)67, 1f); break; case 13: Game.instance.IncrementPlayerStat((PlayerStatType)68, 1f); break; case 14: Game.instance.IncrementPlayerStat((PlayerStatType)69, 1f); break; case 15: Game.instance.IncrementPlayerStat((PlayerStatType)70, 1f); break; case 16: Game.instance.IncrementPlayerStat((PlayerStatType)71, 1f); break; case 17: Game.instance.IncrementPlayerStat((PlayerStatType)72, 1f); break; case 18: Game.instance.IncrementPlayerStat((PlayerStatType)73, 1f); break; default: ZLog.LogWarning((object)("Not implemented death type " + ((object)(HitType)(ref ___m_lastHit.m_hitType)).ToString())); break; } } } [HarmonyPatch] internal class Smelters { [HarmonyPatch(typeof(Smelter), "Awake")] public static class Smelter_Awake_Patch { private static void Prefix(ref Smelter __instance) { string value = "$piece_charcoalkiln"; string value2 = "$piece_smelter"; string value3 = "$piece_blastfurnace"; if (__instance.m_name.Equals(value)) { __instance.m_maxOre = 100; __instance.m_secPerProduct = 20f; } else if (__instance.m_name.Equals(value2)) { __instance.m_maxOre = 50; __instance.m_maxFuel = 100; __instance.m_secPerProduct = 20f; __instance.m_fuelPerProduct = 2; } else if (__instance.m_name.Equals(value3)) { __instance.m_maxOre = 50; __instance.m_maxFuel = 100; __instance.m_secPerProduct = 20f; __instance.m_fuelPerProduct = 2; } } } } } namespace Deadheim.world { internal class World { [HarmonyPatch(typeof(ZNet), "SaveWorldThread")] internal class SaveWorldThread { private static void Prefix(ref ZNet __instance) { if (Plugin.ResetWorldDay.Value) { __instance.m_netTime = 2040.0; } } } } } namespace Deadheim.EnhancedWards { [HarmonyPatch] public class Ward { [HarmonyPatch(typeof(WearNTear), "RPC_Damage")] public static class RPC_Damage { [HarmonyPriority(800)] private static bool Prefix(WearNTear __instance, ref HitData hit, ZNetView ___m_nview) { //IL_0017: 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_0088: Unknown result type (might be due to invalid IL or missing references) try { if (___m_nview == null) { return false; } if (!CheckInPrivateArea(((Component)__instance).transform.position)) { return true; } if (((Object)((Component)__instance).gameObject).name.Contains("guard_stone")) { return false; } if (((Object)((Component)__instance).gameObject).name.Contains("AdminWard")) { return false; } if (Vector3.Distance(new Vector3(0f, 0f), ((Component)Player.m_localPlayer).transform.position) <= (float)Plugin.SafeArea.Value) { return false; } return true; } catch (Exception ex) { Debug.LogError((object)(ex.Message + " - " + ex.StackTrace)); return false; } } } [HarmonyPatch(typeof(Door), "CanInteract")] public static class DoorCanInteract { private static void Postfix(Door __instance, ref bool __result) { string name = ((Object)((Component)__instance).gameObject).name; name = name.Replace("(Clone)", ""); if (Plugin.DungeonPrefabs.Value.Split(new char[1] { ',' }).Contains(((Object)((Component)__instance).gameObject).name.Replace("(Clone)", ""))) { __result = true; } } } [HarmonyPatch(typeof(PrivateArea), "IsEnabled")] public static class PrivateAreaCheckAccess { private static void Postfix(PrivateArea __instance, ref bool __result) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || !Object.op_Implicit((Object)(object)localPlayer.m_hovering)) { return; } Interactable componentInParent = localPlayer.m_hovering.GetComponentInParent<Interactable>(); if (componentInParent == null) { return; } Door val = null; Container val2 = null; if (((object)componentInParent).GetType().Name == "Door") { val = (Door)componentInParent; } if (((object)componentInParent).GetType().Name == "Container") { val2 = (Container)componentInParent; } if (val == null && val2 == null) { return; } string text = ""; if (val != null) { text = ((Object)((Component)val).gameObject).name; } if (Object.op_Implicit((Object)(object)val2)) { text = ((Object)((Component)val2).gameObject).name; } if (!(text == "")) { text = text.Replace("(Clone)", ""); if (Plugin.DungeonPrefabs.Value.Split(new char[1] { ',' }).Contains(text)) { __result = false; } } } } [HarmonyPatch(typeof(Fireplace), "UpdateState")] public static class FireplaceUpdateState { private static bool Prefix(Fireplace __instance) { if (!((Object)((Component)__instance).gameObject).name.Contains("guard_stone")) { return true; } return false; } } [HarmonyPatch(typeof(Fireplace), "Awake")] public static class FireplaceAwake { private static bool Prefix(Fireplace __instance) { try { if (!((Object)((Component)__instance).gameObject).name.Contains("guard_stone")) { return true; } __instance.m_nview = ((Component)__instance).gameObject.GetComponent<ZNetView>(); __instance.m_piece = ((Component)__instance).gameObject.GetComponent<Piece>(); if (__instance.m_nview.GetZDO() == null) { return false; } if (__instance.m_nview.IsOwner() && (double)__instance.m_nview.GetZDO().GetFloat("fuel", -1f) == -1.0) { __instance.m_nview.GetZDO().Set("fuel", __instance.m_startFuel); } __instance.m_nview.Register("AddFuel", (Action<long>)__instance.RPC_AddFuel); ((MonoBehaviour)__instance).InvokeRepeating("UpdateFireplace", 0f, 10f); return false; } catch { return false; } } } [HarmonyPatch(typeof(Fireplace), "UpdateFireplace")] public static class UpdateFireplace { private static bool Prefix(Fireplace __instance) { if (!((Object)((Component)__instance).gameObject).name.Contains("guard_stone")) { return true; } if (!__instance.m_nview.IsValid()) { return false; } Piece component = ((Component)__instance).gameObject.GetComponent<Piece>(); if (__instance.m_nview.IsOwner()) { if (__instance.m_fuelItem == null) { __instance.m_fuelItem = PrefabManager.Instance.GetPrefab("GreydwarfEye").GetComponent<ItemDrop>(); } __instance.m_secPerFuel = Plugin.WardChargeDurationInSec.Value; __instance.m_maxFuel = 10f; PrivateArea component2 = ((Component)__instance).gameObject.GetComponent<PrivateArea>(); float @float = __instance.m_nview.GetZDO().GetFloat("fuel", 0f); double timeSinceLastUpdate = __instance.GetTimeSinceLastUpdate(); float num = (float)timeSinceLastUpdate / __instance.m_secPerFuel; float num2 = @float - num; if ((double)num2 <= 0.0) { num2 = 0f; if (component2.IsEnabled()) { component2.SetEnabled(false); } } if (num2 > 10f) { num2 = 10f; } __instance.m_nview.GetZDO().Set("fuel", num2); } return false; } } [HarmonyPatch(typeof(Player), "PlacePiece")] public static class NoBuild_Patch { [HarmonyPriority(800)] private static bool Prefix(Piece piece, Player __instance) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_007d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (SynchronizationManager.Instance.PlayerIsAdmin) { return true; } bool flag = ((Object)((Component)piece).gameObject).name.Contains("guard_stone"); bool flag2 = false; Vector3 position = __instance.m_placementGhost.transform.position; if (flag) { List<ZDO> zDOList = GetZDOList(StringExtensionMethods.GetStableHashCode(((Object)((Component)piece).gameObject).name)); foreach (ZDO item in zDOList) { if (Vector3.Distance(new Vector3(position.x, 0f, position.z), new Vector3(item.m_position.x, 0f, item.m_position.z)) <= ((Component)piece).GetComponent<PrivateArea>().m_radius * 3f && !IsBuilderPermitted(item, __instance)) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Não é possível construir wards próximo da área de outros wards.", 0, (Sprite)null); return false; } } } if (!flag) { return true; } int wardCount = GetWardCount(); if (Plugin.Vip.Value.Contains(Plugin.steamId)) { if (wardCount >= Plugin.WardLimitVip.Value) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Você não pode mais colocar wards.", 0, (Sprite)null); return false; } } else if (wardCount >= Plugin.WardLimit.Value) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Você não pode mais colocar wards.", 0, (Sprite)null); return false; } Minimap.instance.AddPin(((Component)__instance).transform.position, (PinType)9, "WARD", true, false, 0L, default(PlatformUserID)); ZPackage val = new ZPackage(); val.Write(Player.m_localPlayer.GetPlayerID()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "DeadheimPortalAndTotemCountServer", new object[1] { val }); return true; } } [HarmonyPatch(typeof(Player), "Update")] public static class Update { private static void Postfix(ref Player __instance) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)__instance.m_hovering)) { return; } Interactable componentInParent = __instance.m_hovering.GetComponentInParent<Interactable>(); if (componentInParent == null) { return; } PrivateArea val = (PrivateArea)(object)((componentInParent is PrivateArea) ? componentInParent : null); if (val == null) { return; } Fireplace componentInParent2 = ((Component)val).GetComponentInParent<Fireplace>(); StringBuilder stringBuilder = new StringBuilder(256); KeyCode val2 = (KeyCode)107; KeyCode val3 = (KeyCode)121; if (val.IsPermitted(__instance.GetPlayerID()) || val.m_piece.m_creator == __instance.GetPlayerID()) { if (Object.op_Implicit((Object)(object)componentInParent2)) { stringBuilder.Append("\n[<color=yellow><b>" + ((object)(KeyCode)(ref val3)).ToString() + "</b></color>] Fuel: " + Math.Round(componentInParent2.m_nview.GetZDO().GetFloat("fuel", 0f), 2) + "/" + componentInParent2.m_maxFuel); } stringBuilder.Append("\n[<color=yellow><b>" + ((object)(KeyCode)(ref val2)).ToString() + "</b></color>]"); val.m_name = stringBuilder.ToString(); val.AddUserList(stringBuilder); if (Input.GetKeyDown(val2)) { Interact(__instance, __instance.m_hovering, val); } if (Input.GetKeyDown(val3)) { FuelWard(__instance, componentInParent2); } } } public static void FuelWard(Player player, Fireplace fireplace) { if (!((double)fireplace.m_holdRepeatInterval <= 0.0) && !(Time.time - fireplace.m_lastUseTime < fireplace.m_holdRepeatInterval)) { if (!fireplace.m_nview.HasOwner()) { fireplace.m_nview.ClaimOwnership(); } if (fireplace.m_fuelItem == null) { fireplace.m_fuelItem = PrefabManager.Instance.GetPrefab("GreydwarfEye").GetComponent<ItemDrop>(); } fireplace.Interact((Humanoid)(object)player, false, false); } } public static void Interact(Player player, GameObject go, PrivateArea privateArea) { //IL_003c: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_006d: Unknown result type (might be due to invalid IL or missing references) player.m_lastHoverInteractTime = Time.time; privateArea.m_nview.InvokeRPC("ToggleEnabled", new object[1] { privateArea.m_piece.GetCreator() }); Vector3 val = go.transform.position - ((Component)player).transform.position; val.y = 0f; ((Vector3)(ref val)).Normalize(); ((Component)player).transform.rotation = Quaternion.LookRotation(val); ((Character)player).m_zanim.SetTrigger("interact"); } } public static bool CheckInPrivateArea(Vector3 point, bool flash = false) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) foreach (PrivateArea allArea in PrivateArea.m_allAreas) { if (allArea.IsEnabled() && allArea.IsInside(point, 0f)) { if (flash) { allArea.FlashShield(false); } return true; } } return false; } private static int GetWardCount() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (SynchronizationManager.Instance.PlayerIsAdmin) { return 0; } ZPackage val = new ZPackage(); val.Write(Player.m_localPlayer.GetPlayerID()); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "DeadheimPortalAndTotemCountServer", new object[1] { val }); return Plugin.PlayerWardCount; } private static List<ZDO> GetZDOList(int prefabHash) { List<ZDO> list = new List<ZDO>(); List<ZDO>[] objectsBySector = ZDOMan.instance.m_objectsBySector; foreach (List<ZDO> list2 in objectsBySector) { if (list2 == null) { continue; } for (int j = 0; j < list2.Count; j++) { ZDO val = list2[j]; if (val.GetPrefab() == prefabHash) { list.Add(val); } } } return list; } private static bool IsBuilderPermitted(ZDO zdo, Player player) { List<KeyValuePair<long, string>> list = new List<KeyValuePair<long, string>>(); long @long = zdo.GetLong(Util.CREATORHASH, 0L); if (@long == player.GetPlayerID()) { return true; } int @int = zdo.GetInt("permitted", 0); for (int i = 0; i < @int; i++) { long long2 = zdo.GetLong("pu_id" + i, 0L); string @string = zdo.GetString("pu_name" + i, ""); if (long2 != 0) { list.Add(new KeyValuePair<long, string>(long2, @string)); } } foreach (KeyValuePair<long, string> item in list) { if (item.Key == player.GetPlayerID()) { return true; } } return false; } } } namespace Deadheim.Craft { public class CraftPatches { [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] private class FasterCrafting { private static void Prefix(ref InventoryGui __instance) { __instance.m_craftDuration = 0.25f; } } } }