Please disclose if your mod was created primarily 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 MeadhallChronicles v1.0.0
MeadhallPlayers.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MeadhallPlayers")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeadhallPlayers")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e8b610df-701f-4b0e-ad9f-ecbd5b36c416")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Meadhall; internal sealed class ConfigurationManagerAttributes { public bool? IsAdminOnly { get; set; } } [BepInPlugin("com.meadhall.valheim", "Meadhall", "1.0.0")] public class MeadhallPlugin : BaseUnityPlugin { private const string PluginGUID = "com.meadhall.valheim"; private const string PluginName = "Meadhall"; private const string PluginVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("com.meadhall.valheim"); public static ConfigEntry<bool> EnableAliasSystem; public static ConfigEntry<bool> HidePlayerHuds; public static ConfigEntry<bool> ShowRealNamesForAdmins; public static ConfigEntry<float> SwordStabDamageMultiplier; public static ConfigEntry<float> BoatMapExploreRadius; public static ConfigEntry<bool> DisableArmorSetBonuses; public static ConfigEntry<bool> ModifyRecipes; public static ConfigEntry<string> StonecutterRecipe; public static ConfigEntry<string> PortalRecipe; public static ConfigEntry<string> PortalWoodRecipe; public static ConfigEntry<string> StaffShieldRecipe; public static ConfigEntry<float> StaffOfEmbersBluntDamageMultiplier; public static ConfigEntry<float> StaffOfEmbersFireDamageMultiplier; public static ConfigEntry<float> FuelDurationMultiplier; public static ConfigEntry<bool> AdminsSeeMinimap; public static ConfigEntry<bool> ForcePvP; public static ConfigEntry<bool> AdminOnlyPortals; public static ConfigEntry<bool> DisableTerrainModification; public static ConfigEntry<int> StonePickableCost; private void Awake() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Expected O, but got Unknown //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Expected O, but got Unknown //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Expected O, but got Unknown //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Expected O, but got Unknown try { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Starting to apply Harmony patches..."); EnableAliasSystem = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableAliasSystem", true, new ConfigDescription("Enable player alias system with /setalias command", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); HidePlayerHuds = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "HidePlayerHuds", true, new ConfigDescription("Hide player health bars and names above heads", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); ShowRealNamesForAdmins = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "ShowRealNamesForAdmins", true, new ConfigDescription("Admins see real names in parentheses alongside aliases", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); SwordStabDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "SwordStabDamageMultiplier", 2f, new ConfigDescription("Damage multiplier for sword secondary attack (stab). Default: 2.0x", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); BoatMapExploreRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "BoatMapExploreRadius", 300f, new ConfigDescription("Map exploration radius when on a boat. Vanilla: 100, Recommended: 200-400", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); DisableArmorSetBonuses = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "DisableArmorSetBonuses", true, new ConfigDescription("Disable all armor set bonuses from mods. Does not affect vanilla armor.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); ModifyRecipes = ((BaseUnityPlugin)this).Config.Bind<bool>("Recipes", "ModifyRecipes", true, new ConfigDescription("Enable custom recipe modification for stonecutter", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); StonecutterRecipe = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "StonecutterRecipe", "Wood:10,Stone:10,Flint:10", new ConfigDescription("Recipe for stonecutter. Format: ItemName:Amount,ItemName:Amount (requires restart)", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); PortalRecipe = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "PortalRecipe", "Flametal:20", new ConfigDescription("Recipe for regular stone portal. Format: ItemName:Amount,ItemName:Amount (requires restart)", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); PortalWoodRecipe = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "PortalWoodRecipe", "Flametal:20", new ConfigDescription("Recipe for portal (wood variant). Format: ItemName:Amount,ItemName:Amount (requires restart)", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); StaffShieldRecipe = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "StaffShieldRecipe", "Flametal:1", new ConfigDescription("Recipe for Staff of Protection. Format: ItemName:Amount,ItemName:Amount (requires restart)", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); StaffOfEmbersBluntDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "StaffOfEmbersBluntDamageMultiplier", 0.5f, new ConfigDescription("Blunt damage multiplier for Staff of Embers. Default: 0.5 (50% nerf)", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); StaffOfEmbersFireDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "StaffOfEmbersFireDamageMultiplier", 0.5f, new ConfigDescription("Fire damage multiplier for Staff of Embers. Default: 0.5 (50% nerf)", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); FuelDurationMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "FuelDurationMultiplier", 2f, new ConfigDescription("Fuel duration multiplier for torches, fires, etc. 2.0 = double duration, 3.0 = triple duration", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); AdminsSeeMinimap = ((BaseUnityPlugin)this).Config.Bind<bool>("Admin", "AdminsSeeMinimap", true, new ConfigDescription("Admins can see all player positions on the minimap", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); ForcePvP = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "ForcePvP", true, new ConfigDescription("Force all players to have PvP enabled and prevent them from disabling it", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); AdminOnlyPortals = ((BaseUnityPlugin)this).Config.Bind<bool>("Admin", "AdminOnlyPortals", true, new ConfigDescription("Only admins can change portal names", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); DisableTerrainModification = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "DisableTerrainModification", true, new ConfigDescription("Disable raise and dirt path terrain tools. Cultivate and stone path work normally.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); StonePickableCost = ((BaseUnityPlugin)this).Config.Bind<int>("Gameplay", "StonePickableCost", 3, new ConfigDescription("Stone cost for placing stone pickables with the hoe. Default: 3", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdminOnly = true } })); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Config loaded - Alias: {EnableAliasSystem.Value}, HideHUDs: {HidePlayerHuds.Value}, AdminNames: {ShowRealNamesForAdmins.Value}, SwordStab: {SwordStabDamageMultiplier.Value}x, BoatRadius: {BoatMapExploreRadius.Value}, DisableSetBonuses: {DisableArmorSetBonuses.Value}, ModifyRecipes: {ModifyRecipes.Value}"); MethodInfo methodInfo = AccessTools.Method(typeof(Chat), "AddString", new Type[1] { typeof(string) }, (Type[])null); if (methodInfo != null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Found AddString method: {methodInfo}"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find AddString method!"); } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Meadhall v1.0.0 loaded!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patches applied successfully!"); IEnumerable<MethodBase> allPatchedMethods = Harmony.GetAllPatchedMethods(); foreach (MethodBase item in allPatchedMethods) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched method: " + item.DeclaringType?.Name + "." + item.Name)); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Error applying patches: {arg}"); } } private void OnDestroy() { harmony.UnpatchSelf(); } public static bool IsPlayerAdmin() { if ((Object)(object)ZNet.instance != (Object)null) { return ZNet.instance.IsServer(); } return false; } } [HarmonyPatch(typeof(EnemyHud), "ShowHud")] public static class EnemyHud_ShowHud_Patch { private static bool Prefix(Character c) { if (!MeadhallPlugin.HidePlayerHuds.Value) { return true; } if (MeadhallPlugin.IsPlayerAdmin()) { return true; } if ((Object)(object)c != (Object)null && c.IsPlayer()) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHud), "UpdateHuds")] public static class EnemyHud_UpdateHuds_Patch { private static FieldInfo m_hudsField; private static FieldInfo m_guiField; private static void Postfix(EnemyHud __instance) { if (!MeadhallPlugin.HidePlayerHuds.Value || MeadhallPlugin.IsPlayerAdmin()) { return; } try { if (m_hudsField == null) { m_hudsField = AccessTools.Field(typeof(EnemyHud), "m_huds"); } if (!(m_hudsField.GetValue(__instance) is IDictionary dictionary)) { return; } foreach (DictionaryEntry item in dictionary) { object key = item.Key; Character val = (Character)((key is Character) ? key : null); if (!((Object)(object)val != (Object)null) || !val.IsPlayer()) { continue; } object value = item.Value; if (value != null) { if (m_guiField == null) { m_guiField = AccessTools.Field(value.GetType(), "m_gui"); } object? value2 = m_guiField.GetValue(value); GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null); if ((Object)(object)val2 != (Object)null && val2.activeSelf) { val2.SetActive(false); } } } } catch (Exception) { } } } [HarmonyPatch] public static class Chat_AddString_Patch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Chat), "AddString", new Type[1] { typeof(string) }, (Type[])null); } private static void Prefix(ref string text) { if (!MeadhallPlugin.EnableAliasSystem.Value) { return; } Debug.Log((object)("[Meadhall] AddString called with: '" + text + "'")); try { bool flag = MeadhallPlugin.IsPlayerAdmin() && MeadhallPlugin.ShowRealNamesForAdmins.Value; Debug.Log((object)$"[Meadhall] Is admin: {flag}"); List<Player> allPlayers = Player.GetAllPlayers(); if (allPlayers == null) { return; } foreach (Player item in allPlayers) { if ((Object)(object)item == (Object)null) { continue; } object? obj = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(item); ZNetView val = (ZNetView)((obj is ZNetView) ? obj : null); if ((Object)(object)val == (Object)null) { continue; } ZDO zDO = val.GetZDO(); if (zDO == null) { continue; } string @string = zDO.GetString("playerAlias", ""); if (!string.IsNullOrEmpty(@string)) { string playerName = item.GetPlayerName(); if (!string.IsNullOrEmpty(playerName) && text.Contains(playerName)) { string text2 = (flag ? (@string + " (" + playerName + ")") : @string); Debug.Log((object)("[Meadhall] Replacing '" + playerName + "' with '" + text2 + "'")); text = text.Replace(playerName, text2); Debug.Log((object)("[Meadhall] Result: '" + text + "'")); } } } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error in AddString patch: {arg}"); } } } [HarmonyPatch(typeof(Chat), "UpdateWorldTextField")] public static class Chat_UpdateWorldTextField_Patch { private static void Postfix(WorldTextInstance wt) { if (!MeadhallPlugin.EnableAliasSystem.Value || wt == null || (Object)(object)wt.m_textMeshField == (Object)null) { return; } string displayName = wt.m_userInfo.GetDisplayName(); string playerAlias = GetPlayerAlias(displayName); if (!string.IsNullOrEmpty(playerAlias)) { string text = ((TMP_Text)wt.m_textMeshField).text; if (!string.IsNullOrEmpty(text) && text.Contains(displayName)) { ((TMP_Text)wt.m_textMeshField).text = text.Replace(displayName, playerAlias); } } } private static string GetPlayerAlias(string playerName) { List<Player> allPlayers = Player.GetAllPlayers(); if (allPlayers == null) { return ""; } Player val = null; foreach (Player item in allPlayers) { if ((Object)(object)item != (Object)null && item.GetPlayerName().Equals(playerName)) { val = item; break; } } if ((Object)(object)val == (Object)null) { return ""; } object? obj = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(val); ZNetView val2 = (ZNetView)((obj is ZNetView) ? obj : null); if ((Object)(object)val2 == (Object)null) { return ""; } ZDO zDO = val2.GetZDO(); if (zDO == null) { return ""; } return zDO.GetString("playerAlias", ""); } } [HarmonyPatch(typeof(Chat), "InputText")] public static class Chat_InputText_Patch { private static bool Prefix(Chat __instance) { if (!MeadhallPlugin.EnableAliasSystem.Value) { return true; } string text = ((TMP_InputField)((Terminal)__instance).m_input).text; if (string.IsNullOrEmpty(text)) { return true; } if (text.StartsWith("/setalias ")) { string text2 = text.Substring(10).Trim(); if (string.IsNullOrEmpty(text2)) { ((Terminal)__instance).AddString("<color=yellow>Usage: /setalias [alias]</color>"); ((TMP_InputField)((Terminal)__instance).m_input).text = ""; return false; } if (!IsValidName(text2)) { ((Terminal)__instance).AddString("<color=red>Invalid alias. Letters and spaces only.</color>"); ((TMP_InputField)((Terminal)__instance).m_input).text = ""; return false; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { object? obj = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(localPlayer); ZNetView val = (ZNetView)((obj is ZNetView) ? obj : null); if ((Object)(object)val != (Object)null) { ZDO zDO = val.GetZDO(); if (zDO != null) { zDO.Set("playerAlias", text2); ((Terminal)__instance).AddString("<color=yellow>Your alias is now: " + text2 + "</color>"); Debug.Log((object)("[Meadhall] Set alias to: " + text2)); } } } else { ((Terminal)__instance).AddString("<color=red>Error: Local player not found</color>"); } ((TMP_InputField)((Terminal)__instance).m_input).text = ""; return false; } if (text == "/clearalias") { Player localPlayer2 = Player.m_localPlayer; if ((Object)(object)localPlayer2 != (Object)null) { object? obj2 = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(localPlayer2); ZNetView val2 = (ZNetView)((obj2 is ZNetView) ? obj2 : null); if ((Object)(object)val2 != (Object)null) { ZDO zDO2 = val2.GetZDO(); if (zDO2 != null) { zDO2.Set("playerAlias", ""); ((Terminal)__instance).AddString("<color=yellow>Alias cleared</color>"); } } } else { ((Terminal)__instance).AddString("<color=red>Error: Local player not found</color>"); } ((TMP_InputField)((Terminal)__instance).m_input).text = ""; return false; } return true; } private static bool IsValidName(string input) { return !string.IsNullOrWhiteSpace(input) && Regex.IsMatch(input, "^[\\p{L}\\s]+$"); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class Terminal_InitTerminal_Patch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleEvent <>9__0_2; public static ConsoleEvent <>9__0_3; public static ConsoleEvent <>9__0_4; public static ConsoleEvent <>9__0_5; public static ConsoleEvent <>9__0_6; public static ConsoleEvent <>9__0_7; public static ConsoleEvent <>9__0_8; public static ConsoleEvent <>9__0_9; public static ConsoleEvent <>9__0_10; public static ConsoleEvent <>9__0_11; public static ConsoleEvent <>9__0_12; public static ConsoleEvent <>9__0_13; public static ConsoleEvent <>9__0_14; public static ConsoleEvent <>9__0_15; public static ConsoleEvent <>9__0_16; public static ConsoleEvent <>9__0_17; internal void <Postfix>b__0_0(ConsoleEventArgs args) { if (!MeadhallPlugin.EnableAliasSystem.Value) { args.Context.AddString("Alias system is currently disabled."); return; } if (args.Length < 2) { args.Context.AddString("Usage: setalias [alias]"); args.Context.AddString("Example: setalias MysteriousStranger"); return; } string text = string.Join(" ", args.Args, 1, args.Length - 1).Trim(); if (!IsValidName(text)) { args.Context.AddString("Invalid alias. Letters and spaces only."); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { object? obj = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(localPlayer); ZNetView val = (ZNetView)((obj is ZNetView) ? obj : null); if ((Object)(object)val != (Object)null) { ZDO zDO = val.GetZDO(); if (zDO != null) { zDO.Set("playerAlias", text); args.Context.AddString("Your alias is now: " + text); } } } else { args.Context.AddString("Error: Local player not found"); } } internal void <Postfix>b__0_1(ConsoleEventArgs args) { if (!MeadhallPlugin.EnableAliasSystem.Value) { args.Context.AddString("Alias system is currently disabled."); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { object? obj = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(localPlayer); ZNetView val = (ZNetView)((obj is ZNetView) ? obj : null); if ((Object)(object)val != (Object)null) { ZDO zDO = val.GetZDO(); if (zDO != null) { zDO.Set("playerAlias", ""); args.Context.AddString("Alias cleared"); } } } else { args.Context.AddString("Error: Local player not found"); } } internal void <Postfix>b__0_2(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.EnableAliasSystem.Value = !MeadhallPlugin.EnableAliasSystem.Value; args.Context.AddString("<color=yellow>Alias system is now: " + (MeadhallPlugin.EnableAliasSystem.Value ? "ENABLED" : "DISABLED") + "</color>"); } internal void <Postfix>b__0_3(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.HidePlayerHuds.Value = !MeadhallPlugin.HidePlayerHuds.Value; args.Context.AddString("<color=yellow>Player HUD hiding is now: " + (MeadhallPlugin.HidePlayerHuds.Value ? "ENABLED" : "DISABLED") + "</color>"); } internal void <Postfix>b__0_4(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.ShowRealNamesForAdmins.Value = !MeadhallPlugin.ShowRealNamesForAdmins.Value; args.Context.AddString("<color=yellow>Admin real name display is now: " + (MeadhallPlugin.ShowRealNamesForAdmins.Value ? "ENABLED" : "DISABLED") + "</color>"); } internal void <Postfix>b__0_5(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } args.Context.AddString("<color=yellow>=== Mod Configuration ===</color>"); args.Context.AddString("Alias System: " + (MeadhallPlugin.EnableAliasSystem.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Hide Player HUDs: " + (MeadhallPlugin.HidePlayerHuds.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Show Real Names (Admins): " + (MeadhallPlugin.ShowRealNamesForAdmins.Value ? "ENABLED" : "DISABLED")); args.Context.AddString($"Sword Stab Multiplier: {MeadhallPlugin.SwordStabDamageMultiplier.Value}x"); args.Context.AddString($"Boat Map Explore Radius: {MeadhallPlugin.BoatMapExploreRadius.Value}"); args.Context.AddString($"Staff of Embers Blunt Damage: {MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value}x"); args.Context.AddString($"Staff of Embers Fire Damage: {MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value}x"); args.Context.AddString("Disable Set Bonuses: " + (MeadhallPlugin.DisableArmorSetBonuses.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Modify Recipes: " + (MeadhallPlugin.ModifyRecipes.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Stonecutter Recipe: " + MeadhallPlugin.StonecutterRecipe.Value); args.Context.AddString("Portal Recipe: " + MeadhallPlugin.PortalRecipe.Value); args.Context.AddString("Portal Wood Recipe: " + MeadhallPlugin.PortalWoodRecipe.Value); args.Context.AddString("Admins See All Players: " + (MeadhallPlugin.AdminsSeeMinimap.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Force PvP: " + (MeadhallPlugin.ForcePvP.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Admin Only Portals: " + (MeadhallPlugin.AdminOnlyPortals.Value ? "ENABLED" : "DISABLED")); } internal void <Postfix>b__0_6(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString("Current portal recipe: " + MeadhallPlugin.PortalRecipe.Value); args.Context.AddString("Usage: setportalrecipe <recipe>"); args.Context.AddString("Format: ItemName:Amount,ItemName:Amount"); args.Context.AddString("Example: setportalrecipe FlametalNew:20,GreydwarfEye:20,SurtlingCore:2"); } else { string text = string.Join(" ", args.Args, 1, args.Length - 1); MeadhallPlugin.PortalRecipe.Value = text; args.Context.AddString("<color=yellow>Portal recipe set to: " + text + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } } internal void <Postfix>b__0_7(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString("Current portal wood recipe: " + MeadhallPlugin.PortalWoodRecipe.Value); args.Context.AddString("Usage: setportalwoodrecipe <recipe>"); args.Context.AddString("Format: ItemName:Amount,ItemName:Amount"); args.Context.AddString("Example: setportalwoodrecipe FlametalNew:20,GreydwarfEye:20,SurtlingCore:2"); } else { string text = string.Join(" ", args.Args, 1, args.Length - 1); MeadhallPlugin.PortalWoodRecipe.Value = text; args.Context.AddString("<color=yellow>Portal wood recipe set to: " + text + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } } internal void <Postfix>b__0_8(ConsoleEventArgs args) { float result; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current Staff of Embers blunt damage multiplier: {MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value}x"); args.Context.AddString("Usage: setstaffblunt <multiplier>"); args.Context.AddString("Example: setstaffblunt 0.5 (50% nerf)"); } else if (float.TryParse(args[1], out result)) { MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value = result; args.Context.AddString($"<color=yellow>Staff of Embers blunt damage multiplier set to: {result}x</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a decimal like 0.5 or 1.0</color>"); } } internal void <Postfix>b__0_9(ConsoleEventArgs args) { float result; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current Staff of Embers fire damage multiplier: {MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value}x"); args.Context.AddString("Usage: setstafffire <multiplier>"); args.Context.AddString("Example: setstafffire 0.5 (50% nerf)"); } else if (float.TryParse(args[1], out result)) { MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value = result; args.Context.AddString($"<color=yellow>Staff of Embers fire damage multiplier set to: {result}x</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a decimal like 0.5 or 1.0</color>"); } } internal void <Postfix>b__0_10(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.AdminOnlyPortals.Value = !MeadhallPlugin.AdminOnlyPortals.Value; args.Context.AddString("<color=yellow>Admin-only portals is now: " + (MeadhallPlugin.AdminOnlyPortals.Value ? "ENABLED" : "DISABLED") + "</color>"); } internal void <Postfix>b__0_11(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.ForcePvP.Value = !MeadhallPlugin.ForcePvP.Value; args.Context.AddString("<color=yellow>Forced PvP is now: " + (MeadhallPlugin.ForcePvP.Value ? "ENABLED" : "DISABLED") + "</color>"); if (MeadhallPlugin.ForcePvP.Value && (Object)(object)Player.m_localPlayer != (Object)null) { Player.m_localPlayer.SetPVP(true); args.Context.AddString("<color=yellow>All players will now be forced into PvP mode.</color>"); } } internal void <Postfix>b__0_12(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.AdminsSeeMinimap.Value = !MeadhallPlugin.AdminsSeeMinimap.Value; args.Context.AddString("<color=yellow>Admin minimap vision is now: " + (MeadhallPlugin.AdminsSeeMinimap.Value ? "ENABLED" : "DISABLED") + "</color>"); } internal void <Postfix>b__0_13(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.ModifyRecipes.Value = !MeadhallPlugin.ModifyRecipes.Value; args.Context.AddString("<color=yellow>Recipe modifications are now: " + (MeadhallPlugin.ModifyRecipes.Value ? "ENABLED" : "DISABLED") + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } internal void <Postfix>b__0_14(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString("Current stonecutter recipe: " + MeadhallPlugin.StonecutterRecipe.Value); args.Context.AddString("Usage: setstonecutterrecipe <recipe>"); args.Context.AddString("Format: ItemName:Amount,ItemName:Amount"); args.Context.AddString("Example: setstonecutterrecipe Wood:10,Stone:10,Flint:10"); } else { string text = string.Join(" ", args.Args, 1, args.Length - 1); MeadhallPlugin.StonecutterRecipe.Value = text; args.Context.AddString("<color=yellow>Stonecutter recipe set to: " + text + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } } internal void <Postfix>b__0_15(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); return; } MeadhallPlugin.DisableArmorSetBonuses.Value = !MeadhallPlugin.DisableArmorSetBonuses.Value; args.Context.AddString("<color=yellow>Armor set bonuses are now: " + (MeadhallPlugin.DisableArmorSetBonuses.Value ? "DISABLED" : "ENABLED") + "</color>"); } internal void <Postfix>b__0_16(ConsoleEventArgs args) { float result; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current sword stab multiplier: {MeadhallPlugin.SwordStabDamageMultiplier.Value}x"); args.Context.AddString("Usage: setswordstab <multiplier>"); args.Context.AddString("Example: setswordstab 2.5"); } else if (float.TryParse(args[1], out result)) { MeadhallPlugin.SwordStabDamageMultiplier.Value = result; args.Context.AddString($"<color=yellow>Sword stab multiplier set to: {result}x</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a decimal like 2.0 or 2.5</color>"); } } internal void <Postfix>b__0_17(ConsoleEventArgs args) { float result; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current boat explore radius: {MeadhallPlugin.BoatMapExploreRadius.Value}"); args.Context.AddString("Usage: setboatradius <radius>"); args.Context.AddString("Vanilla: 100, Recommended: 200-400"); args.Context.AddString("Example: setboatradius 300"); } else if (float.TryParse(args[1], out result)) { MeadhallPlugin.BoatMapExploreRadius.Value = result; args.Context.AddString($"<color=yellow>Boat exploration radius set to: {result}</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a number like 200 or 300</color>"); } } } 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 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0183: 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) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01b2: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.EnableAliasSystem.Value) { args.Context.AddString("Alias system is currently disabled."); } else if (args.Length < 2) { args.Context.AddString("Usage: setalias [alias]"); args.Context.AddString("Example: setalias MysteriousStranger"); } else { string text4 = string.Join(" ", args.Args, 1, args.Length - 1).Trim(); if (!IsValidName(text4)) { args.Context.AddString("Invalid alias. Letters and spaces only."); } else { Player localPlayer2 = Player.m_localPlayer; if ((Object)(object)localPlayer2 != (Object)null) { object? obj20 = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(localPlayer2); ZNetView val20 = (ZNetView)((obj20 is ZNetView) ? obj20 : null); if ((Object)(object)val20 != (Object)null) { ZDO zDO2 = val20.GetZDO(); if (zDO2 != null) { zDO2.Set("playerAlias", text4); args.Context.AddString("Your alias is now: " + text4); } } } else { args.Context.AddString("Error: Local player not found"); } } } }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("setalias", "[alias] - Set your alias that everyone sees in chat", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.EnableAliasSystem.Value) { args.Context.AddString("Alias system is currently disabled."); } else { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { object? obj19 = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(localPlayer); ZNetView val19 = (ZNetView)((obj19 is ZNetView) ? obj19 : null); if ((Object)(object)val19 != (Object)null) { ZDO zDO = val19.GetZDO(); if (zDO != null) { zDO.Set("playerAlias", ""); args.Context.AddString("Alias cleared"); } } } else { args.Context.AddString("Error: Local player not found"); } } }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("clearalias", "Clear your alias", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj3 = <>c.<>9__0_2; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.EnableAliasSystem.Value = !MeadhallPlugin.EnableAliasSystem.Value; args.Context.AddString("<color=yellow>Alias system is now: " + (MeadhallPlugin.EnableAliasSystem.Value ? "ENABLED" : "DISABLED") + "</color>"); } }; <>c.<>9__0_2 = val3; obj3 = (object)val3; } new ConsoleCommand("togglealiases", "[Admin] Enable or disable the alias system", (ConsoleEvent)obj3, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj4 = <>c.<>9__0_3; if (obj4 == null) { ConsoleEvent val4 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.HidePlayerHuds.Value = !MeadhallPlugin.HidePlayerHuds.Value; args.Context.AddString("<color=yellow>Player HUD hiding is now: " + (MeadhallPlugin.HidePlayerHuds.Value ? "ENABLED" : "DISABLED") + "</color>"); } }; <>c.<>9__0_3 = val4; obj4 = (object)val4; } new ConsoleCommand("toggleplayerhuds", "[Admin] Enable or disable hiding player HUDs", (ConsoleEvent)obj4, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj5 = <>c.<>9__0_4; if (obj5 == null) { ConsoleEvent val5 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.ShowRealNamesForAdmins.Value = !MeadhallPlugin.ShowRealNamesForAdmins.Value; args.Context.AddString("<color=yellow>Admin real name display is now: " + (MeadhallPlugin.ShowRealNamesForAdmins.Value ? "ENABLED" : "DISABLED") + "</color>"); } }; <>c.<>9__0_4 = val5; obj5 = (object)val5; } new ConsoleCommand("toggleadminnames", "[Admin] Toggle showing real names alongside aliases for admins", (ConsoleEvent)obj5, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj6 = <>c.<>9__0_5; if (obj6 == null) { ConsoleEvent val6 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { args.Context.AddString("<color=yellow>=== Mod Configuration ===</color>"); args.Context.AddString("Alias System: " + (MeadhallPlugin.EnableAliasSystem.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Hide Player HUDs: " + (MeadhallPlugin.HidePlayerHuds.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Show Real Names (Admins): " + (MeadhallPlugin.ShowRealNamesForAdmins.Value ? "ENABLED" : "DISABLED")); args.Context.AddString($"Sword Stab Multiplier: {MeadhallPlugin.SwordStabDamageMultiplier.Value}x"); args.Context.AddString($"Boat Map Explore Radius: {MeadhallPlugin.BoatMapExploreRadius.Value}"); args.Context.AddString($"Staff of Embers Blunt Damage: {MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value}x"); args.Context.AddString($"Staff of Embers Fire Damage: {MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value}x"); args.Context.AddString("Disable Set Bonuses: " + (MeadhallPlugin.DisableArmorSetBonuses.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Modify Recipes: " + (MeadhallPlugin.ModifyRecipes.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Stonecutter Recipe: " + MeadhallPlugin.StonecutterRecipe.Value); args.Context.AddString("Portal Recipe: " + MeadhallPlugin.PortalRecipe.Value); args.Context.AddString("Portal Wood Recipe: " + MeadhallPlugin.PortalWoodRecipe.Value); args.Context.AddString("Admins See All Players: " + (MeadhallPlugin.AdminsSeeMinimap.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Force PvP: " + (MeadhallPlugin.ForcePvP.Value ? "ENABLED" : "DISABLED")); args.Context.AddString("Admin Only Portals: " + (MeadhallPlugin.AdminOnlyPortals.Value ? "ENABLED" : "DISABLED")); } }; <>c.<>9__0_5 = val6; obj6 = (object)val6; } new ConsoleCommand("modconfig", "[Admin] Show current mod configuration", (ConsoleEvent)obj6, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj7 = <>c.<>9__0_6; if (obj7 == null) { ConsoleEvent val7 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString("Current portal recipe: " + MeadhallPlugin.PortalRecipe.Value); args.Context.AddString("Usage: setportalrecipe <recipe>"); args.Context.AddString("Format: ItemName:Amount,ItemName:Amount"); args.Context.AddString("Example: setportalrecipe FlametalNew:20,GreydwarfEye:20,SurtlingCore:2"); } else { string text3 = string.Join(" ", args.Args, 1, args.Length - 1); MeadhallPlugin.PortalRecipe.Value = text3; args.Context.AddString("<color=yellow>Portal recipe set to: " + text3 + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } }; <>c.<>9__0_6 = val7; obj7 = (object)val7; } new ConsoleCommand("setportalrecipe", "[Admin] Set portal recipe", (ConsoleEvent)obj7, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj8 = <>c.<>9__0_7; if (obj8 == null) { ConsoleEvent val8 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString("Current portal wood recipe: " + MeadhallPlugin.PortalWoodRecipe.Value); args.Context.AddString("Usage: setportalwoodrecipe <recipe>"); args.Context.AddString("Format: ItemName:Amount,ItemName:Amount"); args.Context.AddString("Example: setportalwoodrecipe FlametalNew:20,GreydwarfEye:20,SurtlingCore:2"); } else { string text2 = string.Join(" ", args.Args, 1, args.Length - 1); MeadhallPlugin.PortalWoodRecipe.Value = text2; args.Context.AddString("<color=yellow>Portal wood recipe set to: " + text2 + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } }; <>c.<>9__0_7 = val8; obj8 = (object)val8; } new ConsoleCommand("setportalwoodrecipe", "[Admin] Set portal wood recipe", (ConsoleEvent)obj8, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj9 = <>c.<>9__0_8; if (obj9 == null) { ConsoleEvent val9 = delegate(ConsoleEventArgs args) { float result4; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current Staff of Embers blunt damage multiplier: {MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value}x"); args.Context.AddString("Usage: setstaffblunt <multiplier>"); args.Context.AddString("Example: setstaffblunt 0.5 (50% nerf)"); } else if (float.TryParse(args[1], out result4)) { MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value = result4; args.Context.AddString($"<color=yellow>Staff of Embers blunt damage multiplier set to: {result4}x</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a decimal like 0.5 or 1.0</color>"); } }; <>c.<>9__0_8 = val9; obj9 = (object)val9; } new ConsoleCommand("setstaffblunt", "[Admin] Set Staff of Embers blunt damage multiplier", (ConsoleEvent)obj9, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj10 = <>c.<>9__0_9; if (obj10 == null) { ConsoleEvent val10 = delegate(ConsoleEventArgs args) { float result3; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current Staff of Embers fire damage multiplier: {MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value}x"); args.Context.AddString("Usage: setstafffire <multiplier>"); args.Context.AddString("Example: setstafffire 0.5 (50% nerf)"); } else if (float.TryParse(args[1], out result3)) { MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value = result3; args.Context.AddString($"<color=yellow>Staff of Embers fire damage multiplier set to: {result3}x</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a decimal like 0.5 or 1.0</color>"); } }; <>c.<>9__0_9 = val10; obj10 = (object)val10; } new ConsoleCommand("setstafffire", "[Admin] Set Staff of Embers fire damage multiplier", (ConsoleEvent)obj10, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj11 = <>c.<>9__0_10; if (obj11 == null) { ConsoleEvent val11 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.AdminOnlyPortals.Value = !MeadhallPlugin.AdminOnlyPortals.Value; args.Context.AddString("<color=yellow>Admin-only portals is now: " + (MeadhallPlugin.AdminOnlyPortals.Value ? "ENABLED" : "DISABLED") + "</color>"); } }; <>c.<>9__0_10 = val11; obj11 = (object)val11; } new ConsoleCommand("toggleportals", "[Admin] Toggle admin-only portal naming", (ConsoleEvent)obj11, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj12 = <>c.<>9__0_11; if (obj12 == null) { ConsoleEvent val12 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.ForcePvP.Value = !MeadhallPlugin.ForcePvP.Value; args.Context.AddString("<color=yellow>Forced PvP is now: " + (MeadhallPlugin.ForcePvP.Value ? "ENABLED" : "DISABLED") + "</color>"); if (MeadhallPlugin.ForcePvP.Value && (Object)(object)Player.m_localPlayer != (Object)null) { Player.m_localPlayer.SetPVP(true); args.Context.AddString("<color=yellow>All players will now be forced into PvP mode.</color>"); } } }; <>c.<>9__0_11 = val12; obj12 = (object)val12; } new ConsoleCommand("togglepvp", "[Admin] Toggle forced PvP mode", (ConsoleEvent)obj12, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj13 = <>c.<>9__0_12; if (obj13 == null) { ConsoleEvent val13 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.AdminsSeeMinimap.Value = !MeadhallPlugin.AdminsSeeMinimap.Value; args.Context.AddString("<color=yellow>Admin minimap vision is now: " + (MeadhallPlugin.AdminsSeeMinimap.Value ? "ENABLED" : "DISABLED") + "</color>"); } }; <>c.<>9__0_12 = val13; obj13 = (object)val13; } new ConsoleCommand("toggleadminmap", "[Admin] Toggle seeing all players on minimap", (ConsoleEvent)obj13, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj14 = <>c.<>9__0_13; if (obj14 == null) { ConsoleEvent val14 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.ModifyRecipes.Value = !MeadhallPlugin.ModifyRecipes.Value; args.Context.AddString("<color=yellow>Recipe modifications are now: " + (MeadhallPlugin.ModifyRecipes.Value ? "ENABLED" : "DISABLED") + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } }; <>c.<>9__0_13 = val14; obj14 = (object)val14; } new ConsoleCommand("togglerecipes", "[Admin] Enable or disable recipe modifications", (ConsoleEvent)obj14, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj15 = <>c.<>9__0_14; if (obj15 == null) { ConsoleEvent val15 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString("Current stonecutter recipe: " + MeadhallPlugin.StonecutterRecipe.Value); args.Context.AddString("Usage: setstonecutterrecipe <recipe>"); args.Context.AddString("Format: ItemName:Amount,ItemName:Amount"); args.Context.AddString("Example: setstonecutterrecipe Wood:10,Stone:10,Flint:10"); } else { string text = string.Join(" ", args.Args, 1, args.Length - 1); MeadhallPlugin.StonecutterRecipe.Value = text; args.Context.AddString("<color=yellow>Stonecutter recipe set to: " + text + "</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } }; <>c.<>9__0_14 = val15; obj15 = (object)val15; } new ConsoleCommand("setstonecutterrecipe", "[Admin] Set stonecutter recipe", (ConsoleEvent)obj15, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj16 = <>c.<>9__0_15; if (obj16 == null) { ConsoleEvent val16 = delegate(ConsoleEventArgs args) { if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else { MeadhallPlugin.DisableArmorSetBonuses.Value = !MeadhallPlugin.DisableArmorSetBonuses.Value; args.Context.AddString("<color=yellow>Armor set bonuses are now: " + (MeadhallPlugin.DisableArmorSetBonuses.Value ? "DISABLED" : "ENABLED") + "</color>"); } }; <>c.<>9__0_15 = val16; obj16 = (object)val16; } new ConsoleCommand("togglesetbonuses", "[Admin] Enable or disable armor set bonuses", (ConsoleEvent)obj16, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj17 = <>c.<>9__0_16; if (obj17 == null) { ConsoleEvent val17 = delegate(ConsoleEventArgs args) { float result2; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current sword stab multiplier: {MeadhallPlugin.SwordStabDamageMultiplier.Value}x"); args.Context.AddString("Usage: setswordstab <multiplier>"); args.Context.AddString("Example: setswordstab 2.5"); } else if (float.TryParse(args[1], out result2)) { MeadhallPlugin.SwordStabDamageMultiplier.Value = result2; args.Context.AddString($"<color=yellow>Sword stab multiplier set to: {result2}x</color>"); args.Context.AddString("<color=yellow>Restart required for changes to take effect.</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a decimal like 2.0 or 2.5</color>"); } }; <>c.<>9__0_16 = val17; obj17 = (object)val17; } new ConsoleCommand("setswordstab", "[Admin] Set sword stab damage multiplier", (ConsoleEvent)obj17, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj18 = <>c.<>9__0_17; if (obj18 == null) { ConsoleEvent val18 = delegate(ConsoleEventArgs args) { float result; if (!MeadhallPlugin.IsPlayerAdmin()) { args.Context.AddString("<color=red>You must be an admin to use this command.</color>"); } else if (args.Length < 2) { args.Context.AddString($"Current boat explore radius: {MeadhallPlugin.BoatMapExploreRadius.Value}"); args.Context.AddString("Usage: setboatradius <radius>"); args.Context.AddString("Vanilla: 100, Recommended: 200-400"); args.Context.AddString("Example: setboatradius 300"); } else if (float.TryParse(args[1], out result)) { MeadhallPlugin.BoatMapExploreRadius.Value = result; args.Context.AddString($"<color=yellow>Boat exploration radius set to: {result}</color>"); } else { args.Context.AddString("<color=red>Invalid number. Use a number like 200 or 300</color>"); } }; <>c.<>9__0_17 = val18; obj18 = (object)val18; } new ConsoleCommand("setboatradius", "[Admin] Set boat map exploration radius", (ConsoleEvent)obj18, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static bool IsValidName(string input) { return !string.IsNullOrWhiteSpace(input) && Regex.IsMatch(input, "^[\\p{L}\\s]+$"); } } [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class ObjectDB_Awake_Patch { private static void Postfix(ObjectDB __instance) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || __instance.m_items == null || __instance.m_items.Count == 0) { return; } foreach (GameObject item in __instance.m_items) { if ((Object)(object)item == (Object)null) { continue; } ItemDrop component = item.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { continue; } string text = component.m_itemData.m_shared.m_name.ToLower(); if ((int)component.m_itemData.m_shared.m_itemType == 3 || (int)component.m_itemData.m_shared.m_itemType == 14) { if (text.Contains("sword") && component.m_itemData.m_shared.m_attack != null && component.m_itemData.m_shared.m_secondaryAttack != null) { component.m_itemData.m_shared.m_secondaryAttack.m_damageMultiplier = MeadhallPlugin.SwordStabDamageMultiplier.Value; } if (text.Contains("stafffireball")) { Debug.Log((object)("[Meadhall] Found Staff of Embers: " + component.m_itemData.m_shared.m_name)); component.m_itemData.m_shared.m_damages.m_blunt *= MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value; component.m_itemData.m_shared.m_damages.m_fire *= MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value; Debug.Log((object)$"[Meadhall] Nerfed Staff of Embers - Blunt: {MeadhallPlugin.StaffOfEmbersBluntDamageMultiplier.Value}x, Fire: {MeadhallPlugin.StaffOfEmbersFireDamageMultiplier.Value}x"); } } } if (!MeadhallPlugin.DisableArmorSetBonuses.Value || (Object)(object)__instance == (Object)null || __instance.m_items == null || __instance.m_items.Count == 0) { return; } int num = 0; foreach (GameObject item2 in __instance.m_items) { if (!((Object)(object)item2 == (Object)null)) { ItemDrop component2 = item2.GetComponent<ItemDrop>(); if (!((Object)(object)component2 == (Object)null) && component2.m_itemData != null && component2.m_itemData.m_shared != null && (Object)(object)component2.m_itemData.m_shared.m_setStatusEffect != (Object)null) { Debug.Log((object)("[Meadhall] Removing set effect from " + component2.m_itemData.m_shared.m_name + ": " + ((Object)component2.m_itemData.m_shared.m_setStatusEffect).name)); component2.m_itemData.m_shared.m_setStatusEffect = null; num++; } } } if (num > 0) { Debug.Log((object)$"[Meadhall] Removed set effects from {num} items"); } } } [HarmonyPatch(typeof(Fireplace), "Awake")] public static class Fireplace_Awake_Patch { private static void Postfix(Fireplace __instance) { if (!((Object)(object)__instance == (Object)null)) { __instance.m_secPerFuel *= MeadhallPlugin.FuelDurationMultiplier.Value; Debug.Log((object)$"[Meadhall] Extended fuel duration for {((Object)__instance).name} - {MeadhallPlugin.FuelDurationMultiplier.Value}x longer"); } } } [HarmonyPatch(typeof(Minimap), "UpdateExplore")] public static class Minimap_UpdateExplore_Patch { private static MethodInfo exploreMethod; private static void Postfix(Minimap __instance, float dt, Player player) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)__instance == (Object)null) { return; } Ship controlledShip = player.GetControlledShip(); if ((Object)(object)controlledShip != (Object)null) { float value = MeadhallPlugin.BoatMapExploreRadius.Value; if (exploreMethod == null) { exploreMethod = AccessTools.Method(typeof(Minimap), "Explore", new Type[2] { typeof(Vector3), typeof(float) }, (Type[])null); } if (exploreMethod != null) { exploreMethod.Invoke(__instance, new object[2] { ((Component)player).transform.position, value }); } } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class ZNetScene_Awake_Patch { private static void Postfix(ZNetScene __instance) { Debug.Log((object)$"[Meadhall] ZNetScene.Awake - ModifyRecipes = {MeadhallPlugin.ModifyRecipes.Value}"); Debug.Log((object)$"[Meadhall] Extending fuel duration for all Fireplace prefabs - Multiplier: {MeadhallPlugin.FuelDurationMultiplier.Value}x"); int num = 0; foreach (GameObject prefab in __instance.m_prefabs) { if (!((Object)(object)prefab == (Object)null)) { Fireplace component = prefab.GetComponent<Fireplace>(); if ((Object)(object)component != (Object)null) { float secPerFuel = component.m_secPerFuel; component.m_secPerFuel *= MeadhallPlugin.FuelDurationMultiplier.Value; Debug.Log((object)$"[Meadhall] Extended fuel for {((Object)prefab).name}: {secPerFuel}s -> {component.m_secPerFuel}s"); num++; } } } Debug.Log((object)$"[Meadhall] Modified {num} Fireplace prefabs"); if (!MeadhallPlugin.ModifyRecipes.Value) { return; } Debug.Log((object)"[Meadhall] Available portal prefabs:"); foreach (GameObject prefab2 in __instance.m_prefabs) { if ((Object)(object)prefab2 != (Object)null && ((Object)prefab2).name.ToLower().Contains("portal")) { Debug.Log((object)(" - " + ((Object)prefab2).name)); } } Debug.Log((object)"[Meadhall] Attempting to modify recipes..."); ModifyPieceRecipe(__instance, "piece_stonecutter", "Stonecutter", MeadhallPlugin.StonecutterRecipe.Value); ModifyPieceRecipe(__instance, "portal_stone", "Portal Stone", MeadhallPlugin.PortalRecipe.Value); ModifyPieceRecipe(__instance, "portal_wood", "Portal Wood", MeadhallPlugin.PortalWoodRecipe.Value); ModifyItemRecipe(__instance, "StaffShield", "Staff of Protection", MeadhallPlugin.StaffShieldRecipe.Value); } private static void ModifyItemRecipe(ZNetScene instance, string itemName, string displayName, string recipeString) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown Debug.Log((object)("[Meadhall] Looking for item: " + itemName)); GameObject prefab = instance.GetPrefab(itemName); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("[Meadhall] Could not find item prefab: " + itemName)); return; } Debug.Log((object)("[Meadhall] Found prefab: " + itemName)); Recipe recipe = ObjectDB.instance.GetRecipe(prefab.GetComponent<ItemDrop>()?.m_itemData); if ((Object)(object)recipe == (Object)null) { Debug.LogWarning((object)("[Meadhall] Could not find recipe for: " + itemName)); return; } try { string[] array = recipeString.Split(new char[1] { ',' }); List<Requirement> list = new List<Requirement>(); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Trim().Split(new char[1] { ':' }); if (array3.Length != 2) { Debug.LogWarning((object)("[Meadhall] Invalid recipe format for " + displayName + ": " + text)); continue; } string text2 = array3[0].Trim(); if (!int.TryParse(array3[1].Trim(), out var result)) { Debug.LogWarning((object)("[Meadhall] Invalid amount in recipe for " + displayName + ": " + array3[1])); continue; } ObjectDB instance2 = ObjectDB.instance; GameObject val = ((instance2 != null) ? instance2.GetItemPrefab(text2) : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("[Meadhall] Item not found for " + displayName + " recipe: " + text2)); continue; } list.Add(new Requirement { m_resItem = val.GetComponent<ItemDrop>(), m_amount = result, m_recover = true }); Debug.Log((object)$"[Meadhall] Added requirement: {text2} x{result}"); } if (list.Count > 0) { recipe.m_resources = list.ToArray(); Debug.Log((object)$"[Meadhall] Successfully modified recipe for {displayName} with {list.Count} requirements"); } else { Debug.LogWarning((object)("[Meadhall] No valid requirements found for " + displayName)); } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error modifying recipe for {displayName}: {arg}"); } } private static void ModifyPieceRecipe(ZNetScene instance, string pieceName, string displayName, string recipeString) { //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown Debug.Log((object)("[Meadhall] Looking for prefab: " + pieceName)); GameObject prefab = instance.GetPrefab(pieceName); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("[Meadhall] Could not find prefab for " + displayName + " (" + pieceName + ")")); Debug.Log((object)"[Meadhall] Available prefabs containing 'stone':"); { foreach (GameObject prefab2 in instance.m_prefabs) { if ((Object)(object)prefab2 != (Object)null && ((Object)prefab2).name.ToLower().Contains("stone")) { Debug.Log((object)(" - " + ((Object)prefab2).name)); } } return; } } Debug.Log((object)("[Meadhall] Found prefab: " + ((Object)prefab).name)); Piece component = prefab.GetComponent<Piece>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("[Meadhall] No Piece component found on " + displayName)); return; } Debug.Log((object)"[Meadhall] Found Piece component, current requirements:"); if (component.m_resources != null) { Requirement[] resources = component.m_resources; foreach (Requirement val in resources) { if ((Object)(object)val.m_resItem != (Object)null) { Debug.Log((object)$" - {((Object)val.m_resItem).name}: {val.m_amount}"); } } } try { string[] array = recipeString.Split(new char[1] { ',' }); List<Requirement> list = new List<Requirement>(); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Trim().Split(new char[1] { ':' }); if (array3.Length != 2) { Debug.LogWarning((object)("[Meadhall] Invalid recipe format for " + displayName + ": " + text)); continue; } string text2 = array3[0].Trim(); if (!int.TryParse(array3[1].Trim(), out var result)) { Debug.LogWarning((object)("[Meadhall] Invalid amount in recipe for " + displayName + ": " + array3[1])); continue; } ObjectDB instance2 = ObjectDB.instance; GameObject val2 = ((instance2 != null) ? instance2.GetItemPrefab(text2) : null); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)("[Meadhall] Item not found for " + displayName + " recipe: " + text2)); continue; } list.Add(new Requirement { m_resItem = val2.GetComponent<ItemDrop>(), m_amount = result, m_recover = true }); Debug.Log((object)$"[Meadhall] Added requirement: {text2} x{result}"); } if (list.Count > 0) { component.m_resources = list.ToArray(); Debug.Log((object)$"[Meadhall] Successfully modified recipe for {displayName} with {list.Count} requirements"); } else { Debug.LogWarning((object)("[Meadhall] No valid requirements found for " + displayName)); } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error modifying recipe for {displayName}: {arg}"); } } } [HarmonyPatch(typeof(Player), "SetPVP")] public static class Player_SetPVP_Patch { private static bool isForcing; private static FieldInfo m_pvpField; private static bool Prefix(Player __instance, bool enabled) { if (!MeadhallPlugin.ForcePvP.Value) { return true; } if ((Object)(object)__instance == (Object)null) { return true; } if (isForcing) { return true; } if (!enabled) { Debug.Log((object)"[Meadhall] Blocking attempt to disable PvP - forcing field to true"); if (m_pvpField == null) { m_pvpField = AccessTools.Field(typeof(Player), "m_pvp"); } if (m_pvpField != null) { m_pvpField.SetValue(__instance, true); } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { ZDO zDO = component.GetZDO(); if (zDO != null) { zDO.Set("pvp", true); } } return false; } return true; } } [HarmonyPatch(typeof(Player), "IsPVPEnabled")] public static class Player_IsPVPEnabled_Patch { private static void Postfix(ref bool __result) { if (MeadhallPlugin.ForcePvP.Value) { __result = true; } } } [HarmonyPatch(typeof(Player), "CanSwitchPVP")] public static class Player_CanSwitchPVP_Patch { private static void Postfix(ref bool __result) { Debug.Log((object)$"[Meadhall] CanSwitchPVP called - ForcePvP={MeadhallPlugin.ForcePvP.Value}, Original result={__result}"); if (MeadhallPlugin.ForcePvP.Value) { __result = false; Debug.Log((object)"[Meadhall] CanSwitchPVP - blocking toggle, setting result to false"); } } } [HarmonyPatch(typeof(MessageHud), "ShowMessage")] public static class MessageHud_ShowMessage_Patch { private static bool Prefix(MessageType type, string text) { if (!MeadhallPlugin.ForcePvP.Value) { return true; } if (text == null) { return true; } string text2 = text.ToLower(); if (text2.Contains("friendly") || text2.Contains("pvp") || text2.Contains("player vs player") || text2.Contains("$msg_pvpon") || text2.Contains("$msg_pvpoff")) { Debug.Log((object)("[Meadhall] Blocking PvP message: " + text)); return false; } return true; } } [HarmonyPatch(typeof(TeleportWorld), "Interact")] public static class TeleportWorld_Interact_Patch { private static bool Prefix(TeleportWorld __instance, Humanoid human, bool hold) { if (!MeadhallPlugin.AdminOnlyPortals.Value) { return true; } if ((Object)(object)human == (Object)null || !(human is Player)) { return true; } if (MeadhallPlugin.IsPlayerAdmin()) { return true; } return false; } } [HarmonyPatch(typeof(Player), "Update")] public static class Player_Update_Patch { private static float updateTimer; private static float ghostReminderTimer; private static float instanceCheckTimer; private static float instance10500ReminderTimer; private static FieldInfo m_pvpField; private static bool wasInGhostMode; private static bool hasWarned10500; private static bool hasWarned11000; private static void Postfix(Player __instance) { if (MeadhallPlugin.ForcePvP.Value && (Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { updateTimer += Time.deltaTime; if (updateTimer >= 0.5f) { updateTimer = 0f; if (m_pvpField == null) { m_pvpField = AccessTools.Field(typeof(Player), "m_pvp"); } if (m_pvpField != null && !(bool)m_pvpField.GetValue(__instance)) { Debug.Log((object)"[Meadhall] Blocking attempt to disable PvP - forcing field to true"); m_pvpField.SetValue(__instance, true); object? obj = AccessTools.Field(typeof(Character), "m_nview")?.GetValue(__instance); ZNetView val = (ZNetView)((obj is ZNetView) ? obj : null); if (((val != null) ? val.GetZDO() : null) != null) { val.GetZDO().Set("pvp", true); } } } } if ((Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && MeadhallPlugin.IsPlayerAdmin()) { bool flag = ((Character)__instance).InGhostMode(); if (flag && !wasInGhostMode) { MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)2, "\ud83d\udc7b GHOSTED", 0, (Sprite)null, false); } wasInGhostMode = true; ghostReminderTimer = 0f; } else if (!flag && wasInGhostMode) { MessageHud instance2 = MessageHud.instance; if (instance2 != null) { instance2.ShowMessage((MessageType)2, "Ghost mode disabled", 0, (Sprite)null, false); } wasInGhostMode = false; ghostReminderTimer = 0f; } else if (flag && wasInGhostMode) { ghostReminderTimer += Time.deltaTime; if (ghostReminderTimer >= 10f) { MessageHud instance3 = MessageHud.instance; if (instance3 != null) { instance3.ShowMessage((MessageType)2, "\ud83d\udc7b GHOSTED", 0, (Sprite)null, false); } ghostReminderTimer = 0f; } } } if (!((Object)(object)__instance != (Object)null) || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer)) { return; } instanceCheckTimer += Time.deltaTime; if (!(instanceCheckTimer >= 5f)) { return; } instanceCheckTimer = 0f; if (!((Object)(object)ZNetScene.instance != (Object)null)) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(ZNetScene), "m_instances"); if (!(fieldInfo != null) || !(fieldInfo.GetValue(ZNetScene.instance) is IDictionary dictionary)) { return; } int count = dictionary.Count; if (count >= 11000) { MessageHud instance4 = MessageHud.instance; if (instance4 != null) { instance4.ShowMessage((MessageType)2, "⚠\ufe0f INSTANCE LIMIT REACHED ⚠\ufe0f (" + count + ")", 0, (Sprite)null, false); } hasWarned11000 = true; hasWarned10500 = true; instance10500ReminderTimer = 0f; } else if (count >= 10500) { if (!hasWarned10500) { MessageHud instance5 = MessageHud.instance; if (instance5 != null) { instance5.ShowMessage((MessageType)2, "⚠\ufe0f Instance limit close - " + count + " instances", 0, (Sprite)null, false); } hasWarned10500 = true; instance10500ReminderTimer = 0f; return; } instance10500ReminderTimer += 5f; if (instance10500ReminderTimer >= 15f) { MessageHud instance6 = MessageHud.instance; if (instance6 != null) { instance6.ShowMessage((MessageType)2, "⚠\ufe0f Instance limit close - " + count + " instances", 0, (Sprite)null, false); } instance10500ReminderTimer = 0f; } } else if (hasWarned10500 || hasWarned11000) { hasWarned10500 = false; hasWarned11000 = false; instance10500ReminderTimer = 0f; } } } [HarmonyPatch(typeof(Player), "Awake")] public static class Player_Awake_Patch { private static void Postfix(Player __instance) { if (MeadhallPlugin.ForcePvP.Value && !((Object)(object)__instance == (Object)null) && !((Object)(object)ZNet.instance == (Object)null)) { Debug.Log((object)"[Meadhall] Player spawned, forcing PvP on"); __instance.SetPVP(true); } } } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(int), typeof(bool), typeof(int), typeof(float) })] public static class SEMan_AddStatusEffect_Patch { private static FieldInfo m_characterField; private static bool Prefix(SEMan __instance, int nameHash, bool resetTime, int itemLevel, float skillLevel) { if (!MeadhallPlugin.DisableArmorSetBonuses.Value) { return true; } if (__instance == null) { return true; } if (m_characterField == null) { m_characterField = AccessTools.Field(typeof(SEMan), "m_character"); } object? obj = m_characterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val == (Object)null || !(val is Player)) { return true; } ObjectDB instance = ObjectDB.instance; StatusEffect val2 = ((instance != null) ? instance.GetStatusEffect(nameHash) : null); if ((Object)(object)val2 == (Object)null) { return true; } string text = ((Object)val2).name.ToLower(); if (text.Contains("set") || text.Contains("armor") || text.Contains("seteffect") || text.Contains("setbonus") || text.Contains("piece") || text.Contains("ragnarok") || text.Contains("aesir") || text.Contains("wraith") || text.Contains("serpent") || text.Contains("abomination") || ShouldBlockEffect(val2)) { Debug.Log((object)("[Meadhall] BLOCKED armor set bonus effect: " + ((Object)val2).name)); return false; } return true; } private static bool ShouldBlockEffect(StatusEffect effect) { if ((Object)(object)effect.m_icon == (Object)null) { return false; } string text = ((Object)effect.m_icon).name?.ToLower() ?? ""; if (text.Contains("set") || text.Contains("armor")) { return true; } if (effect.m_tooltip != null && effect.m_tooltip.ToLower().Contains("set effect")) { return true; } return false; } } [HarmonyPatch(typeof(TerrainOp), "Awake")] public static class TerrainOp_Awake_Patch { private static void Postfix(TerrainOp __instance) { if (!MeadhallPlugin.DisableTerrainModification.Value || MeadhallPlugin.IsPlayerAdmin() || (Object)(object)__instance == (Object)null) { return; } try { Piece component = ((Component)__instance).GetComponent<Piece>(); if (!((Object)(object)component == (Object)null)) { string text = ((Object)component).name?.ToLower() ?? ""; if (text.Contains("raise") || text.Contains("mud_road")) { ((Behaviour)__instance).enabled = false; Debug.Log((object)("[Meadhall] Disabled terrain tool: " + ((Object)component).name)); } } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error in TerrainOp_Awake patch: {arg}"); } } } [HarmonyPatch(typeof(Player), "PlacePiece")] public static class Player_PlacePiece_Patch { private static bool Prefix(Player __instance, Piece piece) { if (!MeadhallPlugin.DisableTerrainModification.Value) { return true; } if (MeadhallPlugin.IsPlayerAdmin()) { return true; } if ((Object)(object)piece == (Object)null) { return true; } try { string text = ((Object)piece).name?.ToLower() ?? ""; if (text.Contains("raise") || text.Contains("mud_road")) { return false; } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error in PlacePiece patch: {arg}"); } return true; } } [HarmonyPatch(typeof(TerrainComp), "ApplyOperation")] public static class TerrainComp_ApplyOperation_Patch { private static bool Prefix(TerrainOp modifier) { if (!MeadhallPlugin.DisableTerrainModification.Value) { return true; } if (MeadhallPlugin.IsPlayerAdmin()) { return true; } if ((Object)(object)modifier == (Object)null) { return true; } try { Piece component = ((Component)modifier).GetComponent<Piece>(); if ((Object)(object)component == (Object)null) { return true; } string text = ((Object)component).name?.ToLower() ?? ""; if (text.Contains("raise") || text.Contains("mud_road")) { Debug.Log((object)("[Meadhall] Blocked terrain operation for: " + ((Object)component).name)); return false; } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error in ApplyOperation patch: {arg}"); } return true; } } [HarmonyPatch(typeof(Player), "SetPlaceMode")] public static class Player_SetPlaceMode_StonePickable_Patch { private static void Postfix(Player __instance, PieceTable buildPieces) { if ((Object)(object)buildPieces == (Object)null || (Object)(object)__instance == (Object)null) { return; } try { GameObject selectedPrefab = buildPieces.GetSelectedPrefab(); if ((Object)(object)selectedPrefab == (Object)null) { return; } string name = ((Object)selectedPrefab).name; if (!(name == "Placeable_Stone") && !(name == "placeable_stone")) { return; } Piece component = selectedPrefab.GetComponent<Piece>(); if (!((Object)(object)component != (Object)null) || component.m_resources == null || component.m_resources.Length == 0) { return; } Requirement[] resources = component.m_resources; foreach (Requirement val in resources) { if ((Object)(object)val.m_resItem != (Object)null) { string name2 = ((Object)val.m_resItem).name; if (name2.ToLower().Contains("stone")) { val.m_amount = MeadhallPlugin.StonePickableCost.Value; Debug.Log((object)$"[Meadhall] Modified {name} stone cost to {MeadhallPlugin.StonePickableCost.Value}"); } } } } catch (Exception arg) { Debug.LogError((object)$"[Meadhall] Error in Player_SetPlaceMode_StonePickable patch: {arg}"); } } }
MeadhallModels.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MeadhallModels")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeadhallModels")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("30b9e8e6-a679-4b46-834a-069a64c98706")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MeadhallModels; [BepInPlugin("meadhall.meadhallmodels", "Meadhall Models", "3.0.0")] public class MeadhallModelsPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "Start")] private static class PlayerStartPatch { private static void Postfix(Player __instance) { if ((Object)(object)CustomRuntime == (Object)null) { Animator value = Traverse.Create((object)__instance).Field("m_animator").GetValue<Animator>(); CustomRuntime = MakeAOC(replacementMap, value.runtimeAnimatorController); } if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } ZNetView value2 = Traverse.Create((object)__instance).Field("m_nview").GetValue<ZNetView>(); ZDO value3 = Traverse.Create((object)value2).Field("m_zdo").GetValue<ZDO>(); string @string = value3.GetString("KGmodelchanged", ""); if (!string.IsNullOrWhiteSpace(@string)) { ApplyModelOnPlayer(__instance, @string); } if (Humanoids != null) { return; } Humanoids = new Dictionary<string, string>(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Humanoid component = prefab.GetComponent<Humanoid>(); if (Object.op_Implicit((Object)(object)component)) { string value4 = Traverse.Create((object)component).Field("m_name").GetValue<string>(); if (value4 != null) { Humanoids.Add(((Object)prefab).name, value4); } else { Humanoids.Add(((Object)prefab).name, ((Object)prefab).name); } } } OrderedHumanoids = Humanoids.OrderBy((KeyValuePair<string, string> kvp) => kvp.Value); } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class AddingZroutMethods { private static void Postfix() { ZRoutedRpc.instance.Register<ZPackage>("KGchangemodel", (Action<long, ZPackage>)PlayerChangedModel); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class AddCommands { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; public static ConsoleEvent <>9__0_1; internal void <Postfix>b__0_0(ConsoleEventArgs args) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 2) { if (Humanoids.ContainsKey(args[1])) { ZNetView value = Traverse.Create((object)Player.m_localPlayer).Field("m_nview").GetValue<ZNetView>(); ZDO value2 = Traverse.Create((object)value).Field("m_zdo").GetValue<ZDO>(); value2.Set("KGmodelchanged", args[1]); ZPackage val = new ZPackage(); val.Write(((Character)Player.m_localPlayer).GetZDOID()); val.Write(args[1]); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "KGchangemodel", new object[1] { val }); args.Context.AddString("model changed! " + args[1]); } else { args.Context.AddString("invalid model"); } } else { args.Context.AddString("you must specify a model, use modellist to get the options"); } } internal void <Postfix>b__0_1(ConsoleEventArgs args) { string text = "Models you can change to: "; foreach (KeyValuePair<string, string> orderedHumanoid in OrderedHumanoids) { text = text + orderedHumanoid.Key + ", "; } args.Context.AddString(text); } } 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 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 2) { if (Humanoids.ContainsKey(args[1])) { ZNetView value = Traverse.Create((object)Player.m_localPlayer).Field("m_nview").GetValue<ZNetView>(); ZDO value2 = Traverse.Create((object)value).Field("m_zdo").GetValue<ZDO>(); value2.Set("KGmodelchanged", args[1]); ZPackage val3 = new ZPackage(); val3.Write(((Character)Player.m_localPlayer).GetZDOID()); val3.Write(args[1]); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "KGchangemodel", new object[1] { val3 }); args.Context.AddString("model changed! " + args[1]); } else { args.Context.AddString("invalid model"); } } else { args.Context.AddString("you must specify a model, use modellist to get the options"); } }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("modelchange", "[creature] - Change to creature model", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { string text = "Models you can change to: "; foreach (KeyValuePair<string, string> orderedHumanoid in OrderedHumanoids) { text = text + orderedHumanoid.Key + ", "; } args.Context.AddString(text); }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("modellist", "List available creature models", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } private static Harmony harmony; private static RuntimeAnimatorController CustomRuntime; private static Dictionary<string, string> Humanoids; private static IOrderedEnumerable<KeyValuePair<string, string>> OrderedHumanoids; private static Dictionary<string, string> replacementMap = new Dictionary<string, string>(); public static Dictionary<string, AnimationClip> ExternalAnimations = new Dictionary<string, AnimationClip>(); private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("meadhall.meadhallmodels"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Meadhall Models v3.0.0 loaded!"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private static void ResetPlayerModel(Player p) { Transform val = ((Component)p).transform.Find("NewVisual"); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)((Component)p).transform.Find("NewVisual")).gameObject); } GameObject gameObject = ((Component)((Component)p).transform.Find("Visual")).gameObject; Traverse.Create((object)p).Field("m_visual").SetValue((object)gameObject); gameObject.transform.SetSiblingIndex(0); gameObject.SetActive(true); Animator component = gameObject.GetComponent<Animator>(); Traverse.Create((object)p).Field("m_animator").SetValue((object)component); object value = Traverse.Create((object)p).Field("m_zanim").GetValue(); Traverse.Create(value).Field("m_animator").SetValue((object)component); VisEquipment value2 = Traverse.Create((object)p).Field("m_visEquipment").GetValue<VisEquipment>(); Traverse.Create((object)value2).Field("m_visual").SetValue((object)gameObject); ((Component)p).GetComponent<FootStep>().m_feet = (Transform[])(object)new Transform[2] { FindChildRecursive(gameObject.transform, "LeftFoot"), FindChildRecursive(gameObject.transform, "RightFoot") }; Traverse.Create((object)value2).Field("m_rightHand").SetValue((object)FindChildRecursive(gameObject.transform, "RightHand_Attach")); Traverse.Create((object)value2).Field("m_leftHand").SetValue((object)FindChildRecursive(gameObject.transform, "LeftHand_Attach")); Traverse.Create((object)value2).Field("m_helmet").SetValue((object)FindChildRecursive(gameObject.transform, "Helmet_attach")); Collider value3 = Traverse.Create((object)p).Field("m_collider").GetValue<Collider>(); if ((Object)(object)value3 != (Object)null) { value3.enabled = true; } } private static void ApplyModelOnPlayer(Player p, string changedModel) { //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) ResetPlayerModel(p); GameObject prefab = ZNetScene.instance.GetPrefab(changedModel); if (!Object.op_Implicit((Object)(object)prefab) || !Object.op_Implicit((Object)(object)prefab.GetComponent<Humanoid>())) { return; } prefab = ((Component)prefab.GetComponentInChildren<Animator>()).gameObject; GameObject val = Object.Instantiate<GameObject>(prefab, ((Component)p).transform); Traverse.Create((object)p).Field("m_visual").SetValue((object)val); val.transform.SetSiblingIndex(0); ((Object)val.transform).name = "NewVisual"; Collider value = Traverse.Create((object)p).Field("m_collider").GetValue<Collider>(); Collider val2 = CopyComponent<Collider>(ZNetScene.instance.GetPrefab(changedModel).GetComponent<Collider>(), val); ((Component)val2).gameObject.layer = ((Component)value).gameObject.layer; Transform val3 = FindChildRecursive(val.transform, "Armature"); if (Object.op_Implicit((Object)(object)val3)) { SkinnedMeshRenderer componentInChildren = val.GetComponentInChildren<SkinnedMeshRenderer>(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMesh != (Object)null) { Vector3 localScale = val3.localScale; Bounds bounds = componentInChildren.sharedMesh.bounds; Vector3 val4 = Vector3.Scale(localScale, ((Bounds)(ref bounds)).size); float magnitude = ((Vector3)(ref val4)).magnitude; if (magnitude >= 12f) { val3.localScale /= 3.5f; CapsuleCollider val5 = (CapsuleCollider)(object)((val2 is CapsuleCollider) ? val2 : null); if ((Object)(object)val5 != (Object)null) { val5.radius /= 3.5f; } } } } val.transform.localPosition = Vector3.zero; val.GetComponent<Animator>().runtimeAnimatorController = CustomRuntime; Animator component = val.GetComponent<Animator>(); Traverse.Create((object)p).Field("m_animator").SetValue((object)component); object value2 = Traverse.Create((object)p).Field("m_zanim").GetValue(); Traverse.Create(value2).Field("m_animator").SetValue((object)component); ((Component)((Component)p).transform.Find("Visual")).gameObject.SetActive(false); VisEquipment value3 = Traverse.Create((object)p).Field("m_visEquipment").GetValue<VisEquipment>(); Traverse.Create((object)value3).Field("m_visual").SetValue((object)val); Transform val6 = FindChildRecursive(val.transform, "RightHand_Attach"); if ((Object)(object)val6 == (Object)null) { val6 = FindChildRecursive(val.transform, "RightAttach"); } if ((Object)(object)val6 == (Object)null) { val6 = FindChildRecursive(val.transform, "RightHand"); } if ((Object)(object)val6 == (Object)null) { val6 = FindChildRecursive(val.transform, "r_hand"); } if ((Object)(object)val6 == (Object)null) { val6 = FindChildRecursive(val.transform, "mixamorig:RightHand"); } Transform val7 = FindChildRecursive(val.transform, "LeftHand_Attach"); if ((Object)(object)val7 == (Object)null) { val7 = FindChildRecursive(val.transform, "LeftAttach"); } if ((Object)(object)val7 == (Object)null) { val7 = FindChildRecursive(val.transform, "LeftHand"); } if ((Object)(object)val7 == (Object)null) { val7 = FindChildRecursive(val.transform, "l_hand"); } if ((Object)(object)val7 == (Object)null) { val7 = FindChildRecursive(val.transform, "mixamorig:LeftHand"); } Transform val8 = FindChildRecursive(val.transform, "Helmet_attach"); if ((Object)(object)val8 == (Object)null) { val8 = FindChildRecursive(val.transform, "HelmetAttach"); } if ((Object)(object)val8 == (Object)null) { val8 = FindChildRecursive(val.transform, "Head"); } if ((Object)(object)val8 == (Object)null) { val8 = FindChildRecursive(val.transform, "head"); } if ((Object)(object)val8 == (Object)null) { val8 = FindChildRecursive(val.transform, "mixamorig:HeadTop_End"); } Traverse.Create((object)value3).Field("m_rightHand").SetValue((object)val6); Traverse.Create((object)value3).Field("m_leftHand").SetValue((object)val7); Traverse.Create((object)value3).Field("m_helmet").SetValue((object)val8); value.enabled = false; ((Component)p).GetComponent<FootStep>().m_feet = (Transform[])(object)new Transform[2] { FindChildRecursive(val.transform, "LeftFoot"), FindChildRecursive(val.transform, "RightFoot") }; } private static Transform FindChildRecursive(Transform parent, string name) { if ((Object)(object)parent == (Object)null) { return null; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == name) { return child; } } for (int j = 0; j < parent.childCount; j++) { Transform val = FindChildRecursive(parent.GetChild(j), name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static void PlayerChangedModel(long sender, ZPackage pkg) { //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_0014: Unknown result type (might be due to invalid IL or missing references) ZDOID val = pkg.ReadZDOID(); string changedModel = pkg.ReadString(); GameObject val2 = ZNetScene.instance.FindInstance(val); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.GetComponent<Player>())) { Player component = val2.GetComponent<Player>(); ApplyModelOnPlayer(component, changedModel); } } private static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); try { BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { if (propertyInfo.CanWrite) { propertyInfo.SetValue(val, propertyInfo.GetValue(original, null), null); } } FieldInfo[] fields = type.GetFields(bindingAttr); FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } } catch { } return (T)(object)((val is T) ? val : null); } public static RuntimeAnimatorController MakeAOC(Dictionary<string, string> replacement, RuntimeAnimatorController ORIGINAL) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown AnimatorOverrideController val = new AnimatorOverrideController(ORIGINAL); List<KeyValuePair<AnimationClip, AnimationClip>> list = new List<KeyValuePair<AnimationClip, AnimationClip>>(); AnimationClip[] animationClips = ((RuntimeAnimatorController)val).animationClips; foreach (AnimationClip val2 in animationClips) { string name = ((Object)val2).name; if (replacement.ContainsKey(name)) { AnimationClip value = Object.Instantiate<AnimationClip>(ExternalAnimations[replacement[name]]); list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, value)); } else { list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, val2)); } } val.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list); return (RuntimeAnimatorController)(object)val; } }