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:
+20077
-7695
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user