2022-05-14 19:53:00 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Aki.Reflection.Patching;
|
|
|
|
|
using Aki.Reflection.Utils;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
|
namespace CWX_DeSharpener
|
2022-05-14 19:53:00 +01:00
|
|
|
|
{
|
2022-10-19 17:27:45 +01:00
|
|
|
|
public class DeSharpenerPatch : ModulePatch
|
2022-05-14 19:53:00 +01:00
|
|
|
|
{
|
|
|
|
|
private static Type _targetType;
|
2022-05-21 17:48:06 +01:00
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
|
public DeSharpenerPatch()
|
2022-05-14 19:53:00 +01:00
|
|
|
|
{
|
|
|
|
|
_targetType = PatchConstants.EftTypes.Single(IsTargetType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool IsTargetType(Type type)
|
|
|
|
|
{
|
|
|
|
|
return type.GetMethod("UpdateAmount") != null && type.GetMethod("ChangeDefaultSharpenValue") != null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return _targetType.GetMethod("UpdateAmount");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
|
|
|
|
private static bool PatchPrefix()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|