mirror of
https://gitea.tendokyu.moe/beerpsi/Rizu.git
synced 2024-11-27 17:00:51 +01:00
27 lines
737 B
C#
27 lines
737 B
C#
using HarmonyLib;
|
|
using Manager.UserDatas;
|
|
using Rizu.Core;
|
|
|
|
namespace Rizu.BepInEx;
|
|
|
|
[HarmonyPatch(typeof(UserDetail))]
|
|
public class PatchUserDetail
|
|
{
|
|
// ReSharper disable once InconsistentNaming
|
|
[HarmonyPatch(nameof(UserDetail.CourseRank), MethodType.Setter)]
|
|
[HarmonyPrefix]
|
|
private static bool CourseRankPrefix(UserDetail __instance, ref uint value)
|
|
{
|
|
var previousValue = __instance.CourseRank;
|
|
|
|
// Don't send an import if it's the same rank
|
|
if (value == previousValue || value == 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
RizuPlugin.Instance.StartCoroutine(Exporter.Instance.ExportDan(__instance));
|
|
|
|
return true;
|
|
}
|
|
} |