Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of VillageNPCs v1.0.8
VillageNPCs.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using VillageNPCs.Functions; using VillageNPCs.NPCs; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("blacks7ar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.8")] [assembly: AssemblyInformationalVersion("1.0.8")] [assembly: AssemblyProduct("VillageNPCs")] [assembly: AssemblyTitle("VillageNPCs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VillageNPCs { [BepInPlugin("blacks7ar.VillageNPCs", "VillageNPCs", "1.0.8")] public class Plugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } private const string modGUID = "blacks7ar.VillageNPCs"; public const string modName = "VillageNPCs"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.0.8"; public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/VillageNPCs/"; private static readonly Harmony _harmony = new Harmony("blacks7ar.VillageNPCs"); private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.VillageNPCs") { DisplayName = "VillageNPCs", CurrentVersion = "1.0.8", MinimumRequiredVersion = "1.0.8", ModRequired = true }; private static ConfigEntry<Toggle> _serverConfigLocked; public static GameObject _PrefabContainer; public static Plugin _Instance; public ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedConfig = true) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedConfig ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); _configSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedConfig; return val2; } public void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown _Instance = this; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; Localizer.Load(); _serverConfigLocked = config("1- ServerSync", "Lock Configuration", Toggle.On, new ConfigDescription("If On, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>())); _configSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); PrefabContainerInit(); ConfigSetup.Init(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; ((BaseUnityPlugin)this).Config.Save(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } public static void PrefabContainerInit() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _PrefabContainer = new GameObject("BNpcPrefabs"); _PrefabContainer.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_PrefabContainer); } } } namespace VillageNPCs.Patches { [HarmonyPatch(typeof(Humanoid), "UseItem")] public class HumanoidPatch { private static bool Prefix(Humanoid __instance, Inventory inventory, ItemData item, bool fromInventoryGui) { //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Invalid comparison between Unknown and I4 //IL_0132: 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) if (inventory == null) { inventory = __instance.m_inventory; } if (!inventory.ContainsItem(item)) { return true; } GameObject hoverObject = __instance.GetHoverObject(); if ((Object.op_Implicit((Object)(object)hoverObject) ? hoverObject.GetComponentInParent<Hoverable>() : null) != null && !fromInventoryGui) { MonsterAI component = hoverObject.GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null && (((Object)((Component)component).gameObject).name.Replace("(Clone)", "") == "BVN_MaleNPC" || ((Object)((Component)component).gameObject).name.Replace("(Clone)", "") == "BVN_FemaleNPC") && component.CanConsume(item)) { Tameable component2 = hoverObject.GetComponent<Tameable>(); string text = ((((component2 != null) ? component2.GetText() : null) == "") ? ((Object)component2.m_character).name : component2.GetText()); if ((int)item.m_shared.m_itemType == 2) { if ((Object)(object)component2 != (Object)null && component2.IsHungry()) { __instance.DoInteractAnimation(hoverObject); component.m_onConsumedItem(item.m_dropPrefab.GetComponent<ItemDrop>()); Humanoid component3 = hoverObject.GetComponent<Humanoid>(); component3.m_consumeItemEffects.Create(((Component)component3).transform.position, Quaternion.identity, (Transform)null, 1f, -1); hoverObject.GetComponentInChildren<Animator>().SetTrigger("consume"); inventory.RemoveOneItem(item); ((Character)__instance).Message((MessageType)2, text + " is very happy!", 0, (Sprite)null); return false; } if (!component2.IsHungry()) { ((Character)__instance).Message((MessageType)2, text + " is not yet hungry!", 0, (Sprite)null); return false; } return false; } } } string name = ((Object)item.m_dropPrefab).name; if (!(name == "BVN_OrbOfLife1")) { if (name == "BVN_OrbOfLife2") { Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("BVN_FemaleNPC"), ((Component)__instance).transform.position + ((Component)__instance).transform.forward + ((Component)__instance).transform.forward, Quaternion.identity); Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("sfx_dverger_vo_idle"), ((Component)__instance).transform.position + ((Component)__instance).transform.forward + ((Component)__instance).transform.forward, Quaternion.identity); inventory.RemoveOneItem(item); ((Character)__instance).Message((MessageType)2, "A new villager has joined your village!", 0, (Sprite)null); } } else { Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("BVN_MaleNPC"), ((Component)__instance).transform.position + ((Component)__instance).transform.forward + ((Component)__instance).transform.forward, Quaternion.identity); Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("sfx_dverger_vo_idle"), ((Component)__instance).transform.position + ((Component)__instance).transform.forward + ((Component)__instance).transform.forward, Quaternion.identity); inventory.RemoveOneItem(item); ((Character)__instance).Message((MessageType)2, "A new villager has joined your village!", 0, (Sprite)null); } return true; } } [HarmonyPatch] public class ObjectDBPatch { [HarmonyPriority(700)] [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "Awake")] private static void Awake_Postfix(ObjectDB __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name != "main") && !((Object)(object)__instance == (Object)null) && __instance.m_items.Count > 0) { Orb.InitOrb1(__instance); Orb.InitOrb2(__instance); __instance.UpdateRegisters(); } } [HarmonyPriority(700)] [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] private static void CopyOtherDB_Postfix(ObjectDB __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name != "main") && !((Object)(object)__instance == (Object)null) && __instance.m_items.Count > 0) { Orb.InitOrb1(__instance); Orb.InitOrb2(__instance); __instance.UpdateRegisters(); } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public class ZNetScenePatch { private static void Postfix(ZNetScene __instance) { if (!((Object)(object)__instance == (Object)null) && __instance.m_prefabs.Count > 0) { Plugin.PrefabContainerInit(); Male.Init(__instance); Female.Init(__instance); } } } } namespace VillageNPCs.NPCs { public static class Female { public static void Init(ZNetScene zNetScene) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown GameObject val = zNetScene.GetPrefab("Player").Clone("BVN_FemaleNPC"); val.transform.SetParent(Plugin._PrefabContainer.transform, false); val.RemoveComponent(typeof(PlayerController)); val.RemoveComponent(typeof(Player)); val.RemoveComponent(typeof(Talker)); val.RemoveComponent(typeof(Skills)); SetHumanoid(val.AddComponent<Humanoid>(), zNetScene); SetMonsterAI(val.AddComponent<MonsterAI>(), zNetScene); ZNetView component = val.GetComponent<ZNetView>(); component.m_persistent = true; component.m_distant = false; component.m_type = (ObjectType)0; component.m_syncInitialScale = false; ZSyncTransform component2 = val.GetComponent<ZSyncTransform>(); component2.m_syncPosition = true; component2.m_syncRotation = true; component2.m_syncScale = false; component2.m_syncBodyVelocity = false; component2.m_characterParentSync = false; val.GetComponent<ZSyncAnimation>().m_smoothCharacterSpeeds = true; val.AddComponent<FemaleNPC>(); SetTameable(val.AddComponent<Tameable>(), zNetScene); val.AddComponent<RandomAnimation>().m_values = new List<RandomValue>(1) { new RandomValue { m_name = "idle", m_values = 5, m_interval = 3f, m_floatValue = false, m_floatTransition = 1f } }; val.AddComponent<VillageCook>(); zNetScene.AddClonedObject(val); } private static void SetHumanoid(Humanoid humanoid, ZNetScene zNetScene) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Expected O, but got Unknown ((Character)humanoid).m_group = "VillageNpc_Female"; ((Character)humanoid).m_name = "$bvn_villagerfemale"; ((Character)humanoid).m_faction = (Faction)0; ((Character)humanoid).m_crouchSpeed = 2f; ((Character)humanoid).m_walkSpeed = 1.6f; ((Character)humanoid).m_speed = 4f; ((Character)humanoid).m_turnSpeed = 300f; ((Character)humanoid).m_runSpeed = 7f; ((Character)humanoid).m_runTurnSpeed = 300f; ((Character)humanoid).m_acceleration = 0.8f; ((Character)humanoid).m_jumpForce = 8f; ((Character)humanoid).m_jumpForceForward = 2f; ((Character)humanoid).m_jumpForceTiredFactor = 0.6f; ((Character)humanoid).m_canSwim = true; ((Character)humanoid).m_swimDepth = 1.5f; ((Character)humanoid).m_swimSpeed = 2f; ((Character)humanoid).m_swimTurnSpeed = 100f; ((Character)humanoid).m_swimAcceleration = 0.05f; ((Character)humanoid).m_groundTilt = (GroundTiltType)0; ((Character)humanoid).m_groundTiltSpeed = 50f; ((Character)humanoid).m_eye = Utils.FindChild(((Component)humanoid).gameObject.transform, "EyePos", (IterativeSearchType)0); ((Character)humanoid).m_hitEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_player_hit"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = zNetScene.GetPrefab("sfx_hit"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_critHitEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("fx_crit"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_backstabHitEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("fx_backstab"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_deathEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_ghost_death"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = zNetScene.GetPrefab("sfx_ghost_death"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_tolerateWater = true; ((Character)humanoid).m_health = 100f; ((Character)humanoid).m_damageModifiers = new DamageModifiers { m_blunt = (DamageModifier)0, m_slash = (DamageModifier)0, m_pierce = (DamageModifier)0, m_chop = (DamageModifier)3, m_pickaxe = (DamageModifier)3, m_fire = (DamageModifier)0, m_frost = (DamageModifier)0, m_lightning = (DamageModifier)0, m_spirit = (DamageModifier)3 }; ((Character)humanoid).m_staggerWhenBlocked = true; ((Character)humanoid).m_staggerDamageFactor = 0.4f; humanoid.m_consumeItemEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_creature_consume"), m_enabled = true, m_variant = -1 } }; } private static void SetMonsterAI(MonsterAI monsterAI, ZNetScene zNetScene) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) ((BaseAI)monsterAI).m_viewRange = 40f; ((BaseAI)monsterAI).m_viewAngle = 90f; ((BaseAI)monsterAI).m_hearRange = 9999f; ((BaseAI)monsterAI).m_mistVision = false; ((BaseAI)monsterAI).m_alertedEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_dverger_vo_alerted"), m_enabled = true, m_variant = -1 } }; ((BaseAI)monsterAI).m_idleSound.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_dverger_vo_idle"), m_enabled = true, m_variant = 0 } }; ((BaseAI)monsterAI).m_idleSoundInterval = 10f; ((BaseAI)monsterAI).m_idleSoundChance = 0.5f; ((BaseAI)monsterAI).m_pathAgentType = (AgentType)1; ((BaseAI)monsterAI).m_moveMinAngle = 90f; ((BaseAI)monsterAI).m_smoothMovement = true; ((BaseAI)monsterAI).m_serpentMovement = false; ((BaseAI)monsterAI).m_jumpInterval = 0f; ((BaseAI)monsterAI).m_randomCircleInterval = 2f; ((BaseAI)monsterAI).m_randomMoveInterval = 20f; ((BaseAI)monsterAI).m_randomMoveRange = 30f; ((BaseAI)monsterAI).m_avoidFire = false; ((BaseAI)monsterAI).m_afraidOfFire = false; ((BaseAI)monsterAI).m_avoidWater = true; ((BaseAI)monsterAI).m_aggravatable = false; monsterAI.m_alertRange = 5f; monsterAI.m_fleeIfHurtWhenTargetCantBeReached = true; monsterAI.m_fleeIfNotAlerted = false; monsterAI.m_fleeIfLowHealth = 0f; monsterAI.m_circulateWhileCharging = false; monsterAI.m_circulateWhileChargingFlying = false; monsterAI.m_enableHuntPlayer = false; monsterAI.m_attackPlayerObjects = false; monsterAI.m_privateAreaTriggerTreshold = 5; monsterAI.m_interceptTimeMax = 2f; monsterAI.m_interceptTimeMin = 0f; monsterAI.m_maxChaseDistance = 0f; monsterAI.m_minAttackInterval = 0f; monsterAI.m_circleTargetInterval = 5f; monsterAI.m_circleTargetDuration = 2f; monsterAI.m_circleTargetDistance = 5f; monsterAI.m_consumeItems = new List<ItemDrop>(8) { ObjectDB.instance.GetItemPrefab("CookedMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedWolfMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedLoxMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedDeerMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedChickenMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedEgg").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedHareMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("FishCooked").GetComponent<ItemDrop>() }; monsterAI.m_consumeRange = 1.4f; monsterAI.m_consumeSearchRange = 20f; monsterAI.m_consumeSearchInterval = 10f; } private static void SetTameable(Tameable tameable, ZNetScene zNetScene) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown tameable.m_fedDuration = 600f; tameable.m_tamingTime = 1800f; tameable.m_tamedEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("fx_creature_tamed"), m_enabled = true, m_variant = -1 } }; tameable.m_sootheEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_creature_soothed"), m_enabled = true, m_variant = -1 } }; tameable.m_petEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_dverger_vo_idle"), m_enabled = true, m_variant = 0 } }; tameable.m_commandable = true; } private static void SetNpcTalk(NpcTalk npcTalk, Character character) { List<string> randomTalk = new List<string> { "$bvn_randomtalk1", "$bvn_randomtalk2", "$bvn_randomtalk3", "$bvn_randomtalk4", "$bvn_randomtalk5", "$bvn_randomtalk6", "$bvn_randomtalk7", "$bvn_randomtalk8", "$bvn_randomtalk9", "$bvn_randomtalk10" }; List<string> randomGreets = new List<string> { "$bvn_randomgreet1", "$bvn_randomgreet2", "$bvn_randomgreet3", "$bvn_randomgreet4", "$bvn_randomgreet5", "$bvn_randomgreet6" }; List<string> randomGoodbye = new List<string> { "$bvn_randombye1", "$bvn_randombye2", "$bvn_randombye3", "$bvn_randombye4", "$bvn_randombye5" }; npcTalk.m_name = character.m_name; npcTalk.m_maxRange = 20f; npcTalk.m_greetRange = 10f; npcTalk.m_byeRange = 15f; npcTalk.m_offset = 2.2f; npcTalk.m_minTalkInterval = 3f; npcTalk.m_hideDialogDelay = 9f; npcTalk.m_randomTalkInterval = 30f; npcTalk.m_randomTalkChance = 0.75f; npcTalk.m_randomTalk = randomTalk; npcTalk.m_randomGreets = randomGreets; npcTalk.m_randomGoodbye = randomGoodbye; } } public static class Male { public static void Init(ZNetScene zNetScene) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown GameObject val = zNetScene.GetPrefab("Player").Clone("BVN_MaleNPC"); val.transform.SetParent(Plugin._PrefabContainer.transform, false); val.RemoveComponent(typeof(PlayerController)); val.RemoveComponent(typeof(Player)); val.RemoveComponent(typeof(Talker)); val.RemoveComponent(typeof(Skills)); Humanoid val2 = val.AddComponent<Humanoid>(); SetHumanoid(val2, zNetScene); SetMonsterAI(val.AddComponent<MonsterAI>(), zNetScene); ZNetView component = val.GetComponent<ZNetView>(); component.m_persistent = true; component.m_distant = false; component.m_type = (ObjectType)0; component.m_syncInitialScale = false; ZSyncTransform component2 = val.GetComponent<ZSyncTransform>(); component2.m_syncPosition = true; component2.m_syncRotation = true; component2.m_syncScale = false; component2.m_syncBodyVelocity = false; component2.m_characterParentSync = false; val.GetComponent<ZSyncAnimation>().m_smoothCharacterSpeeds = true; val.AddComponent<MaleNPC>(); SetTameable(val.AddComponent<Tameable>(), zNetScene); SetNpcTalk(val.AddComponent<NpcTalk>(), (Character)(object)val2); val.AddComponent<RandomAnimation>().m_values = new List<RandomValue>(1) { new RandomValue { m_name = "idle", m_values = 5, m_interval = 3f, m_floatValue = false, m_floatTransition = 1f } }; zNetScene.AddClonedObject(val); } private static void SetHumanoid(Humanoid humanoid, ZNetScene zNetScene) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Expected O, but got Unknown ((Character)humanoid).m_group = "VillageNpc_Male"; ((Character)humanoid).m_name = "$bvn_villagermale"; ((Character)humanoid).m_faction = (Faction)0; ((Character)humanoid).m_crouchSpeed = 2f; ((Character)humanoid).m_walkSpeed = 1.6f; ((Character)humanoid).m_speed = 4f; ((Character)humanoid).m_turnSpeed = 300f; ((Character)humanoid).m_runSpeed = 7f; ((Character)humanoid).m_runTurnSpeed = 300f; ((Character)humanoid).m_acceleration = 0.8f; ((Character)humanoid).m_jumpForce = 8f; ((Character)humanoid).m_jumpForceForward = 2f; ((Character)humanoid).m_jumpForceTiredFactor = 0.6f; ((Character)humanoid).m_canSwim = true; ((Character)humanoid).m_swimDepth = 1.5f; ((Character)humanoid).m_swimSpeed = 2f; ((Character)humanoid).m_swimTurnSpeed = 100f; ((Character)humanoid).m_swimAcceleration = 0.05f; ((Character)humanoid).m_groundTilt = (GroundTiltType)0; ((Character)humanoid).m_groundTiltSpeed = 50f; ((Character)humanoid).m_eye = Utils.FindChild(((Component)humanoid).gameObject.transform, "EyePos", (IterativeSearchType)0); ((Character)humanoid).m_hitEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_player_hit"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = zNetScene.GetPrefab("sfx_hit"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_critHitEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("fx_crit"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_backstabHitEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("fx_backstab"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_deathEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_ghost_death"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = zNetScene.GetPrefab("sfx_ghost_death"), m_enabled = true, m_variant = -1 } }; ((Character)humanoid).m_tolerateWater = true; ((Character)humanoid).m_health = 100f; ((Character)humanoid).m_damageModifiers = new DamageModifiers { m_blunt = (DamageModifier)0, m_slash = (DamageModifier)0, m_pierce = (DamageModifier)0, m_chop = (DamageModifier)3, m_pickaxe = (DamageModifier)3, m_fire = (DamageModifier)0, m_frost = (DamageModifier)0, m_lightning = (DamageModifier)0, m_spirit = (DamageModifier)3 }; ((Character)humanoid).m_staggerWhenBlocked = true; ((Character)humanoid).m_staggerDamageFactor = 0.4f; humanoid.m_consumeItemEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_creature_consume"), m_enabled = true, m_variant = -1 } }; } private static void SetMonsterAI(MonsterAI monsterAI, ZNetScene zNetScene) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) ((BaseAI)monsterAI).m_viewRange = 40f; ((BaseAI)monsterAI).m_viewAngle = 90f; ((BaseAI)monsterAI).m_hearRange = 9999f; ((BaseAI)monsterAI).m_mistVision = false; ((BaseAI)monsterAI).m_alertedEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_dverger_vo_alerted"), m_enabled = true, m_variant = -1 } }; ((BaseAI)monsterAI).m_idleSound.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_dverger_vo_idle"), m_enabled = true, m_variant = 0 } }; ((BaseAI)monsterAI).m_idleSoundInterval = 10f; ((BaseAI)monsterAI).m_idleSoundChance = 0.5f; ((BaseAI)monsterAI).m_pathAgentType = (AgentType)1; ((BaseAI)monsterAI).m_moveMinAngle = 90f; ((BaseAI)monsterAI).m_smoothMovement = true; ((BaseAI)monsterAI).m_serpentMovement = false; ((BaseAI)monsterAI).m_jumpInterval = 0f; ((BaseAI)monsterAI).m_randomCircleInterval = 2f; ((BaseAI)monsterAI).m_randomMoveInterval = 20f; ((BaseAI)monsterAI).m_randomMoveRange = 30f; ((BaseAI)monsterAI).m_avoidFire = false; ((BaseAI)monsterAI).m_afraidOfFire = false; ((BaseAI)monsterAI).m_avoidWater = true; ((BaseAI)monsterAI).m_aggravatable = false; monsterAI.m_alertRange = 5f; monsterAI.m_fleeIfHurtWhenTargetCantBeReached = true; monsterAI.m_fleeIfNotAlerted = false; monsterAI.m_fleeIfLowHealth = 0f; monsterAI.m_circulateWhileCharging = false; monsterAI.m_circulateWhileChargingFlying = false; monsterAI.m_enableHuntPlayer = false; monsterAI.m_attackPlayerObjects = false; monsterAI.m_privateAreaTriggerTreshold = 5; monsterAI.m_interceptTimeMax = 2f; monsterAI.m_interceptTimeMin = 0f; monsterAI.m_maxChaseDistance = 0f; monsterAI.m_minAttackInterval = 0f; monsterAI.m_circleTargetInterval = 5f; monsterAI.m_circleTargetDuration = 2f; monsterAI.m_circleTargetDistance = 5f; monsterAI.m_consumeItems = new List<ItemDrop>(8) { ObjectDB.instance.GetItemPrefab("CookedMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedWolfMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedLoxMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedDeerMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedChickenMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedEgg").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("CookedHareMeat").GetComponent<ItemDrop>(), ObjectDB.instance.GetItemPrefab("FishCooked").GetComponent<ItemDrop>() }; monsterAI.m_consumeRange = 1.4f; monsterAI.m_consumeSearchRange = 20f; monsterAI.m_consumeSearchInterval = 10f; } private static void SetTameable(Tameable tameable, ZNetScene zNetScene) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown tameable.m_fedDuration = 600f; tameable.m_tamingTime = 1800f; tameable.m_tamedEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("fx_creature_tamed"), m_enabled = true, m_variant = -1 } }; tameable.m_sootheEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_creature_soothed"), m_enabled = true, m_variant = -1 } }; tameable.m_petEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("sfx_dverger_vo_idle"), m_enabled = true, m_variant = 0 } }; tameable.m_commandable = true; } private static void SetNpcTalk(NpcTalk npcTalk, Character character) { List<string> randomTalk = new List<string> { "$bvn_randomtalk1", "$bvn_randomtalk2", "$bvn_randomtalk3", "$bvn_randomtalk4", "$bvn_randomtalk5", "$bvn_randomtalk6", "$bvn_randomtalk7", "$bvn_randomtalk8", "$bvn_randomtalk9", "$bvn_randomtalk10" }; List<string> randomGreets = new List<string> { "$bvn_randomgreet1", "$bvn_randomgreet2", "$bvn_randomgreet3", "$bvn_randomgreet4", "$bvn_randomgreet5", "$bvn_randomgreet6" }; List<string> randomGoodbye = new List<string> { "$bvn_randombye1", "$bvn_randombye2", "$bvn_randombye3", "$bvn_randombye4", "$bvn_randombye5" }; npcTalk.m_name = character.m_name; npcTalk.m_maxRange = 20f; npcTalk.m_greetRange = 10f; npcTalk.m_byeRange = 15f; npcTalk.m_offset = 2.2f; npcTalk.m_minTalkInterval = 3f; npcTalk.m_hideDialogDelay = 9f; npcTalk.m_randomTalkInterval = 30f; npcTalk.m_randomTalkChance = 0.75f; npcTalk.m_randomTalk = randomTalk; npcTalk.m_randomGreets = randomGreets; npcTalk.m_randomGoodbye = randomGoodbye; } } public static class Orb { public static void InitOrb1(ObjectDB objectDB) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_0294: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown GameObject val = objectDB.GetItemPrefab("Eitr").CloneItem("BVN_OrbOfLife1"); val.transform.localScale = new Vector3(1.75f, 1.75f, 1.75f); ((Component)Utils.FindChild(val.transform, "Radiator", (IterativeSearchType)0)).gameObject.SetActive(false); ItemDrop component = val.GetComponent<ItemDrop>(); component.m_itemData.m_shared.m_name = "$bvn_orboflife1"; component.m_itemData.m_shared.m_itemType = (ItemType)2; component.m_itemData.m_shared.m_description = "$bvn_orboflife1_description"; component.m_itemData.m_shared.m_maxStackSize = 1; component.m_itemData.m_shared.m_teleportable = false; objectDB.AddClonedObject(val); ZNetScene instance = ZNetScene.instance; if (Object.op_Implicit((Object)(object)instance)) { instance.AddClonedObject(val); } Recipe val2 = ScriptableObject.CreateInstance<Recipe>(); ((Object)val2).name = "Recipe_" + ((Object)val).name; val2.m_item = component; val2.m_amount = 1; val2.m_enabled = ConfigSetup._enableOrb1.Value == Plugin.Toggle.On; val2.m_qualityResultAmountMultiplier = 1f; val2.m_craftingStation = instance.GetPrefab("piece_workbench").GetComponent<CraftingStation>(); val2.m_repairStation = null; val2.m_minStationLevel = 1; val2.m_requireOnlyOneIngredient = false; string[] array = ConfigSetup._orb1Mat1.Value.Split(':', ' '); string[] array2 = ConfigSetup._orb1Mat2.Value.Split(':', ' '); string[] array3 = ConfigSetup._orb1Mat3.Value.Split(':', ' '); string[] array4 = ConfigSetup._orb1Mat4.Value.Split(':', ' '); val2.m_resources = (Requirement[])(object)new Requirement[4] { new Requirement { m_resItem = objectDB.GetItemPrefab(array[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = objectDB.GetItemPrefab(array2[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array2[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = objectDB.GetItemPrefab(array3[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array3[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = objectDB.GetItemPrefab(array4[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array4[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true } }; objectDB.AddRecipe(val2); } public static void InitOrb2(ObjectDB objectDB) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_0294: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown GameObject val = objectDB.GetItemPrefab("Eitr").CloneItem("BVN_OrbOfLife2"); val.transform.localScale = new Vector3(1.75f, 1.75f, 1.75f); ((Component)Utils.FindChild(val.transform, "Radiator", (IterativeSearchType)0)).gameObject.SetActive(false); ItemDrop component = val.GetComponent<ItemDrop>(); component.m_itemData.m_shared.m_name = "$bvn_orboflife2"; component.m_itemData.m_shared.m_itemType = (ItemType)2; component.m_itemData.m_shared.m_description = "$bvn_orboflife2_description"; component.m_itemData.m_shared.m_maxStackSize = 1; component.m_itemData.m_shared.m_teleportable = false; objectDB.AddClonedObject(val); ZNetScene instance = ZNetScene.instance; if (Object.op_Implicit((Object)(object)instance)) { instance.AddClonedObject(val); } Recipe val2 = ScriptableObject.CreateInstance<Recipe>(); ((Object)val2).name = "Recipe_" + ((Object)val).name; val2.m_item = component; val2.m_amount = 1; val2.m_enabled = ConfigSetup._enableOrb2.Value == Plugin.Toggle.On; val2.m_qualityResultAmountMultiplier = 1f; val2.m_craftingStation = instance.GetPrefab("piece_workbench").GetComponent<CraftingStation>(); val2.m_repairStation = null; val2.m_minStationLevel = 1; val2.m_requireOnlyOneIngredient = false; string[] array = ConfigSetup._orb2Mat1.Value.Split(':', ' '); string[] array2 = ConfigSetup._orb2Mat2.Value.Split(':', ' '); string[] array3 = ConfigSetup._orb2Mat3.Value.Split(':', ' '); string[] array4 = ConfigSetup._orb2Mat4.Value.Split(':', ' '); val2.m_resources = (Requirement[])(object)new Requirement[4] { new Requirement { m_resItem = objectDB.GetItemPrefab(array[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = objectDB.GetItemPrefab(array2[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array2[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = objectDB.GetItemPrefab(array3[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array3[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = objectDB.GetItemPrefab(array4[0]).GetComponent<ItemDrop>(), m_amount = int.Parse(array4[1]), m_extraAmountOnlyOneIngredient = 0, m_amountPerLevel = 0, m_recover = true } }; objectDB.AddRecipe(val2); } } } namespace VillageNPCs.Functions { public static class ConfigSetup { public static ConfigEntry<Plugin.Toggle> _enableOrb1; public static ConfigEntry<string> _orb1Mat1; public static ConfigEntry<string> _orb1Mat2; public static ConfigEntry<string> _orb1Mat3; public static ConfigEntry<string> _orb1Mat4; public static ConfigEntry<Plugin.Toggle> _enableOrb2; public static ConfigEntry<string> _orb2Mat1; public static ConfigEntry<string> _orb2Mat2; public static ConfigEntry<string> _orb2Mat3; public static ConfigEntry<string> _orb2Mat4; private const string _enableDesc = "Enable/Disables recipe. (Needs logout)"; private const string _amountDesc = "Craft amount (Needs logout)"; private const string _matDesc = "Item name : amount (Needs logout)"; public static void Init() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown string group = "Orb of Life - Male"; _enableOrb1 = Plugin._Instance.config(group, "Recipe", Plugin.Toggle.On, new ConfigDescription("Enable/Disables recipe. (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb1Mat1 = Plugin._Instance.config(group, "Required Material 1", "AncientSeed:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb1Mat2 = Plugin._Instance.config(group, "Required Material 2", "Bloodbag:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb1Mat3 = Plugin._Instance.config(group, "Required Material 3", "Resin:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb1Mat4 = Plugin._Instance.config(group, "Required Material 4", "Wood:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); string group2 = "Orb Of Life - Female"; _enableOrb2 = Plugin._Instance.config(group2, "Recipe", Plugin.Toggle.On, new ConfigDescription("Enable/Disables recipe. (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb2Mat1 = Plugin._Instance.config(group2, "Required Material 1", "AncientSeed:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb2Mat2 = Plugin._Instance.config(group2, "Required Material 2", "Bloodbag:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb2Mat3 = Plugin._Instance.config(group2, "Required Material 3", "Resin:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); _orb2Mat4 = Plugin._Instance.config(group2, "Required Material 4", "Wood:1", new ConfigDescription("Item name : amount (Needs logout)", (AcceptableValueBase)null, Array.Empty<object>())); } } public class FemaleNPC : MonoBehaviour { public string[] m_hairItem = new string[31] { "Hair1", "Hair2", "Hair3", "Hair4", "Hair5", "Hair6", "Hair7", "Hair8", "Hair9", "Hair10", "Hair11", "Hair12", "Hair13", "Hair14", "Hair15", "Hair16", "Hair17", "Hair18", "Hair19", "Hair20", "Hair21", "Hair22", "Hair23", "Hair24", "Hair25", "Hair26", "Hair27", "Hair28", "Hair29", "Hair30", "Hair31" }; public string[] m_helmetItem = new string[13] { "HelmetFishingHat", "HelmetHat1", "HelmetHat2", "HelmetHat3", "HelmetHat4", "HelmetHat5", "HelmetHat6", "HelmetHat7", "HelmetHat8", "HelmetHat9", "HelmetHat10", "HelmetMidsummerCrown", "HelmetYule" }; public string[] m_chestItem = new string[10] { "ArmorDress1", "ArmorDress2", "ArmorDress3", "ArmorDress4", "ArmorDress5", "ArmorDress6", "ArmorDress7", "ArmorDress8", "ArmorDress9", "ArmorDress10" }; public string[] m_legItem = new string[10] { "ArmorBronzeLegs", "ArmorCarapaceLegs", "ArmorFenringLegs", "ArmorIronLegs", "ArmorLeatherLegs", "ArmorMageLegs", "ArmorPaddedGreaves", "ArmorRagsLegs", "ArmorRootLegs", "ArmorTrollLeatherLegs" }; private ZNetView m_nview; private VisEquipment m_visEquipment; private Humanoid m_humanoid; private readonly int m_npcInitialized = StringExtensionMethods.GetStableHashCode("NpcInitialized"); private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) m_nview = ((Component)this).GetComponent<ZNetView>(); m_visEquipment = ((Component)this).GetComponent<VisEquipment>(); m_humanoid = ((Component)this).GetComponent<Humanoid>(); Vector3 position = ((Component)this).gameObject.transform.position; Helper._baseNumber += (int)((position.x + position.y) * 1000f); SetupVisuals(); SetupEquipment(); m_visEquipment.UpdateEquipmentVisuals(); m_nview.GetZDO().Set(m_npcInitialized, true); if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { ((Character)m_humanoid).SetTamed(true); } } private void SetItem(string slot, string[] name) { ZNetView nview = m_nview; if (nview != null) { nview.GetZDO().Set(slot, StringExtensionMethods.GetStableHashCode(name.GetRandomElement())); } } private void SetupVisuals() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.GetZDO().GetBool(m_npcInitialized, false)) { m_visEquipment.m_nview = m_nview; float num = 0.2f + 0.8f.RandomValue(); Color val = Color.HSVToRGB(0.13f + 0.03f.RandomValue(), 1f.RandomValue(), 1f.RandomValue()); m_visEquipment.SetModel(1); SetItem("HairItem", m_hairItem); VisEquipment visEquipment = m_visEquipment; if (visEquipment != null) { visEquipment.SetHairItem(""); } VisEquipment visEquipment2 = m_visEquipment; if (visEquipment2 != null) { visEquipment2.SetHairItem(m_hairItem.GetRandomElement()); } VisEquipment visEquipment3 = m_visEquipment; if (visEquipment3 != null) { visEquipment3.SetHairColor(new Vector3(val.r, val.g, val.b)); } VisEquipment visEquipment4 = m_visEquipment; if (visEquipment4 != null) { visEquipment4.SetSkinColor(new Vector3(num, num, num)); } } } private void SetupEquipment() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (!m_nview.GetZDO().GetBool(m_npcInitialized, false)) { ItemSet[] array = new ItemSet[1]; ItemSet val = new ItemSet(); val.m_items = (GameObject[])(object)new GameObject[3] { ObjectDB.instance.GetItemPrefab(m_helmetItem.GetRandomElement()), ObjectDB.instance.GetItemPrefab(m_chestItem.GetRandomElement()), ObjectDB.instance.GetItemPrefab(m_legItem.GetRandomElement()) }; array[0] = val; ItemSet[] randomSets = (ItemSet[])(object)array; m_humanoid.m_randomSets = randomSets; } } } public static class Helper { public static int _baseNumber; public static GameObject Clone(this GameObject gameObject, string name) { GameObject obj = Object.Instantiate<GameObject>(gameObject, Plugin._PrefabContainer.transform, false); ((Object)obj).name = name; obj.transform.SetParent(Plugin._PrefabContainer.transform, false); return obj; } public static GameObject CloneItem(this GameObject gameObject, string name) { GameObject obj = Object.Instantiate<GameObject>(gameObject, Plugin._PrefabContainer.transform, false); ((Object)obj).name = name; return obj; } public static void AddClonedObject(this ZNetScene zNetScene, GameObject gameObject, bool overWrite = true) { GameObject prefab; if ((Object)(object)(prefab = zNetScene.GetPrefab(((Object)gameObject).name)) != (Object)null) { if (!overWrite) { return; } zNetScene.m_prefabs.Remove(prefab); zNetScene.m_namedPrefabs.Remove(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name)); } zNetScene.m_prefabs.Add(gameObject); zNetScene.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name), gameObject); } public static void AddClonedObject(this ObjectDB objectDB, GameObject gameObject, bool overWrite = true) { GameObject itemPrefab; if ((Object)(object)(itemPrefab = objectDB.GetItemPrefab(((Object)gameObject).name)) != (Object)null) { if (!overWrite) { return; } objectDB.m_items.Remove(itemPrefab); objectDB.m_itemByHash.Remove(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name)); } objectDB.m_items.Add(gameObject); objectDB.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name), gameObject); } public static void AddRecipe(this ObjectDB objectDB, Recipe recipe, bool overWrite = true) { Recipe recipe2; if ((Object)(object)(recipe2 = objectDB.GetRecipe(recipe.m_item.m_itemData)) != (Object)null) { if (!overWrite) { return; } objectDB.m_recipes.Remove(recipe2); } objectDB.m_recipes.Add(recipe); } public static float RandomValue(this float value) { _baseNumber++; Random.InitState((int)((Time.time + value) * 1000f) + _baseNumber); return value * Random.value; } private static int RandomValue(this int value) { _baseNumber++; Random.InitState((int)((Time.time + (float)value) * 1000f) + _baseNumber); return Mathf.FloorToInt(Random.Range(0f, (float)value - 0.0001f)); } public static string GetRandomElement(this string[] array) { return array[array.Length.RandomValue()]; } public static void RemoveComponent(this GameObject gameObject, Type type) { Component component = gameObject.GetComponent(type); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } } public class MaleNPC : MonoBehaviour { public string[] m_beardItem = new string[20] { "Beard2", "Beard3", "Beard4", "Beard5", "Beard6", "Beard7", "Beard8", "Beard9", "Beard10", "Beard11", "Beard12", "Beard13", "Beard14", "Beard15", "Beard16", "Beard17", "Beard18", "Beard19", "Beard20", "Beard21" }; public string[] m_hairItem = new string[31] { "Hair1", "Hair2", "Hair3", "Hair4", "Hair5", "Hair6", "Hair7", "Hair8", "Hair9", "Hair10", "Hair11", "Hair12", "Hair13", "Hair14", "Hair15", "Hair16", "Hair17", "Hair18", "Hair19", "Hair20", "Hair21", "Hair22", "Hair23", "Hair24", "Hair25", "Hair26", "Hair27", "Hair28", "Hair29", "Hair30", "Hair31" }; public string[] m_helmetItem = new string[13] { "HelmetFishingHat", "HelmetHat1", "HelmetHat2", "HelmetHat3", "HelmetHat4", "HelmetHat5", "HelmetHat6", "HelmetHat7", "HelmetHat8", "HelmetHat9", "HelmetHat10", "HelmetMidsummerCrown", "HelmetYule" }; public string[] m_chestItem = new string[10] { "ArmorTunic1", "ArmorTunic2", "ArmorTunic3", "ArmorTunic4", "ArmorTunic5", "ArmorTunic6", "ArmorTunic7", "ArmorTunic8", "ArmorTunic9", "ArmorTunic10" }; public string[] m_legItem = new string[10] { "ArmorBronzeLegs", "ArmorCarapaceLegs", "ArmorFenringLegs", "ArmorIronLegs", "ArmorLeatherLegs", "ArmorMageLegs", "ArmorPaddedGreaves", "ArmorRagsLegs", "ArmorRootLegs", "ArmorTrollLeatherLegs" }; private ZNetView m_nview; private VisEquipment m_visEquipment; private Humanoid m_humanoid; private readonly int m_npcInitialized = StringExtensionMethods.GetStableHashCode("NpcInitialized"); private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) m_nview = ((Component)this).GetComponent<ZNetView>(); m_visEquipment = ((Component)this).GetComponent<VisEquipment>(); m_humanoid = ((Component)this).GetComponent<Humanoid>(); Vector3 position = ((Component)this).gameObject.transform.position; Helper._baseNumber += (int)((position.x + position.y) * 1000f); SetupVisuals(); SetupEquipment(); m_visEquipment.UpdateEquipmentVisuals(); m_nview.GetZDO().Set(m_npcInitialized, true); if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { ((Character)m_humanoid).SetTamed(true); } } private void SetItem(string slot, string[] name) { ZNetView nview = m_nview; if (nview != null) { nview.GetZDO().Set(slot, StringExtensionMethods.GetStableHashCode(name.GetRandomElement())); } } private void SetupVisuals() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.GetZDO().GetBool(m_npcInitialized, false)) { m_visEquipment.m_nview = m_nview; float num = 0.2f + 0.8f.RandomValue(); Color val = Color.HSVToRGB(0.13f + 0.03f.RandomValue(), 1f.RandomValue(), 1f.RandomValue()); m_visEquipment.SetModel(0); SetItem("HairItem", m_hairItem); VisEquipment visEquipment = m_visEquipment; if (visEquipment != null) { visEquipment.SetHairItem(""); } VisEquipment visEquipment2 = m_visEquipment; if (visEquipment2 != null) { visEquipment2.SetHairItem(m_hairItem.GetRandomElement()); } SetItem("BeardItem", m_beardItem); VisEquipment visEquipment3 = m_visEquipment; if (visEquipment3 != null) { visEquipment3.SetBeardItem(""); } VisEquipment visEquipment4 = m_visEquipment; if (visEquipment4 != null) { visEquipment4.SetBeardItem(m_beardItem.GetRandomElement()); } VisEquipment visEquipment5 = m_visEquipment; if (visEquipment5 != null) { visEquipment5.SetHairColor(new Vector3(val.r, val.g, val.b)); } VisEquipment visEquipment6 = m_visEquipment; if (visEquipment6 != null) { visEquipment6.SetSkinColor(new Vector3(num, num, num)); } } } private void SetupEquipment() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (!m_nview.GetZDO().GetBool(m_npcInitialized, false)) { ItemSet[] array = new ItemSet[1]; ItemSet val = new ItemSet(); val.m_items = (GameObject[])(object)new GameObject[3] { ObjectDB.instance.GetItemPrefab(m_helmetItem.GetRandomElement()), ObjectDB.instance.GetItemPrefab(m_chestItem.GetRandomElement()), ObjectDB.instance.GetItemPrefab(m_legItem.GetRandomElement()) }; array[0] = val; ItemSet[] randomSets = (ItemSet[])(object)array; m_humanoid.m_randomSets = randomSets; } } } public class VillageCook : MonoBehaviour { public enum VikingStates { Idle, MovingToContainer, MovingToStation, Cooking, RetrievingFood, ReturningFood, Wait } [CompilerGenerated] private sealed class <PickupCookedFood>d__24 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public VillageCook <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PickupCookedFood>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; VillageCook villageCook = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)villageCook.m_targetStation)) { string text = default(string); float num2 = default(float); Status val = default(Status); for (int i = 0; i < villageCook.m_targetStation.m_slots.Length; i++) { villageCook.m_targetStation.GetSlot(i, ref text, ref num2, ref val); if (text != null && villageCook.m_targetStation.IsItemDone(text)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(text); ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); villageCook.m_carriedItemData = component.m_itemData; villageCook.AttachToHead(itemPrefab); villageCook.m_hasItem = true; villageCook.m_targetContainer = villageCook.FindNearbyContainer(); villageCook.m_vikingState = VikingStates.ReturningFood; villageCook.m_targetStation.SetSlot(i, "", 0f, (Status)0); villageCook.m_targetStation.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetSlotVisual", new object[2] { i, "" }); } } } else { villageCook.m_vikingState = VikingStates.Idle; } Debug.Log((object)"PickupCookedFood"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PickupFromContainer>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public VillageCook <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PickupFromContainer>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; VillageCook villageCook = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)villageCook.m_targetContainer) && villageCook.m_currentItem != null) { ItemData item = villageCook.m_targetContainer.GetInventory().GetItem(villageCook.m_currentItem.m_shared.m_name, -1, false); if (item != null && villageCook.m_targetContainer.GetInventory().RemoveOneItem(item)) { villageCook.m_carriedItemData = item.Clone(); villageCook.m_hasItem = true; villageCook.AttachToHead(villageCook.m_carriedItemData.m_dropPrefab); villageCook.m_vikingState = VikingStates.MovingToStation; } } Debug.Log((object)"PickupFromContainer"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PlaceOnStation>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public VillageCook <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PlaceOnStation>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; VillageCook villageCook = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)villageCook.m_targetStation) && villageCook.m_carriedItemData != null) { villageCook.m_targetStation.OnUseItem(villageCook.m_humanoid, villageCook.m_carriedItemData); villageCook.DropCarried(); villageCook.m_vikingState = VikingStates.Idle; } else if (villageCook.m_targetStation.GetFreeSlot() < 0) { villageCook.m_vikingState = VikingStates.Cooking; } Debug.Log((object)"PlaceOnStation"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ReturnFood>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public VillageCook <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ReturnFood>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; VillageCook villageCook = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (villageCook.m_hasItem && Object.op_Implicit((Object)(object)villageCook.m_targetContainer) && villageCook.m_carriedItemData != null && villageCook.m_targetContainer.GetInventory().AddItem(villageCook.m_carriedItemData)) { villageCook.DropCarried(); } villageCook.m_vikingState = VikingStates.Idle; Debug.Log((object)"ReturnFood"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly int Interact = Animator.StringToHash("interact"); public Animator m_animator; public MonsterAI m_monsterAI; public VikingStates m_vikingState; public float m_updateTimer; public float m_stateTime; public float m_distanceInteract = 1f; private ItemData m_carriedItemData; private Rigidbody m_carriedItem; private bool m_hasItem; private Container m_targetContainer; private CookingStation m_targetStation; private ItemData m_currentItem; public float m_searchRange = 15f; private Humanoid m_humanoid; private ZNetView m_nview; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); if (!((Object)(object)m_nview == (Object)null) && m_nview.IsValid()) { m_monsterAI = ((Component)this).GetComponent<MonsterAI>(); ((Behaviour)m_monsterAI).enabled = false; m_animator = ((Component)this).GetComponentInChildren<Animator>(); m_humanoid = ((Component)this).GetComponent<Humanoid>(); } } private void Start() { m_monsterAI.Start(); } private void FixedUpdate() { m_updateTimer += Time.fixedDeltaTime; if (!(m_updateTimer < 0.05f)) { UpdateAI(0.05f); m_updateTimer -= 0.05f; } } private void UpdateAI(float dt) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) m_stateTime -= dt; switch (m_vikingState) { case VikingStates.Idle: case VikingStates.Cooking: case VikingStates.Wait: ((BaseAI)m_monsterAI).UpdateAI(dt); if (m_vikingState == VikingStates.Idle && m_stateTime <= 0f) { SearchForWork(); } if (m_vikingState == VikingStates.Wait && m_stateTime <= 0f) { m_vikingState = VikingStates.Idle; } if (m_vikingState == VikingStates.Cooking && Object.op_Implicit((Object)(object)m_targetStation) && m_targetStation.HaveDoneItem()) { m_vikingState = VikingStates.RetrievingFood; } break; case VikingStates.MovingToContainer: if (!Object.op_Implicit((Object)(object)m_targetContainer)) { m_vikingState = VikingStates.Idle; } else if (((BaseAI)m_monsterAI).MoveTo(dt, ((Component)m_targetContainer).transform.position, m_distanceInteract, true)) { m_animator.SetTrigger(Interact); ((MonoBehaviour)this).StartCoroutine(PickupFromContainer()); m_stateTime = 1f; } break; case VikingStates.MovingToStation: if (!Object.op_Implicit((Object)(object)m_targetStation)) { m_vikingState = VikingStates.Idle; } else if (((BaseAI)m_monsterAI).MoveTo(dt, ((Component)m_targetStation).transform.position, m_distanceInteract, true) && m_hasItem) { m_animator.SetTrigger(Interact); ((MonoBehaviour)this).StartCoroutine(PlaceOnStation()); m_stateTime = 1f; } break; case VikingStates.RetrievingFood: if (!Object.op_Implicit((Object)(object)m_targetStation)) { m_vikingState = VikingStates.Idle; } else if (((BaseAI)m_monsterAI).MoveTo(dt, ((Component)m_targetStation).transform.position, m_distanceInteract, true)) { if (m_targetStation.HaveDoneItem()) { m_animator.SetTrigger(Interact); ((MonoBehaviour)this).StartCoroutine(PickupCookedFood()); m_stateTime = 1f; } else { m_vikingState = VikingStates.Idle; } } break; case VikingStates.ReturningFood: if (!Object.op_Implicit((Object)(object)m_targetContainer)) { m_vikingState = VikingStates.Idle; } else if (((BaseAI)m_monsterAI).MoveTo(dt, ((Component)m_targetContainer).transform.position, m_distanceInteract, true)) { if (m_hasItem) { m_animator.SetTrigger(Interact); ((MonoBehaviour)this).StartCoroutine(ReturnFood()); m_stateTime = 1f; } else { m_vikingState = VikingStates.Idle; } } break; } } private void SearchForWork() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) foreach (CookingStation item in Enumerable.ToList(Enumerable.Where(Enumerable.Select(Physics.OverlapSphere(((Component)this).transform.position, m_searchRange), (Collider c) => ((Component)c).GetComponentInParent<CookingStation>()), (CookingStation cs) => (Object)(object)cs != (Object)null && cs.m_nview.IsValid()))) { if (item.GetFreeSlot() >= 0) { foreach (ItemConversion item2 in item.m_conversion) { Container val = FindContainerWithItem(item2.m_from.m_itemData.m_shared.m_name); if (!((Object)(object)val == (Object)null)) { m_targetStation = item; m_targetContainer = val; m_currentItem = val.GetInventory().GetItem(item2.m_from.m_itemData.m_shared.m_name, -1, false); m_vikingState = VikingStates.MovingToContainer; return; } } } if (item.HaveDoneItem()) { m_targetStation = item; m_vikingState = VikingStates.RetrievingFood; return; } } m_stateTime = Random.Range(0.5f, 1.5f); Debug.Log((object)"SearchForWork"); } [IteratorStateMachine(typeof(<PickupFromContainer>d__22))] private IEnumerator PickupFromContainer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PickupFromContainer>d__22(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PlaceOnStation>d__23))] private IEnumerator PlaceOnStation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PlaceOnStation>d__23(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PickupCookedFood>d__24))] private IEnumerator PickupCookedFood() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PickupCookedFood>d__24(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<ReturnFood>d__25))] private IEnumerator ReturnFood() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReturnFood>d__25(0) { <>4__this = this }; } private void AttachToHead(GameObject prefab) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)prefab)) { GameObject val = Object.Instantiate<GameObject>(prefab); m_carriedItem = val.GetComponent<Rigidbody>(); VisEquipment component = ((Component)((Component)this).transform).gameObject.GetComponent<VisEquipment>(); if ((Object)(object)component != (Object)null) { val.transform.SetParent(component.m_rightHand, true); val.transform.localPosition = new Vector3(0.18f, 0.56f, 0f); val.transform.localRotation = Quaternion.identity; } MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).enabled = true; } m_carriedItem.isKinematic = true; m_carriedItem.collisionDetectionMode = (CollisionDetectionMode)3; } } private void DropCarried() { if (Object.op_Implicit((Object)(object)m_carriedItem)) { Object.Destroy((Object)(object)((Component)m_carriedItem).gameObject); m_carriedItem = null; m_carriedItemData = null; m_hasItem = false; Debug.Log((object)"DroppedCarried"); } } private Container FindContainerWithItem(string itemName) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) return Enumerable.FirstOrDefault(Enumerable.Select(Physics.OverlapSphere(((Component)this).transform.position, m_searchRange, LayerMask.GetMask(new string[1] { "piece" })), (Collider hit) => ((Component)hit).GetComponentInParent<Container>()), (Func<Container, bool>)((Container container) => (Object)(object)container != (Object)null && container.m_inventory.GetItem(itemName, -1, false) != null)); } private Container FindNearbyContainer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Enumerable.FirstOrDefault(Enumerable.Select(Physics.OverlapSphere(((Component)this).transform.position, m_searchRange, LayerMask.GetMask(new string[1] { "piece" })), (Collider hit) => ((Component)hit).GetComponentInParent<Container>()), (Func<Container, bool>)((Container container) => (Object)(object)container != (Object)null)); } } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<112b52fc-385e-4422-8766-76e3d2c67965>Embedded] internal sealed class <112b52fc-385e-4422-8766-76e3d2c67965>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<112b52fc-385e-4422-8766-76e3d2c67965>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<112b52fc-385e-4422-8766-76e3d2c67965>Embedded] internal sealed class <79594173-e941-4ad9-973e-713c0d41eb0b>NullableContextAttribute : Attribute { public readonly byte Flag; public <79594173-e941-4ad9-973e-713c0d41eb0b>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LocalizationManager { [<1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(0)] [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(1)] [PublicAPI] internal class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; [<1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(2)] private static BaseUnityPlugin _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin plugin { get { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Enumerable.ToList(Assembly.GetExecutingAssembly().DefinedTypes); } catch (ReflectionTypeLoadException ex) { source = Enumerable.Select(Enumerable.Where(ex.Types, [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (Type t) => t != null), [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (Type t) => t.GetTypeInfo()); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)Enumerable.First(source, [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } [<1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(2)] [method: <79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(2)] [field: <1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(2)] public static event Action OnLocalizationComplete; private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out var value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out var value2)) { text = Enumerable.Aggregate(value2, text, [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null) { if (convertConfigValue == null) { convertConfigValue = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key)) { PlaceholderProcessors[key] = new Dictionary<string, Func<string>>(); } config.SettingChanged += [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (object _, EventArgs _) => { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value); UpdatePlaceholderText(Localization.instance, key); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { _ = plugin; } public static void LoadLocalizationLater(Localization __instance) { LoadLocalization(Localization.instance, __instance.GetSelectedLanguage()); } public static void SafeCallLocalizeComplete() { Localizer.OnLocalizationComplete?.Invoke(); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in Enumerable.Where(Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories), [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (string f) => fileExtensions.IndexOf(Path.GetExtension(f)) >= 0)) { string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } byte[] array = LoadTranslationFromAssembly("English"); if (array == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.TryGetValue(language, out var value)) { text2 = File.ReadAllText(value); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } } if (text2 == null && dictionary.TryGetValue("English", out var value2)) { text2 = File.ReadAllText(value2); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string>(2) { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "SetupGui", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalizationLater", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "SafeCallLocalizeComplete", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [return: <1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(2)] private static byte[] LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(2)] public static byte[] ReadEmbeddedFileBytes([<1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(1)] string resourceFileName, Assembly containingAssembly = null) { using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = Enumerable.FirstOrDefault(containingAssembly.GetManifestResourceNames(), [<79594173-e941-4ad9-973e-713c0d41eb0b>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } internal static class LocalizationManagerVersion { [<1bfc4759-c5a6-4eb1-bee9-a1d0c5c59449>Nullable(1)] public const string Version = "1.4.0"; } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(Attribut