45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Harmony.XUiC_PoiListPatches
|
|
{
|
|
[HarmonyPatch(typeof(XUiC_PoiList))]
|
|
[HarmonyPatch("RebuildList")]
|
|
public class RebuildListPatch
|
|
{
|
|
public static bool Prefix(XUiC_PoiList __instance, bool _resetFilter)
|
|
{
|
|
__instance.allEntries.Clear();
|
|
if ((UnityEngine.Object)GameManager.Instance != (UnityEngine.Object)null)
|
|
{
|
|
List<PrefabInstance> dynamicPrefabs = GameManager.Instance.GetDynamicPrefabDecorator()?.GetDynamicPrefabs();
|
|
if (dynamicPrefabs != null)
|
|
{
|
|
foreach (PrefabInstance _prefabInstance in dynamicPrefabs)
|
|
{
|
|
if (!__instance.openedBefore)
|
|
{
|
|
__instance.MinTier = Mathf.Min((int)_prefabInstance.prefab.DifficultyTier, __instance.MinTier);
|
|
__instance.MaxTier = Mathf.Max((int)_prefabInstance.prefab.DifficultyTier, __instance.MaxTier);
|
|
}
|
|
if ((!__instance.filterSmallPois || _prefabInstance.boundingBoxSize.Volume() >= 100) && (__instance.filterTier < 0 || (int)_prefabInstance.prefab.DifficultyTier == __instance.filterTier))
|
|
{
|
|
if (!_prefabInstance.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("rwgonly,streettile,hideui")))
|
|
{
|
|
__instance.allEntries.Add(new XUiC_PoiList.PoiListEntry(_prefabInstance));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
__instance.allEntries.Sort();
|
|
|
|
__instance.SelectedEntry = null;
|
|
if (__instance.filteredEntries != null)
|
|
__instance.filteredEntries.Clear();
|
|
__instance.RefreshView(_resetFilter);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|