Skip to main content

nil_payload/request/cheat/
resources.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use nil_core::resources::{Food, Iron, Resources, Stone, Wood};
5use nil_core::ruler::Ruler;
6use nil_core::world::config::WorldId;
7use serde::{Deserialize, Serialize};
8
9#[cfg(feature = "typescript")]
10use ts_rs::TS;
11
12#[derive(Clone, Debug, Deserialize, Serialize)]
13#[serde(rename_all = "camelCase")]
14#[cfg_attr(feature = "typescript", derive(TS))]
15#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
16pub struct CheatGetResourcesRequest {
17  pub world: WorldId,
18  #[serde(default)]
19  pub ruler: Option<Ruler>,
20}
21
22#[derive(Clone, Debug, Deserialize, Serialize)]
23#[serde(rename_all = "camelCase")]
24#[cfg_attr(feature = "typescript", derive(TS))]
25#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
26pub struct CheatSetFoodRequest {
27  pub world: WorldId,
28  #[serde(default)]
29  pub ruler: Option<Ruler>,
30  #[serde(default)]
31  pub food: Food,
32}
33
34#[derive(Clone, Debug, Deserialize, Serialize)]
35#[serde(rename_all = "camelCase")]
36#[cfg_attr(feature = "typescript", derive(TS))]
37#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
38pub struct CheatSetIronRequest {
39  pub world: WorldId,
40  #[serde(default)]
41  pub ruler: Option<Ruler>,
42  #[serde(default)]
43  pub iron: Iron,
44}
45
46#[derive(Clone, Debug, Deserialize, Serialize)]
47#[serde(rename_all = "camelCase")]
48#[cfg_attr(feature = "typescript", derive(TS))]
49#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
50pub struct CheatSetMaxFoodRequest {
51  pub world: WorldId,
52  #[serde(default)]
53  pub ruler: Option<Ruler>,
54}
55
56#[derive(Clone, Debug, Deserialize, Serialize)]
57#[serde(rename_all = "camelCase")]
58#[cfg_attr(feature = "typescript", derive(TS))]
59#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
60pub struct CheatSetMaxIronRequest {
61  pub world: WorldId,
62  #[serde(default)]
63  pub ruler: Option<Ruler>,
64}
65
66#[derive(Clone, Debug, Deserialize, Serialize)]
67#[serde(rename_all = "camelCase")]
68#[cfg_attr(feature = "typescript", derive(TS))]
69#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
70pub struct CheatSetMaxResourcesRequest {
71  pub world: WorldId,
72  #[serde(default)]
73  pub ruler: Option<Ruler>,
74}
75
76#[derive(Clone, Debug, Deserialize, Serialize)]
77#[serde(rename_all = "camelCase")]
78#[cfg_attr(feature = "typescript", derive(TS))]
79#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
80pub struct CheatSetMaxSiloResourcesRequest {
81  pub world: WorldId,
82  #[serde(default)]
83  pub ruler: Option<Ruler>,
84}
85
86#[derive(Clone, Debug, Deserialize, Serialize)]
87#[serde(rename_all = "camelCase")]
88#[cfg_attr(feature = "typescript", derive(TS))]
89#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
90pub struct CheatSetMaxStoneRequest {
91  pub world: WorldId,
92  #[serde(default)]
93  pub ruler: Option<Ruler>,
94}
95
96#[derive(Clone, Debug, Deserialize, Serialize)]
97#[serde(rename_all = "camelCase")]
98#[cfg_attr(feature = "typescript", derive(TS))]
99#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
100pub struct CheatSetMaxWarehouseResourcesRequest {
101  pub world: WorldId,
102  #[serde(default)]
103  pub ruler: Option<Ruler>,
104}
105
106#[derive(Clone, Debug, Deserialize, Serialize)]
107#[serde(rename_all = "camelCase")]
108#[cfg_attr(feature = "typescript", derive(TS))]
109#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
110pub struct CheatSetMaxWoodRequest {
111  pub world: WorldId,
112  #[serde(default)]
113  pub ruler: Option<Ruler>,
114}
115
116#[derive(Clone, Debug, Deserialize, Serialize)]
117#[serde(rename_all = "camelCase")]
118#[cfg_attr(feature = "typescript", derive(TS))]
119#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
120pub struct CheatSetResourcesRequest {
121  pub world: WorldId,
122  #[serde(default)]
123  pub ruler: Option<Ruler>,
124  #[serde(default)]
125  pub resources: Resources,
126}
127
128#[derive(Clone, Debug, Deserialize, Serialize)]
129#[serde(rename_all = "camelCase")]
130#[cfg_attr(feature = "typescript", derive(TS))]
131#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
132pub struct CheatSetStoneRequest {
133  pub world: WorldId,
134  #[serde(default)]
135  pub ruler: Option<Ruler>,
136  #[serde(default)]
137  pub stone: Stone,
138}
139
140#[derive(Clone, Debug, Deserialize, Serialize)]
141#[serde(rename_all = "camelCase")]
142#[cfg_attr(feature = "typescript", derive(TS))]
143#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
144pub struct CheatSetWoodRequest {
145  pub world: WorldId,
146  #[serde(default)]
147  pub ruler: Option<Ruler>,
148  #[serde(default)]
149  pub wood: Wood,
150}