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 Wolfborn v1.0.10
Wolfborn (by LoupWave).dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; using UnityEngine.UI; using Wolfborn.Configuration; using Wolfborn.Network; using Wolfborn.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Wolfborn (by LoupWave)")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Wolfborn (by LoupWave)")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("10c3c687-ace4-4d44-9c84-5f7eaa45ac7d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Wolfborn { public static class WolfbornZDOManager { public static readonly int Hash_IsCompanion = StringExtensionMethods.GetStableHashCode("WB_IsCompanion"); public static readonly int Hash_VariantID = StringExtensionMethods.GetStableHashCode("WB_VariantID"); public static readonly int Hash_WolfLevel = StringExtensionMethods.GetStableHashCode("WB_WolfLevel"); public static readonly int Hash_CurrentXP = StringExtensionMethods.GetStableHashCode("WB_CurrentXP"); public static readonly int Hash_IsUnconscious = StringExtensionMethods.GetStableHashCode("WB_IsUnconscious"); public static readonly int Hash_Unconscious = Hash_IsUnconscious; public static readonly int Hash_Evaluated = StringExtensionMethods.GetStableHashCode("WB_Evaluated"); public static readonly int Hash_FollowTarget = StringExtensionMethods.GetStableHashCode("WB_FollowTarget"); public static readonly int Hash_TotemActive = StringExtensionMethods.GetStableHashCode("WB_TotemActive"); public static readonly int Hash_TotemMode = StringExtensionMethods.GetStableHashCode("WB_TotemMode"); public static void LoadCompanionData(WolfbornCompanion companion, ZNetView nview) { if (!((Object)(object)nview == (Object)null) && nview.IsValid() && nview.GetZDO() != null) { ZDO zDO = nview.GetZDO(); companion.variantID = zDO.GetInt(Hash_VariantID, companion.variantID); companion.wolfLevel = Mathf.Clamp(zDO.GetInt(Hash_WolfLevel, companion.wolfLevel), 1, 10); companion.currentXP = zDO.GetFloat(Hash_CurrentXP, companion.currentXP); companion.isUnconscious = zDO.GetBool(Hash_IsUnconscious, companion.isUnconscious); if (nview.IsOwner()) { zDO.Set(Hash_VariantID, companion.variantID, false); zDO.Set(Hash_WolfLevel, companion.wolfLevel, false); } companion.RecalculateStats(); companion.ApplyVisuals(); companion.m_initialized = true; } } public static void SyncFromZDO(WolfbornCompanion companion, ZNetView nview) { if (!((Object)(object)companion == (Object)null) && !((Object)(object)nview == (Object)null) && nview.IsValid() && nview.GetZDO() != null) { ZDO zDO = nview.GetZDO(); companion.variantID = zDO.GetInt(Hash_VariantID, companion.variantID); companion.wolfLevel = Mathf.Clamp(zDO.GetInt(Hash_WolfLevel, companion.wolfLevel), 1, 10); companion.currentXP = zDO.GetFloat(Hash_CurrentXP, companion.currentXP); companion.isUnconscious = zDO.GetBool(Hash_IsUnconscious, companion.isUnconscious); companion.RecalculateStats(); companion.ApplyVisuals(); } } public static void SaveCompanionData(WolfbornCompanion companion, ZNetView nview) { if (!((Object)(object)nview == (Object)null) && nview.IsValid() && nview.IsOwner()) { ZDO zDO = nview.GetZDO(); if (zDO != null) { zDO.Set(Hash_WolfLevel, companion.wolfLevel, false); zDO.Set(Hash_CurrentXP, companion.currentXP); zDO.Set(Hash_IsUnconscious, companion.isUnconscious); } } } } [BepInPlugin("com.loupwave.wolfborn", "Wolfborn", "1.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class WolfbornPlugin : BaseUnityPlugin { public const string PluginGUID = "com.loupwave.wolfborn"; public const string PluginName = "Wolfborn"; public const string PluginVersion = "1.0.7"; private readonly Harmony harmony = new Harmony("com.loupwave.wolfborn"); private void Awake() { WolfbornConfig.Init(((BaseUnityPlugin)this).Config); WolfRegistry.Initialize(); WolfbornPrefabManager.RegisterPrefabs(); WolfbornPieceManager.RegisterPieces(); WolfbornLocalizationManager.LoadEmbeddedLocalizations(); harmony.PatchAll(); WolfbornRaiosEffect.InitJotunnEvents(); Logger.LogInfo((object)"Modifier [Wolfborn] by LoupWave initialized successfully!"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } WolfbornAssetManager.Unload(); } } [HarmonyPatch] public static class WolfbornRaiosEffect { private static AssetBundle raiosBundle; private static GameObject raiosPrefab; private static float forwardOffset = 0.5f; private static float rightOffset = 0f; private static float heightOffset = 0.5f; public static void Initialize() { if ((Object)(object)raiosBundle != (Object)null) { return; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("raios_wolfborntotem", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Logger.LogError((object)"[WolfbornRaios] O AssetBundle 'raios_wolfborntotem' não foi encontrado como Recurso Inserido!"); return; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); raiosBundle = AssetBundle.LoadFromMemory(array); if ((Object)(object)raiosBundle != (Object)null) { raiosPrefab = raiosBundle.LoadAsset<GameObject>("raios_wolfborntotem"); if ((Object)(object)raiosPrefab != (Object)null) { PrefabManager.Instance.AddPrefab(raiosPrefab); Logger.LogInfo((object)"[WolfbornRaios] Prefab de raios registrado com sucesso!"); } else { Logger.LogError((object)"[WolfbornRaios] Prefab 'raios_wolfborntotem' não encontrado no AssetBundle!"); } raiosBundle.Unload(false); } } public static void InitJotunnEvents() { PrefabManager.OnVanillaPrefabsAvailable += Initialize; } [HarmonyPatch(typeof(WolfbornTotem), "Interact")] [HarmonyPostfix] private static void OnTotemInteract(WolfbornTotem __instance, Humanoid user, bool hold, bool alt, ref bool __result) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) //IL_0074: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (!__result || hold || !((Object)(object)__instance != (Object)null)) { return; } Vector3 val = ((Component)__instance).transform.position + ((Component)__instance).transform.forward * forwardOffset + ((Component)__instance).transform.right * rightOffset + Vector3.up * heightOffset; Quaternion rotation = ((Component)__instance).transform.rotation; if ((Object)(object)raiosPrefab != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(raiosPrefab, val, rotation); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2, 10f); } } } } public class WolfbornCompanion : MonoBehaviour { private Character m_character; private ZNetView m_nview; private WolfbornSpheresEffect m_spheresEffect; private static readonly MaterialPropertyBlock mpb = new MaterialPropertyBlock(); public bool m_initialized; public static readonly List<WolfbornCompanion> m_instances = new List<WolfbornCompanion>(); public int variantID = 1; public int wolfLevel = 1; public float currentXP; public float xpToNextLevel = 150f; public float extraMaxHp; public float damageMultiplier = 1f; public float unconsciousTimer; private const float UNCONSCIOUS_DURATION = 60f; public float postWakeInvincibleTimer; public bool isBeingSacrificed; private Vector3 lastPosition; private GameObject savedFollowTarget; public bool isUnconscious { get { if ((Object)(object)m_nview != (Object)null && m_nview.GetZDO() != null) { return m_nview.GetZDO().GetBool(WolfbornZDOManager.Hash_IsUnconscious, false); } return false; } set { if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { if (!m_nview.IsOwner()) { m_nview.ClaimOwnership(); } m_nview.GetZDO().Set(WolfbornZDOManager.Hash_IsUnconscious, value); } } } private void Awake() { m_spheresEffect = ((Component)this).gameObject.GetComponent<WolfbornSpheresEffect>(); if ((Object)(object)m_spheresEffect == (Object)null) { m_spheresEffect = ((Component)this).gameObject.AddComponent<WolfbornSpheresEffect>(); } if (!m_instances.Contains(this)) { m_instances.Add(this); } m_nview = ((Component)this).GetComponent<ZNetView>(); m_character = ((Component)this).GetComponent<Character>(); DisableValheimNativeScaling(); } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) lastPosition = ((Component)this).transform.position; } private int GetCorrectStarLevel() { switch (variantID) { case 3: case 4: return 1; case 5: case 6: return 2; default: return 0; } } private float GetNativeValheimScale() { return 1f; } private void DisableValheimNativeScaling() { if ((Object)(object)m_character == (Object)null) { m_character = ((Component)this).GetComponent<Character>(); } if ((Object)(object)m_character != (Object)null) { FieldInfo field = typeof(Character).GetField("m_scaleByLevel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); if (field != null) { field.SetValue(m_character, false); } } } private void RegisterRPCs() { if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { m_nview.Register<string, int>("RPC_WolfbornLevelUp", (Action<long, string, int>)RPC_WolfbornLevelUp); } } public void TriggerLevelUpNotification() { if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { Character component = ((Component)this).GetComponent<Character>(); string text = (((Object)(object)component != (Object)null) ? component.GetHoverName() : "$wb_default_wolf_name"); if (string.IsNullOrEmpty(text)) { text = "$wb_default_wolf_name"; } m_nview.InvokeRPC(ZNetView.Everybody, "RPC_WolfbornLevelUp", new object[2] { text, wolfLevel }); } } private void Update() { if (!m_initialized) { WolfbornZDOManager.LoadCompanionData(this, m_nview); } } private void LateUpdate() { //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (!m_initialized) { return; } if (postWakeInvincibleTimer > 0f) { postWakeInvincibleTimer -= Time.deltaTime; } UpdateFollowTargetZDO(); if (isUnconscious) { if (isBeingSacrificed) { return; } MonsterAI component = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { savedFollowTarget = component.GetFollowTarget(); ((BaseAI)component).StopMoving(); ((Behaviour)component).enabled = false; } if ((Object)(object)m_nview != (Object)null && m_nview.IsOwner()) { unconsciousTimer -= Time.deltaTime; } Character component2 = ((Component)this).GetComponent<Character>(); if ((Object)(object)component2 != (Object)null) { component2.SetHealth(1f); SEMan sEMan = component2.GetSEMan(); if (sEMan != null) { sEMan.RemoveAllStatusEffects(false); } } if (unconsciousTimer <= 0f && (Object)(object)m_nview != (Object)null && m_nview.IsOwner()) { WakeUp(); } return; } MonsterAI component3 = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component3 != (Object)null && !((Behaviour)component3).enabled) { ((Behaviour)component3).enabled = true; if ((Object)(object)savedFollowTarget != (Object)null) { component3.SetFollowTarget(savedFollowTarget); } } if (wolfLevel >= 10 || !((Object)(object)m_nview != (Object)null) || !m_nview.IsOwner()) { return; } Character component4 = ((Component)this).GetComponent<Character>(); if (!((Object)(object)component4 != (Object)null) || component4.IsDead() || !component4.IsTamed()) { return; } float num = Vector3.Distance(((Component)this).transform.position, lastPosition); if (num >= 25f) { MonsterAI component5 = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component5 != (Object)null && (Object)(object)component5.GetFollowTarget() != (Object)null && (Object)(object)component5.GetFollowTarget().GetComponent<Player>() != (Object)null) { AddXP(0.2f * (num / 25f)); } lastPosition = ((Component)this).transform.position; } } private void UpdateFollowTargetZDO() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid()) { return; } MonsterAI component = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component == (Object)null) { return; } GameObject followTarget = component.GetFollowTarget(); ZDOID val = ZDOID.None; if ((Object)(object)followTarget != (Object)null) { Player component2 = followTarget.GetComponent<Player>(); if ((Object)(object)component2 != (Object)null && ((Character)component2).GetZDOID() != ZDOID.None) { val = ((Character)component2).GetZDOID(); } } ZDO zDO = m_nview.GetZDO(); if (zDO == null) { return; } zDO.Set("WB_IsCompanion", true); if (zDO.GetZDOID("WB_FollowTarget") != val) { if (!m_nview.IsOwner()) { m_nview.ClaimOwnership(); } zDO.Set("WB_FollowTarget", val); } } public void TeleportTo(Vector3 position) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Character component = ((Component)this).GetComponent<Character>(); if ((Object)(object)component != (Object)null) { component.TeleportTo(position, ((Component)this).transform.rotation, true); } else { ((Component)this).transform.position = position; } if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { m_nview.GetZDO().SetPosition(position); } } public string GetLevelText() { string text = ((wolfLevel >= 10) ? "$wb_level_max" : "$wb_level"); return string.Format(Localization.instance.Localize(text), wolfLevel); } public void RecalculateStats() { int num = WolfRegistry.GetDefinition(variantID)?.StarLevel ?? 0; float num2 = 80f * (float)(num + 1); float num3 = 1000f; if (num == 1) { num3 = 2000f; } else if (num >= 2) { num3 = 3000f; } float num4 = num3 - num2; extraMaxHp = Mathf.Round(num4 * ((float)(wolfLevel - 1) / 9f)); damageMultiplier = 1f + (float)(wolfLevel - 1) * 0.05556f; xpToNextLevel = Mathf.Round(150f * Mathf.Pow(1.4542f, (float)(wolfLevel - 1))); } private void RPC_WolfbornLevelUp(long sender, string wolfName, int level) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.m_localPlayer == (Object)null) && Vector3.Distance(((Component)this).transform.position, ((Component)Player.m_localPlayer).transform.position) <= 50f && (Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, Localization.instance.Localize("$wb_msg_levelup", new string[2] { wolfName, level.ToString() }), 0, (Sprite)null, false, true); } } public void ApplyVisuals() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) WolfDefinition definition = WolfRegistry.GetDefinition(variantID); if (definition == null) { return; } if ((Object)(object)m_character == (Object)null) { m_character = ((Component)this).GetComponent<Character>(); } DisableValheimNativeScaling(); if ((Object)(object)m_character != (Object)null) { int num = GetCorrectStarLevel() + 1; if (m_character.GetLevel() != num) { m_character.SetLevel(num); DisableValheimNativeScaling(); } } float nativeValheimScale = GetNativeValheimScale(); float num2 = Mathf.Clamp01((float)(wolfLevel - 1) / 9f); float num3 = Mathf.Lerp(1f, 1.2f, num2); float num4 = nativeValheimScale * num3; ((Component)this).transform.localScale = new Vector3(num4, num4, num4); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); if (componentsInChildren == null) { return; } Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!((Object)(object)val == (Object)null)) { val.GetPropertyBlock(mpb); mpb.SetColor("_Color", definition.FurColor); mpb.SetColor("_TintColor", definition.FurColor); val.SetPropertyBlock(mpb); } } } public void AddXP(float amount) { if ((Object)(object)m_nview == (Object)null || !m_nview.IsOwner()) { return; } Character component = ((Component)this).GetComponent<Character>(); if ((Object)(object)component == (Object)null || !component.IsTamed() || wolfLevel >= 10) { return; } currentXP += amount; bool flag = false; while (wolfLevel < 10) { float requiredXPForLevel = GetRequiredXPForLevel(wolfLevel); if (!(currentXP >= requiredXPForLevel)) { break; } currentXP -= requiredXPForLevel; wolfLevel++; flag = true; } if (wolfLevel >= 10) { currentXP = 0f; } RecalculateStats(); ApplyVisuals(); WolfbornZDOManager.SaveCompanionData(this, m_nview); WolfbornRPCManager.BroadcastStatsUpdate(this); if (flag) { OnLevelUpEffect(); } } private float GetRequiredXPForLevel(int level) { return (float)level * 100f; } private void OnLevelUpEffect() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ZNetScene.instance == (Object)null)) { GameObject prefab = ZNetScene.instance.GetPrefab("vfx_create_tamed_animal"); if ((Object)(object)prefab != (Object)null) { Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position + Vector3.up * 0.5f, Quaternion.identity); } } } public void SetUnconscious() { isUnconscious = true; unconsciousTimer = 60f; Character component = ((Component)this).GetComponent<Character>(); MonsterAI component2 = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null) { component.SetHealth(1f); SEMan sEMan = component.GetSEMan(); if (sEMan != null) { sEMan.RemoveAllStatusEffects(false); } } if ((Object)(object)component2 != (Object)null) { savedFollowTarget = component2.GetFollowTarget(); ((BaseAI)component2).StopMoving(); ((Behaviour)component2).enabled = false; } if ((Object)(object)m_spheresEffect != (Object)null) { m_spheresEffect.SpawnEffect(((Component)this).transform); } } public void WakeUp() { isUnconscious = false; postWakeInvincibleTimer = 5f; Character component = ((Component)this).GetComponent<Character>(); MonsterAI component2 = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null) { component.SetHealth(component.GetMaxHealth() * 0.3f); SEMan sEMan = component.GetSEMan(); if (sEMan != null) { sEMan.RemoveAllStatusEffects(false); } } if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; if ((Object)(object)savedFollowTarget != (Object)null) { component2.SetFollowTarget(savedFollowTarget); } } if ((Object)(object)m_spheresEffect != (Object)null) { m_spheresEffect.RemoveEffect(); } } private void OnDestroy() { m_instances.Remove(this); } public bool IsFollowingPlayer(Player player) { if ((Object)(object)player == (Object)null) { return false; } MonsterAI component = ((Component)this).GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null) { GameObject followTarget = component.GetFollowTarget(); if ((Object)(object)followTarget != (Object)null && (Object)(object)followTarget.GetComponent<Player>() == (Object)(object)player) { return true; } } return false; } } public class WolfbornTotem : MonoBehaviour, Hoverable, Interactable { private ZNetView m_nview; private Camera cachedCamera; private float distanceCheckTimer; private const float DISTANCE_CHECK_INTERVAL = 0.25f; private bool isVisibleByDistance = true; private GameObject activeOrbitShieldVFX; private float shieldOrbitAngle; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); RegisterRPCs(); } private void Start() { EnsureAlwaysActiveVisuals(); SpawnVerticalOrbitShield(); } private void RegisterRPCs() { if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { m_nview.Register<bool>("RPC_WolfbornTotemToggle", (Action<long, bool>)RPC_WolfbornTotemToggle); } } private void Update() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) if ((Object)(object)cachedCamera == (Object)null) { cachedCamera = Camera.main; if ((Object)(object)cachedCamera == (Object)null) { return; } } distanceCheckTimer += Time.deltaTime; if (distanceCheckTimer >= 0.25f) { distanceCheckTimer = 0f; Vector3 val = ((Component)this).transform.position - ((Component)cachedCamera).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; isVisibleByDistance = sqrMagnitude <= 1225f; if ((Object)(object)activeOrbitShieldVFX != (Object)null && activeOrbitShieldVFX.activeSelf != isVisibleByDistance) { activeOrbitShieldVFX.SetActive(isVisibleByDistance); } } if (isVisibleByDistance) { UpdateVerticalOrbitAnimation(); } } private void OnDestroy() { if ((Object)(object)activeOrbitShieldVFX != (Object)null) { Object.Destroy((Object)(object)activeOrbitShieldVFX); } } public string GetHoverName() { return Localization.instance.Localize("$wb_totem_name"); } public string GetHoverText() { return Localization.instance.Localize("$wb_totem_hover_text").Replace("$KEY_Use", "E"); } public float GetHoverOffset() { return 0f; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return false; } if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid()) { return false; } ZDOID zDOID = ((Character)val).GetZDOID(); Vector3 position = ((Component)this).transform.position; if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(0L, "Wolfborn_RequestTotemTeleport", new object[2] { zDOID, position }); if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { m_nview.InvokeRPC(ZNetView.Everybody, "RPC_WolfbornTotemToggle", new object[1] { true }); } return true; } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } private void RPC_WolfbornTotemToggle(long sender, bool active) { } private void EnsureAlwaysActiveVisuals() { ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { if (!val.isPlaying) { val.Play(); } } } private void SpawnVerticalOrbitShield() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4 || !((Object)(object)activeOrbitShieldVFX == (Object)null)) { return; } GameObject orbitShieldPrefab = WolfbornPrefabManager.OrbitShieldPrefab; if ((Object)(object)orbitShieldPrefab != (Object)null) { activeOrbitShieldVFX = Object.Instantiate<GameObject>(orbitShieldPrefab); Collider[] componentsInChildren = activeOrbitShieldVFX.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } } else { Logger.LogWarning((object)"[WolfbornTotem] Prefab customizado da esfera orbital não foi encontrado no ZNetScene."); } } private void UpdateVerticalOrbitAnimation() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_011c: 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_0123: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)activeOrbitShieldVFX == (Object)null)) { float num = 50f; float num2 = 0.7f; float num3 = 0f; float num4 = 0f; float num5 = 1.1f; float num6 = 45f; shieldOrbitAngle += num * Time.deltaTime; if (shieldOrbitAngle >= 360f) { shieldOrbitAngle -= 360f; } float num7 = shieldOrbitAngle * ((float)Math.PI / 180f); Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * num4 + Vector3.up * num5 + ((Component)this).transform.right * num3; Vector3 val2 = ((Component)this).transform.right * Mathf.Cos(num7) * num2 + ((Component)this).transform.up * Mathf.Sin(num7) * num2; if (num6 != 0f) { val2 = Quaternion.AngleAxis(num6, ((Component)this).transform.right) * val2; } activeOrbitShieldVFX.transform.position = val + val2; } } } public static class WolfbornPieceManager { public static float TotemScale = 1f; public static void RegisterPieces() { PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; } private static void OnVanillaPrefabsAvailable() { //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Expected O, but got Unknown //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Expected O, but got Unknown //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable; WolfbornAssetManager.EnsureLoaded(); Sprite totemIconSprite = WolfbornAssetManager.TotemIconSprite; GameObject val = PrefabManager.Instance.CreateClonedPrefab("Wolfborn_Totem", "guard_stone"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"[Wolfborn] Falha ao clonar o prefab 'guard_stone'."); return; } Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if (!((Object)(object)val2 != (Object)null) || val2.sharedMaterials == null) { continue; } Material[] array = (Material[])(object)new Material[val2.sharedMaterials.Length]; for (int j = 0; j < val2.sharedMaterials.Length; j++) { if ((Object)(object)val2.sharedMaterials[j] != (Object)null) { array[j] = Object.Instantiate<Material>(val2.sharedMaterials[j]); string text = ((Object)array[j]).name.ToLower(); if ((text.Contains("glow") || text.Contains("emission") || text.Contains("lines") || text.Contains("_e")) && array[j].HasProperty("_EmissionColor")) { Color val3 = new Color(0.486f, 1f, 0.984f) * 1f; array[j].SetColor("_EmissionColor", val3); array[j].EnableKeyword("_EMISSION"); } } } val2.materials = array; } val.transform.localScale = Vector3.one * TotemScale; PrivateArea component = val.GetComponent<PrivateArea>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } CircleProjector[] componentsInChildren2 = val.GetComponentsInChildren<CircleProjector>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } Transform[] componentsInChildren3 = val.GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren3) { if ((Object)(object)val4 != (Object)null && (Object)(object)val4 != (Object)(object)val.transform && (((Object)val4).name.ToLower().Contains("area") || ((Object)val4).name.ToLower().Contains("marker") || ((Object)val4).name.ToLower().Contains("projector"))) { Object.DestroyImmediate((Object)(object)((Component)val4).gameObject); } } Light[] componentsInChildren4 = val.GetComponentsInChildren<Light>(true); foreach (Light val5 in componentsInChildren4) { if ((Object)(object)val5 != (Object)null) { val5.color = new Color(0.6f, 1f, 0.984f, 0.6f); } } ParticleSystem[] componentsInChildren5 = val.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val6 in componentsInChildren5) { if ((Object)(object)val6 != (Object)null) { MainModule main = val6.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; Color color = ((MinMaxGradient)(ref startColor)).color; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.486f, 1f, 0.984f, (color.a > 0f) ? color.a : 0.6f)); } } val.AddComponent<WolfbornTotem>(); PieceManager.Instance.AddPieceCategory("Wolfborn"); Piece component2 = val.GetComponent<Piece>(); if ((Object)(object)component2 != (Object)null) { component2.m_name = "$wb_totem_name"; component2.m_description = "$wb_totem_description"; component2.m_enabled = true; component2.m_craftingStation = null; component2.m_allowedInDungeons = true; component2.m_category = PieceManager.Instance.GetPieceCategory("Wolfborn").Value; if ((Object)(object)totemIconSprite != (Object)null) { component2.m_icon = totemIconSprite; } } PieceConfig val7 = new PieceConfig(); val7.Name = "$wb_totem_name"; val7.Description = "$wb_totem_description"; val7.PieceTable = "Hammer"; val7.Category = "Wolfborn"; val7.CraftingStation = ""; val7.Icon = totemIconSprite; val7.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wood", 3, 0, true), new RequirementConfig("FreezeGland", 1, 0, true) }; PieceConfig val8 = val7; CustomPiece val9 = new CustomPiece(val, false, val8); if ((Object)(object)totemIconSprite != (Object)null) { val9.Piece.m_icon = totemIconSprite; } PieceManager.Instance.AddPiece(val9); Logger.LogInfo((object)"[Wolfborn] 'Wolfborn Totem' configurado com sucesso!"); } } public static class WolfbornPrefabManager { public static GameObject RaiosWolfbornPrefab { get; private set; } public static GameObject OrbitShieldPrefab { get; private set; } public static void RegisterPrefabs() { PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; } private static void OnVanillaPrefabsAvailable() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable; LoadRaiosPrefab(); LoadOrbitShieldPrefab(); foreach (WolfDefinition allWolf in WolfRegistry.GetAllWolves()) { GameObject val = PrefabManager.Instance.CreateClonedPrefab(allWolf.PrefabName, "Wolf"); if (!((Object)(object)val == (Object)null)) { WolfbornCompanion wolfbornCompanion = val.GetComponent<WolfbornCompanion>(); if ((Object)(object)wolfbornCompanion == (Object)null) { wolfbornCompanion = val.AddComponent<WolfbornCompanion>(); } wolfbornCompanion.variantID = allWolf.ID; CustomPrefab val2 = new CustomPrefab(val, false); PrefabManager.Instance.AddPrefab(val2); } } } private static void LoadRaiosPrefab() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("raios_wolfborn", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Logger.LogError((object)"[Wolfborn] O recurso embutido 'raios_wolfborn' não foi encontrado na DLL!"); return; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { return; } AssetBundle val = AssetBundle.LoadFromStream(stream); if ((Object)(object)val != (Object)null) { GameObject val2 = val.LoadAsset<GameObject>("raios_wolfborn"); if ((Object)(object)val2 == (Object)null) { GameObject[] array = val.LoadAllAssets<GameObject>(); if (array.Length != 0) { val2 = array[0]; } } if ((Object)(object)val2 != (Object)null) { RaiosWolfbornPrefab = val2; CustomPrefab val3 = new CustomPrefab(val2, false); PrefabManager.Instance.AddPrefab(val3); Logger.LogInfo((object)"[Wolfborn] Prefab 'raios_wolfborn' registrado com sucesso!"); } else { Logger.LogError((object)"[Wolfborn] Não foi possível extrair o GameObject do AssetBundle 'raios_wolfborn'."); } val.Unload(false); } else { Logger.LogError((object)"[Wolfborn] Falha ao carregar o AssetBundle 'raios_wolfborn'."); } } private static void LoadOrbitShieldPrefab() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("sphere_wolfborntotem", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Logger.LogError((object)"[Wolfborn] O recurso embutido da esfera orbital não foi encontrado na DLL!"); return; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { return; } AssetBundle val = AssetBundle.LoadFromStream(stream); if ((Object)(object)val != (Object)null) { GameObject val2 = val.LoadAsset<GameObject>("sphere_wolfborntotem"); if ((Object)(object)val2 == (Object)null) { GameObject[] array = val.LoadAllAssets<GameObject>(); if (array.Length != 0) { val2 = array[0]; } } if ((Object)(object)val2 != (Object)null) { OrbitShieldPrefab = val2; CustomPrefab val3 = new CustomPrefab(val2, false); PrefabManager.Instance.AddPrefab(val3); Logger.LogInfo((object)"[Wolfborn] Prefab da esfera orbital customizada registrado com sucesso!"); } else { Logger.LogError((object)"[Wolfborn] Não foi possível extrair o GameObject do AssetBundle da esfera orbital."); } val.Unload(false); } else { Logger.LogError((object)"[Wolfborn] Falha ao carregar o AssetBundle da esfera orbital."); } } } [HarmonyPatch] public static class WolfbornProtectionPatches { private static readonly FieldRef<EnemyHud, IDictionary> m_hudsRef = AccessTools.FieldRefAccess<EnemyHud, IDictionary>("m_huds"); private static readonly Type hudDataType = typeof(EnemyHud).GetNestedType("HudData", BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldRef<object, GameObject> m_guiRef = AccessTools.FieldRefAccess<object, GameObject>(AccessTools.Field(hudDataType, "m_gui")); private static readonly FieldRef<object, GuiBar> m_healthFastRef = AccessTools.FieldRefAccess<object, GuiBar>(AccessTools.Field(hudDataType, "m_healthFast")); [HarmonyPatch(typeof(Character), "GetHoverName")] [HarmonyPostfix] private static void ModifyHoverName(Character __instance, ref string __result) { if ((Object)(object)__instance == (Object)null) { return; } WolfbornCompanion component = ((Component)__instance).GetComponent<WolfbornCompanion>(); if ((Object)(object)component != (Object)null && component.m_initialized) { Tameable component2 = ((Component)__instance).GetComponent<Tameable>(); string text = (((Object)(object)component2 != (Object)null) ? component2.GetText() : string.Empty); if (!string.IsNullOrEmpty(text)) { __result = text; } else { __result = Localization.instance.Localize("<color=#FFD700>$wb_default_name</color>"); } } } [HarmonyPatch(typeof(EnemyHud), "UpdateHuds")] [HarmonyPostfix] private static void UpdateWolfbornHudIcons(EnemyHud __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if ((int)SystemInfo.graphicsDeviceType == 4 || (Object)(object)__instance == (Object)null) { return; } WolfbornAssetManager.EnsureLoaded(); float num = 20f; float num2 = -14f; float num3 = 34f; IDictionary dictionary = m_hudsRef.Invoke(__instance); if (dictionary == null) { return; } foreach (DictionaryEntry item in dictionary) { object key = item.Key; Character val = (Character)((key is Character) ? key : null); object value = item.Value; if ((Object)(object)val == (Object)null || value == null) { continue; } GameObject val2 = m_guiRef.Invoke(value); GuiBar val3 = m_healthFastRef.Invoke(value); if ((Object)(object)val2 == (Object)null) { continue; } Transform val4 = val2.transform.Find("WolfbornHUDIcon"); WolfbornCompanion component = ((Component)val).GetComponent<WolfbornCompanion>(); if ((Object)(object)component != (Object)null && component.m_initialized) { Image val5 = null; if ((Object)(object)val4 == (Object)null) { GameObject val6 = new GameObject("WolfbornHUDIcon", new Type[2] { typeof(RectTransform), typeof(Image) }); val6.transform.SetParent(val2.transform, false); val5 = val6.GetComponent<Image>(); val5.preserveAspect = true; val4 = val6.transform; } else { val5 = ((Component)val4).GetComponent<Image>(); } RectTransform component2 = ((Component)val4).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(num, num); if ((Object)(object)val5 != (Object)null && (Object)(object)WolfbornAssetManager.WolfIconSprite != (Object)null) { val5.sprite = WolfbornAssetManager.WolfIconSprite; ((Graphic)val5).color = Color.white; } Vector3 val7 = Vector3.zero; float num4 = 40f; if ((Object)(object)val3 != (Object)null) { val7 = ((Component)val3).transform.localPosition; RectTransform component3 = ((Component)val3).GetComponent<RectTransform>(); if ((Object)(object)component3 != (Object)null) { Rect rect = component3.rect; if (((Rect)(ref rect)).width > 0f) { rect = component3.rect; num4 = ((Rect)(ref rect)).width / 2f; } } } float num5 = val7.x - num4 + num2; float num6 = val7.y + num3; ((Transform)component2).localPosition = new Vector3(num5, num6, val7.z); ((Component)val4).gameObject.SetActive(true); } else if ((Object)(object)val4 != (Object)null) { ((Component)val4).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(Tameable), "GetHoverText")] [HarmonyPostfix] private static void RenderHoverUI(Tameable __instance, ref string __result) { if ((Object)(object)__instance == (Object)null) { return; } WolfbornCompanion component = ((Component)__instance).GetComponent<WolfbornCompanion>(); if ((Object)(object)component != (Object)null && component.m_initialized) { if (component.isUnconscious) { int num = Mathf.CeilToInt(component.unconsciousTimer); string arg = Localization.instance.Localize("$wb_status_unconscious"); __result += $"\n<color=red><b>[ {arg} ] ({num}s)</b></color>"; } else if (__instance.IsTamed()) { Character component2 = ((Component)__instance).GetComponent<Character>(); float num2 = Mathf.Ceil(component2.GetHealth()); float num3 = Mathf.Ceil(component2.GetMaxHealth()); int num4 = Mathf.RoundToInt((component.damageMultiplier - 1f) * 100f); string text = Localization.instance.Localize("$wb_damage_base"); string text2 = ((num4 > 0) ? $"+{num4}%" : text); bool num5 = component.wolfLevel >= 10; string text3 = (num5 ? string.Format(Localization.instance.Localize("$wb_level_max"), component.wolfLevel) : string.Format(Localization.instance.Localize("$wb_level"), component.wolfLevel)); string text4 = (num5 ? ("<color=#FFD700><b>" + text3 + "</b></color>") : ("<color=yellow><b>" + text3 + "</b></color>")); string text5 = (num5 ? "" : $"\n<color=orange>XP:</color> {component.currentXP:F0}/{component.xpToNextLevel:F0}"); string text6 = Localization.instance.Localize("$wb_label_bonus_damage"); __result = __result + "\n" + text4 + text5 + $"\n<color=green>HP:</color> {num2}/{num3}" + "\n<color=red>" + text6 + ":</color> " + text2; } } } [HarmonyPatch(typeof(Character), "SetLevel")] [HarmonyPostfix] private static void UpdateCompanionScale(Character __instance) { WolfbornCompanion wolfbornCompanion = ((__instance != null) ? ((Component)__instance).GetComponent<WolfbornCompanion>() : null); if ((Object)(object)wolfbornCompanion != (Object)null && wolfbornCompanion.m_initialized) { wolfbornCompanion.ApplyVisuals(); } } [HarmonyPatch(typeof(Character), "OnDeath")] [HarmonyPrefix] private static bool PreventDeath(Character __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (!__instance.IsTamed()) { return true; } WolfbornCompanion component = ((Component)__instance).GetComponent<WolfbornCompanion>(); if ((Object)(object)component != (Object)null && component.m_initialized) { if (component.isBeingSacrificed) { return true; } if (!component.isUnconscious) { component.SetUnconscious(); } return false; } return true; } [HarmonyPatch(typeof(Character), "Damage")] [HarmonyPrefix] private static bool HandleDamage(Character __instance, HitData hit) { if ((Object)(object)__instance == (Object)null || hit == null) { return true; } Character attacker = hit.GetAttacker(); if ((Object)(object)attacker != (Object)null) { WolfbornCompanion component = ((Component)attacker).GetComponent<WolfbornCompanion>(); if ((Object)(object)component != (Object)null && component.m_initialized) { if (component.isUnconscious) { return false; } ((DamageTypes)(ref hit.m_damage)).Modify(component.damageMultiplier); if (hit.GetTotalDamage() >= __instance.GetHealth()) { component.AddXP(15f); } } } WolfbornCompanion component2 = ((Component)__instance).GetComponent<WolfbornCompanion>(); if ((Object)(object)component2 != (Object)null && component2.m_initialized) { if (!__instance.IsTamed()) { return true; } if (IsButcherKnife(hit)) { component2.isBeingSacrificed = true; return true; } if (component2.isUnconscious || component2.postWakeInvincibleTimer > 0f) { return false; } if (hit.GetTotalDamage() >= __instance.GetHealth()) { component2.SetUnconscious(); return false; } } return true; } private static bool IsButcherKnife(HitData hit) { if (hit == null) { return false; } Character attacker = hit.GetAttacker(); if ((Object)(object)attacker != (Object)null && attacker.IsPlayer()) { Character obj = ((attacker is Player) ? attacker : null); ItemData val = ((obj != null) ? ((Humanoid)obj).GetCurrentWeapon() : null); if (val?.m_shared != null) { string text = val.m_shared.m_name.ToLower(); if (text.Contains("butcher") || text.Contains("açougueiro") || text.Contains("knife_butcher")) { return true; } } } return false; } [HarmonyPatch(typeof(Character), "GetMaxHealth")] [HarmonyPostfix] private static void ApplyBonusMaxHealth(Character __instance, ref float __result) { WolfbornCompanion wolfbornCompanion = ((__instance != null) ? ((Component)__instance).GetComponent<WolfbornCompanion>() : null); if ((Object)(object)wolfbornCompanion != (Object)null && wolfbornCompanion.m_initialized) { __result += wolfbornCompanion.extraMaxHp; } } [HarmonyPatch(typeof(BaseAI), "CanSeeTarget", new Type[] { typeof(Character) })] [HarmonyPostfix] private static void IgnoreUnconsciousTarget(BaseAI __instance, Character target, ref bool __result) { WolfbornCompanion wolfbornCompanion = ((target != null) ? ((Component)target).GetComponent<WolfbornCompanion>() : null); if ((Object)(object)wolfbornCompanion != (Object)null && wolfbornCompanion.isUnconscious) { __result = false; } } } [HarmonyPatch] public static class WolfbornSpawnManager { [HarmonyPatch(typeof(MonsterAI), "Start")] [HarmonyPostfix] private static void InterceptWolfSpawn(MonsterAI __instance) { if ((Object)(object)__instance == (Object)null) { return; } Character component = ((Component)__instance).GetComponent<Character>(); if ((Object)(object)component == (Object)null) { return; } ZNetView component2 = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component2 == (Object)null || !component2.IsValid() || ((Object)((Component)component).gameObject).name.Replace("(Clone)", "").Trim() != "Wolf") { return; } ZDO zDO = component2.GetZDO(); if (zDO == null) { return; } if (zDO.GetBool(WolfbornZDOManager.Hash_IsCompanion, false)) { WolfbornCompanion wolfbornCompanion = ((Component)component).GetComponent<WolfbornCompanion>(); if ((Object)(object)wolfbornCompanion == (Object)null) { wolfbornCompanion = ((Component)component).gameObject.AddComponent<WolfbornCompanion>(); } wolfbornCompanion.variantID = zDO.GetInt(WolfbornZDOManager.Hash_VariantID, 1); wolfbornCompanion.wolfLevel = zDO.GetInt(WolfbornZDOManager.Hash_WolfLevel, 1); wolfbornCompanion.ApplyVisuals(); } else { if (zDO.GetBool(WolfbornZDOManager.Hash_Evaluated, false) || !component2.IsOwner()) { return; } zDO.Set(WolfbornZDOManager.Hash_Evaluated, true); if (Random.value <= 0.2f) { int num = zDO.GetInt(StringExtensionMethods.GetStableHashCode("level"), component.GetLevel()); int num2 = SorteiaVariante(num); zDO.Set(WolfbornZDOManager.Hash_IsCompanion, true); zDO.Set(WolfbornZDOManager.Hash_VariantID, num2, false); zDO.Set(WolfbornZDOManager.Hash_WolfLevel, 1, false); WolfbornCompanion wolfbornCompanion2 = ((Component)component).GetComponent<WolfbornCompanion>(); if ((Object)(object)wolfbornCompanion2 == (Object)null) { wolfbornCompanion2 = ((Component)component).gameObject.AddComponent<WolfbornCompanion>(); } wolfbornCompanion2.variantID = num2; wolfbornCompanion2.wolfLevel = 1; wolfbornCompanion2.ApplyVisuals(); if (WolfbornConfig.IsDebugMode) { Logger.LogInfo((object)$"[Wolfborn] Novo Wolfborn (Variante {num2}, Nível Nativo {num}) gerado com sucesso!"); } } } } private static int SorteiaVariante(int nativeLevel) { switch (nativeLevel) { case 2: if (!(Random.value > 0.5f)) { return 4; } return 3; case 3: if (!(Random.value > 0.5f)) { return 6; } return 5; default: if (!(Random.value > 0.5f)) { return 2; } return 1; } } } public class WolfbornSpheresEffect : MonoBehaviour { private GameObject m_activeRaiosInstance; private Transform m_orbitSphereTransform; private Vector3 m_initialOrbitLocalPos; private float m_orbitAngle; private const float OrbitSpeed = 90f; private const float OrbitRadius = 1.5f; private const float OrbitCenterZ = -1f; public void SpawnEffect(Transform parentTransform) { //IL_0076: 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_00c2: 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) if ((Object)(object)m_activeRaiosInstance != (Object)null) { return; } GameObject val = (((Object)(object)WolfbornPrefabManager.RaiosWolfbornPrefab != (Object)null) ? WolfbornPrefabManager.RaiosWolfbornPrefab : (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("raios_wolfborn") : null)); if ((Object)(object)val != (Object)null) { m_activeRaiosInstance = Object.Instantiate<GameObject>(val, parentTransform); m_activeRaiosInstance.transform.localPosition = new Vector3(0f, 0.55f, 1f); m_activeRaiosInstance.transform.localRotation = Quaternion.identity; Transform val2 = m_activeRaiosInstance.transform.Find("sphere_orbit"); if ((Object)(object)val2 != (Object)null) { m_orbitSphereTransform = val2; m_initialOrbitLocalPos = m_orbitSphereTransform.localPosition; } else { Logger.LogWarning((object)"[Wolfborn] O GameObject 'sphere_orbit' não foi encontrado no prefab 'raios_wolfborn'!"); } } else { Logger.LogWarning((object)"[Wolfborn] Prefab 'raios_wolfborn' não foi encontrado no ZNetScene!"); } } private void Update() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_activeRaiosInstance != (Object)null && (Object)(object)m_orbitSphereTransform != (Object)null) { m_orbitAngle += 90f * Time.deltaTime; if (m_orbitAngle >= 360f) { m_orbitAngle -= 360f; } float num = m_orbitAngle * ((float)Math.PI / 180f); float num2 = Mathf.Cos(num) * 1.5f; float y = m_initialOrbitLocalPos.y; float num3 = -1f + Mathf.Sin(num) * 1.5f; m_orbitSphereTransform.localPosition = new Vector3(num2, y, num3); } } public void RemoveEffect() { if ((Object)(object)m_activeRaiosInstance != (Object)null) { Object.Destroy((Object)(object)m_activeRaiosInstance); m_activeRaiosInstance = null; m_orbitSphereTransform = null; } } private void OnDestroy() { RemoveEffect(); } } public class WolfDefinition { public int ID { get; set; } public string Name { get; set; } public string PrefabName { get; set; } public int StarLevel { get; set; } public Color FurColor { get; set; } public float BaseScale { get; set; } public WolfDefinition(int id, string name, string prefabName, int starLevel, Color furColor, float baseScale) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) ID = id; Name = name; PrefabName = prefabName; StarLevel = starLevel; FurColor = furColor; BaseScale = baseScale; } } public static class WolfRegistry { public static Dictionary<int, WolfDefinition> Variants { get; private set; } = new Dictionary<int, WolfDefinition>(); public static void Initialize() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) Variants.Clear(); Variants.Add(1, new WolfDefinition(1, "$wb_wolf_variant_1", "Wolfborn1", 0, new Color(1f, 1f, 1f, 1f), 1f)); Variants.Add(2, new WolfDefinition(2, "$wb_wolf_variant_2", "Wolfborn2", 0, new Color(0.46f, 0.46f, 0.48f, 1f), 1f)); Variants.Add(3, new WolfDefinition(3, "$wb_wolf_variant_3", "Wolfborn3", 1, new Color(1f, 1f, 1f, 1f), 1f)); Variants.Add(4, new WolfDefinition(4, "$wb_wolf_variant_4", "Wolfborn4", 1, new Color(0.46f, 0.46f, 0.48f, 1f), 1f)); Variants.Add(5, new WolfDefinition(5, "$wb_wolf_variant_5", "Wolfborn5", 2, new Color(1f, 1f, 1f, 1f), 1f)); Variants.Add(6, new WolfDefinition(6, "$wb_wolf_variant_6", "Wolfborn6", 2, new Color(0.55f, 0.55f, 0.52f, 1f), 1f)); } public static WolfDefinition GetDefinition(int id) { if (!Variants.TryGetValue(id, out var value)) { return null; } return value; } public static IEnumerable<WolfDefinition> GetAllWolves() { return Variants.Values; } } } namespace Wolfborn.Wolves { public enum WolfType { None, Companion_Standard_0Star, Companion_Gray_0Star, Companion_Standard_1Star, Companion_Gray_1Star, Companion_Standard_2Star, Companion_Gray_2Star } } namespace Wolfborn.Utils { public static class WolfbornLocalizationManager { public static void LoadEmbeddedLocalizations() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.EndsWith(".json", StringComparison.OrdinalIgnoreCase)) { continue; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { using StreamReader streamReader = new StreamReader(stream); string text2 = streamReader.ReadToEnd(); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text); string text3 = (fileNameWithoutExtension.Contains(".") ? fileNameWithoutExtension.Substring(fileNameWithoutExtension.LastIndexOf('.') + 1) : fileNameWithoutExtension); LocalizationManager.Instance.GetLocalization().AddJsonFile(text3, text2); Logger.LogInfo((object)("[Wolfborn] Embedded translation '" + text3 + "' loaded successfully!")); } } } } public static class WolfbornAssetManager { public static Sprite WolfIconSprite { get; private set; } public static Sprite TotemIconSprite { get; private set; } public static void EnsureLoaded() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType != 4) { if ((Object)(object)WolfIconSprite == (Object)null) { LoadCustomIcon(); } if ((Object)(object)TotemIconSprite == (Object)null) { LoadTotemIcon(); } } } public static void LoadAssetBundle() { EnsureLoaded(); } private static void LoadCustomIcon() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("wolf_icon.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Logger.LogError((object)"[Wolfborn] O ficheiro 'wolf_icon.png' não foi encontrado nos Recursos Embutidos (Embedded Resources)."); return; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (LoadImageToTexture(val, array)) { ((Object)val).name = "wolf_icon_texture"; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; WolfIconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); Logger.LogInfo((object)"[Wolfborn] Ícone 'wolf_icon.png' carregado com sucesso!"); } else { Logger.LogError((object)"[Wolfborn] Falha ao converter os bytes de 'wolf_icon.png' em Texture2D."); } } } private static void LoadTotemIcon() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("WolfbornTotemIcon.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Logger.LogError((object)"[Wolfborn] O ficheiro 'WolfbornTotemIcon.png' não foi encontrado nos Recursos Embutidos (Embedded Resources)."); return; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (LoadImageToTexture(val, array)) { ((Object)val).name = "totem_icon_texture"; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; TotemIconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); Logger.LogInfo((object)"[Wolfborn] Ícone 'WolfbornTotemIcon.png' carregado com sucesso!"); } else { Logger.LogError((object)"[Wolfborn] Falha ao converter os bytes de 'WolfbornTotemIcon.png' em Texture2D."); } } } private static bool LoadImageToTexture(Texture2D texture, byte[] buffer) { try { Type type = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule") ?? Type.GetType("UnityEngine.ImageConversion, UnityEngine"); if (type != null) { MethodInfo method = type.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); if (method != null) { return (bool)method.Invoke(null, new object[2] { texture, buffer }); } } } catch (Exception ex) { Logger.LogError((object)("[Wolfborn] Erro na conversão da imagem: " + ex.Message)); } return false; } public static void Unload() { if ((Object)(object)WolfIconSprite != (Object)null) { if ((Object)(object)WolfIconSprite.texture != (Object)null) { Object.Destroy((Object)(object)WolfIconSprite.texture); } Object.Destroy((Object)(object)WolfIconSprite); WolfIconSprite = null; } if ((Object)(object)TotemIconSprite != (Object)null) { if ((Object)(object)TotemIconSprite.texture != (Object)null) { Object.Destroy((Object)(object)TotemIconSprite.texture); } Object.Destroy((Object)(object)TotemIconSprite); TotemIconSprite = null; } } } } namespace Wolfborn.Network { [HarmonyPatch] public static class WolfbornRPCManager { [HarmonyPatch(typeof(Game), "Start")] [HarmonyPostfix] private static void RegisterRPCs() { if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register<ZDOID, Vector3>("Wolfborn_RequestTotemTeleport", (Action<long, ZDOID, Vector3>)RPC_RequestTotemTeleport); ZRoutedRpc.instance.Register<Vector3>("Wolfborn_TotemTeleportVFX", (Action<long, Vector3>)RPC_TotemTeleportVFX); ZRoutedRpc.instance.Register<ZDOID, int, float, bool>("Wolfborn_SyncCompanionStats", (Method<ZDOID, int, float, bool>)RPC_SyncCompanionStats); Logger.LogInfo((object)"[Wolfborn] RPCs customizados registrados com sucesso."); } } public static void BroadcastStatsUpdate(WolfbornCompanion companion) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)companion == (Object)null)) { ZNetView component = ((Component)companion).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid() && ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(0L, "Wolfborn_SyncCompanionStats", new object[4] { component.GetZDO().m_uid, companion.wolfLevel, companion.currentXP, companion.isUnconscious }); } } } private static void RPC_SyncCompanionStats(long sender, ZDOID companionID, int level, float xp, bool isUnconscious) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject val = ZNetScene.instance.FindInstance(companionID); if ((Object)(object)val != (Object)null) { WolfbornCompanion component = val.GetComponent<WolfbornCompanion>(); if ((Object)(object)component != (Object)null) { component.wolfLevel = level; component.currentXP = xp; component.isUnconscious = isUnconscious; component.RecalculateStats(); component.ApplyVisuals(); } } } private static void RPC_RequestTotemTeleport(long sender, ZDOID playerID, Vector3 totemPos) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01a9: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) if (ZDOMan.instance == null) { return; } Player playerByZDOID = GetPlayerByZDOID(playerID); int num = 0; float num2 = 2.5f; HashSet<ZDOID> hashSet = new HashSet<ZDOID>(); Vector3 val = default(Vector3); foreach (WolfbornCompanion instance in WolfbornCompanion.m_instances) { if ((Object)(object)instance == (Object)null) { continue; } bool flag = false; if ((Object)(object)playerByZDOID != (Object)null) { flag = instance.IsFollowingPlayer(playerByZDOID); } if (flag) { num++; float num3 = (float)num * 45f * ((float)Math.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Sin(num3) * num2, 0.5f, Mathf.Cos(num3) * num2); Vector3 position = totemPos + val; instance.TeleportTo(position); ZNetView component = ((Component)instance).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.GetZDO() != null) { hashSet.Add(component.GetZDO().m_uid); } } } Vector3 val2 = default(Vector3); foreach (ZDO allZDO in GetAllZDOs()) { if (allZDO != null && allZDO.IsValid() && !hashSet.Contains(allZDO.m_uid) && (allZDO.GetBool("WB_IsCompanion", false) || allZDO.GetBool(WolfbornZDOManager.Hash_IsCompanion, false))) { ZDOID zDOID = allZDO.GetZDOID("WB_FollowTarget"); if (zDOID != ZDOID.None && zDOID == playerID) { num++; float num4 = (float)num * 45f * ((float)Math.PI / 180f); ((Vector3)(ref val2))..ctor(Mathf.Sin(num4) * num2, 0.5f, Mathf.Cos(num4) * num2); Vector3 position2 = totemPos + val2; allZDO.SetPosition(position2); hashSet.Add(allZDO.m_uid); } } } if ((Object)(object)playerByZDOID != (Object)null) { if (num > 0) { ((Character)playerByZDOID).Message((MessageType)2, "$wb_msg_teleport_success", 0, (Sprite)null, false); ZRoutedRpc.instance.InvokeRoutedRPC(0L, "Wolfborn_TotemTeleportVFX", new object[1] { totemPos }); } else { ((Character)playerByZDOID).Message((MessageType)2, "$wb_msg_no_followers", 0, (Sprite)null, false); } } } private static Player GetPlayerByZDOID(ZDOID id) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (id == ZDOID.None) { return null; } foreach (Player allPlayer in Player.GetAllPlayers()) { if ((Object)(object)allPlayer != (Object)null && ((Character)allPlayer).GetZDOID() == id) { return allPlayer; } } return null; } private static IEnumerable<ZDO> GetAllZDOs() { if (ZDOMan.instance == null || !(typeof(ZDOMan).GetField("m_objectsByID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(ZDOMan.instance) is IDictionary dictionary)) { yield break; } foreach (DictionaryEntry item in dictionary) { object? value = item.Value; ZDO val = (ZDO)((value is ZDO) ? value : null); if (val != null) { yield return val; } } } private static void RPC_TotemTeleportVFX(long sender, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = ZNetScene.instance.GetPrefab("vfx_create_tamed_animal"); if ((Object)(object)prefab != (Object)null) { Object.Instantiate<GameObject>(prefab, position, Quaternion.identity); } } } } namespace Wolfborn.Configuration { public static class WolfbornConfig { public static ConfigEntry<bool> ModEnabled { get; private set; } public static ConfigEntry<bool> DebugMode { get; private set; } public static bool IsModEnabled { get { if (ModEnabled != null) { return ModEnabled.Value; } return false; } } public static bool IsDebugMode { get { if (DebugMode != null) { return DebugMode.Value; } return false; } } public static void Init(ConfigFile config) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown ModEnabled = config.Bind<bool>("1 - General", "EnableMod", true, new ConfigDescription("$wb_config_mod_enabled_desc", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); DebugMode = config.Bind<bool>("1 - General", "EnableDebug", false, new ConfigDescription("$wb_config_debug_mode_desc", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } }