This commit is contained in:
2026-04-28 19:36:39 +08:00
parent a9febe7678
commit f0471a4f8d
206 changed files with 18456 additions and 10133 deletions

View File

@@ -52,7 +52,98 @@ export type RuntimeStoryStatusViewModel = {
inBattle: boolean;
npcInteractionActive: boolean;
currentNpcBattleMode: 'fight' | 'spar' | null;
currentNpcBattleOutcome: 'fight_victory' | 'spar_complete' | null;
currentNpcBattleOutcome: 'fight_victory' | 'fight_defeat' | 'spar_complete' | null;
};
export type RuntimeStoryInventoryActionView = {
functionId: string;
actionText: string;
payload?: JsonObject;
enabled: boolean;
reason?: string | null;
};
export type RuntimeStoryInventoryItemActionsView = {
use: RuntimeStoryInventoryActionView;
equip: RuntimeStoryInventoryActionView;
dismantle: RuntimeStoryInventoryActionView;
reforge: RuntimeStoryInventoryActionView;
};
export type RuntimeStoryInventoryItemView = {
item: JsonObject;
actions: RuntimeStoryInventoryItemActionsView;
};
export type RuntimeStoryEquipmentSlotView = {
slotId: string;
label: string;
item?: JsonObject | null;
unequip: RuntimeStoryInventoryActionView;
};
export type RuntimeStoryForgeRequirementView = {
id: string;
label: string;
quantity: number;
owned: number;
};
export type RuntimeStoryForgeRecipeView = {
id: string;
name: string;
kind: string;
description: string;
resultLabel: string;
currencyCost: number;
currencyText: string;
requirements: RuntimeStoryForgeRequirementView[];
canCraft: boolean;
disabledReason?: string | null;
action: RuntimeStoryInventoryActionView;
};
export type RuntimeStoryInventoryViewModel = {
playerCurrency: number;
currencyText: string;
inBattle: boolean;
backpackItems: RuntimeStoryInventoryItemView[];
equipmentSlots: RuntimeStoryEquipmentSlotView[];
forgeRecipes: RuntimeStoryForgeRecipeView[];
};
export type RuntimeNpcTradeMode = 'buy' | 'sell';
export type RuntimeNpcTradeItemView = {
itemId: string;
item: JsonObject;
mode: RuntimeNpcTradeMode;
unitPrice: number;
maxQuantity: number;
canSubmit: boolean;
reason?: string | null;
};
export type RuntimeNpcGiftItemView = {
itemId: string;
item: JsonObject;
affinityGain: number;
canSubmit: boolean;
reason?: string | null;
};
export type RuntimeNpcInteractionView = {
npcId: string;
npcName: string;
playerCurrency: number;
currencyName: string;
trade: {
buyItems: RuntimeNpcTradeItemView[];
sellItems: RuntimeNpcTradeItemView[];
};
gift: {
items: RuntimeNpcGiftItemView[];
};
};
export type RuntimeBattlePresentation = {
@@ -60,15 +151,17 @@ export type RuntimeBattlePresentation = {
targetName?: string;
damageDealt?: number;
damageTaken?: number;
outcome?: 'ongoing' | 'victory' | 'spar_complete' | 'escaped';
outcome?: 'ongoing' | 'victory' | 'spar_complete' | 'defeat' | 'escaped';
};
export type RuntimeStoryViewModel = {
player: RuntimeStoryPlayerViewModel;
encounter: RuntimeStoryEncounterViewModel | null;
companions: RuntimeStoryCompanionViewModel[];
inventory: RuntimeStoryInventoryViewModel;
availableOptions: RuntimeStoryOptionView[];
status: RuntimeStoryStatusViewModel;
npcInteraction?: RuntimeNpcInteractionView | null;
};
export type RuntimeStoryPresentation = {
@@ -98,14 +191,14 @@ export type RuntimeStoryPatch =
targetId?: string;
damageDealt?: number;
damageTaken?: number;
outcome: 'ongoing' | 'victory' | 'spar_complete' | 'escaped';
outcome: 'ongoing' | 'victory' | 'spar_complete' | 'defeat' | 'escaped';
}
| {
type: 'status_changed';
inBattle: boolean;
npcInteractionActive: boolean;
currentNpcBattleMode: 'fight' | 'spar' | null;
currentNpcBattleOutcome: 'fight_victory' | 'spar_complete' | null;
currentNpcBattleOutcome: 'fight_victory' | 'fight_defeat' | 'spar_complete' | null;
}
| {
type: 'encounter_changed';
@@ -117,6 +210,21 @@ export type RuntimeStoryActionRequest =
snapshot?: SavedGameSnapshotInput;
};
export type RuntimeStoryAiRequestOptions = {
availableOptions?: JsonObject[];
optionCatalog?: JsonObject[];
};
export type RuntimeStoryAiRequest = {
sessionId: string;
clientVersion?: number;
choice?: string;
lastFunctionId?: string | null;
observeSignsRequested?: boolean;
recentActionResult?: string | null;
requestOptions?: RuntimeStoryAiRequestOptions;
};
export type RuntimeStoryStateRequest<
TSnapshotGameState = JsonObject,
TSnapshotCurrentStory = JsonObject,
@@ -130,6 +238,30 @@ export type RuntimeStoryStateRequest<
>;
};
export type RuntimeStoryBootstrapRequest<
TProfile = JsonObject,
TCharacter = JsonObject,
> = {
worldType: string;
customWorldProfile?: TProfile | null;
character: TCharacter;
runtimeMode?: 'play' | 'preview' | 'test';
disablePersistence?: boolean;
};
export type RuntimeStoryBootstrapResponse<
TSnapshotGameState = JsonObject,
TSnapshotCurrentStory = JsonObject,
> = {
sessionId: string;
serverVersion: number;
snapshot: SavedGameSnapshot<
TSnapshotGameState,
string,
TSnapshotCurrentStory
>;
};
export type RuntimeStoryActionResponse<
TSnapshotGameState = JsonObject,
TSnapshotCurrentStory = JsonObject,