artifacts/models/
character_schema.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct CharacterSchema {
7    /// Name of the character.
8    #[serde(rename = "name")]
9    pub name: String,
10    /// Account name.
11    #[serde(rename = "account")]
12    pub account: String,
13    /// Character skin code.
14    #[serde(rename = "skin")]
15    pub skin: models::CharacterSkin,
16    /// Combat level.
17    #[serde(rename = "level")]
18    pub level: i32,
19    /// The current xp level of the combat level.
20    #[serde(rename = "xp")]
21    pub xp: i32,
22    /// XP required to level up the character.
23    #[serde(rename = "max_xp")]
24    pub max_xp: i32,
25    /// The numbers of gold on this character.
26    #[serde(rename = "gold")]
27    pub gold: i32,
28    /// *Not available, on the roadmap. Character movement speed.
29    #[serde(rename = "speed")]
30    pub speed: i32,
31    /// Mining level.
32    #[serde(rename = "mining_level")]
33    pub mining_level: i32,
34    /// The current xp level of the Mining skill.
35    #[serde(rename = "mining_xp")]
36    pub mining_xp: i32,
37    /// Mining XP required to level up the skill.
38    #[serde(rename = "mining_max_xp")]
39    pub mining_max_xp: i32,
40    /// Woodcutting level.
41    #[serde(rename = "woodcutting_level")]
42    pub woodcutting_level: i32,
43    /// The current xp level of the Woodcutting skill.
44    #[serde(rename = "woodcutting_xp")]
45    pub woodcutting_xp: i32,
46    /// Woodcutting XP required to level up the skill.
47    #[serde(rename = "woodcutting_max_xp")]
48    pub woodcutting_max_xp: i32,
49    /// Fishing level.
50    #[serde(rename = "fishing_level")]
51    pub fishing_level: i32,
52    /// The current xp level of the Fishing skill.
53    #[serde(rename = "fishing_xp")]
54    pub fishing_xp: i32,
55    /// Fishing XP required to level up the skill.
56    #[serde(rename = "fishing_max_xp")]
57    pub fishing_max_xp: i32,
58    /// Weaponcrafting level.
59    #[serde(rename = "weaponcrafting_level")]
60    pub weaponcrafting_level: i32,
61    /// The current xp level of the Weaponcrafting skill.
62    #[serde(rename = "weaponcrafting_xp")]
63    pub weaponcrafting_xp: i32,
64    /// Weaponcrafting XP required to level up the skill.
65    #[serde(rename = "weaponcrafting_max_xp")]
66    pub weaponcrafting_max_xp: i32,
67    /// Gearcrafting level.
68    #[serde(rename = "gearcrafting_level")]
69    pub gearcrafting_level: i32,
70    /// The current xp level of the Gearcrafting skill.
71    #[serde(rename = "gearcrafting_xp")]
72    pub gearcrafting_xp: i32,
73    /// Gearcrafting XP required to level up the skill.
74    #[serde(rename = "gearcrafting_max_xp")]
75    pub gearcrafting_max_xp: i32,
76    /// Jewelrycrafting level.
77    #[serde(rename = "jewelrycrafting_level")]
78    pub jewelrycrafting_level: i32,
79    /// The current xp level of the Jewelrycrafting skill.
80    #[serde(rename = "jewelrycrafting_xp")]
81    pub jewelrycrafting_xp: i32,
82    /// Jewelrycrafting XP required to level up the skill.
83    #[serde(rename = "jewelrycrafting_max_xp")]
84    pub jewelrycrafting_max_xp: i32,
85    /// The current xp level of the Cooking skill.
86    #[serde(rename = "cooking_level")]
87    pub cooking_level: i32,
88    /// Cooking XP.
89    #[serde(rename = "cooking_xp")]
90    pub cooking_xp: i32,
91    /// Cooking XP required to level up the skill.
92    #[serde(rename = "cooking_max_xp")]
93    pub cooking_max_xp: i32,
94    /// Alchemy level.
95    #[serde(rename = "alchemy_level")]
96    pub alchemy_level: i32,
97    /// Alchemy XP.
98    #[serde(rename = "alchemy_xp")]
99    pub alchemy_xp: i32,
100    /// Alchemy XP required to level up the skill.
101    #[serde(rename = "alchemy_max_xp")]
102    pub alchemy_max_xp: i32,
103    /// Character actual HP.
104    #[serde(rename = "hp")]
105    pub hp: i32,
106    /// Character max HP.
107    #[serde(rename = "max_hp")]
108    pub max_hp: i32,
109    /// *Increase speed attack (reduce fight cooldown)
110    #[serde(rename = "haste")]
111    pub haste: i32,
112    /// % Critical strike. Critical strikes adds 50% extra damage to an attack (1.5x).
113    #[serde(rename = "critical_strike")]
114    pub critical_strike: i32,
115    /// Wisdom increases the amount of XP gained from fights and skills (1% extra per 10 wisdom).
116    #[serde(rename = "wisdom")]
117    pub wisdom: i32,
118    /// Prospecting increases the chances of getting drops from fights and skills (1% extra per 10 PP).
119    #[serde(rename = "prospecting")]
120    pub prospecting: i32,
121    /// Fire attack.
122    #[serde(rename = "attack_fire")]
123    pub attack_fire: i32,
124    /// Earth attack.
125    #[serde(rename = "attack_earth")]
126    pub attack_earth: i32,
127    /// Water attack.
128    #[serde(rename = "attack_water")]
129    pub attack_water: i32,
130    /// Air attack.
131    #[serde(rename = "attack_air")]
132    pub attack_air: i32,
133    /// % Damage. Damage increases your attack in all elements.
134    #[serde(rename = "dmg")]
135    pub dmg: i32,
136    /// % Fire damage. Damage increases your fire attack.
137    #[serde(rename = "dmg_fire")]
138    pub dmg_fire: i32,
139    /// % Earth damage. Damage increases your earth attack.
140    #[serde(rename = "dmg_earth")]
141    pub dmg_earth: i32,
142    /// % Water damage. Damage increases your water attack.
143    #[serde(rename = "dmg_water")]
144    pub dmg_water: i32,
145    /// % Air damage. Damage increases your air attack.
146    #[serde(rename = "dmg_air")]
147    pub dmg_air: i32,
148    /// % Fire resistance. Reduces fire attack.
149    #[serde(rename = "res_fire")]
150    pub res_fire: i32,
151    /// % Earth resistance. Reduces earth attack.
152    #[serde(rename = "res_earth")]
153    pub res_earth: i32,
154    /// % Water resistance. Reduces water attack.
155    #[serde(rename = "res_water")]
156    pub res_water: i32,
157    /// % Air resistance. Reduces air attack.
158    #[serde(rename = "res_air")]
159    pub res_air: i32,
160    /// Character x coordinate.
161    #[serde(rename = "x")]
162    pub x: i32,
163    /// Character y coordinate.
164    #[serde(rename = "y")]
165    pub y: i32,
166    /// Cooldown in seconds.
167    #[serde(rename = "cooldown")]
168    pub cooldown: i32,
169    /// Datetime Cooldown expiration.
170    #[serde(
171        rename = "cooldown_expiration",
172        skip_serializing_if = "Option::is_none"
173    )]
174    pub cooldown_expiration: Option<String>,
175    /// Weapon slot.
176    #[serde(rename = "weapon_slot")]
177    pub weapon_slot: String,
178    /// Rune slot.
179    #[serde(rename = "rune_slot")]
180    pub rune_slot: String,
181    /// Shield slot.
182    #[serde(rename = "shield_slot")]
183    pub shield_slot: String,
184    /// Helmet slot.
185    #[serde(rename = "helmet_slot")]
186    pub helmet_slot: String,
187    /// Body armor slot.
188    #[serde(rename = "body_armor_slot")]
189    pub body_armor_slot: String,
190    /// Leg armor slot.
191    #[serde(rename = "leg_armor_slot")]
192    pub leg_armor_slot: String,
193    /// Boots slot.
194    #[serde(rename = "boots_slot")]
195    pub boots_slot: String,
196    /// Ring 1 slot.
197    #[serde(rename = "ring1_slot")]
198    pub ring1_slot: String,
199    /// Ring 2 slot.
200    #[serde(rename = "ring2_slot")]
201    pub ring2_slot: String,
202    /// Amulet slot.
203    #[serde(rename = "amulet_slot")]
204    pub amulet_slot: String,
205    /// Artifact 1 slot.
206    #[serde(rename = "artifact1_slot")]
207    pub artifact1_slot: String,
208    /// Artifact 2 slot.
209    #[serde(rename = "artifact2_slot")]
210    pub artifact2_slot: String,
211    /// Artifact 3 slot.
212    #[serde(rename = "artifact3_slot")]
213    pub artifact3_slot: String,
214    /// Utility 1 slot.
215    #[serde(rename = "utility1_slot")]
216    pub utility1_slot: String,
217    /// Utility 1 quantity.
218    #[serde(rename = "utility1_slot_quantity")]
219    pub utility1_slot_quantity: u32,
220    /// Utility 2 slot.
221    #[serde(rename = "utility2_slot")]
222    pub utility2_slot: String,
223    /// Utility 2 quantity.
224    #[serde(rename = "utility2_slot_quantity")]
225    pub utility2_slot_quantity: u32,
226    /// Bag slot.
227    #[serde(rename = "bag_slot")]
228    pub bag_slot: String,
229    /// Task in progress.
230    #[serde(rename = "task")]
231    pub task: String,
232    /// Task type.
233    #[serde(rename = "task_type")]
234    pub task_type: String,
235    /// Task progression.
236    #[serde(rename = "task_progress")]
237    pub task_progress: i32,
238    /// Task total objective.
239    #[serde(rename = "task_total")]
240    pub task_total: i32,
241    /// Inventory max items.
242    #[serde(rename = "inventory_max_items")]
243    pub inventory_max_items: i32,
244    /// List of inventory slots.
245    #[serde(rename = "inventory", skip_serializing_if = "Option::is_none")]
246    pub inventory: Option<Vec<models::InventorySlot>>,
247}
248
249impl CharacterSchema {
250    pub fn new(
251        name: String,
252        account: String,
253        skin: models::CharacterSkin,
254        level: i32,
255        xp: i32,
256        max_xp: i32,
257        gold: i32,
258        speed: i32,
259        mining_level: i32,
260        mining_xp: i32,
261        mining_max_xp: i32,
262        woodcutting_level: i32,
263        woodcutting_xp: i32,
264        woodcutting_max_xp: i32,
265        fishing_level: i32,
266        fishing_xp: i32,
267        fishing_max_xp: i32,
268        weaponcrafting_level: i32,
269        weaponcrafting_xp: i32,
270        weaponcrafting_max_xp: i32,
271        gearcrafting_level: i32,
272        gearcrafting_xp: i32,
273        gearcrafting_max_xp: i32,
274        jewelrycrafting_level: i32,
275        jewelrycrafting_xp: i32,
276        jewelrycrafting_max_xp: i32,
277        cooking_level: i32,
278        cooking_xp: i32,
279        cooking_max_xp: i32,
280        alchemy_level: i32,
281        alchemy_xp: i32,
282        alchemy_max_xp: i32,
283        hp: i32,
284        max_hp: i32,
285        haste: i32,
286        critical_strike: i32,
287        wisdom: i32,
288        prospecting: i32,
289        attack_fire: i32,
290        attack_earth: i32,
291        attack_water: i32,
292        attack_air: i32,
293        dmg: i32,
294        dmg_fire: i32,
295        dmg_earth: i32,
296        dmg_water: i32,
297        dmg_air: i32,
298        res_fire: i32,
299        res_earth: i32,
300        res_water: i32,
301        res_air: i32,
302        x: i32,
303        y: i32,
304        cooldown: i32,
305        weapon_slot: String,
306        rune_slot: String,
307        shield_slot: String,
308        helmet_slot: String,
309        body_armor_slot: String,
310        leg_armor_slot: String,
311        boots_slot: String,
312        ring1_slot: String,
313        ring2_slot: String,
314        amulet_slot: String,
315        artifact1_slot: String,
316        artifact2_slot: String,
317        artifact3_slot: String,
318        utility1_slot: String,
319        utility1_slot_quantity: u32,
320        utility2_slot: String,
321        utility2_slot_quantity: u32,
322        bag_slot: String,
323        task: String,
324        task_type: String,
325        task_progress: i32,
326        task_total: i32,
327        inventory_max_items: i32,
328    ) -> CharacterSchema {
329        CharacterSchema {
330            name,
331            account,
332            skin,
333            level,
334            xp,
335            max_xp,
336            gold,
337            speed,
338            mining_level,
339            mining_xp,
340            mining_max_xp,
341            woodcutting_level,
342            woodcutting_xp,
343            woodcutting_max_xp,
344            fishing_level,
345            fishing_xp,
346            fishing_max_xp,
347            weaponcrafting_level,
348            weaponcrafting_xp,
349            weaponcrafting_max_xp,
350            gearcrafting_level,
351            gearcrafting_xp,
352            gearcrafting_max_xp,
353            jewelrycrafting_level,
354            jewelrycrafting_xp,
355            jewelrycrafting_max_xp,
356            cooking_level,
357            cooking_xp,
358            cooking_max_xp,
359            alchemy_level,
360            alchemy_xp,
361            alchemy_max_xp,
362            hp,
363            max_hp,
364            haste,
365            critical_strike,
366            wisdom,
367            prospecting,
368            attack_fire,
369            attack_earth,
370            attack_water,
371            attack_air,
372            dmg,
373            dmg_fire,
374            dmg_earth,
375            dmg_water,
376            dmg_air,
377            res_fire,
378            res_earth,
379            res_water,
380            res_air,
381            x,
382            y,
383            cooldown,
384            cooldown_expiration: None,
385            weapon_slot,
386            rune_slot,
387            shield_slot,
388            helmet_slot,
389            body_armor_slot,
390            leg_armor_slot,
391            boots_slot,
392            ring1_slot,
393            ring2_slot,
394            amulet_slot,
395            artifact1_slot,
396            artifact2_slot,
397            artifact3_slot,
398            utility1_slot,
399            utility1_slot_quantity,
400            utility2_slot,
401            utility2_slot_quantity,
402            bag_slot,
403            task,
404            task_type,
405            task_progress,
406            task_total,
407            inventory_max_items,
408            inventory: None,
409        }
410    }
411}