Skip to main content

nil_payload/request/cheat/
city.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use bon::Builder;
5use nil_core::city::stability::Stability;
6use nil_core::continent::coord::Coord;
7use nil_core::ruler::Ruler;
8use nil_core::world::config::WorldId;
9use serde::{Deserialize, Serialize};
10use std::collections::HashSet;
11
12#[cfg(feature = "typescript")]
13use ts_rs::TS;
14
15#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
16#[serde(rename_all = "camelCase")]
17#[cfg_attr(feature = "typescript", derive(TS))]
18#[cfg_attr(feature = "typescript", ts(export))]
19pub struct CheatGetCitiesRequest {
20  #[builder(start_fn, into)]
21  pub world: WorldId,
22  #[serde(default)]
23  #[builder(default, with = FromIterator::from_iter)]
24  pub coords: HashSet<Coord>,
25  #[serde(default)]
26  #[builder(default)]
27  pub score: bool,
28  #[serde(default)]
29  #[builder(default)]
30  pub all: bool,
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 CheatGetCityRequest {
38  #[builder(start_fn, into)]
39  pub world: WorldId,
40  #[builder(into)]
41  pub coord: Coord,
42  #[serde(default)]
43  #[builder(default)]
44  pub score: bool,
45}
46
47#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
48#[serde(rename_all = "camelCase")]
49#[cfg_attr(feature = "typescript", derive(TS))]
50#[cfg_attr(feature = "typescript", ts(export))]
51pub struct CheatSetStabilityRequest {
52  #[builder(start_fn, into)]
53  pub world: WorldId,
54  #[builder(into)]
55  pub coord: Coord,
56  #[builder(into)]
57  pub stability: Stability,
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 CheatSpawnCityRequest {
65  #[builder(start_fn, into)]
66  pub world: WorldId,
67  #[serde(default)]
68  #[builder(into)]
69  pub ruler: Option<Ruler>,
70  #[builder(into)]
71  pub coord: Coord,
72}