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    /// Initiative determines turn order in combat. Higher initiative goes first.
122    #[serde(rename = "initiative")]
123    pub initiative: i32,
124    /// Threat level affects monster targeting in multi-character combat.
125    #[serde(rename = "threat")]
126    pub threat: i32,
127    /// Fire attack.
128    #[serde(rename = "attack_fire")]
129    pub attack_fire: i32,
130    /// Earth attack.
131    #[serde(rename = "attack_earth")]
132    pub attack_earth: i32,
133    /// Water attack.
134    #[serde(rename = "attack_water")]
135    pub attack_water: i32,
136    /// Air attack.
137    #[serde(rename = "attack_air")]
138    pub attack_air: i32,
139    /// % Damage. Damage increases your attack in all elements.
140    #[serde(rename = "dmg")]
141    pub dmg: i32,
142    /// % Fire damage. Damage increases your fire attack.
143    #[serde(rename = "dmg_fire")]
144    pub dmg_fire: i32,
145    /// % Earth damage. Damage increases your earth attack.
146    #[serde(rename = "dmg_earth")]
147    pub dmg_earth: i32,
148    /// % Water damage. Damage increases your water attack.
149    #[serde(rename = "dmg_water")]
150    pub dmg_water: i32,
151    /// % Air damage. Damage increases your air attack.
152    #[serde(rename = "dmg_air")]
153    pub dmg_air: i32,
154    /// % Fire resistance. Reduces fire attack.
155    #[serde(rename = "res_fire")]
156    pub res_fire: i32,
157    /// % Earth resistance. Reduces earth attack.
158    #[serde(rename = "res_earth")]
159    pub res_earth: i32,
160    /// % Water resistance. Reduces water attack.
161    #[serde(rename = "res_water")]
162    pub res_water: i32,
163    /// % Air resistance. Reduces air attack.
164    #[serde(rename = "res_air")]
165    pub res_air: i32,
166    /// List of active effects on the character.
167    #[serde(rename = "effects", skip_serializing_if = "Option::is_none")]
168    pub effects: Option<Vec<models::StorageEffectSchema>>,
169    /// Character x coordinate.
170    #[serde(rename = "x")]
171    pub x: i32,
172    /// Character y coordinate.
173    #[serde(rename = "y")]
174    pub y: i32,
175    /// Character current layer.
176    #[serde(rename = "layer")]
177    pub layer: models::MapLayer,
178    /// Character current map ID.
179    #[serde(rename = "map_id")]
180    pub map_id: i32,
181    /// Cooldown in seconds.
182    #[serde(rename = "cooldown")]
183    pub cooldown: i32,
184    /// Datetime Cooldown expiration.
185    #[serde(
186        rename = "cooldown_expiration",
187        skip_serializing_if = "Option::is_none"
188    )]
189    pub cooldown_expiration: Option<String>,
190    /// Weapon slot.
191    #[serde(rename = "weapon_slot")]
192    pub weapon_slot: String,
193    /// Rune slot.
194    #[serde(rename = "rune_slot")]
195    pub rune_slot: String,
196    /// Shield slot.
197    #[serde(rename = "shield_slot")]
198    pub shield_slot: String,
199    /// Helmet slot.
200    #[serde(rename = "helmet_slot")]
201    pub helmet_slot: String,
202    /// Body armor slot.
203    #[serde(rename = "body_armor_slot")]
204    pub body_armor_slot: String,
205    /// Leg armor slot.
206    #[serde(rename = "leg_armor_slot")]
207    pub leg_armor_slot: String,
208    /// Boots slot.
209    #[serde(rename = "boots_slot")]
210    pub boots_slot: String,
211    /// Ring 1 slot.
212    #[serde(rename = "ring1_slot")]
213    pub ring1_slot: String,
214    /// Ring 2 slot.
215    #[serde(rename = "ring2_slot")]
216    pub ring2_slot: String,
217    /// Amulet slot.
218    #[serde(rename = "amulet_slot")]
219    pub amulet_slot: String,
220    /// Artifact 1 slot.
221    #[serde(rename = "artifact1_slot")]
222    pub artifact1_slot: String,
223    /// Artifact 2 slot.
224    #[serde(rename = "artifact2_slot")]
225    pub artifact2_slot: String,
226    /// Artifact 3 slot.
227    #[serde(rename = "artifact3_slot")]
228    pub artifact3_slot: String,
229    /// Utility 1 slot.
230    #[serde(rename = "utility1_slot")]
231    pub utility1_slot: String,
232    /// Utility 1 quantity.
233    #[serde(rename = "utility1_slot_quantity")]
234    pub utility1_slot_quantity: u32,
235    /// Utility 2 slot.
236    #[serde(rename = "utility2_slot")]
237    pub utility2_slot: String,
238    /// Utility 2 quantity.
239    #[serde(rename = "utility2_slot_quantity")]
240    pub utility2_slot_quantity: u32,
241    /// Bag slot.
242    #[serde(rename = "bag_slot")]
243    pub bag_slot: String,
244    /// Task in progress.
245    #[serde(rename = "task")]
246    pub task: String,
247    /// Task type.
248    #[serde(rename = "task_type")]
249    pub task_type: String,
250    /// Task progression.
251    #[serde(rename = "task_progress")]
252    pub task_progress: i32,
253    /// Task total objective.
254    #[serde(rename = "task_total")]
255    pub task_total: i32,
256    /// Inventory max items.
257    #[serde(rename = "inventory_max_items")]
258    pub inventory_max_items: i32,
259    /// List of inventory slots.
260    #[serde(rename = "inventory", skip_serializing_if = "Option::is_none")]
261    pub inventory: Option<Vec<models::InventorySlot>>,
262}
263
264impl CharacterSchema {
265    pub fn new(
266        name: String,
267        account: String,
268        skin: models::CharacterSkin,
269        level: i32,
270        xp: i32,
271        max_xp: i32,
272        gold: i32,
273        speed: i32,
274        mining_level: i32,
275        mining_xp: i32,
276        mining_max_xp: i32,
277        woodcutting_level: i32,
278        woodcutting_xp: i32,
279        woodcutting_max_xp: i32,
280        fishing_level: i32,
281        fishing_xp: i32,
282        fishing_max_xp: i32,
283        weaponcrafting_level: i32,
284        weaponcrafting_xp: i32,
285        weaponcrafting_max_xp: i32,
286        gearcrafting_level: i32,
287        gearcrafting_xp: i32,
288        gearcrafting_max_xp: i32,
289        jewelrycrafting_level: i32,
290        jewelrycrafting_xp: i32,
291        jewelrycrafting_max_xp: i32,
292        cooking_level: i32,
293        cooking_xp: i32,
294        cooking_max_xp: i32,
295        alchemy_level: i32,
296        alchemy_xp: i32,
297        alchemy_max_xp: i32,
298        hp: i32,
299        max_hp: i32,
300        haste: i32,
301        critical_strike: i32,
302        wisdom: i32,
303        prospecting: i32,
304        initiative: i32,
305        threat: i32,
306        attack_fire: i32,
307        attack_earth: i32,
308        attack_water: i32,
309        attack_air: i32,
310        dmg: i32,
311        dmg_fire: i32,
312        dmg_earth: i32,
313        dmg_water: i32,
314        dmg_air: i32,
315        res_fire: i32,
316        res_earth: i32,
317        res_water: i32,
318        res_air: i32,
319        x: i32,
320        y: i32,
321        layer: models::MapLayer,
322        map_id: i32,
323        cooldown: i32,
324        weapon_slot: String,
325        rune_slot: String,
326        shield_slot: String,
327        helmet_slot: String,
328        body_armor_slot: String,
329        leg_armor_slot: String,
330        boots_slot: String,
331        ring1_slot: String,
332        ring2_slot: String,
333        amulet_slot: String,
334        artifact1_slot: String,
335        artifact2_slot: String,
336        artifact3_slot: String,
337        utility1_slot: String,
338        utility1_slot_quantity: u32,
339        utility2_slot: String,
340        utility2_slot_quantity: u32,
341        bag_slot: String,
342        task: String,
343        task_type: String,
344        task_progress: i32,
345        task_total: i32,
346        inventory_max_items: i32,
347    ) -> CharacterSchema {
348        CharacterSchema {
349            name,
350            account,
351            skin,
352            level,
353            xp,
354            max_xp,
355            gold,
356            speed,
357            mining_level,
358            mining_xp,
359            mining_max_xp,
360            woodcutting_level,
361            woodcutting_xp,
362            woodcutting_max_xp,
363            fishing_level,
364            fishing_xp,
365            fishing_max_xp,
366            weaponcrafting_level,
367            weaponcrafting_xp,
368            weaponcrafting_max_xp,
369            gearcrafting_level,
370            gearcrafting_xp,
371            gearcrafting_max_xp,
372            jewelrycrafting_level,
373            jewelrycrafting_xp,
374            jewelrycrafting_max_xp,
375            cooking_level,
376            cooking_xp,
377            cooking_max_xp,
378            alchemy_level,
379            alchemy_xp,
380            alchemy_max_xp,
381            hp,
382            max_hp,
383            haste,
384            critical_strike,
385            wisdom,
386            prospecting,
387            initiative,
388            threat,
389            attack_fire,
390            attack_earth,
391            attack_water,
392            attack_air,
393            dmg,
394            dmg_fire,
395            dmg_earth,
396            dmg_water,
397            dmg_air,
398            res_fire,
399            res_earth,
400            res_water,
401            res_air,
402            effects: None,
403            x,
404            y,
405            layer,
406            map_id,
407            cooldown,
408            cooldown_expiration: None,
409            weapon_slot,
410            rune_slot,
411            shield_slot,
412            helmet_slot,
413            body_armor_slot,
414            leg_armor_slot,
415            boots_slot,
416            ring1_slot,
417            ring2_slot,
418            amulet_slot,
419            artifact1_slot,
420            artifact2_slot,
421            artifact3_slot,
422            utility1_slot,
423            utility1_slot_quantity,
424            utility2_slot,
425            utility2_slot_quantity,
426            bag_slot,
427            task,
428            task_type,
429            task_progress,
430            task_total,
431            inventory_max_items,
432            inventory: None,
433        }
434    }
435}