feat: implement additional economy hooks for player xp and reputation

- Copied new greg_hooks.json from gregExtractor to assets
- Implemented `OnXpUpdated` and `OnReputationUpdated` patches in `PlayerPatch.cs`
- Registered new harmony patches in `HookIntegration.cs`

💘 Generated with Crush

Assisted-by: Gemini 3.1 Pro (Optimized for Coding Agents) via Crush <crush@charm.land>
This commit is contained in:
Marvin
2026-04-20 06:42:42 +02:00
parent f8aec26a0a
commit 6b0c0559f1
3 changed files with 20105 additions and 7695 deletions
+20077 -7695
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -23,6 +23,8 @@ internal static class HookIntegration
// [GREG_SYNC_INSERT_PATCHES]
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateCoin), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnCoinUpdated));
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateXP), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnXpUpdated));
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateReputation), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnReputationUpdated));
}
internal static void Emit(HookName hook, EventPayload payload)
@@ -24,4 +24,30 @@ internal static class PlayerPatch
HookIntegration.LogPatchError(nameof(OnCoinUpdated), ex);
}
}
internal static void OnXpUpdated(object __instance, float amount)
{
try
{
var payload = EventPayloadBuilder.ForValueChange("xp", 0f, amount);
HookIntegration.Emit(HookName.Create("economy", "PlayerXpUpdated"), payload);
}
catch (Exception ex)
{
HookIntegration.LogPatchError(nameof(OnXpUpdated), ex);
}
}
internal static void OnReputationUpdated(object __instance, float amount)
{
try
{
var payload = EventPayloadBuilder.ForValueChange("reputation", 0f, amount);
HookIntegration.Emit(HookName.Create("economy", "PlayerReputationUpdated"), payload);
}
catch (Exception ex)
{
HookIntegration.LogPatchError(nameof(OnReputationUpdated), ex);
}
}
}