Fix borked filter/linked/needed histories; add quest name to locked offers

This commit is contained in:
Tyfon
2024-05-24 15:37:10 -07:00
parent 44933de9d1
commit 109bcb4b4d
3 changed files with 99 additions and 11 deletions

19
R.cs
View File

@@ -41,6 +41,7 @@ namespace UIFixes
RagfairScreen.InitTypes();
OfferViewList.InitTypes();
FiltersPanel.InitTypes();
QuestCache.InitTypes();
}
public abstract class Wrapper(object value)
@@ -378,6 +379,24 @@ namespace UIFixes
public RagfairFilterButton PriceButton { get { return (RagfairFilterButton)PriceButtonField.GetValue(Value); } }
public RagfairFilterButton ExpirationButton { get { return (RagfairFilterButton)ExpirationButtonField.GetValue(Value); } }
}
public class QuestCache(object value) : Wrapper(value)
{
public static Type Type { get; private set; }
private static PropertyInfo InstanceProperty;
private static MethodInfo GetAllQuestTemplatesMethod;
public static void InitTypes()
{
Type = PatchConstants.EftTypes.First(t => t.GetMethod("GetAllQuestTemplates") != null); // GClass3212
InstanceProperty = AccessTools.Property(Type, "Instance");
GetAllQuestTemplatesMethod = AccessTools.Method(Type, "GetAllQuestTemplates");
}
public static QuestCache Instance { get { return new QuestCache(InstanceProperty.GetValue(null)); } }
public IReadOnlyCollection<RawQuestClass> GetAllQuestTemplates() => (IReadOnlyCollection<RawQuestClass>)GetAllQuestTemplatesMethod.Invoke(Value, []);
}
}
public static class RExtentensions