fix: replace Unicode with ASCII equivalents

This commit is contained in:
god
2026-07-05 12:54:57 +08:00
parent 644f2f0f95
commit 878ad659db
+33 -33
View File
@@ -1,6 +1,6 @@
# Tekton Nakama Lua Server API Reference
> Auto-generated from source code. For AI agents call these RPCs without reading Lua.
> Auto-generated from source code. For AI agents -- call these RPCs without reading Lua.
## Table of Contents
@@ -40,7 +40,7 @@
nk.leaderboard_create("global_high_score", true, "desc", "best", nil, {})
```
Creates native leaderboard `"global_high_score"` on module load (also created in `leaderboard.lua` pcall wraps both so duplicate is safe).
Creates native leaderboard `"global_high_score"` on module load (also created in `leaderboard.lua` -- pcall wraps both so duplicate is safe).
---
@@ -96,7 +96,7 @@ Resolves a friendly room name (e.g. `"social_global"`) to a hashed Nakama channe
|---|---|---|
| `channel_id` | string | Raw channel ID or friendly room name |
**Returns:** `string` resolved channel ID (passes through if already hashed, i.e. contains `"."`)
**Returns:** `string` -- resolved channel ID (passes through if already hashed, i.e. contains `"."`)
**Logic:** If no `"."` in value, calls `nk.channel_id_build("", name, CHANNEL_TYPE_ROOM)`.
---
@@ -129,9 +129,9 @@ Resolves a friendly room name (e.g. `"social_global"`) to a hashed Nakama channe
| `role` | string | Role from metadata (`"player"` default) |
**Errors:**
- `"Account not found"` user doesn't exist
- `"Account banned until <time>. Reason: <reason>"` temporary ban still active
- `"Account permanently banned. Reason: <reason>"` permanent ban
- `"Account not found"` -- user doesn't exist
- `"Account banned until <time>. Reason: <reason>"` -- temporary ban still active
- `"Account permanently banned. Reason: <reason>"` -- permanent ban
**Ban logic:** Reads `metadata.banned`, `metadata.ban_expires` (Unix timestamp), `metadata.ban_reason`. If `ban_expires <= os.time()`, auto-clears the ban on read.
@@ -215,9 +215,9 @@ Resolves a friendly room name (e.g. `"social_global"`) to a hashed Nakama channe
**Errors:**
- `"Not authenticated"`
- `"Current password required"` account has email but no `current_password` provided
- `"Incorrect current password."` email auth re-verify failed
- `"Failed to set new credentials: <err>"` link_email failed (rolls back old link)
- `"Current password required"` -- account has email but no `current_password` provided
- `"Incorrect current password."` -- email auth re-verify failed
- `"Failed to set new credentials: <err>"` -- link_email failed (rolls back old link)
**Logic:** Verifies current password via `nk.authenticate_email`, unlinks old email, links new email+password. On failure, re-links old credentials.
@@ -383,7 +383,7 @@ Hardcoded items available for purchase:
| `star_250` | -1100 | +250 | No |
| `star_600` | -2500 | +600 | No |
**Returns (JSON) success:**
**Returns (JSON) -- success:**
| Field | Type | Description |
|---|---|---|
@@ -397,8 +397,8 @@ Hardcoded items available for purchase:
- `"Package ID required"`
- `"Idempotency key required"`
- `"Invalid package ID"`
- `"InvalidReceipt"` IAP validation failed
- `"NotEnoughFunds"` wallet update failed (e.g. insufficient gold for star packages)
- `"InvalidReceipt"` -- IAP validation failed
- `"NotEnoughFunds"` -- wallet update failed (e.g. insufficient gold for star packages)
**Idempotency:** Checks `receipts` collection with idempotency_key. Returns existing result on duplicate.
@@ -416,9 +416,9 @@ Hardcoded items available for purchase:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `item_id` | string | Yes | | Item ID from catalog |
| `item_id` | string | Yes | -- | Item ID from catalog |
| `quantity` | number | No | 1 | Quantity (min 1) |
| `idempotency_key` | string | Yes | | Idempotency key |
| `idempotency_key` | string | Yes | -- | Idempotency key |
**Returns (JSON):**
@@ -434,8 +434,8 @@ Hardcoded items available for purchase:
- `"Invalid quantity"`
- `"Idempotency key required"`
- `"ItemNotFound"`
- `"NotEnoughFunds"` insufficient gold/star balance
- `"PurchaseFailed"` storage write failed
- `"NotEnoughFunds"` -- insufficient gold/star balance
- `"PurchaseFailed"` -- storage write failed
**Storage writes:**
- Collection `"inventory"`, key `item_id`: `{category, purchased_at, quantity}`
@@ -464,7 +464,7 @@ Hardcoded items available for purchase:
**Errors:**
- `"Admin privileges required"`
- `"Item not found in catalog: <itemId>"` banner references a non-catalog item
- `"Item not found in catalog: <itemId>"` -- banner references a non-catalog item
**Storage:** Collection `"shop_config"`, key `"featured_banners"`, user `SYSTEM_USER_ID`, permission_read=`2`, permission_write=`0`.
@@ -533,7 +533,7 @@ Hardcoded items available for purchase:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `banner_id` | string | Yes | | `"star"` or `"gold"` |
| `banner_id` | string | Yes | -- | `"star"` or `"gold"` |
| `count` | number | No | 1 | Number of pulls (1 or 10) |
**Returns (JSON):**
@@ -599,7 +599,7 @@ Hardcoded items available for purchase:
|---|---|---|
| `user_id` | string | Owner user ID |
| `username` | string | Username |
| `display_name` | string | Username (fallback actually `record.username`) |
| `display_name` | string | Username (fallback -- actually `record.username`) |
| `avatar_url` | string | Avatar URL from metadata |
| `loadout_character` | string | Character from metadata (default `"Copper"`) |
| `high_score` | number | Score |
@@ -675,7 +675,7 @@ Hardcoded items available for purchase:
|---|---|---|
| `success` | bool | `true` |
**Storage write:** Collection `"stats"`, key `"game_stats"` zeros out `games_played`, `games_won`, `high_score`, `total_kills`, `total_deaths`. permission_read=`2`, permission_write=`1`.
**Storage write:** Collection `"stats"`, key `"game_stats"` -- zeros out `games_played`, `games_won`, `high_score`, `total_kills`, `total_deaths`. permission_read=`2`, permission_write=`1`.
### RPC: `admin_update_stats`
@@ -751,7 +751,7 @@ Hardcoded items available for purchase:
| `start_date` | string | No | Current UTC | ISO8601 start date |
| `end_date` | string | No | `""` | ISO8601 end date (global only) |
| `rewards` | array/object | No | `{}` | Attached rewards (see claim_mail_reward for format) |
| `target_user_id` | string | No | `""` | If set personal mail to this user. Omit global mail |
| `target_user_id` | string | No | `""` | If set -> personal mail to this user. Omit -> global mail |
**Returns (JSON):**
@@ -922,7 +922,7 @@ Array format: `[{type="star", amount=100}, {type="gold", amount=50}, {type="frag
### Default Reward Schedule
Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
Days 1-31, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
| Day | Reward |
|---|---|
@@ -930,7 +930,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
| 2 | 15 star |
| ... | ... |
| 19 | 100 star (capped) |
| 2031 | 100 star each |
| 20-31 | 100 star each |
### RPC: `claim_daily_reward`
@@ -953,9 +953,9 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
**Errors:**
- `"Not authenticated"`
- `"Already claimed today"` `last_claim_date == today`
- `"Already claimed all rewards for this month"` day index >= rewards array length
- `"Already claimed today's reward"` day index already in `claimed_days`
- `"Already claimed today"` -- `last_claim_date == today`
- `"Already claimed all rewards for this month"` -- day index >= rewards array length
- `"Already claimed today's reward"` -- day index already in `claimed_days`
**Storage reads/writes:**
- Read: Collection `"daily_rewards"`, key `"state"` (per-user)
@@ -964,7 +964,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
- Write (if fragment): Collection `"inventory"`, key `"fragments"`
- Wallet update for star/gold rewards
**Reward types:** `"star"` or `"gold"` wallet update. `"frag_"` prefix inventory fragments.
**Reward types:** `"star"` or `"gold"` -> wallet update. `"frag_"` prefix -> inventory fragments.
### RPC: `get_daily_reward_state`
@@ -999,7 +999,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
| Field | Type | Required | Description |
|---|---|---|---|
| `config` | object | Yes | Map of month array of `{type, amount}` rewards. E.g. `{"01": [{type="star", amount=50}, ...]}` |
| `config` | object | Yes | Map of month -> array of `{type, amount}` rewards. E.g. `{"01": [{type="star", amount=50}, ...]}` |
### RPC: `get_daily_reward_config_admin` [Admin]
@@ -1208,7 +1208,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `user_id` | string | Yes | | Target user ID |
| `user_id` | string | Yes | -- | Target user ID |
| `collections` | array | No | `["profiles","stats","inventory","receipts","history","matches","inbox"]` | Storage collections to include |
**Returns (JSON):** Rich object with `{user, friends, purchases, wallet_ledger, storage, subscription}`.
@@ -1259,7 +1259,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
|---|---|
| **Function** | `admin.rpc_admin_get_player_list` |
| **Auth** | Admin **or** match host |
| **Purpose** | Get player list for a match (stub returns empty) |
| **Purpose** | Get player list for a match (stub -- returns empty) |
### RPC: `admin_get_chat_config`
@@ -1316,7 +1316,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `channel_id` | string | Yes | | Channel ID or room name |
| `channel_id` | string | Yes | -- | Channel ID or room name |
| `limit` | number | No | 50 | Messages per page |
| `cursor` | string | No | `""` | Pagination cursor |
| `forward` | bool | No | `true` | Direction |
@@ -1397,7 +1397,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
| Key | User | Permission Read | Permission Write | Schema |
|---|---|---|---|---|
| `"daily_rewards"` | SYSTEM | 2 (public) | 0 (owner) | `{"MM": [{type, amount}, ...]}` (monthrewards map) |
| `"daily_rewards"` | SYSTEM | 2 (public) | 0 (owner) | `{"MM": [{type, amount}, ...]}` (month->rewards map) |
| `"global_mail"` | SYSTEM | 2 (public) | 0 (owner) | `{mails: [{id, title, content, ...}]}` |
| `"lobby_chat"` | SYSTEM | 2 (public) | 0 (owner) | `{prefix, max_messages, max_age_days}` |
@@ -1421,7 +1421,7 @@ Days 131, each day gives `star` currency: `min(10 + (day-1)*5, 100)`.
|---|---|
| **ID** | `"global_high_score"` |
| **Authoritative** | `true` (can only be written server-side) |
| **Sort Order** | `"desc"` (highest lowest) |
| **Sort Order** | `"desc"` (highest -> lowest) |
| **Operator** | `"best"` (keep best score per user) |
| **Reset** | `nil` (never auto-resets) |
| **Created By** | Both `core.lua` and `leaderboard.lua` on module load |