Skip to main content

wowlab_types/types/data/
resolved.rs

1use serde::{Deserialize, Serialize};
2
3use super::{
4    item::{ItemClassification, ItemEffect, ItemSetInfo},
5    scaling::AppliedBonus,
6    weapon::WeaponStats,
7};
8
9#[derive(Clone, Debug, Default, Deserialize, Serialize)]
10#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
11#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
12pub struct ResolvedStat {
13    pub stat_type: i32,
14    pub stat_name: String,
15    /// Final value (`alloc * budget * 0.0001`), rounded.
16    pub value: i32,
17}
18
19#[derive(Clone, Debug, Default, Deserialize, Serialize)]
20#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
21#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
22// #t(rust_newtype_pub_field) serialized socket DTO intentionally mirrors the one-field data record
23pub struct ResolvedSocket {
24    /// `SOCKET_COLOR_*` bitmask (from base sockets + Socket bonuses).
25    pub color: i32,
26}
27
28#[derive(Clone, Debug, Default, Deserialize, Serialize)]
29#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
30#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
31pub struct ResolvedItem {
32    pub id: i32,
33    pub name: String,
34    pub file_name: String,
35    pub description: String,
36
37    pub base_item_level: i32,
38    pub item_level: i32,
39    /// 0..7; a `Quality` bonus may override the base.
40    pub quality: i32,
41    pub required_level: i32,
42    /// 0 = not crafted; else 1..N.
43    pub crafting_quality: i32,
44
45    pub inventory_type: i32,
46    pub class_id: i32,
47    pub subclass_id: i32,
48    pub binding: i32,
49    pub speed: i32,
50    pub dmg_variance: f32,
51    pub classification: Option<ItemClassification>,
52
53    pub stats: Vec<ResolvedStat>,
54    pub sockets: Vec<ResolvedSocket>,
55    pub socket_bonus_enchant_id: i32,
56
57    pub effects: Vec<ItemEffect>,
58    pub item_set_id: i32,
59    pub set_info: Option<ItemSetInfo>,
60
61    pub weapon: Option<WeaponStats>,
62
63    pub applied_bonuses: Vec<AppliedBonus>,
64}