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