using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JP_RepoHolySkills.GlobalMananger;
using JP_RepoHolySkills.MapToolControllerCustoms;
using JP_RepoHolySkills.Patches;
using JP_RepoHolySkills.Player;
using JP_RepoHolySkills.SkillSelector;
using JP_RepoHolySkills.Skills;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JP_RepoHolySkills")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: AssemblyInformationalVersion("1.1.5+d82aedec3bc0197f0984a3f480680a6d8b234fe7")]
[assembly: AssemblyProduct("RepoHolySkills")]
[assembly: AssemblyTitle("JP_RepoHolySkills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.5.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;
}
}
}
public static class ClassModConstants
{
public const string HOLY_AURA_ASSET = "HolyAura";
public const string HOLY_AURA_BUFF_ASSET = "HolyAuraBuff";
public const string HOLY_AURA_ICON_ASSET = "HolyAuraIcon";
public const string HOLY_AURA_SFX_ASSET = "HolyAuraSFX";
public const string HEAL_SKILL = "HealSkill";
public const string HEAL_SKILL_ICON = "HealSkillIcon";
public const string HEAL_SKILL_SFX = "HealSkillSFX";
public const string HEAL_REVIVE_SKILL = "HealReviveSkill";
public const string HEAL_REVIVE_SKILL_SFX = "HealReviveSkillSFX";
public const string HOLY_WALL = "HolyWall";
public const string HOLY_WALL_SFX = "HolyWallSFX";
public const string HOLY_WALL_ICON = "HolyWallIcon";
public const string SELECT_SKILL_UI = "SelectSkillUI";
public const int HAUL_TIER_INCREMENT = 500000;
public const int PLAYER_LAYER = 11;
public static readonly string[] HOLY_WAR_CRIES = new string[5] { "For the Emperor!", "Glory to His name!", "Burn the heretics!", "The Emperor wills it!", "Purge in His light!" };
public static readonly string[] HEAL_WAR_CRIES = new string[6] { "The Emperor restores us!", "His will strengthens us!", "Rise by His grace!", "No wound shall stop us!", "His mercy heals you!", "The Emperor protects!" };
public static readonly string[] HOLY_WALL_WAR_CRIES = new string[10] { "The Emperor’s shield holds!", "His light is our wall!", "None shall pass!", "Stand firm in His name!", "The righteous endure!", "Faith is our fortress!", "His will is our shield!", "This ground is sacred!", "Let them break upon us!", "The Emperor defends!" };
public static readonly string HolyAuraDescription = "Grants <b><color=#00FF00>+40% movement speed</color></b> and <b><color=#00FF00>2% stamina regen/sec</color></b> based on the caster’s max stamina to all players within range.\r\nRegen increases by <b><color=#00FF00>+2%</color></b> for each nearby player.\r\n<b>Duration:</b> <b><color=#FFD700>4 seconds</color></b>\r\n<b>Cooldown:</b> <b><color=#FF5555>90 seconds</color></b>";
public static readonly string HealDescription = "Restores <b><color=#00FF00>10 HP</color></b> to all nearby allies and grants <b><color=#00FF00>2% HP regen/sec</color></b> based on the caster’s max health.\r\nRegen increases by <b><color=#00FF00>+3%</color></b> for each nearby player.\r\n<b>Duration:</b> <b><color=#FFD700>3 seconds</color></b>\r\n<b>Cooldown:</b> <b><color=#FF5555>3 minutes</color></b>";
public static readonly string HolyWallDescription = "Summons a <b><color=#00FF00>holy barrier</color></b> that blocks movement.\r\n<b>Duration:</b> <b><color=#FFD700>3 seconds</color></b>\r\n<b>Cooldown:</b> <b><color=#FF5555>90 seconds</color></b>";
public static readonly string[] HolyAuraTierDescriptions = new string[4] { "<b><color=#FFFFFF>Cast radius <color=#00FF00>doubled</color></color></b>\r\n<size=80%><b><color=#00FFFF>Requires 500,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Stamina regen increased from <color=#00FF00>2%</color> to <color=#00FF00>4%</color></color></b>\r\n<size=80%><b><color=#00FFFF>Requires 1,000,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Sprint duration increased from <color=#00FF00>4</color> to <color=#00FF00>8</color> seconds</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 1,500,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Regen duration increased from <color=#00FF00>4</color> to <color=#00FF00>8</color> seconds</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 2,000,000 total haul extracted</color></b></size>" };
public static readonly string[] HealSkillTierDescriptions = new string[5] { "<b><color=#FFFFFF>Base heal increased from <color=#00FF00>10</color> to <color=#00FF00>20</color></color></b>\r\n<size=80%><b><color=#00FFFF>Requires 500,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Healing radius <color=#00FF00>doubled</color></color></b>\r\n<size=80%><b><color=#00FFFF>Requires 1,000,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Heal regen increased from <color=#00FF00>2%</color> to <color=#00FF00>4%</color></color></b>\r\n<size=80%><b><color=#00FFFF>Requires 1,500,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Regen duration increased from <color=#00FF00>3</color> to <color=#00FF00>6</color> seconds</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 2,000,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF><color=#00FF00>Can revive</color> all nearby allies once per game</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 2,500,000 total haul extracted</color></b></size>" };
public static readonly string[] HolyWallSkillTierDescriptions = new string[4] { "<b><color=#FFFFFF>Wall size increased by <color=#00FF00>2x</color></color></b>\r\n<size=80%><b><color=#00FFFF>Requires 500,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF>Duration increased from <color=#00FF00>3</color> to <color=#00FF00>6</color> seconds</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 1,000,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF><color=#00FF00>20%</color> chance to spawn a stun grenade</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 1,500,000 total haul extracted</color></b></size>", "<b><color=#FFFFFF><color=#00FF00>20%</color> chance to spawn a stun mine</color></b>\r\n<size=80%><b><color=#00FFFF>Requires 2,000,000 total haul extracted</color></b></size>" };
}
namespace JP_RepoHolySkills
{
public class CombinedPrefabPool : IPunPrefabPool
{
private IPunPrefabPool basePool;
private Dictionary<string, GameObject> moddedPrefabs = new Dictionary<string, GameObject>();
public CombinedPrefabPool(IPunPrefabPool basePool)
{
this.basePool = basePool;
}
public void AddModdedPrefab(string key, GameObject prefab)
{
if (!moddedPrefabs.ContainsKey(key))
{
moddedPrefabs.Add(key, prefab);
}
}
public Dictionary<string, GameObject> GetModdedPrefabs()
{
return moddedPrefabs;
}
public GameObject Instantiate(string prefabId, Vector3 position, Quaternion rotation)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (moddedPrefabs.TryGetValue(prefabId, out var value))
{
GameObject val = Object.Instantiate<GameObject>(value, position, rotation);
val.SetActive(false);
if ((Object)(object)val.GetComponent<PhotonView>() == (Object)null)
{
PhotonView val2 = val.AddComponent<PhotonView>();
}
return val;
}
return basePool.Instantiate(prefabId, position, rotation);
}
public void Destroy(GameObject gameObject)
{
basePool.Destroy(gameObject);
}
}
[BepInPlugin("JP_RepoHolySkills", "RepoHolySkills", "1.1.5")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("JP_RepoHolySkills");
public static Plugin Instance;
public static ManualLogSource Logger;
public static Dictionary<string, GameObject> AssetManager;
public static ConfigEntry<KeyboardShortcut> SkillPageHotkey;
public static ConfigEntry<KeyboardShortcut> ActivateSkillHotkey;
public ConfigEntry<string> holyWarCriesConfig;
public ConfigEntry<string> healWarCriesConfig;
public ConfigEntry<string> holyWallWarCriesConfig;
public ConfigEntry<bool> enableWarCriesConfig;
public GameObject stunGrenadePrefab;
public GameObject shockwaveGrenadePrefab;
public bool isInDebugMode = false;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin JP_RepoHolySkills is loaded!");
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
Logger.LogInfo((object)"Plugin: Instance set successfully.");
}
else
{
Logger.LogWarning((object)"Plugin: Multiple Plugin instances detected.");
}
SetupUserConfig();
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
Logger.LogInfo((object)("Plugin: DLL directory is " + directoryName));
string text = Path.Combine(directoryName, "jp_repoholyskillsprefabs");
AssetBundle val = AssetBundle.LoadFromFile(text);
AssetManager = new Dictionary<string, GameObject>();
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)("Plugin: Unable to load asset bundle from " + text));
}
else
{
Logger.LogInfo((object)"Plugin: Asset bundle loaded successfully.");
}
GameObject value = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyAura");
GameObject value2 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyAuraBuff");
GameObject value3 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyAuraIcon");
GameObject value4 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyAuraSFX");
GameObject value5 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HealSkillIcon");
GameObject value6 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HealSkillSFX");
GameObject value7 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HealSkill");
GameObject value8 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HealReviveSkill");
GameObject value9 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HealReviveSkillSFX");
GameObject value10 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyWall");
GameObject value11 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyWallSFX");
GameObject value12 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HolyWallIcon");
GameObject value13 = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "SelectSkillUI");
AssetManager.Add("HolyAura", value);
AssetManager.Add("HolyAuraBuff", value2);
AssetManager.Add("HolyAuraIcon", value3);
AssetManager.Add("HolyAuraSFX", value4);
AssetManager.Add("HealSkill", value7);
AssetManager.Add("HealSkillIcon", value5);
AssetManager.Add("HealSkillSFX", value6);
AssetManager.Add("HealReviveSkill", value8);
AssetManager.Add("HealReviveSkillSFX", value9);
AssetManager.Add("HolyWall", value10);
AssetManager.Add("HolyWallIcon", value12);
AssetManager.Add("HolyWallSFX", value11);
AssetManager.Add("SelectSkillUI", value13);
Logger.LogInfo((object)"Plugin: AssetManager populated successfully.");
harmony.PatchAll(typeof(PlayerControllerPatch));
harmony.PatchAll(typeof(MapToolControllerPatch));
harmony.PatchAll(typeof(ExtractionPointPatch));
harmony.PatchAll(typeof(PlayerAvatarPatch));
harmony.PatchAll(typeof(GameManagerPatch));
Logger.LogInfo((object)"Plugin: All Harmony patches applied successfully.");
Logger.LogInfo((object)"Plugin: Awake completed.");
}
private void SetupUserConfig()
{
//IL_0018: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
SkillPageHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "OpenSkillSelectionPage", new KeyboardShortcut((KeyCode)112, Array.Empty<KeyCode>()), "The key used to open the skill selection page. Use Unity KeyCode names: https://docs.unity3d.com/ScriptReference/KeyCode.html");
Logger.LogInfo((object)$"Config: SkillPageHotkey bound to {SkillPageHotkey.Value}");
ActivateSkillHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "ActivateSkill", new KeyboardShortcut((KeyCode)114, Array.Empty<KeyCode>()), "The key used to activate the currently selected skill. Use Unity KeyCode names: https://docs.unity3d.com/ScriptReference/KeyCode.html");
Logger.LogInfo((object)$"Config: ActivateSkillHotkey bound to {ActivateSkillHotkey.Value}");
enableWarCriesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("WarCries", "EnableWarCries", true, "Set to false to disable war cries entirely.");
Logger.LogInfo((object)$"Config: WarCries enabled = {enableWarCriesConfig.Value}");
holyWarCriesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("WarCries", "HolyWarCries", JoinDefaultsWarcries(ClassModConstants.HOLY_WAR_CRIES), "List of war cries shouted when casting holy aura (comma-separated)");
Logger.LogInfo((object)("Config: Loaded HolyWarCries = [" + holyWarCriesConfig.Value + "]"));
healWarCriesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("WarCries", "HealWarCries", JoinDefaultsWarcries(ClassModConstants.HEAL_WAR_CRIES), "List of war cries shouted when casting healing (comma-separated)");
Logger.LogInfo((object)("Config: Loaded HealWarCries = [" + healWarCriesConfig.Value + "]"));
holyWallWarCriesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("WarCries", "HolyWallWarCries", JoinDefaultsWarcries(ClassModConstants.HOLY_WALL_WAR_CRIES), "List of war cries shouted when casting holy wall (comma-separated)");
Logger.LogInfo((object)("Config: Loaded HolyWallWarCries = [" + holyWallWarCriesConfig.Value + "]"));
}
private static string JoinDefaultsWarcries(string[] array)
{
return string.Join(",", array);
}
private static void NetcodeWeaver()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
Logger.LogInfo((object)"Plugin: NetcodeWeaver executed.");
}
private T LoadAssetFromAssetBundleAndLogInfo<T>(AssetBundle bundle, string assetName) where T : Object
{
T val = bundle.LoadAsset<T>(assetName);
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)("Plugin: " + assetName + " asset failed to load."));
}
else
{
Logger.LogInfo((object)("Plugin: " + assetName + " asset successfully loaded."));
}
return val;
}
}
public class TimedDestroyer : MonoBehaviourPun
{
public float lifeTime = 10f;
private void Start()
{
((MonoBehaviour)this).StartCoroutine(SelfDestruct());
}
private IEnumerator SelfDestruct()
{
yield return (object)new WaitForSeconds(lifeTime);
if (((MonoBehaviourPun)this).photonView.IsMine)
{
PhotonNetwork.Destroy(((Component)this).gameObject);
}
}
}
public class Utility
{
public static GameObject FindSkillTierContainer(int index)
{
string text = $"SkillTier{index}Container";
return GameObject.Find(text);
}
public static GameObject FindSkillTierDescription(int index)
{
string text = $"SkillTier{index}Description";
return GameObject.Find(text);
}
public static void SetSkillTierContainerColor(int index, Color newColor)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
GameObject val = FindSkillTierContainer(index);
if ((Object)(object)val != (Object)null)
{
Image component = val.GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
((Graphic)component).color = newColor;
}
else
{
Debug.LogWarning((object)$"SkillTier{index}Container does not have an Image component.");
}
}
else
{
Debug.LogWarning((object)$"SkillTier{index}Container not found in the scene.");
}
}
public static void SetSkillTierContainerText(int index, string newText)
{
GameObject val = FindSkillTierContainer(index);
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = newText;
}
else
{
Debug.LogWarning((object)$"SkillTier{index}Container does not have a TextMeshProUGUI component.");
}
}
else
{
Debug.LogWarning((object)$"SkillTier{index}Container not found in the scene.");
}
}
public static string FormatTotalExtractedHaul(int haulAmount)
{
string text = haulAmount.ToString("N0");
return "<b><color=#FFFFFF>Total Extracted Haul:</color> <color=#00FFFF>" + text + "</color></b>";
}
public static void UpdateTotalExtractedHaulText(int extractedHaul)
{
GameObject val = GameObject.Find("SkillTotalHaulText");
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = FormatTotalExtractedHaul(extractedHaul);
}
}
}
public static void TriggerWarCry(ConfigEntry<bool> enableWarCries, ConfigEntry<string> warCriesConfig, string context, Color textColor, ChatManager chatManager)
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
if (!enableWarCries.Value)
{
Plugin.Logger.LogInfo((object)(context + ": War cries are disabled via config. Skipping trigger."));
return;
}
string[] array = (from s in warCriesConfig.Value.Split(',')
select s.Trim() into s
where !string.IsNullOrEmpty(s)
select s).ToArray();
if (array.Length == 0)
{
Plugin.Logger.LogWarning((object)(context + ": No war cries found in config. Aborting trigger."));
return;
}
int num = Random.Range(0, array.Length);
string text = array[num];
Plugin.Logger.LogInfo((object)(context + ": Selected war cry: " + text));
chatManager.PossessChatScheduleStart(10);
chatManager.PossessChat((PossessChatID)3, text, 1.5f, textColor, 0f, false, 0, (UnityEvent)null);
chatManager.PossessChatScheduleEnd();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "JP_RepoHolySkills";
public const string PLUGIN_NAME = "RepoHolySkills";
public const string PLUGIN_VERSION = "1.1.5";
}
}
namespace JP_RepoHolySkills.Skills
{
public class HealSkill : MonoBehaviour
{
public int baseHealAmount = 10;
public float healRange = 4.5f;
public float healthRegenPercentage = 0.02f;
public float regenDuration = 3f;
public GameObject healIconInstance;
public Color healUICooldownStartColor = new Color(1f, 1f, 1f, 0f);
public Color healUICooldownEndColor = Color.white;
public Color healUIColor = new Color(0f, 1f, 0f, 1f);
public float cooldownDuration = 180f;
private PhotonView pv;
private bool isOnCooldown;
private const string CANVAS_NAME = "Game Hud";
private const int UI_LAYER = 5;
private static readonly Vector3 UI_SCALE = new Vector3(13f, 13f, 13f);
private const float UI_VERTICAL_OFFSET = 40f;
private const float SOUND_VOLUME = 0.2f;
private const int BASE_HEAL_UPGRADE_THRESHOLD = 500000;
private const int DOUBLE_HEAL_RADIUS_THRESHOLD = 1000000;
private const int HEAL_REGEN_INCREASE_THRESHOLD = 1500000;
private const int REGEN_DURATION_INCREASE_THRESHOLD = 2000000;
private const int REVIVAL_THRESHOLD = 2500000;
private bool hasRevivedAll = false;
private void Start()
{
pv = ((Component)this).GetComponent<PhotonView>();
Plugin.Logger.LogInfo((object)"HealSkill: Started.");
if (Plugin.Instance.isInDebugMode)
{
cooldownDuration = 1f;
}
}
private void Update()
{
//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_0036: Unknown result type (might be due to invalid IL or missing references)
if (ShouldProcessInput() && JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.Heal)
{
SetupUIIfNeeded();
KeyboardShortcut value = Plugin.ActivateSkillHotkey.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) && !isOnCooldown)
{
ActivateHealSkill();
}
}
}
private bool ShouldProcessInput()
{
if (!SemiFunc.RunIsLevel() || !pv.IsMine)
{
return false;
}
if (IsChatActive())
{
return false;
}
return true;
}
private bool IsChatActive()
{
FieldInfo field = typeof(ChatManager).GetField("chatActive", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
return false;
}
return (bool)field.GetValue(ChatManager.instance);
}
private void SetupUIIfNeeded()
{
if (JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.Heal && (Object)(object)healIconInstance == (Object)null)
{
Plugin.Logger.LogInfo((object)"HealSkill: Rendering Heal UI for selected Heal skill.");
RenderHealUI();
}
}
private void ActivateHealSkill()
{
//IL_0045: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"HealSkill: Activated by local player.");
isOnCooldown = true;
Utility.TriggerWarCry(Plugin.Instance.enableWarCriesConfig, Plugin.Instance.healWarCriesConfig, "HealSkill", new Color(0.5f, 1f, 0.5f, 1f), ChatManager.instance);
pv.RPC("PlayHealSkillSFX_RPC", (RpcTarget)0, new object[1] { ((Component)this).transform.position });
ComputeEffectiveValues(out var effectiveBaseHeal, out var effectiveHealRange, out var effectiveRegenPercentage, out var effectiveRegenDuration, out var allowRevival, out var healParticleScaleMultiplier);
pv.RPC("PlayHealSkillParticles_RPC", (RpcTarget)0, new object[2]
{
((Component)this).transform.position,
healParticleScaleMultiplier
});
Plugin.Logger.LogInfo((object)"HealSkill: SFX and particle effects triggered.");
int num = CountAdditionalPlayers(effectiveHealRange);
ProcessRevival(effectiveHealRange, allowRevival);
float num2 = 1f + (float)num * 0.03f;
Plugin.Logger.LogInfo((object)$"HealSkill: Healing multiplier is {num2} ({num} additional players in range).");
ProcessHealing(effectiveHealRange, effectiveBaseHeal, num2, effectiveRegenPercentage, effectiveRegenDuration);
if (allowRevival)
{
hasRevivedAll = true;
}
pv.RPC("PlayHealReviveSFX_RPC", (RpcTarget)0, Array.Empty<object>());
if ((Object)(object)healIconInstance != (Object)null)
{
((MonoBehaviour)this).StartCoroutine(HealCooldownCount());
}
else
{
Plugin.Logger.LogWarning((object)"HealSkill: healIconInstance is null; cannot start cooldown transparency effect.");
}
}
private void ComputeEffectiveValues(out int effectiveBaseHeal, out float effectiveHealRange, out float effectiveRegenPercentage, out float effectiveRegenDuration, out bool allowRevival, out float healParticleScaleMultiplier)
{
int savedExtractionHaul = JPSkill_GlobalManager.Instance.savedExtractionHaul;
effectiveBaseHeal = ((savedExtractionHaul >= 500000) ? 20 : baseHealAmount);
effectiveHealRange = ((savedExtractionHaul >= 1000000) ? (healRange * 2f) : healRange);
effectiveRegenPercentage = ((savedExtractionHaul >= 1500000) ? 0.04f : healthRegenPercentage);
effectiveRegenDuration = ((savedExtractionHaul >= 2000000) ? 6f : regenDuration);
allowRevival = savedExtractionHaul >= 2500000;
healParticleScaleMultiplier = ((savedExtractionHaul >= 1000000) ? 2f : 1f);
}
private int CountAdditionalPlayers(float effectiveHealRange)
{
//IL_004a: 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)
int num = 0;
List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
foreach (PlayerAvatar item in list)
{
if (!((Object)(object)item == (Object)null) && !((Object)(object)((Component)item).gameObject == (Object)(object)((Component)this).gameObject) && Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position) <= effectiveHealRange)
{
FieldInfo field = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null && !(bool)field.GetValue(item))
{
num++;
}
}
}
return num;
}
private void ProcessRevival(float effectiveHealRange, bool allowRevival)
{
//IL_0086: 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)
List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
List<PlayerDeathHead> list2 = new List<PlayerDeathHead>();
foreach (PlayerAvatar item in list)
{
if ((Object)(object)item != (Object)null && (Object)(object)item.playerDeathHead != (Object)null)
{
list2.Add(item.playerDeathHead);
}
}
foreach (PlayerDeathHead item2 in list2)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)item2).transform.position) > effectiveHealRange)
{
continue;
}
PlayerAvatar playerAvatar = item2.playerAvatar;
FieldInfo field = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
Plugin.Logger.LogWarning((object)"HealSkill: 'deadSet' field not found in PlayerAvatar");
}
else if ((bool)field.GetValue(playerAvatar))
{
if (allowRevival && !hasRevivedAll)
{
Plugin.Logger.LogInfo((object)("HealSkill: '" + ((Object)playerAvatar).name + "' is dead. Reviving..."));
playerAvatar.Revive(false);
Plugin.Logger.LogInfo((object)("HealSkill: '" + ((Object)playerAvatar).name + "' revived successfully."));
pv.RPC("PlayHealReviveParticles_RPC", (RpcTarget)0, new object[1] { playerAvatar.photonView.ViewID });
}
else
{
Plugin.Logger.LogInfo((object)("HealSkill: '" + ((Object)playerAvatar).name + "' is dead, but revival is not allowed or already used."));
}
}
}
}
private void ProcessHealing(float effectiveHealRange, int effectiveBaseHeal, float healingMultiplier, float effectiveRegenPercentage, float effectiveRegenDuration)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
foreach (PlayerAvatar item in list)
{
if ((Object)(object)item == (Object)null)
{
Plugin.Logger.LogWarning((object)"HealSkill: Encountered a null player avatar. Skipping.");
continue;
}
float num = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position);
Plugin.Logger.LogInfo((object)$"HealSkill: Checking '{((Object)item).name}' at distance {num:F2}.");
if (num > effectiveHealRange)
{
Plugin.Logger.LogInfo((object)$"HealSkill: '{((Object)item).name}' is outside the effective heal range ({effectiveHealRange}). Skipping.");
continue;
}
PlayerHealth component = ((Component)item).GetComponent<PlayerHealth>();
if ((Object)(object)component == (Object)null)
{
Plugin.Logger.LogWarning((object)("HealSkill: '" + ((Object)item).name + "' has no PlayerHealth component. Skipping."));
continue;
}
Plugin.Logger.LogInfo((object)("HealSkill: Found PlayerHealth for '" + ((Object)item).name + "'."));
FieldInfo field = typeof(PlayerHealth).GetField("maxHealth", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
Plugin.Logger.LogWarning((object)("HealSkill: 'maxHealth' field not found in PlayerHealth for '" + ((Object)item).name + "'. Skipping."));
continue;
}
int num2 = (int)field.GetValue(component);
Plugin.Logger.LogInfo((object)$"HealSkill: '{((Object)item).name}' max health is {num2}.");
PlayerControllerCustom component2 = ((Component)item).GetComponent<PlayerControllerCustom>();
if ((Object)(object)component2 == (Object)null)
{
Plugin.Logger.LogWarning((object)("HealSkill: No PlayerControllerCustom component found on '" + ((Object)item).name + "'. Skipping."));
continue;
}
FieldInfo field2 = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.NonPublic);
if (field2 == null)
{
Plugin.Logger.LogWarning((object)("HealSkill: 'deadSet' field not found in PlayerAvatar for '" + ((Object)item).name + "'. Skipping."));
}
else if (!(bool)field2.GetValue(item))
{
int num3 = (int)((float)effectiveBaseHeal * healingMultiplier);
Plugin.Logger.LogInfo((object)$"HealSkill: Healing '{((Object)item).name}' with {num3} health (base: {effectiveBaseHeal}, multiplier: {healingMultiplier}).");
component2.StartOwnerHealRPC(num3);
int num4 = (int)((float)num2 * effectiveRegenPercentage);
Plugin.Logger.LogInfo((object)$"HealSkill: Starting health regeneration for '{((Object)item).name}' with {num4} health over {effectiveRegenDuration} seconds.");
component2.StartOwnerRPCHealthRegen(num4, effectiveRegenDuration);
}
}
}
[PunRPC]
public void PlayHealReviveParticles_RPC(int targetViewID)
{
//IL_0038: 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_0060: 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_0073: 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)
PhotonView val = PhotonView.Find(targetViewID);
if ((Object)(object)val == (Object)null)
{
Plugin.Logger.LogWarning((object)"HealSkill: Could not find player for heal revive particles.");
return;
}
GameObject gameObject = ((Component)val).gameObject;
Vector3 position = gameObject.transform.position;
if (Plugin.AssetManager.TryGetValue("HealReviveSkill", out var value))
{
Plugin.Logger.LogInfo((object)$"HealSkill: Spawning revive particle effect at {position}.");
GameObject val2 = Object.Instantiate<GameObject>(value, position, Quaternion.identity);
Plugin.Logger.LogInfo((object)$"HealSkill: Revive particles spawned for '{((Object)gameObject).name}' at {val2.transform.position}.");
val2.transform.SetParent(gameObject.transform, true);
Object.Destroy((Object)(object)val2, 5f);
}
else
{
Plugin.Logger.LogWarning((object)"HealSkill: HealReviveSkill particle asset not found!");
}
}
[PunRPC]
public void PlayHealReviveSFX_RPC()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.AssetManager.TryGetValue("HealReviveSkillSFX", out var value))
{
AudioSource component = value.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
component.volume = 0.2f;
}
Object.Instantiate<GameObject>(value, ((Component)this).transform.position, Quaternion.identity);
Plugin.Logger.LogInfo((object)"HealSkill: Heal Revive Skill SFX played.");
}
else
{
Plugin.Logger.LogWarning((object)"HealSkill: HealReviveSkillSFX asset not found!");
}
}
[PunRPC]
public void PlayHealSkillSFX_RPC(Vector3 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayHealSkillSFX(position);
}
public void PlayHealSkillSFX(Vector3 position)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.AssetManager.TryGetValue("HealSkillSFX", out var value))
{
AudioSource component = value.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
component.volume = 0.2f;
}
Object.Instantiate<GameObject>(value, position, Quaternion.identity);
ManualLogSource logger = Plugin.Logger;
Vector3 val = position;
logger.LogInfo((object)("HealSkill: HealSkillSFX played at position " + ((object)(Vector3)(ref val)).ToString()));
}
else
{
Plugin.Logger.LogWarning((object)"HealSkill: HealSkillSFX asset not found!");
}
}
[PunRPC]
public void PlayHealSkillParticles_RPC(Vector3 position, float scaleMultiplier)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayHealSkillParticles(position, scaleMultiplier);
}
public void PlayHealSkillParticles(Vector3 position, float scaleMultiplier)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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 (Plugin.AssetManager.TryGetValue("HealSkill", out var value))
{
GameObject val = Object.Instantiate<GameObject>(value, position, Quaternion.identity);
Transform transform = val.transform;
transform.localScale *= scaleMultiplier;
ManualLogSource logger = Plugin.Logger;
Vector3 val2 = position;
logger.LogInfo((object)("HealSkill: HealSkillParticles played at position " + ((object)(Vector3)(ref val2)).ToString() + " with scale multiplier " + scaleMultiplier));
}
else
{
Plugin.Logger.LogWarning((object)"HealSkill: HealSkillParticles asset not found!");
}
}
public void RenderHealUI()
{
//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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.AssetManager.TryGetValue("HealSkillIcon", out var value))
{
GameObject val = GameObject.Find("Game Hud");
if ((Object)(object)val == (Object)null)
{
Plugin.Logger.LogWarning((object)"HealSkill: 'Game Hud' canvas not found!");
return;
}
healIconInstance = Object.Instantiate<GameObject>(value, ((Component)this).transform.position, Quaternion.identity);
healIconInstance.layer = 5;
healIconInstance.transform.localScale = UI_SCALE;
healIconInstance.transform.SetParent(val.transform, false);
Rect rect = val.GetComponent<RectTransform>().rect;
float num = ((Rect)(ref rect)).height / 2f;
healIconInstance.transform.localPosition = new Vector3(0f, 40f - num, 0f);
ManualLogSource logger = Plugin.Logger;
Vector3 localPosition = healIconInstance.transform.localPosition;
logger.LogInfo((object)("HealSkill: Heal UI rendered on canvas at position " + ((object)(Vector3)(ref localPosition)).ToString()));
SpriteRenderer component = healIconInstance.GetComponent<SpriteRenderer>();
if ((Object)(object)component != (Object)null)
{
component.color = healUIColor;
Plugin.Logger.LogInfo((object)"SpawnHolyWallUI: UI color set to wallUIColor.");
}
else
{
Plugin.Logger.LogWarning((object)"SpawnHolyWallUI: No SpriteRenderer found on Holy Wall UI prefab.");
}
}
else
{
Plugin.Logger.LogWarning((object)"HealSkill: HealSkillIcon asset not found!");
}
}
private IEnumerator HealCooldownCount()
{
Plugin.Logger.LogInfo((object)"HealSkill: Heal cooldown started.");
float currentCooldown = 0f;
SpriteRenderer sr = healIconInstance.GetComponent<SpriteRenderer>();
if ((Object)(object)sr == (Object)null)
{
Plugin.Logger.LogWarning((object)"HealSkill: No SpriteRenderer found on healIconInstance.");
yield break;
}
sr.color = healUICooldownStartColor;
Plugin.Logger.LogInfo((object)"HealSkill: Initial UI color set.");
while (currentCooldown < cooldownDuration)
{
float lerpRatio = currentCooldown / cooldownDuration;
sr.color = Color.Lerp(healUICooldownStartColor, healUICooldownEndColor, lerpRatio);
currentCooldown += Time.deltaTime;
yield return null;
}
sr.color = healUIColor;
isOnCooldown = false;
Plugin.Logger.LogInfo((object)"HealSkill: Cooldown finished. UI color set to base color.");
}
}
public class HolyAuraSkill : MonoBehaviour
{
public float sprintBoostMultiplier = 1.4f;
public int auraFinalScaleValue = 8;
public float auraExpansionTime = 0.3f;
public float sprintBoostDuration = 4f;
public float staminaRegenDuration = 4f;
public float staminaRegenPercentage = 0.02f;
public float auraCooldownDuration = 90f;
public float baseAuraRange = 6.6f;
public GameObject auraIconInstance;
public Color auraUICooldownStartColor = new Color(1f, 1f, 1f, 0f);
public Color auraUICooldownEndColor = Color.white;
public Color auraUIColor = new Color(0f, 1f, 0f, 1f);
private PhotonView pv;
private const string CANVAS_NAME = "Game Hud";
private const int UI_LAYER = 5;
private static readonly Vector3 UI_SCALE = new Vector3(13f, 13f, 13f);
private const float UI_VERTICAL_OFFSET = 40f;
private static readonly Vector3 BUFF_PARTICLES_OFFSET = new Vector3(0f, 1f, 0f);
private const float SOUND_VOLUME = 0.2f;
private bool isAuraOnCooldown;
private float currentAuraCooldown;
private bool hasUIBeenSetup;
private void Start()
{
Plugin.Logger.LogInfo((object)"HolyAuraSkill Start: Initializing skill.");
isAuraOnCooldown = false;
pv = ((Component)this).GetComponent<PhotonView>();
if (Plugin.Instance.isInDebugMode)
{
auraCooldownDuration = 1f;
}
Plugin.Logger.LogInfo((object)"HolyAuraSkill Start: Initialization complete.");
}
private void Update()
{
//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_0036: Unknown result type (might be due to invalid IL or missing references)
if (ShouldProcessInput() && JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.HolyAura)
{
SetupUIIfNeeded();
KeyboardShortcut value = Plugin.ActivateSkillHotkey.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) && !isAuraOnCooldown)
{
ActivateAuraSkill();
}
}
}
private bool ShouldProcessInput()
{
if (!SemiFunc.RunIsLevel() || !pv.IsMine)
{
return false;
}
if (IsChatActive())
{
return false;
}
return true;
}
private bool IsChatActive()
{
FieldInfo field = typeof(ChatManager).GetField("chatActive", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
return false;
}
return (bool)field.GetValue(ChatManager.instance);
}
private void SetupUIIfNeeded()
{
if (JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.HolyAura && !hasUIBeenSetup)
{
Plugin.Logger.LogInfo((object)"HolyAuraSkill Update: HolyAura skill selected; setting up UI.");
SpawnAuraUI();
}
}
private void ActivateAuraSkill()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"HolyAuraSkill Update: R key pressed, activating Holy Aura skill.");
isAuraOnCooldown = true;
pv.RPC("ActivateAuraSFX_RPC", (RpcTarget)0, new object[1] { ((Component)this).transform.position });
((MonoBehaviour)this).StartCoroutine(AuraCooldownCount());
Utility.TriggerWarCry(Plugin.Instance.enableWarCriesConfig, Plugin.Instance.holyWarCriesConfig, "HolyAura", new Color(1f, 0.85f, 0.45f, 1f), ChatManager.instance);
float num = JPSkill_GlobalManager.Instance.savedExtractionHaul;
float num2 = ((num >= 500000f) ? 2f : 1f);
pv.RPC("ExpandAura_RPC", (RpcTarget)0, new object[2]
{
((Component)this).transform.position,
num2
});
Plugin.Logger.LogInfo((object)("HolyAuraSkill Update: ExpandAura_RPC called with scale multiplier " + num2 + "."));
ApplyBuffsToPlayers();
}
private void ApplyBuffsToPlayers()
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
float num = JPSkill_GlobalManager.Instance.savedExtractionHaul;
float num2 = baseAuraRange;
if (num >= 500000f)
{
num2 *= 2f;
}
int num3 = 0;
List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
foreach (PlayerAvatar item in list)
{
if (!((Object)(object)item == (Object)null) && !((Object)(object)((Component)item).gameObject == (Object)(object)((Component)this).gameObject) && Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position) <= num2)
{
FieldInfo field = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null && !(bool)field.GetValue(item))
{
num3++;
}
}
}
float num4 = ((num >= 1000000f) ? 0.04f : 0.02f);
float num5 = num4 + (float)num3 * 0.02f;
float duration = ((num >= 1500000f) ? 8f : sprintBoostDuration);
float duration2 = ((num >= 2000000f) ? 8f : staminaRegenDuration);
Plugin.Logger.LogInfo((object)$"HolyAuraSkill: {num3} additional players in range; effective regen percentage is {num5 * 100f}%.");
foreach (PlayerAvatar item2 in list)
{
if ((Object)(object)item2 == (Object)null)
{
Plugin.Logger.LogWarning((object)"HolyAuraSkill: Encountered null player avatar. Skipping.");
continue;
}
float num6 = Vector3.Distance(((Component)this).transform.position, ((Component)item2).transform.position);
if (num6 > num2)
{
Plugin.Logger.LogInfo((object)$"HolyAuraSkill: '{((Object)item2).name}' is outside the effective aura range ({num2}). Skipping.");
continue;
}
Plugin.Logger.LogInfo((object)("HolyAuraSkill: Applying buffs to '" + ((Object)item2).name + "'."));
PlayerControllerCustom component = ((Component)item2).GetComponent<PlayerControllerCustom>();
int viewID = ((Component)item2).GetComponent<PhotonView>().ViewID;
component.StartOwnerRPCSprintBoost(sprintBoostMultiplier, duration);
component.StartOwnerRPCRegenStamina(PlayerController.instance.EnergyStart * num5, duration2);
}
}
public void SpawnAuraUI()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_015b: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"SpawnAuraUI: Setting up Holy Aura UI.");
hasUIBeenSetup = true;
if (Plugin.AssetManager.TryGetValue("HolyAuraIcon", out var value))
{
GameObject val = GameObject.Find("Game Hud");
if ((Object)(object)val == (Object)null)
{
Plugin.Logger.LogWarning((object)"SpawnAuraUI: 'Game Hud' canvas not found!");
return;
}
auraIconInstance = Object.Instantiate<GameObject>(value, ((Component)this).transform.position, Quaternion.identity);
auraIconInstance.layer = 5;
auraIconInstance.transform.localScale = UI_SCALE;
auraIconInstance.transform.SetParent(val.transform, false);
Rect rect = val.GetComponent<RectTransform>().rect;
float num = ((Rect)(ref rect)).height / 2f;
auraIconInstance.transform.localPosition = new Vector3(0f, 40f - num, 0f);
ManualLogSource logger = Plugin.Logger;
Vector3 localPosition = auraIconInstance.transform.localPosition;
logger.LogInfo((object)("SpawnAuraUI: Holy Aura UI added to canvas at position: " + ((object)(Vector3)(ref localPosition)).ToString()));
if (!isAuraOnCooldown)
{
SpriteRenderer component = auraIconInstance.GetComponent<SpriteRenderer>();
if ((Object)(object)component != (Object)null)
{
component.color = auraUIColor;
Plugin.Logger.LogInfo((object)"SpawnAuraUI: UI color set to auraUIColor.");
}
else
{
Plugin.Logger.LogWarning((object)"SpawnAuraUI: No SpriteRenderer found on Holy Aura UI prefab.");
}
}
}
else
{
Plugin.Logger.LogWarning((object)"SpawnAuraUI: Holy Aura icon asset not found!");
}
}
private IEnumerator AuraCooldownCount()
{
Plugin.Logger.LogInfo((object)"AuraCooldownCount: Cooldown started.");
currentAuraCooldown = 0f;
SpriteRenderer auraSprite = auraIconInstance.GetComponent<SpriteRenderer>();
auraSprite.color = Color.white;
while (currentAuraCooldown < auraCooldownDuration)
{
Color lerpedColor = Color.Lerp(auraUICooldownStartColor, auraUICooldownEndColor, currentAuraCooldown / auraCooldownDuration);
auraSprite.color = lerpedColor;
currentAuraCooldown += Time.deltaTime;
yield return null;
}
auraSprite.color = auraUIColor;
isAuraOnCooldown = false;
Plugin.Logger.LogInfo((object)"AuraCooldownCount: Cooldown finished. UI color reset.");
}
[PunRPC]
private void ActivateAuraSFX_RPC(Vector3 position)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource logger = Plugin.Logger;
Vector3 val = position;
logger.LogInfo((object)("ActivateAuraSFX_RPC: Called at position " + ((object)(Vector3)(ref val)).ToString()));
ActivateAuraSFX(position);
}
private void ActivateAuraSFX(Vector3 position)
{
//IL_0038: 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_004e: 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)
if (Plugin.AssetManager.TryGetValue("HolyAuraSFX", out var value))
{
AudioSource component = value.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
component.volume = 0.2f;
}
Object.Instantiate<GameObject>(value, position, Quaternion.identity);
ManualLogSource logger = Plugin.Logger;
Vector3 val = position;
logger.LogInfo((object)("ActivateAuraSFX: Sound effect instantiated at " + ((object)(Vector3)(ref val)).ToString()));
}
else
{
Plugin.Logger.LogWarning((object)"ActivateAuraSFX: Holy Aura SFX asset not found!");
}
}
[PunRPC]
public void ExpandAura_RPC(Vector3 position, float scaleMultiplier)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource logger = Plugin.Logger;
Vector3 val = position;
logger.LogInfo((object)("ExpandAura_RPC: Spawning Holy Aura effect at " + ((object)(Vector3)(ref val)).ToString() + " with scale multiplier " + scaleMultiplier));
if (Plugin.AssetManager.TryGetValue("HolyAura", out var value))
{
((MonoBehaviour)this).StartCoroutine(ExpandAuraEffect(value, position, scaleMultiplier));
}
else
{
Plugin.Logger.LogWarning((object)"ExpandAura_RPC: Holy Aura asset not found!");
}
}
private IEnumerator ExpandAuraEffect(GameObject auraPrefab, Vector3 position, float scaleMultiplier)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"ExpandAuraEffect: Instantiating Holy Aura effect.");
GameObject spawnedAura = Object.Instantiate<GameObject>(auraPrefab, position, Quaternion.identity);
float elapsed = 0f;
Vector3 initialScale = Vector3.zero;
Vector3 targetScale = new Vector3((float)auraFinalScaleValue, (float)auraFinalScaleValue, (float)auraFinalScaleValue) * scaleMultiplier;
while (elapsed < auraExpansionTime)
{
spawnedAura.transform.localScale = Vector3.Lerp(initialScale, targetScale, elapsed / auraExpansionTime);
elapsed += Time.deltaTime;
yield return null;
}
spawnedAura.transform.localScale = targetScale;
ManualLogSource logger = Plugin.Logger;
Vector3 val = targetScale;
logger.LogInfo((object)("ExpandAuraEffect: Final scale set to " + ((object)(Vector3)(ref val)).ToString()));
ParticleSystem ps = spawnedAura.GetComponent<ParticleSystem>();
float num;
if (!((Object)(object)ps != (Object)null))
{
num = 1.5f;
}
else
{
MainModule main = ps.main;
num = ((MainModule)(ref main)).duration + 1.5f;
}
float effectDuration = num;
Plugin.Logger.LogInfo((object)("ExpandAuraEffect: Waiting " + effectDuration + " seconds before destroying the aura effect."));
yield return (object)new WaitForSeconds(effectDuration);
Plugin.Logger.LogInfo((object)"ExpandAuraEffect: Destroying Holy Aura effect.");
if ((Object)(object)spawnedAura != (Object)null)
{
Object.Destroy((Object)(object)spawnedAura);
}
}
[PunRPC]
public void SpawnAuraBuffParticles_RPC(int avatarViewID)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
PhotonView val = PhotonView.Find(avatarViewID);
if ((Object)(object)val != (Object)null)
{
GameObject gameObject = ((Component)val).gameObject;
if (Plugin.AssetManager.TryGetValue("HolyAuraBuff", out var value))
{
Vector3 val2 = gameObject.transform.position + BUFF_PARTICLES_OFFSET;
Quaternion identity = Quaternion.identity;
Object.Instantiate<GameObject>(value, val2, identity);
GameObject val3 = Object.Instantiate<GameObject>(value, val2, identity, gameObject.transform);
Plugin.Logger.LogInfo((object)$"SpawnAuraBuffParticles_RPC: Buff particles spawned and attached to '{((Object)gameObject).name}' (ViewID: {avatarViewID}).");
}
else
{
Plugin.Logger.LogWarning((object)"SpawnAuraBuffParticles_RPC: Buff particles asset not found!");
}
}
else
{
Plugin.Logger.LogWarning((object)("SpawnAuraBuffParticles_RPC: Avatar with ViewID " + avatarViewID + " not found."));
}
}
}
public class HolyWallSkill : MonoBehaviour
{
public PhotonView photonView;
public float skillDuration = 3f;
public float cooldownDuration = 180f;
public GameObject holyWallIconInstance;
public Color wallUICooldownStartColor = new Color(1f, 1f, 1f, 0f);
public Color wallUICooldownEndColor = Color.white;
public Color wallUIColor = new Color(0f, 1f, 0f, 1f);
private const string CANVAS_NAME = "Game Hud";
private const int UI_LAYER = 5;
private static readonly Vector3 UI_SCALE = new Vector3(13f, 13f, 13f);
private const float UI_VERTICAL_OFFSET = 40f;
private bool isWallOnCooldown;
private float currentWallCooldown;
private bool wallUISetup;
private const float GRENADE_SPAWN_CHANCE = 0.2f;
private const float MINE_SPAWN_CHANCE = 0.2f;
private const float FORWARD_OFFSET = 2f;
private const float UP_OFFSET = 1f;
private const float ADDITIONAL_SPAWN_DISTANCE = 1f;
private const float EXTRACTION_THRESHOLD_SCALE = 500000f;
private const float EXTRACTION_THRESHOLD_DURATION = 1000000f;
private const float EXTRACTION_THRESHOLD_GRENADE = 1500000f;
private const float EXTRACTION_THRESHOLD_MINE = 2000000f;
private void Start()
{
Plugin.Logger.LogInfo((object)"HolyWallSkill: Initializing skill.");
photonView = ((Component)this).GetComponent<PhotonView>();
isWallOnCooldown = false;
wallUISetup = false;
if (Plugin.Instance.isInDebugMode)
{
cooldownDuration = 1f;
}
Plugin.Logger.LogInfo((object)"HolyWallSkill: Initialization complete.");
}
private void Update()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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)
if (!CanActivateSkill() || JPSkill_GlobalManager.Instance.selectedSkill != 0)
{
return;
}
SetupUIIfNeeded();
if (!isWallOnCooldown)
{
KeyboardShortcut value = Plugin.ActivateSkillHotkey.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
ActivateHolyWallSkill();
}
}
}
private bool CanActivateSkill()
{
if (!SemiFunc.RunIsLevel() || !photonView.IsMine)
{
return false;
}
FieldInfo field = typeof(ChatManager).GetField("chatActive", BindingFlags.Instance | BindingFlags.NonPublic);
bool flag = (bool)field.GetValue(ChatManager.instance);
return !flag;
}
private void SetupUIIfNeeded()
{
if (JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.HolyWall && !wallUISetup)
{
SpawnHolyWallUI();
}
}
public void SpawnHolyWallUI()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_014b: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"SpawnHolyWallUI: Setting up Holy Wall UI.");
wallUISetup = true;
if (Plugin.AssetManager.TryGetValue("HolyWallIcon", out var value))
{
GameObject val = GameObject.Find("Game Hud");
if ((Object)(object)val == (Object)null)
{
Plugin.Logger.LogWarning((object)"SpawnHolyWallUI: 'Game Hud' canvas not found!");
return;
}
holyWallIconInstance = Object.Instantiate<GameObject>(value, ((Component)this).transform.position, Quaternion.identity);
holyWallIconInstance.layer = 5;
holyWallIconInstance.transform.localScale = UI_SCALE;
holyWallIconInstance.transform.SetParent(val.transform, false);
Rect rect = val.GetComponent<RectTransform>().rect;
float num = ((Rect)(ref rect)).height / 2f;
holyWallIconInstance.transform.localPosition = new Vector3(0f, 40f - num, 0f);
ManualLogSource logger = Plugin.Logger;
Vector3 localPosition = holyWallIconInstance.transform.localPosition;
logger.LogInfo((object)("SpawnHolyWallUI: Holy Wall UI added at position: " + ((object)(Vector3)(ref localPosition)).ToString()));
SpriteRenderer component = holyWallIconInstance.GetComponent<SpriteRenderer>();
if ((Object)(object)component != (Object)null)
{
component.color = wallUIColor;
Plugin.Logger.LogInfo((object)"SpawnHolyWallUI: UI color set to wallUIColor.");
}
else
{
Plugin.Logger.LogWarning((object)"SpawnHolyWallUI: No SpriteRenderer found on Holy Wall UI prefab.");
}
}
else
{
Plugin.Logger.LogWarning((object)"SpawnHolyWallUI: Holy Wall icon asset not found!");
}
}
private void ActivateHolyWallSkill()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"HolyWallSkill: F key pressed, activating Holy Wall skill.");
isWallOnCooldown = true;
((MonoBehaviour)this).StartCoroutine(WallCooldownCount());
PlayHolyWallSFX();
if (!Plugin.AssetManager.TryGetValue("HolyWall", out var _))
{
Plugin.Logger.LogWarning((object)"HolyWallSkill: Holy Wall asset not found!");
return;
}
Plugin.Logger.LogInfo((object)"HolyWallSkill: Holy Wall asset found. Instantiating...");
Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 2f + Vector3.up * 1f;
Quaternion rotation = ((Component)this).transform.rotation;
GameObject val2 = PhotonNetwork.Instantiate("HolyWall", val, rotation, (byte)0, (object[])null);
AdjustHolyWallScale(val2);
float effectiveDuration = GetEffectiveDuration();
TimedDestroyer timedDestroyer = val2.AddComponent<TimedDestroyer>();
timedDestroyer.lifeTime = effectiveDuration;
TryRequestGrenadeSpawn();
TryRequestMineSpawn();
Utility.TriggerWarCry(Plugin.Instance.enableWarCriesConfig, Plugin.Instance.holyWallWarCriesConfig, "HolyWallSkill", new Color(0.5f, 0.7f, 1f, 1f), ChatManager.instance);
}
private IEnumerator WallCooldownCount()
{
Plugin.Logger.LogInfo((object)"WallCooldownCount: Cooldown started.");
currentWallCooldown = 0f;
if ((Object)(object)holyWallIconInstance == (Object)null)
{
Plugin.Logger.LogWarning((object)"WallCooldownCount: holyWallIconInstance is null. Exiting cooldown coroutine.");
yield break;
}
SpriteRenderer wallSprite = holyWallIconInstance.GetComponent<SpriteRenderer>();
if ((Object)(object)wallSprite == (Object)null)
{
Plugin.Logger.LogWarning((object)"WallCooldownCount: SpriteRenderer not found on holyWallIconInstance. Exiting cooldown coroutine.");
yield break;
}
wallSprite.color = Color.white;
while (currentWallCooldown < cooldownDuration)
{
Color lerpedColor = Color.Lerp(wallUICooldownStartColor, wallUICooldownEndColor, currentWallCooldown / cooldownDuration);
wallSprite.color = lerpedColor;
currentWallCooldown += Time.deltaTime;
yield return null;
}
wallSprite.color = wallUIColor;
isWallOnCooldown = false;
Plugin.Logger.LogInfo((object)"WallCooldownCount: Cooldown finished. UI color reset.");
}
private void PlayHolyWallSFX()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.AssetManager.TryGetValue("HolyWallSFX", out var value))
{
AudioSource component = value.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
component.volume = 0.2f;
}
Object.Instantiate<GameObject>(value, ((Component)this).transform.position, Quaternion.identity);
Plugin.Logger.LogInfo((object)"HolyWallSkill: Holy Wall SFX played.");
}
else
{
Plugin.Logger.LogWarning((object)"HolyWallSkill: HolyWallSFX asset not found!");
}
}
private void AdjustHolyWallScale(GameObject spawnedWall)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0072: Unknown result type (might be due to invalid IL or missing references)
float scaleMultiplier = GetScaleMultiplier();
Vector3 localScale = spawnedWall.transform.localScale;
localScale.x *= scaleMultiplier;
localScale.y *= scaleMultiplier;
int viewID = spawnedWall.GetComponent<PhotonView>().ViewID;
photonView.RPC("SetHolyWallScale_RPC", (RpcTarget)0, new object[2] { viewID, localScale });
Plugin.Logger.LogInfo((object)$"HolyWallSkill: Holy Wall instantiated at {spawnedWall.transform.position} with scale multiplier: {scaleMultiplier}.");
}
private float GetScaleMultiplier()
{
float playerExtractionHaul = GetPlayerExtractionHaul();
return (playerExtractionHaul >= 500000f) ? 2f : 1.5f;
}
private float GetPlayerExtractionHaul()
{
return JPSkill_GlobalManager.Instance.savedExtractionHaul;
}
private float GetEffectiveDuration()
{
float playerExtractionHaul = GetPlayerExtractionHaul();
return (playerExtractionHaul >= 1000000f) ? 6f : skillDuration;
}
private void TryRequestGrenadeSpawn()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_0096: Unknown result type (might be due to invalid IL or missing references)
float playerExtractionHaul = GetPlayerExtractionHaul();
if (playerExtractionHaul >= 1500000f)
{
if (Random.value <= 0.2f)
{
Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 1f + Vector3.up * 1f;
Quaternion rotation = ((Component)this).transform.rotation;
photonView.RPC("RequestGrenadeSpawn", (RpcTarget)2, new object[2] { val, rotation });
Plugin.Logger.LogInfo((object)"HolyWallSkill: Grenade spawn requested.");
}
else
{
Plugin.Logger.LogInfo((object)"HolyWallSkill: Grenade spawn chance failed.");
}
}
else
{
Plugin.Logger.LogInfo((object)"HolyWallSkill: Extraction haul below threshold for grenade spawn.");
}
}
private void TryRequestMineSpawn()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_0096: Unknown result type (might be due to invalid IL or missing references)
float playerExtractionHaul = GetPlayerExtractionHaul();
if (playerExtractionHaul >= 2000000f)
{
if (Random.value <= 0.2f)
{
Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 1f + Vector3.up * 1f;
Quaternion rotation = ((Component)this).transform.rotation;
photonView.RPC("RequestMineSpawn", (RpcTarget)2, new object[2] { val, rotation });
Plugin.Logger.LogInfo((object)"HolyWallSkill: Mine spawn requested.");
}
else
{
Plugin.Logger.LogInfo((object)"HolyWallSkill: Mine spawn chance failed.");
}
}
else
{
Plugin.Logger.LogInfo((object)"HolyWallSkill: Extraction haul below threshold for mine spawn.");
}
}
[PunRPC]
public void RequestGrenadeSpawn(Vector3 spawnPos, Quaternion spawnRot)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient)
{
GameObject val = PhotonNetwork.Instantiate("Items/Item Grenade Stun", spawnPos, spawnRot, (byte)0, (object[])null);
Plugin.Logger.LogInfo((object)$"HolyWallSkill: Grenade spawned at {spawnPos} with rotation {((Quaternion)(ref spawnRot)).eulerAngles}");
}
}
[PunRPC]
public void RequestMineSpawn(Vector3 spawnPos, Quaternion spawnRot)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient)
{
GameObject val = PhotonNetwork.Instantiate("Items/Item Mine Stun", spawnPos, spawnRot, (byte)0, (object[])null);
Plugin.Logger.LogInfo((object)$"HolyWallSkill: Mine spawned at {spawnPos} with rotation {((Quaternion)(ref spawnRot)).eulerAngles}");
}
}
[PunRPC]
private void SetHolyWallScale_RPC(int spawnedWallViewID, Vector3 newScale)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
PhotonView val = PhotonView.Find(spawnedWallViewID);
if ((Object)(object)val != (Object)null)
{
GameObject gameObject = ((Component)val).gameObject;
gameObject.transform.localScale = newScale;
Plugin.Logger.LogInfo((object)"HolyWallSkill: Scale updated for Holy Wall.");
}
else
{
Plugin.Logger.LogWarning((object)"HolyWallSkill: Holy Wall not found for scaling update!");
}
}
}
}
namespace JP_RepoHolySkills.SkillSelector
{
public enum SelectableSkills
{
HolyWall,
HolyAura,
Heal,
None
}
public class SkillSelectorController : MonoBehaviour
{
public string currentSkillDescription = "";
public bool hasSetupSkillUI = false;
public bool isSelectSkillUIShowing = false;
private GameObject spawnedSelectSkillUI;
public static SkillSelectorController Instance;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
Plugin.Logger.LogInfo((object)"SkillSelectorController Awake: Instance set successfully.");
}
else
{
Plugin.Logger.LogWarning((object)"SkillSelectorController Awake: Duplicate instance detected!");
}
}
private void Start()
{
Plugin.Logger.LogInfo((object)"SkillSelectorController Start: Initializing Skill Selector UI.");
SetupSelectSkillUI();
}
private void Update()
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
FieldInfo field = typeof(ChatManager).GetField("chatActive", BindingFlags.Instance | BindingFlags.NonPublic);
if ((bool)field.GetValue(ChatManager.instance) || SemiFunc.RunIsLevel() || SemiFunc.RunIsShop())
{
return;
}
Utility.UpdateTotalExtractedHaulText(JPSkill_GlobalManager.Instance.savedExtractionHaul);
KeyboardShortcut value = Plugin.SkillPageHotkey.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
Plugin.Logger.LogInfo((object)"SkillSelectorController Update: P key pressed to toggle Skill Selector UI.");
if ((Object)(object)spawnedSelectSkillUI == (Object)null)
{
Plugin.Logger.LogWarning((object)"SkillSelectorController Update: spawnedSelectSkillUI is null. Attempting to reinitialize UI.");
hasSetupSkillUI = false;
SetupSelectSkillUI();
}
if ((Object)(object)spawnedSelectSkillUI != (Object)null)
{
if (isSelectSkillUIShowing)
{
Plugin.Logger.LogInfo((object)"SkillSelectorController Update: Hiding Skill Selector UI.");
spawnedSelectSkillUI.SetActive(false);
}
else
{
Plugin.Logger.LogInfo((object)"SkillSelectorController Update: Showing Skill Selector UI.");
spawnedSelectSkillUI.SetActive(true);
AutoSelectSkillUI();
}
isSelectSkillUIShowing = !isSelectSkillUIShowing;
}
else
{
Plugin.Logger.LogError((object)"SkillSelectorController Update: Failed to initialize Skill Selector UI; spawnedSelectSkillUI is still null.");
}
}
if (isSelectSkillUIShowing)
{
HandleSkillSeletorMenuInput();
}
}
public void HandleSkillSeletorMenuInput()
{
if (Input.GetKeyDown((KeyCode)49))
{
SelectHolyAuraSkill();
}
else if (Input.GetKeyDown((KeyCode)50))
{
SelectHealSkill();
}
else if (Input.GetKeyDown((KeyCode)51))
{
SelectHolyWallSkill();
}
}
private void AutoSelectSkillUI()
{
if (JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.HolyAura)
{
SelectHolyAuraSkill();
}
else if (JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.Heal)
{
SelectHealSkill();
}
else if (JPSkill_GlobalManager.Instance.selectedSkill == SelectableSkills.HolyWall)
{
SelectHolyWallSkill();
}
}
private void SelectHolyAuraSkill()
{
Plugin.Logger.LogInfo((object)"SkillSelectorController: Alpha1 pressed - Selecting HolyAura skill.");
JPSkill_GlobalManager.Instance.selectedSkill = SelectableSkills.HolyAura;
currentSkillDescription = ClassModConstants.HolyAuraDescription;
SetSkillPointers(auraEnabled: true, healEnabled: false, wallEnabled: false);
UpdateSkillDescriptionText(currentSkillDescription);
ClearSkillTierDescriptions(5);
UpdateSkillTierContainers(5);
UpdateSkillTierDescriptions(ClassModConstants.HolyAuraTierDescriptions);
}
private void SelectHealSkill()
{
Plugin.Logger.LogInfo((object)"SkillSelectorController: Alpha2 pressed - Selecting Heal skill.");
JPSkill_GlobalManager.Instance.selectedSkill = SelectableSkills.Heal;
currentSkillDescription = ClassModConstants.HealDescription;
SetSkillPointers(auraEnabled: false, healEnabled: true, wallEnabled: false);
UpdateSkillDescriptionText(currentSkillDescription);
ClearSkillTierDescriptions(5);
UpdateSkillTierContainers(5);
UpdateSkillTierDescriptions(ClassModConstants.HealSkillTierDescriptions);
}
private void SelectHolyWallSkill()
{
Plugin.Logger.LogInfo((object)"SkillSelectorController: Alpha3 pressed - Selecting Holy Wall skill.");
JPSkill_GlobalManager.Instance.selectedSkill = SelectableSkills.HolyWall;
currentSkillDescription = ClassModConstants.HolyWallDescription;
SetSkillPointers(auraEnabled: false, healEnabled: false, wallEnabled: true);
UpdateSkillDescriptionText(currentSkillDescription);
ClearSkillTierDescriptions(5);
UpdateSkillTierContainers(5);
UpdateSkillTierDescriptions(ClassModConstants.HolyWallSkillTierDescriptions);
}
private void SetSkillPointers(bool auraEnabled, bool healEnabled, bool wallEnabled)
{
GameObject val = GameObject.Find("HolyAuraPointer");
if ((Object)(object)val != (Object)null)
{
RawImage component = val.GetComponent<RawImage>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = auraEnabled;
}
}
else
{
Plugin.Logger.LogWarning((object)"HolyAuraPointer not found.");
}
GameObject val2 = GameObject.Find("HealPointer");
if ((Object)(object)val2 != (Object)null)
{
RawImage component2 = val2.GetComponent<RawImage>();
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = healEnabled;
}
}
else
{
Plugin.Logger.LogWarning((object)"HealPointer not found.");
}
GameObject val3 = GameObject.Find("HolyWallPointer");
if ((Object)(object)val3 != (Object)null)
{
RawImage component3 = val3.GetComponent<RawImage>();
if ((Object)(object)component3 != (Object)null)
{
((Behaviour)component3).enabled = wallEnabled;
}
}
else
{
Plugin.Logger.LogWarning((object)"HolyWallPointer not found.");
}
}
private void UpdateSkillDescriptionText(string description)
{
GameObject val = GameObject.Find("JP_SkillDescriptionText");
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = description;
}
else
{
Plugin.Logger.LogWarning((object)"JP_SkillDescriptionText does not have a TextMeshProUGUI component.");
}
}
else
{
Plugin.Logger.LogWarning((object)"JP_SkillDescriptionText not found.");
}
}
private void ClearSkillTierDescriptions(int numberOfTiers)
{
for (int i = 1; i <= numberOfTiers; i++)
{
GameObject val = Utility.FindSkillTierDescription(i);
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = "";
Plugin.Logger.LogInfo((object)$"SkillTier{i}Description text cleared.");
}
else
{
Plugin.Logger.LogWarning((object)$"SkillTier{i}Description GameObject does not have a TextMeshProUGUI component.");
}
}
else
{
Plugin.Logger.LogWarning((object)$"SkillTier{i}Description not found in the scene.");
}
}
}
private void UpdateSkillTierContainers(int numberOfTiers)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
for (int i = 1; i <= numberOfTiers; i++)
{
if (JPSkill_GlobalManager.Instance.savedExtractionHaul >= i * 500000)
{
Utility.SetSkillTierContainerColor(i, new Color(0.5235849f, 1f, 0.5453033f, 0.3921569f));
}
else
{
Utility.SetSkillTierContainerColor(i, new Color(1f, 1f, 1f, 0.4f));
}
}
}
private void UpdateSkillTierDescriptions(string[] descriptions)
{
for (int i = 1; i <= descriptions.Length; i++)
{
GameObject val = Utility.FindSkillTierDescription(i);
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = "";
((TMP_Text)component).text = descriptions[i - 1];
Plugin.Logger.LogInfo((object)$"SkillTier{i}Description text set successfully.");
}
else
{
Plugin.Logger.LogWarning((object)$"SkillTier{i}Description GameObject does not have a TextMeshProUGUI component.");
}
}
else
{
Plugin.Logger.LogWarning((object)$"SkillTier{i}Description not found in the scene.");
}
}
}
public void SetupSelectSkillUI()
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: 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_0139: Unknown result type (might be due to invalid IL or missing references)
if (hasSetupSkillUI && (Object)(object)spawnedSelectSkillUI != (Object)null)
{
Plugin.Logger.LogInfo((object)"SkillSelectorController: SetupSelectSkillUI already executed. Skipping.");
return;
}
hasSetupSkillUI = true;
Plugin.Logger.LogInfo((object)"SkillSelectorController: Setting up Skill Selector UI.");
if (Plugin.AssetManager.TryGetValue("SelectSkillUI", out var value))
{
GameObject val = GameObject.Find("Game Hud");
if ((Object)(object)val == (Object)null)
{
Plugin.Logger.LogWarning((object)"SkillSelectorController: 'Game Hud' canvas not found.");
return;
}
spawnedSelectSkillUI = Object.Instantiate<GameObject>(value, ((Component)this).transform.position, Quaternion.identity);
spawnedSelectSkillUI.SetActive(false);
spawnedSelectSkillUI.layer = 5;
spawnedSelectSkillUI.transform.SetParent(val.transform, false);
RectTransform component = val.GetComponent<RectTransform>();
Rect rect = component.rect;
float width = ((Rect)(ref rect)).width;
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(width - width / 2f - 150f, -30f, 0f);
spawnedSelectSkillUI.transform.localPosition = val2;
ManualLogSource logger = Plugin.Logger;
Vector3 val3 = val2;
logger.LogInfo((object)("SkillSelectorController: UI setup complete, added to canvas at local position " + ((object)(Vector3)(ref val3)).ToString()));
}
else
{
Plugin.Logger.LogWarning((object)"SkillSelectorController: SELECT_SKILL_UI asset not found in AssetManager!");
}
}
}
}
namespace JP_RepoHolySkills.Player
{
internal class PlayerControllerCustom : MonoBehaviour
{
public PhotonView photonView;
public HealSkill healSkill;
public HolyAuraSkill holyAuraSkill;
public HolyWallSkill holyWallSkill;
public Coroutine boostSprintCoroutine;
public Coroutine staminaRegenCoroutine;
public Coroutine healthRegenCoroutine;
public PlayerHealth playerHealth;
private void Start()
{
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Start called.");
photonView = ((Component)this).GetComponent<PhotonView>();
playerHealth = ((Component)this).GetComponent<PlayerHealth>();
healSkill = ((Component)this).gameObject.AddComponent<HealSkill>();
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: HealSkill component added.");
holyAuraSkill = ((Component)this).gameObject.AddComponent<HolyAuraSkill>();
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: HolyAuraSkill component added.");
holyWallSkill = ((Component)this).gameObject.AddComponent<HolyWallSkill>();
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: HolyWallSkill component added.");
}
private void Update()
{
if (SemiFunc.RunIsLevel() && photonView.IsMine)
{
}
}
public void StartOwnerRPCSprintBoost(float speedModifier, float duration)
{
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Requesting sprint boost with modifier {speedModifier} for {duration} seconds.");
photonView.RPC("StartSprintBoostCoroutine_RPC", photonView.Owner, new object[2] { speedModifier, duration });
}
[PunRPC]
private void StartSprintBoostCoroutine_RPC(float speedModifier, float duration)
{
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Starting sprint boost coroutine RPC.");
StartBoostSprintCoroutine(speedModifier, duration);
}
private void StartBoostSprintCoroutine(float speedModifier, float duration)
{
if (boostSprintCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(boostSprintCoroutine);
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Stopped existing sprint boost coroutine.");
}
boostSprintCoroutine = ((MonoBehaviour)this).StartCoroutine(BoostSprint(speedModifier, duration));
}
private IEnumerator BoostSprint(float speedModifier, float duration)
{
FieldInfo playerNameField = typeof(PlayerController).GetField("playerName", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo originalSprintField = typeof(PlayerController).GetField("playerOriginalSprintSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo originalMoveField = typeof(PlayerController).GetField("playerOriginalMoveSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
string playerName = (string)playerNameField.GetValue(PlayerController.instance);
float originalSprint = (float)originalSprintField.GetValue(PlayerController.instance);
float originalMove = (float)originalMoveField.GetValue(PlayerController.instance);
Plugin.Logger.LogInfo((object)$"{playerName}: Sprint boost starting. Original Walk: {PlayerController.instance.MoveSpeed}, Original Sprint: {PlayerController.instance.SprintSpeed}");
float newWalkSpeed = PlayerController.instance.MoveSpeed * speedModifier;
float newSprintSpeed = PlayerController.instance.SprintSpeed * speedModifier;
Plugin.Logger.LogInfo((object)$"{playerName}: New Walk: {newWalkSpeed}, New Sprint: {newSprintSpeed}");
PlayerController.instance.MoveSpeed = newWalkSpeed;
PlayerController.instance.SprintSpeed = newSprintSpeed;
yield return (object)new WaitForSeconds(duration);
PlayerController.instance.MoveSpeed = originalMove;
PlayerController.instance.SprintSpeed = originalSprint;
Plugin.Logger.LogInfo((object)$"{playerName}: Sprint boost ended. Speeds reset to Walk: {PlayerController.instance.MoveSpeed}, Sprint: {PlayerController.instance.SprintSpeed}");
}
[PunRPC]
private void SyncMoveSpeed(float walkSpeed, float sprintSpeed)
{
PlayerController.instance.MoveSpeed = walkSpeed;
PlayerController.instance.SprintSpeed = sprintSpeed;
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Synchronized move speeds: Walk = {walkSpeed}, Sprint = {sprintSpeed}");
}
public void StartOwnerRPCRegenStamina(float regenAmount, float duration)
{
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Requesting stamina regeneration: {regenAmount} per tick for {duration} seconds.");
photonView.RPC("StartRegenStamina_RPC", photonView.Owner, new object[2] { regenAmount, duration });
}
[PunRPC]
private void StartRegenStamina_RPC(float regenAmount, float duration)
{
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Starting stamina regen RPC.");
StartRegenStaminaCoroutine(regenAmount, duration);
}
private void StartRegenStaminaCoroutine(float regenAmount, float duration)
{
if (staminaRegenCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(staminaRegenCoroutine);
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Stopped existing stamina regen coroutine.");
}
staminaRegenCoroutine = ((MonoBehaviour)this).StartCoroutine(RegenStamina(regenAmount, duration));
}
private IEnumerator RegenStamina(float regenAmount, float duration)
{
float elapsedTime = 0f;
float tickInterval = 1f;
while (elapsedTime < duration)
{
PlayerController.instance.EnergyCurrent = Mathf.Min(PlayerController.instance.EnergyCurrent + regenAmount, PlayerController.instance.EnergyStart);
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Regenerating stamina. Current: {PlayerController.instance.EnergyCurrent}");
elapsedTime += tickInterval;
yield return (object)new WaitForSeconds(tickInterval);
}
}
public void StartOwnerRPCHealthRegen(int regenAmount, float duration)
{
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Requesting health regeneration: {regenAmount} per tick for {duration} seconds.");
photonView.RPC("StartHealthRegen_RPC", photonView.Owner, new object[2] { regenAmount, duration });
}
[PunRPC]
private void StartHealthRegen_RPC(int regenAmount, float duration)
{
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Starting health regen RPC.");
StartHealthRegenCoroutine(regenAmount, duration);
}
private void StartHealthRegenCoroutine(int regenAmount, float duration)
{
if (healthRegenCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(healthRegenCoroutine);
Plugin.Logger.LogInfo((object)"PlayerControllerCustom: Stopped existing health regen coroutine.");
}
healthRegenCoroutine = ((MonoBehaviour)this).StartCoroutine(RegenHealth(regenAmount, duration));
}
private IEnumerator RegenHealth(int regenAmount, float duration)
{
FieldInfo healthField = typeof(PlayerHealth).GetField("health", BindingFlags.Instance | BindingFlags.NonPublic);
int initialHealth = (int)healthField.GetValue(playerHealth);
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Initial health is {initialHealth}.");
float elapsedTime = 0f;
float tickInterval = 1f;
while (elapsedTime < duration)
{
playerHealth.Heal(regenAmount, true);
int updatedHealth = (int)healthField.GetValue(playerHealth);
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Health regenerated to {updatedHealth}.");
photonView.RPC("SyncHealth", (RpcTarget)4, new object[1] { updatedHealth });
elapsedTime += tickInterval;
yield return (object)new WaitForSeconds(tickInterval);
}
}
public void StartOwnerHealRPC(int amount)
{
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Requesting heal of {amount} HP.");
photonView.RPC("Heal_RPC", photonView.Owner, new object[1] { amount });
}
[PunRPC]
private void Heal_RPC(int amount)
{
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Heal_RPC received with amount {amount}.");
Heal(amount);
}
public void Heal(int amount)
{
playerHealth.Heal(amount, true);
FieldInfo field = typeof(PlayerHealth).GetField("health", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
int num = (int)field.GetValue(playerHealth);
photonView.RPC("SyncHealth", (RpcTarget)4, new object[1] { num });
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Healed. Updated health is {num}.");
}
else
{
Plugin.Logger.LogWarning((object)"PlayerControllerCustom: Field 'health' not found on PlayerHealth.");
}
}
[PunRPC]
private void SyncHealth(int updatedHealth)
{
FieldInfo field = typeof(PlayerHealth).GetField("health", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(playerHealth, updatedHealth);
Plugin.Logger.LogInfo((object)$"PlayerControllerCustom: Synchronized health to {updatedHealth}.");
}
else
{
Plugin.Logger.LogWarning((object)"PlayerControllerCustom: Field 'health' not found on PlayerHealth in SyncHealth RPC.");
}
}
}
}
namespace JP_RepoHolySkills.Patches
{
[HarmonyPatch(typeof(ExtractionPoint))]
internal class ExtractionPointPatch
{
[HarmonyPatch("StateComplete")]
[HarmonyPrefix]
public static void StateComplete(ExtractionPoint __instance)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
if (SemiFunc.RunIsShop())
{
return;
}
FieldInfo field = typeof(ExtractionPoint).GetField("stateStart", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null || !(bool)field.GetValue(__instance))
{
return;
}
FieldInfo field2 = typeof(ExtractionPoint).GetField("extractionHaul", BindingFlags.Instance | BindingFlags.NonPublic);
if (field2 == null)
{
return;
}
int num = (int)field2.GetValue(__instance);
Plugin.Logger.LogInfo((object)("ExtractionPointPatch: extractionHaul value = " + num));
ES3Settings val = new ES3Settings("JPSkillRepo.es3", new Enum[1] { (Enum)(object)(Location)0 });
try
{
int num2 = ES3.Load<int>("accumulatedExtractionHaul", 0, val);
Plugin.Logger.LogInfo((object)("Loaded previous accumulated extraction haul: " + num2));
int num3 = checked(num2 + num);
Plugin.Logger.LogInfo((object)("New accumulated extraction haul = " + num3));
ES3.Save<int>("accumulatedExtractionHaul", num3, val);
Plugin.Logger.LogInfo((object)"Accumulated extraction haul saved successfully.");
JPSkill_GlobalManager.Instance.savedExtractionHaul = num3;
}
catch (OverflowException ex)
{
Plugin.Logger.LogWarning((object)("Overflow occurred while saving extraction haul: " + ex.Message));
}
catch (Exception ex2)
{
Plugin.Logger.LogError((object)("Failed to load & save new extraction haul value: " + ex2.Message));
}
}
}
[HarmonyPatch(typeof(GameManager))]
internal class GameManagerPatch
{
private static bool _hasPatched;
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void Awake(GameManager __instance)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
if (_hasPatched)
{
Plugin.Logger.LogInfo((object)"GameManagerPatch Awake: Already patched, skipping further patching.");
return;
}
_hasPatched = true;
Plugin.Logger.LogInfo((object)"GameManagerPatch Awake: Running patch for the first time.");
((Component)__instance).gameObject.AddComponent<SkillSelectorController>();
Plugin.Logger.LogInfo((object)"GameManagerPatch Awake: SkillSelectorController added to GameManager.");
Plugin.Logger.LogInfo((object)"GameManagerPatch Awake: Creating JPSkill_GlobalManagerGameObject...");
GameObject val = new GameObject("JPSkill_GlobalManagerGameObject");
val.AddComponent<JPSkill_GlobalManager>();
Plugin.Logger.LogInfo((object)"GameManagerPatch Awake: JPSkill_GlobalManager added to JPSkill_GlobalManagerGameObject.");
}
}
[HarmonyPatch(typeof(MapToolController))]
internal class MapToolControllerPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
public static void Start(MapToolController __instance)
{
Plugin.Logger.LogInfo((object)"MapToolControllerPatch start");
((Component)__instance).gameObject.AddComponent<MapToolControllerCustom>();
}
}
[HarmonyPatch(typeof(PlayerAvatar))]
internal class PlayerAvatarPatch
{
[HarmonyPatch("Awake")]
[HarmonyPrefix]
public static void Awake(PlayerAvatar __instance)
{
Plugin.Logger.LogInfo((object)"PlayerAvatarPatch awake");
((Component)__instance).gameObject.AddComponent<PlayerControllerCustom>();
}
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static void Update(PlayerAvatar __instance)
{
}
}
[HarmonyPatch(typeof(PlayerController))]
internal class PlayerControllerPatch
{
[HarmonyPatch("Awake")]
[HarmonyPrefix]
public static void Awake(PlayerController __instance)
{
}
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static void Update(PlayerController __instance)
{
}
}
}
namespace JP_RepoHolySkills.MapToolControllerCustoms
{
internal class MapToolControllerCustom : MonoBehaviour
{
private void Awake()
{
Plugin.Logger.LogInfo((object)"MapToolControllerCustom awake");
}
}
}
namespace JP_RepoHolySkills.GlobalMananger
{
public class JPSkill_GlobalManager : MonoBehaviour
{
public int savedExtractionHaul = 0;
public SelectableSkills selectedSkill = SelectableSkills.None;
public static JPSkill_GlobalManager Instance;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
Plugin.Logger.LogInfo((object)"JPSkill_GlobalManager Awake: Instance set successfully.");
}
else
{
Plugin.Logger.LogWarning((object)"JPSkill_GlobalManager Awake: An instance already exists!");
}
}
private void Start()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
try
{
ES3Settings val = new ES3Settings("JPSkillRepo.es3", new Enum[1] { (Enum)(object)(Location)0 });
if (!ES3.FileExists(val) || !ES3.KeyExists("accumulatedExtractionHaul", val))
{
Plugin.Logger.LogInfo((object)"No saved extraction haul found. Creating file with default value 0.");
ES3.Save<int>("accumulatedExtractionHaul", 0, val);
savedExtractionHaul = 0;
}
else
{
savedExtractionHaul = (Plugin.Instance.isInDebugMode ? 3000000 : ES3.Load<int>("accumulatedExtractionHaul", val));
}
Plugin.Logger.LogInfo((object)$"JPSkill_GlobalManager Start: Loaded savedExtractionHaul = {savedExtractionHaul}.");
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)("JPSkill_GlobalManager Start: Failed to load savedExtractionHaul: " + ex.Message));
}
if (Plugin.AssetManager.TryGetValue("HolyWall", out var value) && (Object)(object)value != (Object)null)
{
Plugin.Logger.LogInfo((object)("JPSkill_GlobalManager Start: Found Holy Wall prefab: " + ((Object)value).name + "."));
}
else
{
Plugin.Logger.LogWarning((object)"JPSkill_GlobalManager Start: Holy Wall prefab not found in AssetManager.");
}
IPunPrefabPool val2 = PhotonNetwork.PrefabPool;
if (val2 == null)
{
Plugin.Logger.LogInfo((object)"JPSkill_GlobalManager Start: No existing Photon prefab pool found, using DefaultPool.");
val2 = (IPunPrefabPool)new DefaultPool();
}
else
{
Plugin.Logger.LogInfo((object)("JPSkill_GlobalManager Start: Existing Photon prefab pool found: " + ((object)val2).GetType().Name));
}
CombinedPrefabPool combinedPrefabPool = new CombinedPrefabPool(val2);
Plugin.Logger.LogInfo((object)"JPSkill_GlobalManager Start: Created CombinedPrefabPool.");
combinedPrefabPool.AddModdedPrefab("HolyWall", value);
Plugin.Logger.LogInfo((object)"JPSkill_GlobalManager Start: Added modded Holy Wall prefab with key 'HolyWall'.");
PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)combinedPrefabPool;
Plugin.Logger.LogInfo((object)"JPSkill_GlobalManager Start: PhotonNetwork.PrefabPool has been set to the CombinedPrefabPool.");
}
}
}