docs: add documentation for economy player hooks
- Created `economy` category in hooks library docs - Added pages for `greg.economy.PlayerCoinUpdated`, `greg.economy.PlayerXpUpdated`, and `greg.economy.PlayerReputationUpdated` 💘 Generated with Crush Assisted-by: Gemini 3.1 Pro (Optimized for Coding Agents) via Crush <crush@charm.land>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Economy",
|
||||
"position": 10
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: greg.economy.PlayerCoinUpdated
|
||||
sidebar_label: greg.economy.PlayerCoinUpdated
|
||||
description: "gregCore Hook — Player Coin Updated"
|
||||
---
|
||||
|
||||
# `greg.economy.PlayerCoinUpdated`
|
||||
|
||||
## Description
|
||||
|
||||
- Emitted when the player's coin balance changes.
|
||||
|
||||
## Payload Schema
|
||||
|
||||
| Field | Type / Note |
|
||||
|------|----------------|
|
||||
| `type` | `valueChange` |
|
||||
| `key` | `money` |
|
||||
| `oldValue` | `float` |
|
||||
| `newValue` | `float` |
|
||||
|
||||
## How to use this hook
|
||||
|
||||
### 1. Object Bus: `GregEventDispatcher` (Rust / FFI / Lua / TS)
|
||||
|
||||
This hook is fired from the core via the `gregCore` plugin bridge whenever the underlying IL2CPP method (`Player.UpdateCoin`) executes successfully.
|
||||
|
||||
```csharp
|
||||
using gregFramework.Core;
|
||||
|
||||
GregEventDispatcher.On("greg.economy.PlayerCoinUpdated", payload =>
|
||||
{
|
||||
var newValue = GregPayload.Get<float>(payload, "newValue", 0f);
|
||||
// Logic here
|
||||
});
|
||||
```
|
||||
|
||||
### 2. Usage in Lua
|
||||
|
||||
Use the Lua bridge and register against the canonical hook string:
|
||||
|
||||
~~~lua
|
||||
greg.on("greg.economy.PlayerCoinUpdated", function(payload)
|
||||
local newVal = payload and payload.newValue or 0
|
||||
greg.log("[ECONOMY] new money=" .. tostring(newVal))
|
||||
end)
|
||||
~~~
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: greg.economy.PlayerReputationUpdated
|
||||
sidebar_label: greg.economy.PlayerReputationUpdated
|
||||
description: "gregCore Hook — Player Reputation Updated"
|
||||
---
|
||||
|
||||
# `greg.economy.PlayerReputationUpdated`
|
||||
|
||||
## Description
|
||||
|
||||
- Emitted when the player's reputation changes.
|
||||
|
||||
## Payload Schema
|
||||
|
||||
| Field | Type / Note |
|
||||
|------|----------------|
|
||||
| `type` | `valueChange` |
|
||||
| `key` | `reputation` |
|
||||
| `oldValue` | `float` |
|
||||
| `newValue` | `float` |
|
||||
|
||||
## How to use this hook
|
||||
|
||||
### 1. Object Bus: `GregEventDispatcher` (Rust / FFI / Lua / TS)
|
||||
|
||||
This hook is fired from the core via the `gregCore` plugin bridge whenever the underlying IL2CPP method (`Player.UpdateReputation`) executes successfully.
|
||||
|
||||
```csharp
|
||||
using gregFramework.Core;
|
||||
|
||||
GregEventDispatcher.On("greg.economy.PlayerReputationUpdated", payload =>
|
||||
{
|
||||
var newValue = GregPayload.Get<float>(payload, "newValue", 0f);
|
||||
// Logic here
|
||||
});
|
||||
```
|
||||
|
||||
### 2. Usage in Lua
|
||||
|
||||
Use the Lua bridge and register against the canonical hook string:
|
||||
|
||||
~~~lua
|
||||
greg.on("greg.economy.PlayerReputationUpdated", function(payload)
|
||||
local newVal = payload and payload.newValue or 0
|
||||
greg.log("[ECONOMY] new reputation=" .. tostring(newVal))
|
||||
end)
|
||||
~~~
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: greg.economy.PlayerXpUpdated
|
||||
sidebar_label: greg.economy.PlayerXpUpdated
|
||||
description: "gregCore Hook — Player XP Updated"
|
||||
---
|
||||
|
||||
# `greg.economy.PlayerXpUpdated`
|
||||
|
||||
## Description
|
||||
|
||||
- Emitted when the player's XP changes.
|
||||
|
||||
## Payload Schema
|
||||
|
||||
| Field | Type / Note |
|
||||
|------|----------------|
|
||||
| `type` | `valueChange` |
|
||||
| `key` | `xp` |
|
||||
| `oldValue` | `float` |
|
||||
| `newValue` | `float` |
|
||||
|
||||
## How to use this hook
|
||||
|
||||
### 1. Object Bus: `GregEventDispatcher` (Rust / FFI / Lua / TS)
|
||||
|
||||
This hook is fired from the core via the `gregCore` plugin bridge whenever the underlying IL2CPP method (`Player.UpdateXP`) executes successfully.
|
||||
|
||||
```csharp
|
||||
using gregFramework.Core;
|
||||
|
||||
GregEventDispatcher.On("greg.economy.PlayerXpUpdated", payload =>
|
||||
{
|
||||
var newValue = GregPayload.Get<float>(payload, "newValue", 0f);
|
||||
// Logic here
|
||||
});
|
||||
```
|
||||
|
||||
### 2. Usage in Lua
|
||||
|
||||
Use the Lua bridge and register against the canonical hook string:
|
||||
|
||||
~~~lua
|
||||
greg.on("greg.economy.PlayerXpUpdated", function(payload)
|
||||
local newVal = payload and payload.newValue or 0
|
||||
greg.log("[ECONOMY] new xp=" .. tostring(newVal))
|
||||
end)
|
||||
~~~
|
||||
Reference in New Issue
Block a user