using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using R2API.Utils;
using RoR2;
using RoR2BepInExPack.GameAssetPaths;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PingIconsOverhaul")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+f3fdcd613747beaf162e255f821c8e0114024c53")]
[assembly: AssemblyProduct("PingIconsOverhaul")]
[assembly: AssemblyTitle("PingIconsOverhaul")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace PingIconsOverhaul
{
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);
}
}
internal struct TexData
{
public string addressable;
public string texName;
}
[BepInPlugin("NotAJunkie.PingIconsOverhaul", "PingIconsOverhaul", "1.4.0")]
public class PingIconsOverhaul : BaseUnityPlugin
{
public const string PluginGUID = "NotAJunkie.PingIconsOverhaul";
public const string PluginAuthor = "NotAJunkie";
public const string PluginName = "PingIconsOverhaul";
public const string PluginVersion = "1.4.0";
private const string bundleName = "pingiconsoverhaul";
private static AssetBundle? bundle;
private static readonly Dictionary<string, TexData> INTERACTABLES = new Dictionary<string, TexData>
{
{
"ShrineCleanse",
new TexData
{
addressable = RoR2_Base_ShrineCleanse.ShrineCleanse_prefab,
texName = "texCleansingPoolIcon"
}
},
{
"ShrineCleanseSandy Variant",
new TexData
{
addressable = RoR2_Base_ShrineCleanse_ShrineCleanseSandy.Variant_prefab,
texName = "texCleansingPoolIcon"
}
},
{
"ShrineCleanseSnowy Variant",
new TexData
{
addressable = RoR2_Base_ShrineCleanse_ShrineCleanseSnowy.Variant_prefab,
texName = "texCleansingPoolIcon"
}
},
{
"Duplicator",
new TexData
{
addressable = RoR2_Base_Duplicator.Duplicator_prefab,
texName = "texDuplicatorIcon"
}
},
{
"DuplicatorLarge",
new TexData
{
addressable = RoR2_Base_DuplicatorLarge.DuplicatorLarge_prefab,
texName = "texDuplicatorIcon"
}
},
{
"DuplicatorMilitary",
new TexData
{
addressable = RoR2_Base_DuplicatorMilitary.DuplicatorMilitary_prefab,
texName = "texDuplicatorIcon"
}
},
{
"DuplicatorWild",
new TexData
{
addressable = RoR2_Base_DuplicatorWild.DuplicatorWild_prefab,
texName = "texDuplicatorIcon"
}
},
{
"Barrel1",
new TexData
{
addressable = RoR2_Base_Barrel1.Barrel1_prefab,
texName = "texBarrelIcon"
}
},
{
"VoidCoinBarrel",
new TexData
{
addressable = RoR2_DLC1_VoidCoinBarrel.VoidCoinBarrel_prefab,
texName = "texVoidStalkIcon"
}
},
{
"Teleporter1",
new TexData
{
addressable = RoR2_Base_Teleporters.Teleporter1_prefab,
texName = "texTeleporterIcon"
}
},
{
"LunarTeleporter Variant",
new TexData
{
addressable = RoR2_Base_Teleporters_LunarTeleporter.Variant_prefab,
texName = "texMoonTeleporterIcon"
}
},
{
"LunarTeleporterProngs",
new TexData
{
addressable = RoR2_Base_Teleporters.LunarTeleporterProngs_prefab,
texName = "texMoonTeleporterIcon"
}
},
{
"MoonBatteryBlood",
new TexData
{
addressable = RoR2_Base_moon2.MoonBatteryBlood_prefab,
texName = "texPillarBloodIcon"
}
},
{
"MoonBatteryDesign",
new TexData
{
addressable = RoR2_Base_moon2.MoonBatteryDesign_prefab,
texName = "texPillarDesignIcon"
}
},
{
"MoonBatteryMass",
new TexData
{
addressable = RoR2_Base_moon2.MoonBatteryMass_prefab,
texName = "texPillarMassIcon"
}
},
{
"MoonBatterySoul",
new TexData
{
addressable = RoR2_Base_moon2.MoonBatterySoul_prefab,
texName = "texPillarSoulIcon"
}
},
{
"DeepVoidPortalBattery",
new TexData
{
addressable = RoR2_DLC1_DeepVoidPortalBattery.DeepVoidPortalBattery_prefab,
texName = "texVoidSignalIcon"
}
},
{
"NullSafeZone",
new TexData
{
addressable = "",
texName = "texCellVentIcon"
}
},
{
"InfiniteTowerSafeWard",
new TexData
{
addressable = RoR2_DLC1_GameModes_InfiniteTowerRun_InfiniteTowerAssets.InfiniteTowerSafeWard_prefab,
texName = "texVoidFocusIcon"
}
},
{
"CasinoChest",
new TexData
{
addressable = RoR2_Base_CasinoChest.CasinoChest_prefab,
texName = "texAdaptiveChestIcon"
}
},
{
"Chest1",
new TexData
{
addressable = RoR2_Base_Chest1.Chest1_prefab,
texName = "texSmallChestIcon"
}
},
{
"CategoryChestDamage",
new TexData
{
addressable = RoR2_Base_CategoryChest.CategoryChestDamage_prefab,
texName = "texSmallCatChestDamIcon"
}
},
{
"CategoryChestHealing",
new TexData
{
addressable = RoR2_Base_CategoryChest.CategoryChestHealing_prefab,
texName = "texSmallCatChestHealIcon"
}
},
{
"CategoryChestUtility",
new TexData
{
addressable = RoR2_Base_CategoryChest.CategoryChestUtility_prefab,
texName = "texSmallCatChestUtilIcon"
}
},
{
"Chest1StealthedVariant",
new TexData
{
addressable = RoR2_Base_Chest1StealthedVariant.Chest1StealthedVariant_prefab,
texName = "texCloackedChestIcon"
}
},
{
"EquipmentBarrel",
new TexData
{
addressable = RoR2_Base_EquipmentBarrel.EquipmentBarrel_prefab,
texName = "texEquipmentBarrelIcon"
}
},
{
"Chest2",
new TexData
{
addressable = RoR2_Base_Chest2.Chest2_prefab,
texName = "texLargeChestIcon"
}
},
{
"CategoryChest2Damage Variant",
new TexData
{
addressable = RoR2_DLC1_CategoryChest2_CategoryChest2Damage.Variant_prefab,
texName = "texLargeCatChestDamIcon"
}
},
{
"CategoryChest2Healing Variant",
new TexData
{
addressable = RoR2_DLC1_CategoryChest2_CategoryChest2Healing.Variant_prefab,
texName = "texLargeCatChestHealIcon"
}
},
{
"CategoryChest2Utility Variant",
new TexData
{
addressable = RoR2_DLC1_CategoryChest2_CategoryChest2Utility.Variant_prefab,
texName = "texLargeCatChestUtilIcon"
}
},
{
"MultiShopEquipment",
new TexData
{
addressable = RoR2_Base_MultiShopEquipmentTerminal.MultiShopEquipmentTerminal_prefab,
texName = "texTripleshopEquipmentIcon"
}
},
{
"MultiShopTerminal",
new TexData
{
addressable = RoR2_Base_MultiShopTerminal.MultiShopTerminal_prefab,
texName = "texTripleShopIcon"
}
},
{
"MultiShopLargeTerminal",
new TexData
{
addressable = RoR2_Base_MultiShopLargeTerminal.MultiShopLargeTerminal_prefab,
texName = "texTripleShopIcon"
}
},
{
"GoldChest",
new TexData
{
addressable = RoR2_Base_GoldChest.GoldChest_prefab,
texName = "texLegendaryChestIcon"
}
},
{
"LunarChest",
new TexData
{
addressable = RoR2_Base_LunarChest.LunarChest_prefab,
texName = "texLunarPodIcon"
}
},
{
"Lockbox",
new TexData
{
addressable = RoR2_Base_TreasureCache.Lockbox_prefab,
texName = "texRustyLockboxIcon"
}
},
{
"ScavBackpack",
new TexData
{
addressable = RoR2_Base_Scav.ScavBackpack_prefab,
texName = "texScavBackpackIcon"
}
},
{
"FreeChestTerminalShippingDrone",
new TexData
{
addressable = RoR2_DLC1_FreeChestTerminalShippingDrone.FreeChestTerminalShippingDrone_prefab,
texName = "texCrashedDeliveryIcon"
}
},
{
"LockboxVoid",
new TexData
{
addressable = RoR2_DLC1_TreasureCacheVoid.LockboxVoid_prefab,
texName = "texEncrustedCacheIcon"
}
},
{
"VoidChest",
new TexData
{
addressable = RoR2_DLC1_VoidChest.VoidChest_prefab,
texName = "texVoidCradleIcon"
}
},
{
"VoidTriple",
new TexData
{
addressable = RoR2_DLC1_VoidTriple.VoidTriple_prefab,
texName = "texVoidPotentialIcon"
}
},
{
"FragmentPotentialPickup",
new TexData
{
addressable = RoR2_DLC2.FragmentPotentialPickup_prefab,
texName = "texAurelioniteFragmentIcon"
}
},
{
"Drone1Broken",
new TexData
{
addressable = RoR2_Base_Drones.Drone1Broken_prefab,
texName = "texCombatDroneIcon"
}
},
{
"EmergencyDroneBroken",
new TexData
{
addressable = RoR2_Base_Drones.EmergencyDroneBroken_prefab,
texName = "texEmergencyDroneIcon"
}
},
{
"EquipmentDroneBroken",
new TexData
{
addressable = RoR2_Base_Drones.EquipmentDroneBroken_prefab,
texName = "texEquipmentDroneIcon"
}
},
{
"Drone2Broken",
new TexData
{
addressable = RoR2_Base_Drones.Drone2Broken_prefab,
texName = "texHealingDroneIcon"
}
},
{
"FlameDroneBroken",
new TexData
{
addressable = RoR2_Base_Drones.FlameDroneBroken_prefab,
texName = "texIncineratorDroneIcon"
}
},
{
"LemurianEgg",
new TexData
{
addressable = RoR2_CU8_LemurianEgg.LemurianEgg_prefab,
texName = "texLemurianDroneIcon"
}
},
{
"MissileDroneBroken",
new TexData
{
addressable = RoR2_Base_Drones.MissileDroneBroken_prefab,
texName = "texMissileDroneIcon"
}
},
{
"MegaDroneBroken",
new TexData
{
addressable = RoR2_Base_Drones.MegaDroneBroken_prefab,
texName = "texTC280DroneIcon"
}
},
{
"Turret1Broken",
new TexData
{
addressable = RoR2_Base_Drones.Turret1Broken_prefab,
texName = "texTurretDroneIcon"
}
},
{
"SetpiecePickup",
new TexData
{
addressable = RoR2_Base_Common.SetpiecePickup_prefab,
texName = "texArtifactPickupIcon"
}
},
{
"CommandCube",
new TexData
{
addressable = RoR2_Base_Command.CommandCube_prefab,
texName = "texCommandEssenceIcon"
}
},
{
"GenericPickup",
new TexData
{
addressable = RoR2_Base_Common.GenericPickup_prefab,
texName = "texGenericPickupIcon"
}
},
{
"LogPickup",
new TexData
{
addressable = RoR2_Base_Common.LogPickup_prefab,
texName = "texLogbookEntryIcon"
}
},
{
"QuestVolatileBatteryWorldPickup",
new TexData
{
addressable = RoR2_Base_QuestVolatileBattery.QuestVolatileBatteryWorldPickup_prefab,
texName = "texFuelArrayQuestIcon"
}
},
{
"Scrapper",
new TexData
{
addressable = RoR2_Base_Scrapper.Scrapper_prefab,
texName = "texScrapperIcon"
}
},
{
"ShrineGoldshoresAccess",
new TexData
{
addressable = RoR2_Base_ShrineGoldshoresAccess.ShrineGoldshoresAccess_prefab,
texName = "texShrineGoldIcon"
}
},
{
"ShrineBlood",
new TexData
{
addressable = RoR2_Base_ShrineBlood.ShrineBlood_prefab,
texName = "texShrineBloodIcon"
}
},
{
"ShrineBloodSandy Variant",
new TexData
{
addressable = RoR2_Base_ShrineBlood_ShrineBloodSandy.Variant_prefab,
texName = "texShrineBloodIcon"
}
},
{
"ShrineBloodSnowy Variant",
new TexData
{
addressable = RoR2_Base_ShrineBlood_ShrineBloodSnowy.Variant_prefab,
texName = "texShrineBloodIcon"
}
},
{
"ShrineChance",
new TexData
{
addressable = RoR2_Base_ShrineChance.ShrineChance_prefab,
texName = "texShrineChanceIcon"
}
},
{
"ShrineChanceSandy Variant",
new TexData
{
addressable = RoR2_Base_ShrineChance_ShrineChanceSandy.Variant_prefab,
texName = "texShrineChanceIcon"
}
},
{
"ShrineChanceSnowy Variant",
new TexData
{
addressable = RoR2_Base_ShrineChance_ShrineChanceSnowy.Variant_prefab,
texName = "texShrineChanceIcon"
}
},
{
"ShrineCombat",
new TexData
{
addressable = RoR2_Base_ShrineCombat.ShrineCombat_prefab,
texName = "texShrineCombatIcon"
}
},
{
"ShrineCombatSandy Variant",
new TexData
{
addressable = RoR2_Base_ShrineCombat_ShrineCombatSandy.Variant_prefab,
texName = "texShrineCombatIcon"
}
},
{
"ShrineCombatSnowy Variant",
new TexData
{
addressable = RoR2_Base_ShrineCombat_ShrineCombatSnowy.Variant_prefab,
texName = "texShrineCombatIcon"
}
},
{
"ShrineRestack",
new TexData
{
addressable = RoR2_Base_ShrineRestack.ShrineRestack_prefab,
texName = "texShrineOrderIcon"
}
},
{
"ShrineRestackSandy Variant",
new TexData
{
addressable = RoR2_Base_ShrineRestack_ShrineRestackSandy.Variant_prefab,
texName = "texShrineOrderIcon"
}
},
{
"ShrineRestackSnowy Variant",
new TexData
{
addressable = RoR2_Base_ShrineRestack_ShrineRestackSnowy.Variant_prefab,
texName = "texShrineOrderIcon"
}
},
{
"ShrineBoss",
new TexData
{
addressable = RoR2_Base_ShrineBoss.ShrineBoss_prefab,
texName = "texShrineMountainIcon"
}
},
{
"ShrineBossSandy Variant",
new TexData
{
addressable = RoR2_Base_ShrineBoss_ShrineBossSandy.Variant_prefab,
texName = "texShrineMountainIcon"
}
},
{
"ShrineBossSnowy Variant",
new TexData
{
addressable = RoR2_Base_ShrineBoss_ShrineBossSnowy.Variant_prefab,
texName = "texShrineMountainIcon"
}
},
{
"ShrineHealing",
new TexData
{
addressable = RoR2_Base_ShrineHealing.ShrineHealing_prefab,
texName = "texShrineWoodsIcon"
}
},
{
"ShrineColossusAccess",
new TexData
{
addressable = RoR2_DLC2.ShrineColossusAccess_prefab,
texName = "texShrineShapingIcon"
}
},
{
"ShrineRebirth",
new TexData
{
addressable = RoR2_DLC2.ShrineRebirth_prefab,
texName = "texShrineRebirthIcon"
}
},
{
"ShrineHalcyonite",
new TexData
{
addressable = RoR2_DLC2.ShrineHalcyonite_prefab,
texName = "texShrineHalcyonIcon"
}
},
{
"CaptainSupplyDrop, EquipmentRestock",
new TexData
{
addressable = RoR2_Base_Captain_CaptainSupplyDrop.EquipmentRestock_prefab,
texName = "texResupplyIcon"
}
},
{
"VendingMachine",
new TexData
{
addressable = RoR2_DLC1_VendingMachine.VendingMachine_prefab,
texName = "texVendingMachineIcon"
}
},
{
"ZiplineVehicle",
new TexData
{
addressable = RoR2_Base_Gateway.ZiplineVehicle_prefab,
texName = "texTunnelIcon"
}
}
};
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
}
public void Start()
{
Log.Info("Initializing PingIconsOverhaul v1.4.0 by NotAJunkie");
bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "pingiconsoverhaul"));
SetPingIconsForInteractables();
Stage.onStageStartGlobal += delegate(Stage stage)
{
Log.Info("Stage started: " + ((Object)stage).name);
OverridePingIconsForObjects<PurchaseInteraction>();
OverridePingIconsForObjects<GenericPickupController>();
OverridePingIconsForTeleporters();
};
}
private void Update()
{
if (!Input.GetKeyDown((KeyCode)92))
{
return;
}
EnumerableExtensions.ForEachTry<KeyValuePair<Type, IEnumerable<MonoBehaviour>>>((IEnumerable<KeyValuePair<Type, IEnumerable<MonoBehaviour>>>)InstanceTracker.instancesLists, (Action<KeyValuePair<Type, IEnumerable<MonoBehaviour>>>)delegate(KeyValuePair<Type, IEnumerable<MonoBehaviour>> kvp)
{
Log.Info($"Key: {kvp.Key}, Value: {kvp.Value}");
foreach (MonoBehaviour item in kvp.Value)
{
Log.Info($" Instance: {((Object)item).name} of type {((object)item).GetType()}");
}
}, (IDictionary<KeyValuePair<Type, IEnumerable<MonoBehaviour>>, Exception>)null);
}
private void SetPingIconsForInteractables()
{
foreach (KeyValuePair<string, TexData> iNTERACTABLE in INTERACTABLES)
{
if (string.IsNullOrEmpty(iNTERACTABLE.Value.addressable))
{
Log.Warning("Skipping " + iNTERACTABLE.Key + " due to missing addressable.");
continue;
}
TexData value = iNTERACTABLE.Value;
if (LoadInteractable(value.addressable, out GameObject interactable) && LoadPingIcon(value.addressable, value.texName, out Sprite pingIcon))
{
if (!iNTERACTABLE.Key.Contains("Prongs"))
{
AddGenericDisplayNameProvider(interactable, iNTERACTABLE.Key);
}
AddPingIconOverride(interactable, pingIcon);
}
}
}
private static bool LoadInteractable(string addressable, out GameObject interactable)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
interactable = Addressables.LoadAssetAsync<GameObject>((object)addressable).WaitForCompletion();
if ((Object)(object)interactable == (Object)null)
{
Log.Error("Failed to load interactable \"" + addressable + "\"");
}
return (Object)(object)interactable != (Object)null;
}
private static bool LoadPingIcon(string addressable, string texName, out Sprite? pingIcon)
{
if ((Object)(object)bundle == (Object)null)
{
Log.Error("Failed to load Asset bundle.");
pingIcon = null;
return false;
}
pingIcon = bundle.LoadAsset<Sprite>(texName);
if ((Object)(object)pingIcon == (Object)null)
{
Log.Error("Failed to load ping icon \"" + texName + "\" from bundle for \"" + addressable + "\"");
}
return (Object)(object)pingIcon != (Object)null;
}
private static void AddGenericDisplayNameProvider(GameObject interactable, string displayName)
{
IDisplayNameProvider val = default(IDisplayNameProvider);
if (!interactable.TryGetComponent<IDisplayNameProvider>(ref val))
{
Log.Info("Adding GenericDisplayNameProvider to " + ((Object)interactable).name + ", display name: " + displayName);
GenericDisplayNameProvider val2 = interactable.AddComponent<GenericDisplayNameProvider>();
val2.SetDisplayToken(displayName);
}
}
private void AddPingIconOverride(GameObject interactable, Sprite sprite)
{
PingInfoProvider val = default(PingInfoProvider);
if (!interactable.TryGetComponent<PingInfoProvider>(ref val))
{
val = interactable.AddComponent<PingInfoProvider>();
}
val.pingIconOverride = sprite;
Log.Info("Successfully added ping icon override for " + ((Object)interactable).name + " with " + ((Object)sprite).name);
}
private static void OverridePingIconsForObjects<T>() where T : MonoBehaviour
{
EnumerableExtensions.ForEachTry<T>((IEnumerable<T>)InstanceTracker.GetInstancesList<T>(), (Action<T>)delegate(T interactable)
{
string text = ((Object)(object)interactable).name.Split('(')[0].Trim();
if (!INTERACTABLES.TryGetValue(text, out var value))
{
Log.Warning("No ping icon is available for " + text + " in asset dictionary");
}
else
{
PingInfoProvider val = default(PingInfoProvider);
if (!((Component)(object)interactable).TryGetComponent<PingInfoProvider>(ref val))
{
val = ((Component)(object)interactable).gameObject.AddComponent<PingInfoProvider>();
}
if (((Object)val.pingIconOverride).name != value.texName)
{
Log.Info("Overriding ping icon for " + text + " with " + value.texName);
if (LoadPingIcon(value.addressable, value.texName, out Sprite pingIcon))
{
val.pingIconOverride = pingIcon;
}
}
}
}, (IDictionary<T, Exception>)null);
}
private static void OverridePingIconsForTeleporters()
{
List<TeleporterInteraction> instancesList = InstanceTracker.GetInstancesList<TeleporterInteraction>();
if (instancesList.Count == 0)
{
Log.Warning("No TeleporterInteraction instances found.");
return;
}
Log.Info($"Found {instancesList.Count} TeleporterInteraction instances.");
EnumerableExtensions.ForEachTry<TeleporterInteraction>((IEnumerable<TeleporterInteraction>)instancesList, (Action<TeleporterInteraction>)delegate(TeleporterInteraction teleporter)
{
if ((Object)(object)teleporter == (Object)null)
{
Log.Warning("Found a null TeleporterInteraction instance.");
}
else
{
ReplaceTeleporterPingIcon(teleporter);
}
}, (IDictionary<TeleporterInteraction, Exception>)null);
}
private static void ReplaceTeleporterPingIcon(TeleporterInteraction teleporter)
{
string text = ((Object)teleporter).name.Split('(')[0].Trim();
if (!INTERACTABLES.TryGetValue(text, out var _))
{
Log.Warning("No ping icon found for teleporter: " + text);
return;
}
Log.Info("Replacing icon for teleporter: " + text);
PositionIndicator teleporterPositionIndicator = teleporter.teleporterPositionIndicator;
SpriteRenderer val = default(SpriteRenderer);
PingInfoProvider val2 = default(PingInfoProvider);
if (teleporterPositionIndicator == null || !teleporterPositionIndicator.alwaysVisibleObject.TryGetComponent<SpriteRenderer>(ref val))
{
Log.Warning("No SpriteRenderer found on alwaysVisibleObject.");
}
else if (!((Component)teleporter).TryGetComponent<PingInfoProvider>(ref val2))
{
Log.Warning("No PingInfoProvider found on the teleporter.");
}
else
{
val.sprite = val2.pingIconOverride;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}