Decompiled source of GoopUpgrades v1.0.1

GoopUpgrades.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib;
using REPOLib.Modules;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("GoopUpgrades")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GoopUpgrades")]
[assembly: AssemblyCopyright("Copyright © GoopSwagger 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("809fa50d-9398-446b-86a3-eaa45523ae0b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GoopUpgrades
{
	[BepInPlugin("GoopSwagger.GoopUpgrades", "GoopUpgrades", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class GoopUpgradesPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerTumble))]
		public static class Patch_PlayerTumble
		{
			[HarmonyPatch("HitEnemy")]
			[HarmonyPostfix]
			private static void HitEnemyPostfix(PlayerTumble __instance)
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: 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)
				if (!SemiFunc.IsMasterClientOrSingleplayer() || instance.upgradeTumbleBlast == null)
				{
					return;
				}
				int level = instance.upgradeTumbleBlast.GetLevel(SemiFunc.PlayerGetSteamID(__instance.playerAvatar));
				if (level > 0)
				{
					TumbleBlastExplosion(level, __instance.playerAvatar.playerAvatarVisuals.colorIndex, ((Component)__instance.playerAvatar).transform.position);
					if (GameManager.Multiplayer())
					{
						tumbleBlastExplosionEvent.RaiseEvent((object)new object[3]
						{
							level,
							__instance.playerAvatar.playerAvatarVisuals.colorIndex,
							((Component)__instance.playerAvatar).transform.position
						}, NetworkingEvents.RaiseOthers, SendOptions.SendReliable);
					}
				}
			}
		}

		[HarmonyPatch(typeof(SemiFunc))]
		public static class Patch_SemiFunc
		{
			[HarmonyPatch("UIHideHealth")]
			[HarmonyPostfix]
			private static void UIHideHealthPostfix()
			{
				if ((Object)(object)ShieldUI.instance != (Object)null)
				{
					((SemiUI)ShieldUI.instance).Hide();
				}
			}
		}

		[HarmonyPatch(typeof(PlayerHealth))]
		public static class Patch_PlayerHealth
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			public static void AwakePostfix(PlayerHealth __instance)
			{
				if ((Object)(object)((Component)__instance).GetComponent<PlayerShield>() == (Object)null)
				{
					((Component)__instance).gameObject.AddComponent<PlayerShield>();
				}
			}

			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			public static void StartPostfix(PlayerHealth __instance)
			{
				PlayerShield component = ((Component)__instance).GetComponent<PlayerShield>();
				try
				{
					if ((Object)(object)component != (Object)null && instance.upgradeShield != null && (Object)(object)__instance.playerAvatar != (Object)null)
					{
						int num = (component.shieldMax = (component.shieldValue = 10 * instance.upgradeShield.GetLevel(SemiFunc.PlayerGetSteamID(__instance.playerAvatar))));
						if (GameManager.Multiplayer())
						{
							__instance.photonView.RPC("UpdateShieldRPC", (RpcTarget)1, new object[3] { num, num, false });
						}
					}
				}
				catch (NullReferenceException)
				{
				}
			}

			[HarmonyPatch("Hurt")]
			[HarmonyPrefix]
			private static void HurtPrefix(PlayerHealth __instance, ref int damage, bool savingGrace, int enemyIndex = -1)
			{
				if (damage > 0)
				{
					PlayerShield component = ((Component)__instance).GetComponent<PlayerShield>();
					component.regenerationTimer = 15f;
					if (savingGrace && component.shieldValue > 0 && __instance.health > 0)
					{
						damage = component.DamageShield(__instance, damage);
					}
				}
			}

			[HarmonyPatch("HurtOther")]
			[HarmonyPrefix]
			private static void HurtOtherPrefix(PlayerHealth __instance, ref int damage, bool savingGrace, int enemyIndex = -1)
			{
				if (damage > 0)
				{
					((Component)__instance).GetComponent<PlayerShield>().regenerationTimer = 15f;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar))]
		public static class Patch_PlayerAvatar
		{
			[HarmonyPatch("Revive")]
			[HarmonyPostfix]
			public static void RevivePostfix(PlayerAvatar __instance)
			{
				PlayerShield component = ((Component)((Component)__instance).GetComponent<PlayerHealth>()).GetComponent<PlayerShield>();
				if (instance.upgradeShield != null && (Object)(object)__instance != (Object)null)
				{
					component.regenerationTimer = 15f;
					component.shieldValue = 0;
				}
			}
		}

		[HarmonyPatch(typeof(EnergyUI))]
		public static class Patch_EnergyUI
		{
			private static bool offset;

			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPostfix(EnergyUI __instance)
			{
				offset = false;
			}

			[HarmonyPatch("Update")]
			[HarmonyPostfix]
			private static void UpdatePostfix(EnergyUI __instance)
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_006d: 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_0081: 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_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)PlayerController.instance == (Object)null) && PlayerController.instance.playerSteamID != null && instance.upgradeShield != null)
				{
					int level = instance.upgradeShield.GetLevel(PlayerController.instance.playerSteamID);
					if (level > 0 && !offset)
					{
						((SemiUI)__instance).showPosition = ((SemiUI)__instance).showPosition + new Vector2(0f, -31f);
						((SemiUI)__instance).hidePosition = ((SemiUI)__instance).hidePosition + new Vector2(0f, -31f);
						offset = true;
					}
					else if (level <= 0 && offset)
					{
						((SemiUI)__instance).showPosition = ((SemiUI)__instance).showPosition - new Vector2(0f, -31f);
						((SemiUI)__instance).hidePosition = ((SemiUI)__instance).hidePosition - new Vector2(0f, -31f);
						offset = false;
					}
				}
			}
		}

		[HarmonyPatch(typeof(OverchargeUI))]
		public static class Patch_OverchargeUI
		{
			private static bool offset;

			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPostfix(OverchargeUI __instance)
			{
				offset = false;
			}

			[HarmonyPatch("Update")]
			[HarmonyPostfix]
			private static void UpdatePostfix(OverchargeUI __instance)
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_006d: 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_0081: 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_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)PlayerController.instance == (Object)null) && PlayerController.instance.playerSteamID != null && instance.upgradeShield != null)
				{
					int level = instance.upgradeShield.GetLevel(PlayerController.instance.playerSteamID);
					if (level > 0 && !offset)
					{
						((SemiUI)__instance).showPosition = ((SemiUI)__instance).showPosition + new Vector2(0f, -31f);
						((SemiUI)__instance).hidePosition = ((SemiUI)__instance).hidePosition + new Vector2(0f, -31f);
						offset = true;
					}
					else if (level <= 0 && offset)
					{
						((SemiUI)__instance).showPosition = ((SemiUI)__instance).showPosition - new Vector2(0f, -31f);
						((SemiUI)__instance).hidePosition = ((SemiUI)__instance).hidePosition - new Vector2(0f, -31f);
						offset = false;
					}
				}
			}
		}

		public static GoopUpgradesPlugin instance;

		public const string PluginGUID = "GoopSwagger.GoopUpgrades";

		public const string PluginName = "GoopUpgrades";

		public const string PluginAuthor = "GoopSwagger";

		public const string PluginVersion = "1.0.1";

		public const float SHIELD_CHARGE_DELAY = 15f;

		public const int SHIELD_PER_UPGRADE = 10;

		public static bool ignoreShield;

		public PlayerUpgrade upgradeTumbleBlast;

		public PlayerUpgrade upgradeShield;

		private AssetBundle assetBundle;

		public static NetworkedEvent tumbleBlastExplosionEvent;

		private void Awake()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"You've got yourself a winner here...");
			new Harmony("GoopSwagger.GoopUpgrades").PatchAll();
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "goopupgrades");
			string text2 = "Upgrades";
			ConfigEntry<bool> enableTumbleBlast = ((BaseUnityPlugin)instance).Config.Bind<bool>(new ConfigDefinition(text2, "Enable Tumble Blast"), true, (ConfigDescription)null);
			ConfigEntry<bool> enableShield = ((BaseUnityPlugin)instance).Config.Bind<bool>(new ConfigDefinition(text2, "Enable Shield"), true, (ConfigDescription)null);
			BundleLoader.LoadBundle(text, (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				instance.assetBundle = assetBundle;
				if (enableTumbleBlast.Value)
				{
					GameObject upgradeItem = assetBundle.LoadAsset<GameObject>("Item Upgrade Player Tumble Blast");
					upgradeTumbleBlast = Upgrade(upgradeItem, "Tumble Blast", "TumbleBlast", 2, null);
				}
				if (enableShield.Value)
				{
					GameObject upgradeItem2 = assetBundle.LoadAsset<GameObject>("Item Upgrade Player Shield");
					upgradeShield = Upgrade(upgradeItem2, "Shield", "Shield", 1, delegate(PlayerAvatar player, int value)
					{
						((SemiUI)EnergyUI.instance).Update();
						if (SemiFunc.IsMasterClientOrSingleplayer())
						{
							PlayerShield component = ((Component)player.playerHealth).GetComponent<PlayerShield>();
							if ((Object)(object)component != (Object)null)
							{
								component.shieldValue += 10;
								component.shieldMax += 10;
								if (GameManager.Multiplayer())
								{
									player.playerHealth.photonView.RPC("UpdateShieldRPC", (RpcTarget)1, new object[3] { component.shieldValue, component.shieldMax, false });
								}
							}
						}
					});
				}
			}, false);
			SceneManager.sceneLoaded += OnSceneLoaded;
			tumbleBlastExplosionEvent = new NetworkedEvent("Tumble Blast Explosion", (Action<EventData>)HandleTumbleBlastExplosionEvent);
		}

		private static void HandleTumbleBlastExplosionEvent(EventData eventData)
		{
			//IL_0032: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			int level = (int)((object[])eventData.CustomData)[0];
			int colorIndex = (int)((object[])eventData.CustomData)[1];
			Vector3 position = (Vector3)((object[])eventData.CustomData)[2];
			TumbleBlastExplosion(level, colorIndex, position);
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			InitializeShieldUI();
		}

		private void InitializeShieldUI()
		{
			if ((Object)(object)instance.assetBundle != (Object)null)
			{
				GameObject val = GameObject.Find("Game Hud");
				if ((Object)(object)val != (Object)null && (Object)(object)val.transform.Find("Shield") == (Object)null)
				{
					Object.Instantiate<GameObject>(instance.assetBundle.LoadAsset<GameObject>("Shield")).transform.SetParent(val.transform, false);
				}
			}
		}

		private static PlayerUpgrade Upgrade(GameObject upgradeItem, string upgradeName, string upgradeId, int maxAmountInShop, Action<PlayerAvatar, int> upgradeAction)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Item val = ScriptableObject.CreateInstance<Item>();
			val.itemType = (itemType)3;
			val.emojiIcon = (emojiIcon)11;
			val.itemVolume = (itemVolume)6;
			string text2 = (((Object)val).name = "Item Upgrade Player " + upgradeName);
			string name = text2;
			val.itemName = upgradeName + " Upgrade";
			val.maxAmount = 10;
			val.maxAmountInShop = maxAmountInShop;
			val.maxPurchaseAmount = 0;
			val.maxPurchase = val.maxPurchaseAmount > 0;
			Value val2 = ScriptableObject.CreateInstance<Value>();
			val2.valueMin = 2250f;
			val2.valueMax = 3000f;
			val.value = val2;
			((Object)upgradeItem).name = name;
			ItemAttributes component = upgradeItem.GetComponent<ItemAttributes>();
			component.item = val;
			REPOLibItemUpgrade component2 = upgradeItem.GetComponent<REPOLibItemUpgrade>();
			AccessTools.Field(typeof(REPOLibItemUpgrade), "_upgradeId").SetValue(component2, upgradeId);
			Items.RegisterItem(component);
			return Upgrades.RegisterUpgrade(upgradeId, val, (Action<PlayerAvatar, int>)null, upgradeAction);
		}

		private static void TumbleBlastExplosion(int level, int colorIndex, Vector3 position)
		{
			//IL_002f: 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)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			ExplosionPreset obj = instance.assetBundle.LoadAsset<ExplosionPreset>("Tumble Blast Preset");
			GameObject obj2 = Resources.Load<GameObject>("Effects/Part Prefab Explosion");
			float num = 1.2f + (float)(level - 1) * 0.2f;
			ParticlePrefabExplosion component = Object.Instantiate<GameObject>(obj2, position, Quaternion.identity).GetComponent<ParticlePrefabExplosion>();
			component.forceMultiplier = 5f;
			component.explosionSize = ((num > 1.8f) ? 1.8f : num);
			component.explosionDamage = 20 + (level - 1) * 15;
			component.explosionDamageEnemy = 40 + (level - 1) * 15;
			component.lightColorOverTime = new Gradient();
			ColorOverLifetimeModule colorOverLifetime = component.particleFire.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(AssetManager.instance.playerColors[colorIndex]);
			colorOverLifetime = component.particleSmoke.colorOverLifetime;
			component.particleFire.Play();
			component.particleSmoke.Play();
			((Behaviour)component.light).enabled = true;
			obj.explosionSoundSmall.Play(position, 1f, 1f, 1f, 1f);
		}
	}
	public class PlayerShield : MonoBehaviour, IPunObservable
	{
		private PhotonView photonView;

		public int shieldValue;

		public int shieldMax;

		public float regenerationTimer;

		private PlayerHealth playerHealth => NestedComponentUtilities.GetParentComponent<PlayerHealth>(((Component)this).transform);

		public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
		{
			throw new NotImplementedException();
		}

		private void Awake()
		{
			photonView = ((Component)this).GetComponentInParent<PhotonView>();
		}

		private void Update()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && regenerationTimer > 0f)
			{
				regenerationTimer -= Time.deltaTime;
				while (regenerationTimer <= 0f && shieldValue < shieldMax)
				{
					regenerationTimer += 1.2f;
					shieldValue++;
				}
				if (GameManager.Multiplayer())
				{
					photonView.RPC("UpdateShieldRPC", (RpcTarget)1, new object[3] { shieldValue, shieldMax, false });
				}
			}
		}

		public int DamageShield(PlayerHealth playerHealth, int damage)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			if (playerHealth.invincibleTimer > 0f || damage <= 0 || (GameManager.Multiplayer() && !photonView.IsMine) || playerHealth.playerAvatar.deadSet || playerHealth.godMode || (int)GameDirector.instance.currentState != 2)
			{
				return damage;
			}
			regenerationTimer = 15f;
			int num = shieldValue - damage;
			if (num < 0)
			{
				shieldValue = 0;
				if (GameManager.Multiplayer())
				{
					photonView.RPC("UpdateShieldRPC", (RpcTarget)1, new object[3] { shieldValue, shieldMax, false });
				}
				return -num;
			}
			if (damage >= 25)
			{
				CameraGlitch.Instance.PlayLongHurt();
			}
			else
			{
				CameraGlitch.Instance.PlayShortHurt();
			}
			shieldValue = num;
			if (GameManager.Multiplayer())
			{
				photonView.RPC("UpdateShieldRPC", (RpcTarget)1, new object[3] { shieldValue, shieldMax, true });
			}
			return 0;
		}

		[PunRPC]
		public void UpdateShieldRPC(int shieldValue, int shieldMax, bool effect, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.MasterAndOwnerOnlyRPC(_info, photonView))
			{
				return;
			}
			if (effect)
			{
				playerHealth.materialEffect = true;
				if (!playerHealth.playerAvatar.deadSet)
				{
					playerHealth.materialEffectLerp = 0f;
				}
				if (shieldValue < this.shieldValue)
				{
					if (shieldValue > 0)
					{
						playerHealth.hurtOther.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
					}
					playerHealth.hurtFreeze = true;
					foreach (Material instancedMaterial in playerHealth.instancedMaterials)
					{
						if ((Object)(object)instancedMaterial != (Object)(object)playerHealth.eyeMaterial && (Object)(object)instancedMaterial != (Object)(object)playerHealth.pupilMaterial)
						{
							instancedMaterial.SetColor(playerHealth.materialHurtColor, new Color(0.25f, 0.5f, 1f));
						}
					}
				}
			}
			if (shieldValue < this.shieldValue)
			{
				regenerationTimer = 15f;
			}
			this.shieldValue = shieldValue;
			this.shieldMax = shieldMax;
		}
	}
	public class ShieldUI : SemiUI
	{
		public TextMeshProUGUI Text;

		public static ShieldUI instance;

		public TextMeshProUGUI textEnergyMax;

		public Vector3 maxEnergyBasePosition;

		public float maxEnergyPrevOffset;

		public int shieldValue;

		public int shieldPrev;

		public override void Start()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			((SemiUI)this).Start();
			Text = ((Component)this).GetComponent<TextMeshProUGUI>();
			instance = this;
			textEnergyMax = ((Component)((Component)this).transform.Find("ShieldMax")).GetComponent<TextMeshProUGUI>();
			maxEnergyBasePosition = ((TMP_Text)textEnergyMax).transform.localPosition;
		}

		public override void Update()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			((SemiUI)this).Update();
			if (!PlayerAvatar.instance.isDisabled)
			{
				if (GoopUpgradesPlugin.instance.upgradeShield == null || GoopUpgradesPlugin.instance.upgradeShield.GetLevel(SemiFunc.PlayerGetSteamID(PlayerAvatar.instance)) == 0)
				{
					((SemiUI)this).Hide();
				}
			}
			else
			{
				((SemiUI)this).Hide();
			}
			if (base.isHidden || !((Object)(object)PlayerAvatar.instance.playerHealth != (Object)null))
			{
				return;
			}
			PlayerShield component = ((Component)PlayerAvatar.instance.playerHealth).GetComponent<PlayerShield>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			shieldValue = component.shieldValue;
			if (shieldValue != shieldPrev)
			{
				((SemiUI)this).SemiUISpringShakeY(4f, 5f, 0.25f);
				Color val = Color.white;
				if (shieldValue < shieldPrev)
				{
					val = Color.red;
				}
				((SemiUI)this).SemiUITextFlashColor(val, 0.2f);
				((SemiUI)this).SemiUISpringScale(0.3f, 5f, 0.125f);
				shieldPrev = shieldValue;
			}
			((TMP_Text)Text).text = component.shieldValue.ToString();
			float num = ((((TMP_Text)Text).text.Length > 3) ? ((float)(((TMP_Text)Text).text.Length - 3) * 20f) : 0f);
			((TMP_Text)textEnergyMax).transform.localPosition = maxEnergyBasePosition + new Vector3(num, 0f, 0f);
			((TMP_Text)textEnergyMax).text = "<b><color=blue>/</color></b>" + component.shieldMax;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}