1use bon::Builder;
5use nil_core::player::{PlayerId, PlayerOptions, PlayerStatus};
6use nil_core::world::config::WorldId;
7use nil_crypto::password::Password;
8use serde::{Deserialize, Serialize};
9
10#[cfg(feature = "typescript")]
11use ts_rs::TS;
12
13#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
14#[serde(rename_all = "camelCase")]
15#[cfg_attr(feature = "typescript", derive(TS))]
16#[cfg_attr(feature = "typescript", ts(export))]
17pub struct GetPlayerRequest {
18 #[builder(start_fn)]
19 pub world: WorldId,
20}
21
22#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
23#[serde(rename_all = "camelCase")]
24#[cfg_attr(feature = "typescript", derive(TS))]
25#[cfg_attr(feature = "typescript", ts(export))]
26pub struct GetPlayerCoordsRequest {
27 #[builder(start_fn)]
28 pub world: WorldId,
29 #[builder(into)]
30 pub id: PlayerId,
31}
32
33#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
34#[serde(rename_all = "camelCase")]
35#[cfg_attr(feature = "typescript", derive(TS))]
36#[cfg_attr(feature = "typescript", ts(export))]
37pub struct GetPlayerIdsRequest {
38 #[builder(start_fn, into)]
39 pub world: WorldId,
40}
41
42#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
43#[serde(rename_all = "camelCase")]
44#[cfg_attr(feature = "typescript", derive(TS))]
45#[cfg_attr(feature = "typescript", ts(export))]
46pub struct GetPlayerMaintenanceRequest {
47 #[builder(start_fn, into)]
48 pub world: WorldId,
49}
50
51#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
52#[serde(rename_all = "camelCase")]
53#[cfg_attr(feature = "typescript", derive(TS))]
54#[cfg_attr(feature = "typescript", ts(export))]
55pub struct GetPlayerMilitaryRequest {
56 #[builder(start_fn, into)]
57 pub world: WorldId,
58}
59
60#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
61#[serde(rename_all = "camelCase")]
62#[cfg_attr(feature = "typescript", derive(TS))]
63#[cfg_attr(feature = "typescript", ts(export))]
64pub struct GetPlayerStatusRequest {
65 #[builder(start_fn, into)]
66 pub world: WorldId,
67 #[builder(into)]
68 pub id: PlayerId,
69}
70
71#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
72#[serde(rename_all = "camelCase")]
73#[cfg_attr(feature = "typescript", derive(TS))]
74#[cfg_attr(feature = "typescript", ts(export))]
75pub struct GetPlayerStorageCapacityRequest {
76 #[builder(start_fn, into)]
77 pub world: WorldId,
78}
79
80#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
81#[serde(rename_all = "camelCase")]
82#[cfg_attr(feature = "typescript", derive(TS))]
83#[cfg_attr(feature = "typescript", ts(export))]
84pub struct GetPlayerWorldsRequest {
85 #[builder(into)]
86 pub id: PlayerId,
87}
88
89#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
90#[serde(rename_all = "camelCase")]
91#[cfg_attr(feature = "typescript", derive(TS))]
92#[cfg_attr(feature = "typescript", ts(export))]
93pub struct GetPublicPlayerRequest {
94 #[builder(start_fn, into)]
95 pub world: WorldId,
96 #[builder(into)]
97 pub id: PlayerId,
98}
99
100#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
101#[serde(rename_all = "camelCase")]
102#[cfg_attr(feature = "typescript", derive(TS))]
103#[cfg_attr(feature = "typescript", ts(export))]
104pub struct GetPublicPlayersRequest {
105 #[builder(start_fn, into)]
106 pub world: WorldId,
107}
108
109#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
110#[serde(rename_all = "camelCase")]
111#[cfg_attr(feature = "typescript", derive(TS))]
112#[cfg_attr(feature = "typescript", ts(export))]
113pub struct PlayerExistsRequest {
114 #[builder(start_fn, into)]
115 pub world: WorldId,
116 #[builder(into)]
117 pub id: PlayerId,
118}
119
120#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
121#[serde(rename_all = "camelCase")]
122#[cfg_attr(feature = "typescript", derive(TS))]
123#[cfg_attr(feature = "typescript", ts(export))]
124pub struct SetPlayerStatusRequest {
125 #[builder(start_fn, into)]
126 pub world: WorldId,
127 pub status: PlayerStatus,
128}
129
130#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
131#[serde(rename_all = "camelCase")]
132#[cfg_attr(feature = "typescript", derive(TS))]
133#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
134pub struct SpawnPlayerRequest {
135 #[builder(start_fn, into)]
136 pub world: WorldId,
137 #[serde(default)]
138 #[builder(into)]
139 pub world_password: Option<Password>,
140 pub options: PlayerOptions,
141}