using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using HarmonyLib;
using HunkHud.Components;
using HunkHud.Components.UI;
using HunkHud.Modules;
using HunkMod.Modules;
using HunkMod.Modules.Components;
using HunkMod.Modules.Components.UI;
using MaterialHud;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using ZioConfigFile;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace HunkHud
{
public class CustomHudElement : HudElement
{
public CharacterMaster targetMaster
{
get
{
HUD hud = base._hud;
if (hud == null)
{
return null;
}
return hud.targetMaster;
}
}
protected virtual void OnEnable()
{
if (!Object.op_Implicit((Object)(object)((HudElement)this).hud))
{
((HudElement)this).hud = ((Component)((Component)this).transform.root).GetComponent<HUD>();
}
HUD.onHudTargetChangedGlobal += HUD_onHudTargetChangedGlobal;
InstanceTracker.Add<CustomHudElement>(this);
}
protected virtual void HUD_onHudTargetChangedGlobal(HUD newHud)
{
((HudElement)this).hud = newHud;
}
protected virtual void OnDisable()
{
InstanceTracker.Remove<CustomHudElement>(this);
HUD.onHudTargetChangedGlobal -= HUD_onHudTargetChangedGlobal;
}
}
public class LevelDisplay : ExpBar
{
private float expFillMin;
private float expFillMax = 0.76f;
public Image fillImage;
private void Update()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)base.source)) ? 1 : ((int)base.source.teamIndex));
float num = 0f;
if (Object.op_Implicit((Object)(object)TeamManager.instance))
{
num = Mathf.InverseLerp((float)TeamManager.instance.GetTeamCurrentLevelExperience(val), (float)TeamManager.instance.GetTeamNextLevelExperience(val), (float)TeamManager.instance.GetTeamExperience(val));
}
if (Object.op_Implicit((Object)(object)fillImage))
{
fillImage.fillAmount = Util.Remap(num, 0f, 1f, expFillMin, expFillMax);
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.public_ParticleSystem.HunkHud", "HunkHud", "1.0.5")]
public class HunkHudMain : BaseUnityPlugin
{
public const string GUID = "com.public_ParticleSystem.HunkHud";
public const string MODAUTHOR = "public_ParticleSystem";
public const string MODNAME = "HunkHud";
public const string VERSION = "1.0.5";
public static AssetBundle mainAssetBundle;
public static ConfigFile activeConfig;
private static Harmony harm;
private static PatchClassProcessor patcher;
public static HunkHudMain instance { get; private set; }
public void Awake()
{
instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
LoadAssets();
SetHooks();
}
private void SetHooks()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
harm = new Harmony("com.public_ParticleSystem.HunkHud");
patcher = harm.CreateClassProcessor(typeof(Hooks));
patcher.Patch();
}
private void LoadAssets()
{
mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "hunkui"));
RiskUIPlugin._newHud = mainAssetBundle.LoadAsset<GameObject>("HunkUI");
RiskUIPlugin._newClassicRunHud = mainAssetBundle.LoadAsset<GameObject>("HunkClassicRunInfoHudPanel");
RiskUIPlugin._newSimulacrumHud = mainAssetBundle.LoadAsset<GameObject>("HunkSimulacrum");
RiskUIPlugin._allyCard = mainAssetBundle.LoadAsset<GameObject>("HunkAllyCard");
((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)CreateBandMap);
}
private void CreateBandMap()
{
CreateEntry("BandDisplay", "FireRing", "IceRing");
CreateEntry("BandDisplayVoid", "ElementalRingVoid");
CreateEntry("BandDisplayHealing", "ITEM_HEALING_BAND", "ITEM_BARRIER_BAND");
CreateEntry("BandDisplayNova", "ITEM_NOVA_BAND");
CreateEntry("BandDisplaySacrificial", "ITEM_SANDSWEPT_SACRIFICIAL_BAND");
}
private void CreateEntry(string prefabName, params string[] itemNames)
{
//IL_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
ItemIndex[] array = (ItemIndex[])(object)new ItemIndex[0];
for (int i = 0; i < itemNames.Length; i++)
{
ItemIndex val = ItemCatalog.FindItemIndex(itemNames[i]);
if ((int)val != -1)
{
ArrayUtils.ArrayAppend<ItemIndex>(ref array, ref val);
}
}
if (array.Length != 0)
{
GameObject val2 = mainAssetBundle.LoadAsset<GameObject>(prefabName);
if (!((Object)(object)val2 == (Object)null))
{
BandDisplayController.BandDisplayInfo bandDisplayInfo = new BandDisplayController.BandDisplayInfo
{
prefabName = prefabName,
displayPrefab = val2,
itemsToDisplay = array
};
ArrayUtils.ArrayAppend<BandDisplayController.BandDisplayInfo>(ref BandDisplayController.bandInfos, ref bandDisplayInfo);
}
}
}
}
public static class HudAssets
{
public static AssetBundle mainAssetBundle;
public static TMP_FontAsset hgFont;
public static void Init()
{
}
private static void HUD_OnHudTargetChangedGlobal(HUD hud)
{
}
private static void HandleHud(HUD hud, CharacterBody targetBody)
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
ChildLocator component = ((Component)hud).GetComponent<ChildLocator>();
Transform val = component.FindChild("SpringCanvas");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
Transform val2 = val.Find("BottomRightCluster/Scaler");
if (Object.op_Implicit((Object)(object)val2))
{
if (((Component)val2).GetComponent<SkillIconMover>() == null)
{
((Component)val2).gameObject.AddComponent<SkillIconMover>();
}
Transform obj = val2.Find("SprintCluster");
if (obj != null)
{
((Component)obj).gameObject.SetActive(false);
}
Transform obj2 = val2.Find("InventoryCluster");
if (obj2 != null)
{
((Component)obj2).gameObject.SetActive(false);
}
}
Transform val3 = val.Find("UpperLeftCluster");
if (Object.op_Implicit((Object)(object)val3) && ((Component)val3).GetComponent<MoneyDisplayMover>() == null)
{
((Component)val3).gameObject.AddComponent<MoneyDisplayMover>();
}
Transform val4 = component.FindChild("TopCenterCluster");
if (Object.op_Implicit((Object)(object)val4))
{
foreach (Transform item in val4)
{
Transform val5 = item;
if (Object.op_Implicit((Object)(object)((Component)val5).GetComponentInChildren<ItemInventoryDisplay>()))
{
if (!Object.op_Implicit((Object)(object)((Component)val5).GetComponent<ItemDisplayMover>()))
{
((Component)val5).gameObject.AddComponent<ItemDisplayMover>();
}
break;
}
}
if (!Object.op_Implicit((Object)(object)val4.Find("ObjectiveGauge")))
{
GameObject obj3 = Object.Instantiate<GameObject>(mainAssetBundle.LoadAsset<GameObject>("ObjectiveGauge"), val4);
((Object)obj3).name = "ObjectiveGauge";
obj3.transform.SetSiblingIndex(1);
obj3.AddComponent<ObjectiveChargeDisplay>();
}
}
if (Object.op_Implicit((Object)(object)hud.gameModeUiInstance) && !Object.op_Implicit((Object)(object)hud.gameModeUiInstance.GetComponent<ObjectiveDisplayMover>()))
{
hud.gameModeUiInstance.AddComponent<ObjectiveDisplayMover>();
}
Transform val6 = component.FindChild("CrosshairExtras");
if (Object.op_Implicit((Object)(object)val6))
{
Transform obj4 = val6.Find("BandTracker");
if (!Object.op_Implicit((Object)(object)((obj4 != null) ? ((Component)obj4).GetComponent<BandDisplay>() : null)))
{
GameObject obj5 = Object.Instantiate<GameObject>(mainAssetBundle.LoadAsset<GameObject>("BandCooldownTracker"), val6);
((Object)obj5).name = "BandTracker";
obj5.AddComponent<BandDisplay>();
}
}
Transform val7 = val.Find("BottomRightCluster");
if (Object.op_Implicit((Object)(object)val7))
{
Transform obj6 = val.Find("BottomLeftCluster/BarRoots");
if (obj6 != null)
{
((Component)obj6).gameObject.SetActive(false);
}
Transform obj7 = val7.Find("CustomHealthBar");
if (!Object.op_Implicit((Object)(object)((obj7 != null) ? ((Component)obj7).GetComponent<CustomHealthBar>() : null)))
{
GameObject obj8 = Object.Instantiate<GameObject>(mainAssetBundle.LoadAsset<GameObject>("CustomHealthBar"), val7);
((Object)obj8).name = "CustomHealthBar";
obj8.AddComponent<CustomHealthBar>();
}
if (Object.op_Implicit((Object)(object)hud.contextManager))
{
RectTransform component2 = ((Component)hud.contextManager).GetComponent<RectTransform>();
((Transform)component2).SetParent(val7);
((Transform)component2).localScale = 0.75f * Vector3.one;
((Transform)component2).localPosition = new Vector3(-550f, 50f, 0f);
}
}
}
}
}
namespace HunkHud.Modules
{
[HarmonyPatch]
public class Hooks
{
[HarmonyPatch(typeof(CrosshairController), "Awake")]
[HarmonyPostfix]
private static void CrosshairController_Awake(CrosshairController __instance)
{
UnityObjectExtensions.EnsureComponent<DynamicCrosshair>((Component)(object)__instance);
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}
namespace HunkHud.Components
{
[RequireComponent(typeof(AllyCardController))]
public class AllyHealthBarMover : DisplayMover
{
private AllyCardController cardController;
protected override void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
base.Awake();
offset = new Vector3(-500f, 0f, 0f);
cardController = ((Component)this).GetComponent<AllyCardController>();
}
public override void CheckForActivity()
{
HealthComponent val = (Object.op_Implicit((Object)(object)cardController) ? cardController.cachedHealthComponent : null);
if (Object.op_Implicit((Object)(object)val))
{
float num = val.health + val.shield;
float num2 = val.fullHealth + val.fullShield;
if (num / num2 < 0.99f)
{
SetActive();
}
}
}
}
[RequireComponent(typeof(CanvasGroup))]
public abstract class DisplayMover : CustomHudElement, IConfigHandler
{
public float delayTimer = 0.1f;
public float activeInterval = 3f;
public float activeTimer = 8f;
public float smoothSpeed = 4f;
public Vector3 offset;
[NonSerialized]
public CanvasGroup canvas;
[NonSerialized]
public Vector3 activePosition;
[NonSerialized]
public Vector3 desiredPosition;
[NonSerialized]
public ZioConfigEntry<bool> _configEntry;
public abstract void CheckForActivity();
protected virtual void ConfigUpdated(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
{
((Behaviour)this).enabled = _configEntry?.Value ?? true;
}
public virtual void Startup()
{
_configEntry = ConfigHelper.Bind<bool>("HunkHud", ((object)this).GetType().Name, true, "Enable or disable moving this hud element", (Action<ZioConfigEntry<bool>>)null, (object)null);
}
public void SetActive()
{
SetActive(activeInterval);
}
public virtual void SetActive(float time)
{
activeTimer = Mathf.Max(activeTimer, time);
delayTimer = Mathf.Max(delayTimer, 0.1f);
}
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
base.HUD_onHudTargetChangedGlobal(newHud);
SetActive(8f);
}
protected virtual void Awake()
{
canvas = ((Component)this).GetComponent<CanvasGroup>();
Startup();
((ZioConfigEntryBase)_configEntry).SettingChanged += ConfigUpdated;
}
protected virtual void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
activePosition = ((Component)this).transform.localPosition;
offset.x = Mathf.Abs(offset.x) * Mathf.Sign(((Component)this).transform.position.x);
offset.y = Mathf.Abs(offset.y) * Mathf.Sign(((Component)this).transform.position.y);
}
protected override void OnEnable()
{
base.OnEnable();
ConfigUpdated(null, null, arg3: false);
}
protected virtual void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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)
Vector3 localPosition = ((Component)this).transform.localPosition;
Vector3 val = activePosition;
if (activeTimer <= 0f)
{
val += offset;
}
if (offset.x == 0f)
{
val.x = localPosition.x;
}
if (offset.y == 0f)
{
val.y = localPosition.y;
}
if (offset.z == 0f)
{
val.z = localPosition.z;
}
((Component)this).transform.localPosition = Vector3.Lerp(localPosition, val, smoothSpeed * Time.deltaTime);
canvas.alpha = Mathf.Clamp01(2f * (activeTimer + 0.5f));
}
protected virtual void FixedUpdate()
{
activeTimer -= Time.fixedDeltaTime;
delayTimer -= Time.fixedDeltaTime;
if (Object.op_Implicit((Object)(object)((HudElement)this).hud?.scoreboardPanel) && ((HudElement)this).hud.scoreboardPanel.activeSelf)
{
SetActive(activeInterval * 0.5f);
}
if (delayTimer <= 0f)
{
delayTimer = 0.1f;
CheckForActivity();
}
}
protected virtual void OnDestroy()
{
((ZioConfigEntryBase)_configEntry).SettingChanged -= ConfigUpdated;
}
}
[RequireComponent(typeof(CrosshairController))]
[RequireComponent(typeof(HudElement))]
public class DynamicCrosshair : MonoBehaviour
{
public float range = 300f;
public float interval = 0.2f;
private HudElement hudElement;
private (Image image, Color color)[] crosshairSprites;
private float stopwatch;
private void Awake()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
hudElement = ((Component)this).GetComponent<HudElement>();
List<(Image, Color)> list = new List<(Image, Color)>();
SpritePosition[] spriteSpreadPositions = ((Component)this).GetComponent<CrosshairController>().spriteSpreadPositions;
foreach (SpritePosition val in spriteSpreadPositions)
{
Image val2 = (Object.op_Implicit((Object)(object)val.target) ? ((Component)val.target).GetComponent<Image>() : null);
if (Object.op_Implicit((Object)(object)val2))
{
list.Add((val2, ((Graphic)val2).color));
}
}
crosshairSprites = list.ToArray();
}
private void FixedUpdate()
{
stopwatch -= Time.fixedDeltaTime;
if (stopwatch <= 0f)
{
stopwatch = interval;
Simulate();
}
}
private void Simulate()
{
//IL_0038: 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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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)
CharacterBody val = (Object.op_Implicit((Object)(object)hudElement) ? hudElement.targetCharacterBody : null);
if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inputBank))
{
return;
}
Ray aimRay = val.inputBank.GetAimRay();
Color? val2 = null;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(aimRay, ref val3, range, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)2))
{
HurtBox val4 = (Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).collider) ? ((Component)((RaycastHit)(ref val3)).collider).GetComponent<HurtBox>() : null);
if (Object.op_Implicit((Object)(object)val4))
{
CharacterBody val5 = (Object.op_Implicit((Object)(object)val4.healthComponent) ? val4.healthComponent.body : null);
if (Object.op_Implicit((Object)(object)val5) && (Object)(object)val5 != (Object)(object)val)
{
val2 = ((val5.teamComponent.teamIndex == val.teamComponent.teamIndex) ? Color.green : Color.red);
}
}
}
for (int i = 0; i < crosshairSprites.Length; i++)
{
((Graphic)crosshairSprites[i].image).color = (Color)(((??)val2) ?? crosshairSprites[i].color);
}
}
}
public class HealthBarMover : DisplayMover
{
private uint prevLevel;
private InteractionDriver interactionDriver;
public override void CheckForActivity()
{
//IL_00b2: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Invalid comparison between Unknown and I4
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Invalid comparison between Unknown and I4
HealthComponent val = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((HudElement)this).targetCharacterBody.healthComponent : null);
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
float num = val.health + val.shield;
float num2 = val.fullHealth + val.fullShield;
if (num / num2 < 0.99f)
{
SetActive();
}
uint num3 = Convert.FloorToUIntClamped(((HudElement)this).targetCharacterBody.level);
if (num3 != prevLevel)
{
prevLevel = num3;
SetActive();
}
if (!Object.op_Implicit((Object)(object)interactionDriver))
{
return;
}
PurchaseInteraction val2 = (Object.op_Implicit((Object)(object)interactionDriver.currentInteractable) ? interactionDriver.currentInteractable.GetComponent<PurchaseInteraction>() : null);
if (Object.op_Implicit((Object)(object)val2))
{
CostTypeIndex costType = val2.costType;
if ((int)costType == 2 || (int)costType == 15)
{
SetActive();
}
}
}
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
base.HUD_onHudTargetChangedGlobal(newHud);
interactionDriver = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((Component)((HudElement)this).targetCharacterBody).GetComponent<InteractionDriver>() : null);
}
}
public class ItemDisplayMover : DisplayMover
{
private InteractionDriver interactionDriver;
protected override void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
base.Awake();
offset = new Vector3(0f, 250f, 0f);
}
protected override void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Vector3 localPosition = ((Component)this).transform.localPosition;
localPosition.x = 0f;
((Component)this).transform.localPosition = localPosition;
base.Start();
}
public override void CheckForActivity()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between I4 and Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Invalid comparison between Unknown and I4
if (Object.op_Implicit((Object)(object)interactionDriver))
{
PurchaseInteraction val = (Object.op_Implicit((Object)(object)interactionDriver.currentInteractable) ? interactionDriver.currentInteractable.GetComponent<PurchaseInteraction>() : null);
if (Object.op_Implicit((Object)(object)val) && 4 <= (int)val.costType && (int)val.costType <= 13)
{
SetActive();
}
}
}
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
if (((HudElement)this).targetCharacterBody != null)
{
((HudElement)this).targetCharacterBody.onInventoryChanged -= base.SetActive;
}
base.HUD_onHudTargetChangedGlobal(newHud);
if (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody))
{
((HudElement)this).targetCharacterBody.onInventoryChanged += base.SetActive;
}
interactionDriver = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((Component)((HudElement)this).targetCharacterBody).GetComponent<InteractionDriver>() : null);
}
}
[RequireComponent(typeof(MoneyText))]
public class MoneyDisplayMover : DisplayMover
{
public CostTypeIndex costType;
private int cachedMoney;
private MoneyText moneyText;
private InteractionDriver interactionDriver;
protected override void Awake()
{
base.Awake();
moneyText = ((Component)this).GetComponent<MoneyText>();
activeInterval = 2.25f;
}
public override void CheckForActivity()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)moneyText))
{
int displayAmount = moneyText.displayAmount;
if (displayAmount != cachedMoney)
{
cachedMoney = displayAmount;
SetActive();
}
}
if (Object.op_Implicit((Object)(object)interactionDriver))
{
PurchaseInteraction val = (Object.op_Implicit((Object)(object)interactionDriver.currentInteractable) ? interactionDriver.currentInteractable.GetComponent<PurchaseInteraction>() : null);
if (Object.op_Implicit((Object)(object)val) && val.costType == costType)
{
SetActive();
}
}
}
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
base.HUD_onHudTargetChangedGlobal(newHud);
interactionDriver = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((Component)((HudElement)this).targetCharacterBody).GetComponent<InteractionDriver>() : null);
}
}
public class ObjectiveDisplayMover : DisplayMover
{
private int prevCount;
private ObjectivePanelController objectivePanel;
protected override void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
base.Awake();
offset = new Vector3(400f, 100f, 0f);
activeInterval = 3f;
objectivePanel = ((Component)this).GetComponentInChildren<ObjectivePanelController>();
GlobalEventManager.onTeamLevelUp += GlobalEventManager_onTeamLevelUp;
}
protected override void OnDestroy()
{
base.OnDestroy();
GlobalEventManager.onTeamLevelUp -= GlobalEventManager_onTeamLevelUp;
}
private void GlobalEventManager_onTeamLevelUp(TeamIndex team)
{
SetActive();
}
public override void CheckForActivity()
{
if (Object.op_Implicit((Object)(object)objectivePanel))
{
int count = objectivePanel.objectiveTrackers.Count;
if (count != prevCount)
{
prevCount = count;
SetActive();
}
}
}
}
public class SkillIconMover : DisplayMover
{
protected override void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
base.Awake();
offset = new Vector3(0f, 0f, 0f);
activeInterval = 2.25f;
}
public override void CheckForActivity()
{
CheckEquipment();
CheckSkills();
}
private void CheckEquipment()
{
Inventory val = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((HudElement)this).targetCharacterBody.inventory : null);
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
for (int i = 0; i < val._equipmentStateSlots?.Length; i++)
{
for (int j = 0; j < val._equipmentStateSlots[i]?.Length; j++)
{
if (((EquipmentState)(ref val._equipmentStateSlots[i][j])).isPerfomingRecharge)
{
SetActive();
return;
}
}
}
}
private void CheckSkills()
{
SkillLocator val = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((HudElement)this).targetCharacterBody.skillLocator : null);
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
for (int i = 0; i < val.allSkills?.Length; i++)
{
if (val.allSkills[i].stock < val.allSkills[i].maxStock)
{
SetActive();
break;
}
}
}
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
if (((HudElement)this).targetCharacterBody != null)
{
((HudElement)this).targetCharacterBody.onSkillActivatedAuthority -= OnSkillActivatedAuthority;
}
base.HUD_onHudTargetChangedGlobal(newHud);
if (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody))
{
((HudElement)this).targetCharacterBody.onSkillActivatedAuthority += OnSkillActivatedAuthority;
}
}
private void OnSkillActivatedAuthority(GenericSkill skill)
{
if (skill.stock < skill.maxStock)
{
SetActive();
}
}
}
}
namespace HunkHud.Components.UI
{
public class BandDisplay : CustomHudElement
{
public Gradient fillGradient;
public GameObject fullObj;
public GameObject fillObj;
public Image fillImage;
public string buffName;
public string cooldownName;
[NonSerialized]
public HealthBarMover healthBar;
private float timer;
private int maxBuffs;
private void FixedUpdate()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) && Object.op_Implicit((Object)(object)healthBar))
{
if (((HudElement)this).targetCharacterBody.HasBuff(BuffCatalog.FindBuffIndex(buffName)))
{
SetRingReady();
return;
}
int buffCount = ((HudElement)this).targetCharacterBody.GetBuffCount(BuffCatalog.FindBuffIndex(cooldownName));
if (buffCount > 0)
{
SetRingCooldown(buffCount);
return;
}
}
fillObj.SetActive(false);
fullObj.SetActive(false);
}
private void SetRingReady()
{
fullObj.SetActive(true);
fillObj.SetActive(false);
timer = 0f;
maxBuffs = 0;
}
private void SetRingCooldown(int newBuffs)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
fullObj.SetActive(false);
fillObj.SetActive(true);
healthBar.SetActive();
maxBuffs = Math.Max(maxBuffs, newBuffs);
float num = Util.Remap(timer, 0f, (float)maxBuffs, 0f, 1f);
((Graphic)fillImage).color = fillGradient.Evaluate(num);
fillImage.fillAmount = num;
timer += Time.fixedDeltaTime;
}
public BandDisplay()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0012: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: 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)
Gradient val = new Gradient();
val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
{
new GradientAlphaKey
{
alpha = 1f,
time = 0f
},
new GradientAlphaKey
{
alpha = 1f,
time = 1f
}
};
val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[5]
{
new GradientColorKey
{
color = Color.red,
time = 0f
},
new GradientColorKey
{
color = Color.yellow,
time = 0.5f
},
new GradientColorKey
{
color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
time = 0.6f
},
new GradientColorKey
{
color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
time = 0.95f
},
new GradientColorKey
{
color = Color.white,
time = 1f
}
};
fillGradient = val;
base..ctor();
}
}
public class BandDisplayController : CustomHudElement
{
public struct BandDisplayInfo
{
public ItemIndex[] itemsToDisplay;
public GameObject displayPrefab;
public string prefabName;
}
public HealthBarMover healthBar;
public static BandDisplayInfo[] bandInfos = new BandDisplayInfo[0];
private Inventory inventory;
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
if (((HudElement)this).targetCharacterBody != null)
{
((HudElement)this).targetCharacterBody.onInventoryChanged -= CheckInventory;
}
base.HUD_onHudTargetChangedGlobal(newHud);
if (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody))
{
((HudElement)this).targetCharacterBody.onInventoryChanged += CheckInventory;
}
}
private void CheckInventory()
{
inventory = (Object.op_Implicit((Object)(object)base.targetMaster) ? base.targetMaster.inventory : null);
Util.NullifyIfInvalid<Inventory>(ref inventory);
for (int i = 0; i < bandInfos.Length; i++)
{
AddOrRemovePrefab(ref bandInfos[i]);
}
}
private void AddOrRemovePrefab(ref BandDisplayInfo bandInfo)
{
bool flag = false;
if (inventory != null)
{
for (int i = 0; i < bandInfo.itemsToDisplay.Length; i++)
{
if (inventory.GetItemCountEffective(bandInfo.itemsToDisplay[i]) > 0)
{
flag = true;
break;
}
}
}
Transform val = ((Component)this).transform.Find(bandInfo.prefabName);
bool flag2 = (Object)(object)val != (Object)null;
if (flag != flag2)
{
if (flag2)
{
Object.Destroy((Object)(object)((Component)val).gameObject);
return;
}
GameObject obj = Object.Instantiate<GameObject>(bandInfo.displayPrefab, ((Component)this).transform);
((Object)obj).name = bandInfo.prefabName;
BandDisplay component = obj.GetComponent<BandDisplay>();
component.healthBar = healthBar;
((HudElement)component).hud = ((HudElement)this).hud;
}
}
}
public class CompatHandler : CustomHudElement
{
public TextMeshProUGUI currentText;
public TextMeshProUGUI totalText;
public TextMeshProUGUI bonusText;
public GameObject ammoPanel;
public GameObject textPanel;
public RawImage gunIcon;
public GameObject gunDisplay;
public GameObject characterDisplay;
public GameObject biomassDisplay;
protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
{
base.HUD_onHudTargetChangedGlobal(newHud);
CheckCompat();
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void CheckCompat()
{
if (Object.op_Implicit((Object)(object)base.targetMaster) && Object.op_Implicit((Object)(object)base.targetMaster.bodyPrefab) && Object.op_Implicit((Object)(object)((HudElement)this).hud) && Chainloader.PluginInfos.ContainsKey("com.rob.Hunk"))
{
HunkCompat();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void HunkCompat()
{
if (Object.op_Implicit((Object)(object)base.targetMaster.bodyPrefab.GetComponent<HunkController>()))
{
SetupHealthbarWeaponIcon();
MainContainer();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void MainContainer()
{
//IL_00b9: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
//IL_060f: Unknown result type (might be due to invalid IL or missing references)
//IL_0624: Unknown result type (might be due to invalid IL or missing references)
//IL_0639: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_0668: Unknown result type (might be due to invalid IL or missing references)
//IL_0673: Unknown result type (might be due to invalid IL or missing references)
//IL_0687: Unknown result type (might be due to invalid IL or missing references)
//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
//IL_070c: Unknown result type (might be due to invalid IL or missing references)
//IL_0721: Unknown result type (might be due to invalid IL or missing references)
//IL_0736: Unknown result type (might be due to invalid IL or missing references)
//IL_074b: Unknown result type (might be due to invalid IL or missing references)
//IL_0760: Unknown result type (might be due to invalid IL or missing references)
//IL_0775: Unknown result type (might be due to invalid IL or missing references)
//IL_078f: Unknown result type (might be due to invalid IL or missing references)
//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0508: Unknown result type (might be due to invalid IL or missing references)
//IL_051d: Unknown result type (might be due to invalid IL or missing references)
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_0547: Unknown result type (might be due to invalid IL or missing references)
//IL_0560: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/SpringCanvas/BottomLeftCluster/BarRoots/LevelDisplayCluster");
if (!Object.op_Implicit((Object)(object)((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras/NotificationPanel")))
{
GameObject obj = Object.Instantiate<GameObject>(HunkAssets.mainAssetBundle.LoadAsset<GameObject>("GenericTextPanel"), val);
((Object)obj).name = "NotificationPanel";
obj.transform.SetParent(((Component)((HudElement)this).hud).transform.Find("MainContainer").Find("MainUIArea").Find("CrosshairCanvas")
.Find("CrosshairExtras"));
obj.AddComponent<HunkNotificationHandler>().targetHUD = ((HudElement)this).hud;
RectTransform component = obj.GetComponent<RectTransform>();
((Transform)component).localScale = new Vector3(1f, 1f, 1f);
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(0f, 0f);
component.pivot = new Vector2(0f, 0f);
component.anchoredPosition = new Vector2(50f, 0f);
((Transform)component).localPosition = new Vector3(0f, -350f, 0f);
}
if (!Object.op_Implicit((Object)(object)((Component)((HudElement)this).hud).transform.Find("MainContainer/NotificationPanel")))
{
GameObject obj2 = Object.Instantiate<GameObject>(((Component)((Component)((HudElement)this).hud).transform.Find("MainContainer/NotificationArea")).gameObject);
((Object)obj2).name = "NotificationPanel";
obj2.transform.SetParent(((Component)((HudElement)this).hud).transform.Find("MainContainer"), true);
((Transform)obj2.GetComponent<RectTransform>()).localPosition = new Vector3(0f, -265f, -150f);
obj2.transform.localScale = Vector3.one;
NotificationUIController component2 = obj2.GetComponent<NotificationUIController>();
HunkNotificationUIController obj3 = obj2.AddComponent<HunkNotificationUIController>();
obj3.hud = component2.hud;
obj3.genericNotificationPrefab = HunkAssets.customNotificationPrefab;
obj3.notificationQueue = ((Component)((HudElement)this).hud.targetMaster).gameObject.AddComponent<HunkNotificationQueue>();
((Behaviour)component2).enabled = false;
}
((Component)((Component)((HudElement)this).hud).transform.Find("MainContainer/NotificationArea")).gameObject.AddComponent<AmmoNotificationHandler>();
if (!Object.op_Implicit((Object)(object)((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras/AmmoTracker")))
{
if (Config.fancyAmmoDisplay.Value)
{
GameObject val2 = Object.Instantiate<GameObject>(HunkAssets.mainAssetBundle.LoadAsset<GameObject>("AmmoPanel"), ((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras"));
((Object)val2).name = "AmmoDisplay";
val2.transform.SetParent(((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras"));
AmmoDisplay2 obj4 = val2.AddComponent<AmmoDisplay2>();
obj4.targetHUD = ((HudElement)this).hud;
obj4.currentText = ((Component)val2.transform.Find("Current")).gameObject.GetComponent<TextMeshProUGUI>();
obj4.totalText = ((Component)val2.transform.Find("Total")).gameObject.GetComponent<TextMeshProUGUI>();
obj4.bonusText = ((Component)val2.transform.Find("Bonus")).gameObject.GetComponent<TextMeshProUGUI>();
obj4.fontOverride = HunkAssets.hgFont;
RectTransform component3 = val2.GetComponent<RectTransform>();
((Transform)component3).localScale = new Vector3(1f, 1f, 1f);
component3.anchorMin = new Vector2(0f, 0f);
component3.anchorMax = new Vector2(0f, 0f);
component3.pivot = new Vector2(0.5f, 0f);
component3.anchoredPosition = new Vector2(50f, 0f);
((Transform)component3).localPosition = new Vector3(100f, -150f, 0f);
}
else
{
GameObject val3 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)((HudElement)this).hud).transform.Find("MainContainer").Find("MainUIArea").Find("SpringCanvas")
.Find("BottomLeftCluster"));
((Object)val3).name = "AmmoTracker";
val3.transform.SetParent(((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras"));
Object.DestroyImmediate((Object)(object)((Component)val3.transform.GetChild(0)).gameObject);
Object.Destroy((Object)(object)val3.GetComponentInChildren<LevelText>());
Object.Destroy((Object)(object)val3.GetComponentInChildren<ExpBar>());
AmmoDisplay obj5 = val3.AddComponent<AmmoDisplay>();
obj5.targetHUD = ((HudElement)this).hud;
obj5.targetText = ((Component)val3.transform.Find("LevelDisplayRoot").Find("PrefixText")).gameObject.GetComponent<LanguageTextMeshController>();
((Component)val3.transform.Find("LevelDisplayRoot").Find("ValueText")).gameObject.SetActive(false);
((Component)val3.transform.Find("LevelDisplayRoot")).GetComponent<RectTransform>().anchoredPosition = new Vector2(-12f, 0f);
RectTransform component4 = val3.GetComponent<RectTransform>();
((Transform)component4).localScale = new Vector3(0.8f, 0.8f, 1f);
component4.anchorMin = new Vector2(0f, 0f);
component4.anchorMax = new Vector2(0f, 0f);
component4.pivot = new Vector2(0.5f, 0f);
component4.anchoredPosition = new Vector2(50f, 0f);
((Transform)component4).localPosition = new Vector3(50f, -95f, 0f);
}
}
GameObject obj6 = Object.Instantiate<GameObject>(HunkAssets.mainAssetBundle.LoadAsset<GameObject>("StaminaBar"), val);
((Object)obj6).name = "RailgunChargeBar";
obj6.transform.SetParent(((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras"));
obj6.AddComponent<RailgunChargeBar>().targetHUD = ((HudElement)this).hud;
RectTransform component5 = obj6.GetComponent<RectTransform>();
((Transform)component5).localScale = new Vector3(1f, 1f, 1f);
component5.anchorMin = new Vector2(0f, 0f);
component5.anchorMax = new Vector2(0f, 0f);
component5.offsetMin = new Vector2(-150f, 0f);
component5.offsetMax = new Vector2(150f, 0f);
component5.pivot = new Vector2(0f, 0f);
component5.anchoredPosition = new Vector2(0f, 0f);
((Transform)component5).localPosition = new Vector3(-50f, -50f, 0f);
((Transform)component5).localRotation = Quaternion.identity;
component5.sizeDelta = new Vector2(100f, 10f);
GameObject obj7 = Object.Instantiate<GameObject>(HunkAssets.mainAssetBundle.LoadAsset<GameObject>("StaminaBar"), val);
((Object)obj7).name = "MayhemChargeBar";
obj7.transform.SetParent(((Component)((HudElement)this).hud).transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras"));
obj7.AddComponent<MayhemGauge>().targetHUD = ((HudElement)this).hud;
RectTransform component6 = obj7.GetComponent<RectTransform>();
((Transform)component6).localScale = new Vector3(1f, 1f, 1f);
component6.anchorMin = new Vector2(0f, 0f);
component6.anchorMax = new Vector2(0f, 0f);
component6.offsetMin = new Vector2(-150f, 0f);
component6.offsetMax = new Vector2(150f, 0f);
component6.pivot = new Vector2(0f, 0f);
component6.anchoredPosition = new Vector2(0f, 0f);
((Transform)component6).localPosition = new Vector3(-200f, -50f, 0f);
((Transform)component6).localRotation = Quaternion.Euler(new Vector3(0f, 0f, 90f));
component6.sizeDelta = new Vector2(100f, 10f);
}
private void SetupHealthbarWeaponIcon()
{
characterDisplay.SetActive(false);
biomassDisplay.SetActive(false);
gunDisplay.SetActive(true);
textPanel.SetActive(false);
ammoPanel.SetActive(true);
((Component)gunIcon).gameObject.SetActive(true);
WeaponIcon obj = UnityObjectExtensions.EnsureComponent<WeaponIcon>(gunDisplay);
obj.targetHUD = ((HudElement)this).hud;
obj.iconImage = gunIcon;
obj.displayRoot = gunDisplay;
AmmoDisplay2 obj2 = UnityObjectExtensions.EnsureComponent<AmmoDisplay2>(ammoPanel);
obj2.useDesiredAlpha = false;
obj2.targetHUD = ((HudElement)this).hud;
obj2.currentText = currentText;
obj2.totalText = totalText;
obj2.bonusText = bonusText;
}
}
public class CustomHealthBar : HealthBar
{
[Serializable]
public struct CustomBarInfo
{
[NonSerialized]
public bool enabled;
[NonSerialized]
public float targetFill;
[NonSerialized]
public float currentFill;
[SerializeField]
public Image image;
}
public static CustomHealthBar instance;
public Gradient healthBarGradient;
public Color shieldColor;
public Color pinkShieldColor;
public Color infusionColor;
public CustomBarInfo healthFill;
public CustomBarInfo lowHealthFill;
public CustomBarInfo shieldFill;
public CustomBarInfo damageFill;
public CustomBarInfo healingFill;
public CustomBarInfo curseFill;
public CustomBarInfo barrierFill;
public CustomBarInfo barrierFillShiny;
public CustomBarInfo delayedDamageMask;
public CustomBarInfo ospFill;
public CustomBarInfo echoFill;
public CustomBarInfo collapseFill;
public CustomBarInfo cullFill;
public TextMeshProUGUI gunText;
public RawImage gunIcon;
public GameObject gunIconHolder;
public RawImage characterIcon;
public RawImage characterIconBorder;
public GameObject characterIconHolder;
public GameObject lunarRuinDisplay;
public GameObject immunityDisplay;
public GameObject biomassBar;
public HealthBarMover hpBarMover;
private float fillSpeed;
private float minFill;
private float maxFill;
private float inverseFillMin;
private float inverseFillMax;
public CharacterBody targetBody => ((HealthBar)this).source?.body;
private void Awake()
{
((HealthBar)this).Awake();
SetDefaults();
biomassBar.SetActive(false);
gunIconHolder.SetActive(false);
characterIconHolder.SetActive(true);
}
private void OnEnable()
{
((HealthBar)this).OnEnable();
SingletonHelper.Assign<CustomHealthBar>(ref instance, this);
}
private void OnDisable()
{
((HealthBar)this).OnDisable();
SingletonHelper.Unassign<CustomHealthBar>(ref instance, this);
}
private void Update()
{
base.updateTimer -= Time.deltaTime;
if ((Object)(object)base._source != (Object)(object)base.oldSource)
{
base.updateTimer = 0f;
base.oldSource = base._source;
SetCharacterIcon();
}
if (base.updateTimer <= 0f)
{
base.updateTimer = base.updateDelay;
SetCharacterIcon();
UpdateCustomBarInfos();
ApplyCustomBars();
}
ApplyCustomBarsUpdate();
}
private void ApplyCustomBarsUpdate()
{
Apply(ref healthFill);
Apply(ref shieldFill);
Apply(ref damageFill);
}
private void ApplyCustomBars()
{
Apply(ref healingFill);
Apply(ref barrierFill);
Apply(ref barrierFillShiny);
Apply(ref lowHealthFill);
Apply(ref curseFill);
Apply(ref cullFill);
Apply(ref delayedDamageMask);
Apply(ref collapseFill);
Apply(ref echoFill);
Apply(ref ospFill);
}
private void Apply(ref CustomBarInfo info)
{
if (info.currentFill != info.targetFill)
{
info.currentFill = Mathf.Lerp(info.currentFill, info.targetFill, fillSpeed * Time.deltaTime);
}
((Behaviour)info.image).enabled = info.enabled;
info.image.fillAmount = info.currentFill;
}
private void SetDefaults()
{
healthFill.enabled = false;
healingFill.enabled = false;
lowHealthFill.enabled = false;
shieldFill.enabled = false;
barrierFill.enabled = false;
barrierFillShiny.enabled = false;
damageFill.targetFill = 0f;
damageFill.enabled = 0f < damageFill.currentFill;
delayedDamageMask.enabled = false;
collapseFill.enabled = false;
echoFill.enabled = false;
ospFill.enabled = false;
cullFill.enabled = false;
immunityDisplay.SetActive(false);
}
private void UpdateCustomBarInfos()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_007e: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: 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_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)((HealthBar)this).source) || !Object.op_Implicit((Object)(object)targetBody))
{
SetDefaults();
return;
}
if (base.isInventoryCheckDirty)
{
((HealthBar)this).CheckInventory();
}
HealthBarValues healthBarValues = ((HealthBar)this).source.GetHealthBarValues();
float num = 1f - (healthBarValues.healthFraction + healthBarValues.shieldFraction);
float num2 = 1f - healthBarValues.curseFraction;
float num3 = Mathf.Clamp01(GetCollapseFraction() * num2);
((Graphic)shieldFill.image).color = (healthBarValues.hasVoidShields ? pinkShieldColor : shieldColor);
((Graphic)healthFill.image).color = (healthBarValues.hasInfusion ? infusionColor : healthBarGradient.Evaluate(healthBarValues.healthFraction));
GameObject obj = immunityDisplay;
if (obj != null)
{
obj.SetActive(targetBody.HasBuff(Buffs.HiddenInvincibility));
}
GameObject obj2 = lunarRuinDisplay;
if (obj2 != null)
{
obj2.SetActive(healthBarValues.hasLunarRuin);
}
float num4 = Util.Remap(healthBarValues.healthFraction, 0f, 1f, minFill, maxFill);
healthFill.enabled = healthBarValues.healthFraction > 0f;
healthFill.targetFill = num4;
healthFill.currentFill = Mathf.Min(num4, healthFill.currentFill);
float num5 = Util.Remap(healthBarValues.healthFraction + healthBarValues.shieldFraction, 0f, 1f, minFill, maxFill);
damageFill.targetFill = num5;
damageFill.currentFill = Mathf.Max(num5, damageFill.currentFill);
damageFill.enabled = damageFill.currentFill > num5;
shieldFill.enabled = healthBarValues.shieldFraction > 0f;
shieldFill.targetFill = num5;
shieldFill.currentFill = Mathf.Min(num5, shieldFill.currentFill);
Remap(ref healingFill, healthBarValues.healthFraction, healthFill.currentFill < healthFill.targetFill, inverse: false);
Remap(ref lowHealthFill, HealthComponent.lowHealthFraction * num2, (base.hasLowHealthItem || base.hasLowHealthBuff) && !((HealthBar)this).source.isHealthLow, inverse: false);
Remap(ref barrierFill, healthBarValues.barrierFraction, healthBarValues.barrierFraction > 0f, inverse: false);
Remap(ref barrierFillShiny, healthBarValues.barrierFraction, healthBarValues.barrierFraction > 0f, inverse: false);
Remap(ref cullFill, healthBarValues.cullFraction, healthBarValues.cullFraction > 0f, inverse: false);
Remap(ref curseFill, healthBarValues.curseFraction, healthBarValues.curseFraction > 0f, inverse: true);
Remap(ref ospFill, healthBarValues.ospFraction + num, healthBarValues.ospFraction > 0f, inverse: true);
Remap(ref delayedDamageMask, healthBarValues.healthFraction + healthBarValues.shieldFraction, enabled: true, inverse: false);
Remap(ref collapseFill, num3 + num, num3 > 0f && targetBody.HasBuff(Buffs.Fracture), inverse: true);
Remap(ref echoFill, healthBarValues.echoFraction + num, healthBarValues.echoFraction > 0f && targetBody.HasBuff(Buffs.DelayedDamageDebuff), inverse: true);
if (echoFill.enabled || collapseFill.enabled)
{
hpBarMover?.SetActive();
damageFill.currentFill = damageFill.targetFill;
}
void Remap(ref CustomBarInfo bar, float value, bool enabled, bool inverse)
{
bar.enabled = enabled;
value = Mathf.Clamp01(value);
bar.currentFill = (bar.targetFill = (inverse ? Util.Remap(value, 0f, 1f, inverseFillMin, inverseFillMax) : Util.Remap(value, 0f, 1f, minFill, maxFill)));
}
}
private float GetCollapseFraction()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_005f: 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)
DotController val = DotController.FindDotController(((Component)targetBody).gameObject);
if (!Object.op_Implicit((Object)(object)val) || !val.HasDotActive((DotIndex)8))
{
return 0f;
}
float num = 0f;
foreach (DotStack dotStack in val.dotStackList)
{
if ((int)dotStack.dotIndex == 8)
{
float damage = dotStack.damage;
ModifyIncomingDamage(ref damage, dotStack.attackerObject, dotStack.attackerTeam, dotStack.damageType);
num += Mathf.Max(0f, damage);
}
}
return num / ((HealthBar)this).source.fullCombinedHealth;
}
private void ModifyIncomingDamage(ref float damage, GameObject attacker, TeamIndex attackerTeam, DamageTypeCombo damageType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
if ((damageType.damageTypeExtended & 0x10000000) != 0)
{
damage = ((HealthBar)this).source.fullHealth * 0.1f;
}
if (targetBody.HasBuff(Buffs.KnockUpHitEnemiesJuggleCount))
{
damage *= 1f + 0.1f * (float)targetBody.GetBuffCount(Buffs.KnockUpHitEnemiesJuggleCount);
}
if (targetBody.HasBuff(Buffs.lunarruin))
{
damage *= 1f + 0.1f * (float)targetBody.GetBuffCount(Buffs.lunarruin);
}
if (attackerTeam == targetBody.teamComponent.teamIndex)
{
damage *= TeamCatalog.GetTeamDef(attackerTeam)?.friendlyFireScaling ?? 1f;
}
CharacterBody val = (Object.op_Implicit((Object)(object)attacker) ? attacker.GetComponent<CharacterBody>() : null);
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory))
{
int itemCountEffective;
if (((HealthBar)this).source.combinedHealth >= ((HealthBar)this).source.fullCombinedHealth * 0.9f)
{
itemCountEffective = val.inventory.GetItemCountEffective(Items.Crowbar);
if (itemCountEffective > 0)
{
damage *= 1f + 0.75f * (float)itemCountEffective;
}
}
itemCountEffective = val.inventory.GetItemCountEffective(Items.NearbyDamageBonus);
if (itemCountEffective > 0)
{
Vector3 val2 = targetBody.corePosition - val.corePosition;
if (((Vector3)(ref val2)).sqrMagnitude <= 169f)
{
damage *= 1f + (float)itemCountEffective * 0.2f;
}
}
itemCountEffective = val.inventory.GetItemCountEffective(Items.FragileDamageBonus);
if (itemCountEffective > 0)
{
damage *= 1f + (float)itemCountEffective * 0.2f;
}
}
if ((damageType.damageType & 0x10) != 0)
{
damage *= 1.5f;
}
if (targetBody.HasBuff(Buffs.DeathMark))
{
damage *= 1.5f;
}
if ((damageType.damageType & 2) == 0)
{
float num = targetBody.armor + ((HealthBar)this).source.adaptiveArmorValue;
if ((targetBody.bodyFlags & 0x40) != 0 && DamageTypeCombo.op_Implicit(damageType & DamageTypeCombo.op_Implicit((DamageType)131072)) != 0L)
{
num += 300f;
}
float num2 = ((num >= 0f) ? (1f - num / (num + 100f)) : (2f - 100f / (100f - num)));
damage = Mathf.Max(1f, damage * num2);
if (Object.op_Implicit((Object)(object)targetBody.inventory))
{
int itemCountEffective = targetBody.inventory.GetItemCountEffective(Items.ArmorPlate);
if (itemCountEffective > 0)
{
damage = Mathf.Max(1f, damage - 5f * (float)itemCountEffective);
}
}
}
if (targetBody.hasOneShotProtection && (damageType.damageType & 0x40000) == 0)
{
float num3 = (((HealthBar)this).source.fullCombinedHealth + ((HealthBar)this).source.barrier) * (1f - targetBody.oneShotProtectionFraction);
float num4 = Mathf.Max(0f, num3 - ((HealthBar)this).source.serverDamageTakenThisUpdate);
damage = Mathf.Min(damage, num4);
}
if ((damageType.damageType & 0x80000) != 0)
{
damage *= Mathf.Lerp(3f, 1f, ((HealthBar)this).source.combinedHealthFraction);
}
if (targetBody.HasBuff(Buffs.LunarShell))
{
damage = Mathf.Min(damage, ((HealthBar)this).source.fullHealth * 0.1f);
}
if (Object.op_Implicit((Object)(object)targetBody.inventory))
{
int itemCountEffective = targetBody.inventory.GetItemCountEffective(Items.MinHealthPercentage);
if (itemCountEffective > 0)
{
float num5 = ((HealthBar)this).source.fullCombinedHealth * ((float)itemCountEffective / 100f);
damage = Mathf.Max(0f, Mathf.Min(damage, ((HealthBar)this).source.combinedHealth - num5));
}
}
if (targetBody.HasBuff(Buffs.DelayedDamageBuff))
{
damage *= 0.8f;
}
}
public void SetCharacterIcon()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)targetBody))
{
Color bodyColor = targetBody.bodyColor;
bodyColor.a = 0.5f;
((Graphic)characterIconBorder).color = bodyColor;
characterIcon.texture = targetBody.portraitIcon;
}
}
public void SetGenericIcon(Texture icon = null)
{
gunIconHolder.SetActive(true);
characterIconHolder.SetActive(false);
gunIcon.texture = icon;
}
public CustomHealthBar()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0012: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
Gradient val = new Gradient();
val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
{
new GradientAlphaKey
{
alpha = 1f,
time = 0f
},
new GradientAlphaKey
{
alpha = 1f,
time = 1f
}
};
val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[4]
{
new GradientColorKey
{
color = Color.red,
time = 0f
},
new GradientColorKey
{
color = Color.yellow,
time = 0.5f
},
new GradientColorKey
{
color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
time = 0.8f
},
new GradientColorKey
{
color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
time = 1f
}
};
healthBarGradient = val;
shieldColor = new Color(0.14901961f, 0.70980394f, 0.80784315f);
pinkShieldColor = new Color(0.80784315f, 0.29803923f, 0.7607843f);
infusionColor = new Color(1f, 18f / 85f, 0.23137255f);
fillSpeed = 1.5f;
minFill = 0.341f;
maxFill = 0.752f;
inverseFillMin = 0.248f;
inverseFillMax = 0.659f;
((HealthBar)this)..ctor();
}
}
public class LuminousDisplay : CustomHudElement
{
public Color activeColor = Color.white;
public Color inactiveColor = new Color(0f, 0f, 0f, 0.25f);
public TextMeshProUGUI label;
public GameObject baseHolder;
public Image[] pips;
private void FixedUpdate()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
int num = (Object.op_Implicit((Object)(object)((HudElement)this).targetCharacterBody) ? ((HudElement)this).targetCharacterBody.GetBuffCount(Buffs.IncreasePrimaryDamageBuff) : 0);
if (num == 0)
{
baseHolder.SetActive(false);
return;
}
for (int i = 0; i < pips.Length; i++)
{
((Graphic)pips[i]).color = ((num > i) ? activeColor : inactiveColor);
}
((TMP_Text)label).text = num.ToString();
baseHolder.SetActive(true);
}
}
public class ObjectiveChargeDisplay : MonoBehaviour
{
public Image fill;
public GameObject fullBar;
public TextMeshProUGUI label;
public CanvasGroup canvas;
private float targetAlpha;
private void Awake()
{
((Component)this).transform.SetSiblingIndex(1);
}
private void FixedUpdate()
{
//IL_0001: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected I4, but got Unknown
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
ActivationState val = (ActivationState)0;
if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
{
val = TeleporterInteraction.instance.activationState;
}
switch (val - 1)
{
default:
targetAlpha = 0f;
break;
case 0:
fullBar.SetActive(false);
fill.fillAmount = 0f;
((TMP_Text)label).text = "";
targetAlpha = Mathf.Lerp(targetAlpha, 1f, Time.fixedDeltaTime);
break;
case 1:
fullBar.SetActive(false);
fill.fillAmount = TeleporterInteraction.instance.chargeFraction;
((TMP_Text)label).text = $"{TeleporterInteraction.instance.chargePercent}%";
targetAlpha = 1f;
break;
case 2:
fullBar.SetActive(true);
fill.fillAmount = 1f;
((TMP_Text)label).text = "100%";
targetAlpha = Mathf.Lerp(targetAlpha, 0f, Time.fixedDeltaTime);
break;
}
canvas.alpha = targetAlpha;
((Component)canvas).gameObject.SetActive(targetAlpha > 0f);
}
}
}