Decompiled source of Lareins RedHealthBars v1.0.0

plugins\Lareins_RedHealthBars\Lareins_RedHealthBars.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Lareins_Core;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lareins_RedHealthBars")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lareins_RedHealthBars")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e5f6c80f-4497-444b-92e6-000b71f25320")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Lareins_RedHealthBars;

[BepInPlugin("com.lareins.redhealthbars", "Lareins_RedHealthBars", "2.9.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class RedHealthBarsPlugin : BaseUnityPlugin
{
	private class KaynakCan
	{
		public int id;

		public Component hedef;

		public ZNetView nv;

		public string ad;

		public Vector3 merkezNokta;

		public float maks;

		public float sonBilinenCan;

		public float zaman;

		public int bolgeIndex = -1;
	}

	public const string ModGUID = "com.lareins.redhealthbars";

	public const string ModName = "Lareins_RedHealthBars";

	public const string ModVersion = "2.9.0";

	public static ConfigEntry<bool> ModAktif;

	public static ConfigEntry<int> GorusMesafesi;

	public static ConfigEntry<int> KaynakMesafesi;

	public static ConfigEntry<bool> KaynakBarlariAktif;

	public static ConfigEntry<bool> IsimGoster;

	private static readonly List<KaynakCan> kaynaklar = new List<KaynakCan>();

	private static Texture2D gradyanKirmiziDoku;

	private static Texture2D arkaPlanDoku;

	private static Texture2D inceCerceveDoku;

	private static Texture2D parlamaDoku;

	private static GUIStyle canYaziStil;

	private static GUIStyle isimYaziStil;

	private static GUIStyle golgeYaziStil;

	private static readonly int HedefKatmanMaskesi = 4494849;

	private void Awake()
	{
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		ModAktif = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "ModAktif", true, "Bakilan veya vurulan yaratik, agac ve madenlerin ustunde zarif kirmizi can barini gosterir");
		GorusMesafesi = ((BaseUnityPlugin)this).Config.Bind<int>("Arayuz", "GorusMesafesi", 25, "Yaratik ve hayvan can barlarinin gorunecegi mesafe (10m - 50m)");
		KaynakMesafesi = ((BaseUnityPlugin)this).Config.Bind<int>("Arayuz", "KaynakMesafesi", 7, "Agac, kaya ve maden barlarinin gorunecegi yakin mesafe (3m - 15m)");
		KaynakBarlariAktif = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "KaynakBarlariAktif", true, "Agac, tomruk, kaya ve maden damarlarinin can barini gosterir");
		IsimGoster = ((BaseUnityPlugin)this).Config.Bind<bool>("Arayuz", "IsimGoster", true, "Can barinin uzerinde hedef adini gosterir");
		CorePlugin.AyarEkle("Kirmizi Can Barlari", "Mod Aktif", "Bakilan veya vurulan hedef ve kaynaklarin canini gosterir.", ModAktif);
		CorePlugin.AyarEkle("Kirmizi Can Barlari", "Kaynak Barlari", "Agac, tomruk ve madenlerin can barini gosterir.", KaynakBarlariAktif);
		CorePlugin.AyarEkle("Kirmizi Can Barlari", "Hedef Ismi Goster", "Barin ustunde yaratik veya kaynagin adini yazar.", IsimGoster);
		CorePlugin.AyarEkle("Kirmizi Can Barlari", "Yaratik Mesafesi (m)", "Dusman ve hayvan barlarinin gorunme mesafesi (10m - 50m).", GorusMesafesi, 10, 50);
		CorePlugin.AyarEkle("Kirmizi Can Barlari", "Agac/Maden Mesafesi (m)", "Agac ve maden barlarinin gorunme mesafesi (3m - 15m).", KaynakMesafesi, 3, 15);
		new Harmony("com.lareins.redhealthbars").PatchAll(typeof(RedHealthBarsPlugin));
	}

	[HarmonyPatch(typeof(EnemyHud), "UpdateHuds")]
	[HarmonyPostfix]
	private static void VarsayilanBarlariGizle(EnemyHud __instance)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		if (!ModAktif.Value || (Object)(object)__instance == (Object)null || (Object)(object)__instance.m_hudRoot == (Object)null)
		{
			return;
		}
		foreach (Transform item in __instance.m_hudRoot.transform)
		{
			Transform val = item;
			if (((Component)val).gameObject.activeSelf && !((Object)val).name.Contains("Boss"))
			{
				((Component)val).gameObject.SetActive(false);
			}
		}
	}

	[HarmonyPatch(typeof(TreeBase), "Damage")]
	[HarmonyPostfix]
	private static void AgacHasar(TreeBase __instance, HitData hit)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (ModAktif.Value && KaynakBarlariAktif.Value && !((Object)(object)__instance == (Object)null))
		{
			float vurulanHasar = ((hit != null) ? hit.GetTotalDamage() : 0f);
			KaynakKaydet((Component)(object)__instance, ((Component)__instance).GetComponent<ZNetView>(), TurkceIsim(((Object)__instance).name), SabitMerkezBul((Component)(object)__instance, null), __instance.m_health, vurulanHasar, 3f);
		}
	}

	[HarmonyPatch(typeof(TreeLog), "Damage")]
	[HarmonyPostfix]
	private static void TomrukHasar(TreeLog __instance, HitData hit)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (ModAktif.Value && KaynakBarlariAktif.Value && !((Object)(object)__instance == (Object)null))
		{
			float vurulanHasar = ((hit != null) ? hit.GetTotalDamage() : 0f);
			KaynakKaydet((Component)(object)__instance, ((Component)__instance).GetComponent<ZNetView>(), TurkceIsim(((Object)__instance).name), SabitMerkezBul((Component)(object)__instance, null), __instance.m_health, vurulanHasar, 3f);
		}
	}

	[HarmonyPatch(typeof(Destructible), "Damage")]
	[HarmonyPostfix]
	private static void KayaHasar(Destructible __instance, HitData hit)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (ModAktif.Value && KaynakBarlariAktif.Value && !((Object)(object)__instance == (Object)null))
		{
			float vurulanHasar = ((hit != null) ? hit.GetTotalDamage() : 0f);
			KaynakKaydet((Component)(object)__instance, ((Component)__instance).GetComponent<ZNetView>(), TurkceIsim(((Object)__instance).name), SabitMerkezBul((Component)(object)__instance, null), __instance.m_health, vurulanHasar, 3f);
		}
	}

	[HarmonyPatch(typeof(MineRock), "Damage")]
	[HarmonyPostfix]
	private static void MadenHasar(MineRock __instance, HitData hit)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (ModAktif.Value && KaynakBarlariAktif.Value && !((Object)(object)__instance == (Object)null))
		{
			float vurulanHasar = ((hit != null) ? hit.GetTotalDamage() : 0f);
			KaynakKaydet((Component)(object)__instance, ((Component)__instance).GetComponent<ZNetView>(), TurkceIsim(((Object)__instance).name), SabitMerkezBul((Component)(object)__instance, null), __instance.m_health, vurulanHasar, 3f);
		}
	}

	[HarmonyPatch(typeof(MineRock5), "DamageArea")]
	[HarmonyPostfix]
	private static void BuyukMadenHasar(MineRock5 __instance, int hitAreaIndex, HitData hit)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		if (ModAktif.Value && KaynakBarlariAktif.Value && !((Object)(object)__instance == (Object)null))
		{
			float vurulanHasar = ((hit != null) ? hit.GetTotalDamage() : 0f);
			Vector3 sabitMerkez = ((hit != null && hit.m_point != Vector3.zero) ? (hit.m_point + Vector3.up * 0.45f) : SabitMerkezBul((Component)(object)__instance, null));
			KaynakKaydet((Component)(object)__instance, ((Component)__instance).GetComponent<ZNetView>(), TurkceIsim(((Object)__instance).name), sabitMerkez, __instance.m_health, vurulanHasar, 3f, hitAreaIndex);
		}
	}

	private static Vector3 SabitMerkezBul(Component comp, Collider vurulanCollider)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//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_002e: 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_00b0: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: 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)
		if (comp is TreeBase)
		{
			return comp.transform.position + Vector3.up * 1.65f;
		}
		Collider val = (((Object)(object)vurulanCollider != (Object)null) ? vurulanCollider : comp.GetComponentInChildren<Collider>());
		if ((Object)(object)val != (Object)null)
		{
			Bounds bounds = val.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			float num = center.y + 0.35f;
			bounds = val.bounds;
			float num2 = Mathf.Max(num, ((Bounds)(ref bounds)).max.y + 0.25f);
			return new Vector3(center.x, num2, center.z);
		}
		return comp.transform.position + Vector3.up * 0.9f;
	}

	private static string TurkceIsim(string hamAd)
	{
		if (string.IsNullOrEmpty(hamAd))
		{
			return "Kaynak";
		}
		string text = hamAd.ToLower();
		if (text.Contains("beech"))
		{
			return text.Contains("log") ? "Kayın Tomruğu" : "Kayın Ağacı";
		}
		if (text.Contains("birch"))
		{
			return text.Contains("log") ? "Huş Tomruğu" : "Huş Ağacı";
		}
		if (text.Contains("oak"))
		{
			return text.Contains("log") ? "Meşe Tomruğu" : "Meşe Ağacı";
		}
		if (text.Contains("pine"))
		{
			return text.Contains("log") ? "Çam Tomruğu" : "Çam Ağacı";
		}
		if (text.Contains("fir"))
		{
			return text.Contains("log") ? "Köknar Tomruğu" : "Köknar Ağacı";
		}
		if (text.Contains("ancient"))
		{
			return "Kadim Ağaç";
		}
		if (text.Contains("yggdrasil"))
		{
			return "Yggdrasil Dalı";
		}
		if (text.Contains("stub"))
		{
			return "Ağaç Kütüğü";
		}
		if (text.Contains("copper"))
		{
			return "Bakır Yatağı";
		}
		if (text.Contains("tin"))
		{
			return "Kalay Yatağı";
		}
		if (text.Contains("silver"))
		{
			return "Gümüş Damarı";
		}
		if (text.Contains("mudpile") || text.Contains("scrap"))
		{
			return "Hurda Yığını";
		}
		if (text.Contains("obsidian"))
		{
			return "Obsidiyen";
		}
		if (text.Contains("flint"))
		{
			return "Çakmaktaşı";
		}
		if (text.Contains("rock") || text.Contains("stone"))
		{
			return "Kaya";
		}
		if (text.Contains("bush") || text.Contains("shrub"))
		{
			return "Çalı";
		}
		string text2 = hamAd.Replace("(Clone)", "").Replace("_frac", "").Replace("$", "")
			.Replace("_", " ")
			.Trim();
		if (text2.Length > 1)
		{
			text2 = char.ToUpper(text2[0]) + text2.Substring(1);
		}
		return text2;
	}

	private static void KaynakKaydet(Component hedef, ZNetView nv, string ad, Vector3 sabitMerkez, float maks, float vurulanHasar, float kalmaSuresi, int bolgeIndex = -1)
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)nv == (Object)null) && nv.IsValid())
		{
			int id = ((Object)hedef).GetInstanceID();
			KaynakCan kaynakCan = kaynaklar.Find((KaynakCan k) => k.id == id && k.bolgeIndex == bolgeIndex);
			if (kaynakCan == null)
			{
				kaynakCan = new KaynakCan
				{
					id = id,
					hedef = hedef,
					nv = nv,
					ad = ad,
					merkezNokta = sabitMerkez,
					maks = Mathf.Max(1f, maks),
					sonBilinenCan = Mathf.Max(1f, maks),
					bolgeIndex = bolgeIndex
				};
				kaynaklar.Add(kaynakCan);
			}
			if (vurulanHasar > 0f)
			{
				kaynakCan.sonBilinenCan = Mathf.Max(0f, kaynakCan.sonBilinenCan - vurulanHasar);
			}
			float num = Time.time + kalmaSuresi;
			if (num > kaynakCan.zaman)
			{
				kaynakCan.zaman = num;
			}
		}
	}

	private static float GercekCanOku(KaynakCan k)
	{
		if ((Object)(object)k.nv == (Object)null || !k.nv.IsValid())
		{
			return 0f;
		}
		ZDO zDO = k.nv.GetZDO();
		if (zDO == null)
		{
			return k.sonBilinenCan;
		}
		if (k.hedef is MineRock5 && k.bolgeIndex >= 0)
		{
			string text = "health" + k.bolgeIndex;
			return zDO.GetFloat(text, k.sonBilinenCan);
		}
		float num = zDO.GetFloat(ZDOVars.s_health, -1f);
		if (num > 0f)
		{
			k.sonBilinenCan = num;
			return num;
		}
		return k.sonBilinenCan;
	}

	private static void DokulariHazirla()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_009e: Expected O, but got Unknown
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Expected O, but got Unknown
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Expected O, but got Unknown
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Expected O, but got Unknown
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: 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_01cc: Expected O, but got Unknown
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Expected O, but got Unknown
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)gradyanKirmiziDoku != (Object)null))
		{
			gradyanKirmiziDoku = new Texture2D(1, 12);
			for (int i = 0; i < 12; i++)
			{
				float num = (float)i / 11f;
				Color val = Color.Lerp(new Color(0.52f, 0.04f, 0.05f, 0.94f), new Color(0.92f, 0.16f, 0.16f, 0.96f), num);
				gradyanKirmiziDoku.SetPixel(0, i, val);
			}
			gradyanKirmiziDoku.Apply();
			arkaPlanDoku = new Texture2D(1, 1);
			arkaPlanDoku.SetPixel(0, 0, new Color(0.04f, 0.04f, 0.05f, 0.78f));
			arkaPlanDoku.Apply();
			inceCerceveDoku = new Texture2D(1, 1);
			inceCerceveDoku.SetPixel(0, 0, new Color(0.18f, 0.15f, 0.14f, 0.92f));
			inceCerceveDoku.Apply();
			parlamaDoku = new Texture2D(1, 1);
			parlamaDoku.SetPixel(0, 0, new Color(1f, 0.75f, 0.75f, 0.3f));
			parlamaDoku.Apply();
			canYaziStil = new GUIStyle(GUI.skin.label)
			{
				fontSize = 10,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			canYaziStil.normal.textColor = new Color(0.98f, 0.98f, 0.98f, 0.96f);
			isimYaziStil = new GUIStyle(GUI.skin.label)
			{
				fontSize = 11,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			isimYaziStil.normal.textColor = new Color(0.96f, 0.9f, 0.78f, 0.96f);
			golgeYaziStil = new GUIStyle(isimYaziStil);
			golgeYaziStil.normal.textColor = new Color(0f, 0f, 0f, 0.88f);
		}
	}

	private static bool NesneKaynakKontrol(GameObject obj, Collider col)
	{
		//IL_003f: 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_00d9: 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_0176: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)obj == (Object)null)
		{
			return false;
		}
		TreeBase componentInParent = obj.GetComponentInParent<TreeBase>();
		if ((Object)(object)componentInParent != (Object)null)
		{
			KaynakKaydet((Component)(object)componentInParent, ((Component)componentInParent).GetComponent<ZNetView>(), TurkceIsim(((Object)componentInParent).name), SabitMerkezBul((Component)(object)componentInParent, col), componentInParent.m_health, 0f, 0.25f);
			return true;
		}
		TreeLog componentInParent2 = obj.GetComponentInParent<TreeLog>();
		if ((Object)(object)componentInParent2 != (Object)null)
		{
			KaynakKaydet((Component)(object)componentInParent2, ((Component)componentInParent2).GetComponent<ZNetView>(), TurkceIsim(((Object)componentInParent2).name), SabitMerkezBul((Component)(object)componentInParent2, col), componentInParent2.m_health, 0f, 0.25f);
			return true;
		}
		MineRock5 componentInParent3 = obj.GetComponentInParent<MineRock5>();
		if ((Object)(object)componentInParent3 != (Object)null)
		{
			KaynakKaydet((Component)(object)componentInParent3, ((Component)componentInParent3).GetComponent<ZNetView>(), TurkceIsim(((Object)componentInParent3).name), SabitMerkezBul((Component)(object)componentInParent3, col), componentInParent3.m_health, 0f, 0.25f);
			return true;
		}
		MineRock componentInParent4 = obj.GetComponentInParent<MineRock>();
		if ((Object)(object)componentInParent4 != (Object)null)
		{
			KaynakKaydet((Component)(object)componentInParent4, ((Component)componentInParent4).GetComponent<ZNetView>(), TurkceIsim(((Object)componentInParent4).name), SabitMerkezBul((Component)(object)componentInParent4, col), componentInParent4.m_health, 0f, 0.25f);
			return true;
		}
		Destructible componentInParent5 = obj.GetComponentInParent<Destructible>();
		if ((Object)(object)componentInParent5 != (Object)null)
		{
			KaynakKaydet((Component)(object)componentInParent5, ((Component)componentInParent5).GetComponent<ZNetView>(), TurkceIsim(((Object)componentInParent5).name), SabitMerkezBul((Component)(object)componentInParent5, col), componentInParent5.m_health, 0f, 0.25f);
			return true;
		}
		return false;
	}

	private void OnGUI()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: 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_03ca: Unknown result type (might be due to invalid IL or missing references)
		if (!ModAktif.Value || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)Hud.instance == (Object)null)
		{
			return;
		}
		Camera main = Camera.main;
		if ((Object)(object)main == (Object)null)
		{
			return;
		}
		DokulariHazirla();
		float num = GorusMesafesi.Value;
		float num2 = KaynakMesafesi.Value;
		Vector3 position = ((Component)Player.m_localPlayer).transform.position;
		if (KaynakBarlariAktif.Value)
		{
			GameObject hoverObject = ((Humanoid)Player.m_localPlayer).GetHoverObject();
			if ((Object)(object)hoverObject != (Object)null)
			{
				NesneKaynakKontrol(hoverObject, hoverObject.GetComponentInChildren<Collider>());
			}
		}
		Character val = null;
		Ray val2 = main.ScreenPointToRay(new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f, 0f));
		RaycastHit[] array = Physics.RaycastAll(val2, num + 8f, HedefKatmanMaskesi, (QueryTriggerInteraction)2);
		Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance));
		for (int num3 = 0; num3 < array.Length; num3++)
		{
			Collider collider = ((RaycastHit)(ref array[num3])).collider;
			if ((Object)(object)collider == (Object)null)
			{
				continue;
			}
			Character componentInParent = ((Component)collider).GetComponentInParent<Character>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				if (!((Object)(object)componentInParent == (Object)(object)Player.m_localPlayer))
				{
					if (Vector3.Distance(position, ((Component)componentInParent).transform.position) <= num)
					{
						val = componentInParent;
					}
					break;
				}
			}
			else if (KaynakBarlariAktif.Value && Vector3.Distance(position, ((RaycastHit)(ref array[num3])).point) <= num2 && NesneKaynakKontrol(((Component)collider).gameObject, collider))
			{
				break;
			}
		}
		Character hoverCreature = Player.m_localPlayer.GetHoverCreature();
		foreach (Character allCharacter in Character.GetAllCharacters())
		{
			if (!((Object)(object)allCharacter == (Object)null) && !allCharacter.IsPlayer() && !allCharacter.IsDead() && !(Vector3.Distance(position, ((Component)allCharacter).transform.position) > num))
			{
				float health = allCharacter.GetHealth();
				float maxHealth = allCharacter.GetMaxHealth();
				if (!(health >= maxHealth) || !((Object)(object)hoverCreature != (Object)(object)allCharacter) || !((Object)(object)val != (Object)(object)allCharacter))
				{
					string hoverName = allCharacter.GetHoverName();
					BarCiz(main, allCharacter.GetTopPoint() + Vector3.up * 0.42f, health, maxHealth, hoverName, allCharacter.IsBoss());
				}
			}
		}
		if (!KaynakBarlariAktif.Value)
		{
			return;
		}
		for (int num4 = kaynaklar.Count - 1; num4 >= 0; num4--)
		{
			KaynakCan kaynakCan = kaynaklar[num4];
			if ((Object)(object)kaynakCan.hedef == (Object)null || (Object)(object)kaynakCan.nv == (Object)null || !kaynakCan.nv.IsValid() || Time.time > kaynakCan.zaman)
			{
				kaynaklar.RemoveAt(num4);
			}
			else if (!(Vector3.Distance(position, kaynakCan.merkezNokta) > num2 + 4f))
			{
				float num5 = GercekCanOku(kaynakCan);
				if (num5 <= 0f)
				{
					kaynaklar.RemoveAt(num4);
				}
				else
				{
					BarCiz(main, kaynakCan.merkezNokta, num5, kaynakCan.maks, kaynakCan.ad, bossMu: false);
				}
			}
		}
	}

	private static void BarCiz(Camera cam, Vector3 pos, float mevcut, float maks, string isim, bool bossMu)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = cam.WorldToScreenPoint(pos);
		if (!(val.z <= 0f))
		{
			float num = (bossMu ? 142f : 106f);
			float num2 = (bossMu ? 13f : 11f);
			float num3 = Mathf.Round(val.x - num / 2f);
			float num4 = Mathf.Round((float)Screen.height - val.y - 10f);
			float num5 = Mathf.Clamp01(mevcut / Mathf.Max(1f, maks));
			if (IsimGoster.Value && !string.IsNullOrEmpty(isim))
			{
				GUI.Label(new Rect(num3 - 24f, num4 - 16f, num + 50f, 16f), isim, golgeYaziStil);
				GUI.Label(new Rect(num3 - 25f, num4 - 17f, num + 50f, 16f), isim, isimYaziStil);
			}
			GUI.DrawTexture(new Rect(num3 - 1f, num4 - 1f, num + 2f, num2 + 2f), (Texture)(object)inceCerceveDoku);
			GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)arkaPlanDoku);
			float num6 = num * num5;
			if (num6 > 0f)
			{
				GUI.DrawTexture(new Rect(num3, num4, num6, num2), (Texture)(object)gradyanKirmiziDoku);
				GUI.DrawTexture(new Rect(num3, num4, num6, 1f), (Texture)(object)parlamaDoku);
			}
			string text = $"{Mathf.CeilToInt(mevcut)} / {Mathf.CeilToInt(maks)}";
			GUI.Label(new Rect(num3 + 1f, num4 - 2f, num, num2 + 4f), text, golgeYaziStil);
			GUI.Label(new Rect(num3, num4 - 3f, num, num2 + 4f), text, canYaziStil);
		}
	}
}