75 lines
2.5 KiB
Rust
75 lines
2.5 KiB
Rust
//! 成长写入命令。
|
||
//!
|
||
//! 这里固定授予经验、章节预算、章节账本和自动定级等输入结构,adapter 只能把外部
|
||
//! 请求映射到这些命令,不在 SpacetimeDB 或 HTTP 层重复定义字段规则。
|
||
|
||
use crate::domain::{ChapterPaceBand, PlayerProgressionGrantSource, ProgressionRole};
|
||
use serde::{Deserialize, Serialize};
|
||
#[cfg(feature = "spacetime-types")]
|
||
use spacetimedb::SpacetimeType;
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||
pub struct PlayerProgressionGetInput {
|
||
pub user_id: String,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||
pub struct PlayerProgressionGrantInput {
|
||
pub user_id: String,
|
||
pub amount: u32,
|
||
pub source: PlayerProgressionGrantSource,
|
||
pub updated_at_micros: i64,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||
pub struct ChapterProgressionGetInput {
|
||
pub user_id: String,
|
||
pub chapter_id: String,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||
pub struct ChapterProgressionInput {
|
||
pub user_id: String,
|
||
pub chapter_id: String,
|
||
pub chapter_index: u32,
|
||
pub total_chapters: u32,
|
||
pub entry_pseudo_level_millis: u32,
|
||
pub exit_pseudo_level_millis: u32,
|
||
pub entry_level: u32,
|
||
pub exit_level: u32,
|
||
pub planned_total_xp: u32,
|
||
pub planned_quest_xp: u32,
|
||
pub planned_hostile_xp: u32,
|
||
pub expected_hostile_defeat_count: u32,
|
||
pub level_at_entry: u32,
|
||
pub pace_band: ChapterPaceBand,
|
||
pub updated_at_micros: i64,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||
pub struct ChapterProgressionLedgerInput {
|
||
pub user_id: String,
|
||
pub chapter_id: String,
|
||
pub granted_quest_xp: u32,
|
||
pub granted_hostile_xp: u32,
|
||
pub hostile_defeat_increment: u32,
|
||
pub level_at_exit: Option<u32>,
|
||
pub updated_at_micros: i64,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||
pub struct ChapterAutoLevelProfileInput {
|
||
pub chapter_id: String,
|
||
pub chapter_index: u32,
|
||
pub entry_pseudo_level_millis: u32,
|
||
pub exit_pseudo_level_millis: u32,
|
||
pub stage_progress_millis: u32,
|
||
pub progression_role: ProgressionRole,
|
||
}
|