xyvera/nakama/modules/progression.ts
caoimhinr fb00954954 Initial scaffold: Nakama backend, Godot client, content schema
Sets up the Step 1 (Project Foundation) and Step 2 (Content Schemas) scaffold
from the implementation sequence. Includes Docker Compose stack, Nakama
TypeScript module stubs, PostgreSQL migration, Godot 4 project shell with
scene stubs and NakamaClient singleton, YAML content schemas for all entity
types, and example data for 3 characters, 2 jobs, and all 7 core resources.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 23:33:06 +02:00

68 lines
2.2 KiB
TypeScript

// progression.ts — character level, ascension, and skill upgrade
//
// All upgrade cost validation is server-side. Costs come from content data
// (content/data/characters/), not hardcoded constants, so they can be tuned
// without code changes.
//
// Progression layers (per spec):
// 1. Character level (capped per ascension tier)
// 2. Ascension / limit break (unlocks higher level cap, costs materials)
// 3. Skill upgrades (costs knowledge + gold)
// 4. Equipment (deferred beyond PoC)
// 5. Bond / familiarity (tracked; mechanical outputs deferred)
// 6. Assignment mastery (tracked in village module)
export function rpcLevelUp(
ctx: nkruntime.Context,
logger: nkruntime.Logger,
nk: nkruntime.Nakama,
payload: string
): string {
// TODO PR 6: validate level-up cost, deduct resources, write new level
const req = JSON.parse(payload || "{}");
logger.info(`progression/level_up stub: char=${req.character_id} user=${ctx.userId}`);
return JSON.stringify({
ok: false,
error: "not_implemented",
message: "Level-up is stubbed. Implement in PR 6.",
character_id: req.character_id,
});
}
export function rpcAscend(
ctx: nkruntime.Context,
logger: nkruntime.Logger,
nk: nkruntime.Nakama,
payload: string
): string {
// TODO PR 6: validate ascension materials, raise tier, uncap level
const req = JSON.parse(payload || "{}");
logger.info(`progression/ascend stub: char=${req.character_id} user=${ctx.userId}`);
return JSON.stringify({
ok: false,
error: "not_implemented",
message: "Ascension is stubbed. Implement in PR 6.",
character_id: req.character_id,
});
}
export function rpcUpgradeSkill(
ctx: nkruntime.Context,
logger: nkruntime.Logger,
nk: nkruntime.Nakama,
payload: string
): string {
// TODO PR 6: validate skill upgrade cost, apply upgrade
const req = JSON.parse(payload || "{}");
logger.info(`progression/upgrade_skill stub: char=${req.character_id} skill=${req.skill_id} user=${ctx.userId}`);
return JSON.stringify({
ok: false,
error: "not_implemented",
message: "Skill upgrade is stubbed. Implement in PR 6.",
character_id: req.character_id,
skill_id: req.skill_id,
});
}