84 lines
2.7 KiB
Rust
84 lines
2.7 KiB
Rust
//! 任务写入命令。
|
|
//!
|
|
//! 用于表达任务创建、信号推进、完成确认和交付等输入。
|
|
|
|
use crate::domain::{
|
|
QuestNarrativeBindingSnapshot, QuestProgressSignal, QuestRecordSnapshot, QuestRewardSnapshot,
|
|
QuestSignalKind, QuestStatus, QuestStepSnapshot,
|
|
};
|
|
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 QuestRecordInput {
|
|
pub quest_id: String,
|
|
pub runtime_session_id: String,
|
|
pub story_session_id: Option<String>,
|
|
pub actor_user_id: String,
|
|
pub issuer_npc_id: String,
|
|
pub issuer_npc_name: String,
|
|
pub scene_id: Option<String>,
|
|
pub chapter_id: Option<String>,
|
|
pub act_id: Option<String>,
|
|
pub thread_id: Option<String>,
|
|
pub contract_id: Option<String>,
|
|
pub title: String,
|
|
pub description: String,
|
|
pub summary: String,
|
|
pub status: QuestStatus,
|
|
pub completion_notified: bool,
|
|
pub reward: QuestRewardSnapshot,
|
|
pub reward_text: String,
|
|
pub narrative_binding: QuestNarrativeBindingSnapshot,
|
|
pub steps: Vec<QuestStepSnapshot>,
|
|
pub active_step_id: Option<String>,
|
|
pub visible_stage: u32,
|
|
pub hidden_flags: Vec<String>,
|
|
pub discovered_fact_ids: Vec<String>,
|
|
pub related_carrier_ids: Vec<String>,
|
|
pub consequence_ids: Vec<String>,
|
|
pub created_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct QuestSignalApplyInput {
|
|
pub quest_id: String,
|
|
pub signal: QuestProgressSignal,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct QuestSignalApplyOutcome {
|
|
pub next_record: QuestRecordSnapshot,
|
|
pub changed: bool,
|
|
pub completed_now: bool,
|
|
pub changed_step_id: Option<String>,
|
|
pub changed_step_progress: Option<u32>,
|
|
pub signal_kind: QuestSignalKind,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct QuestCompletionAckInput {
|
|
pub quest_id: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct QuestCompletionAckOutcome {
|
|
pub next_record: QuestRecordSnapshot,
|
|
pub changed: bool,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct QuestTurnInInput {
|
|
pub quest_id: String,
|
|
pub turned_in_at_micros: i64,
|
|
}
|