1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
pub mod sink;

/// `obj`
#[derive(Default, Debug, PartialEq)]
pub struct Object {
    /// Version
    pub attr_v: u32,
    /// Buffs
    pub buff: Option<Buff>,
    /// Destructible Component
    pub dest: Option<Destructible>,
    /// Inventory Component
    pub inv: Option<Inventory>,
    /// Minifigure Component
    pub mf: Option<Minifig>,
}

/// Buff Component
#[derive(Default, Debug, PartialEq)]
pub struct Buff {}

/// `dest`
#[derive(Default, Debug, PartialEq)]
pub struct Destructible {
    /// Current Armor
    pub attr_ac: Option<u32>,
    /// Maximum Armor
    pub attr_am: Option<u32>,
    /// Object is Dead
    pub attr_d: Option<bool>,
    /// Health Current
    pub attr_hc: Option<u32>,
    /// Maximum Health
    pub attr_hm: Option<u32>,
    /// Current Imagination
    pub attr_ic: Option<u32>,
    /// Maximum Imagination
    pub attr_im: Option<u32>,
    /// Immunity
    pub attr_imm: Option<u32>,
    /// Respawn Health
    pub attr_rsh: Option<u32>,
    /// Respawn Imagination
    pub attr_rsi: Option<u32>,
}

/// The inventory component
#[derive(Default, Debug, PartialEq)]
pub struct Inventory {
    /// Consumable Slot LOT
    pub attr_csl: Option<u32>,
    /// Inventory 'Bags'
    pub bag: Vec<Bag>,
    /// Groups
    pub grps: Vec<Group>,
    /// Items
    pub items: Items,
}

/// One compartment in the inventory
#[derive(Default, Debug, PartialEq)]
pub struct Bag {
    /// Type
    pub attr_t: u32,
    /// Maximum
    pub attr_m: u32,
}

/// One group
#[derive(Default, Debug, PartialEq)]
pub struct Group {
    /// `user_group XXX`
    pub attr_id: String,
    /// Space-separated LOTs
    pub attr_l: String,
    /// Name
    pub attr_n: String,
    /// Type of the group
    pub attr_t: u32,
    /// Unknown
    pub attr_u: String,
}

/// All items
#[derive(Default, Debug, PartialEq)]
pub struct Items {
    pub attr_nn: String,
    pub children: Vec<ItemBag>,
}

/// A list of items for a bag
#[derive(Default, Debug, PartialEq)]
pub struct ItemBag {
    pub attr_t: u32,
    pub children: Vec<Item>,
}

/// An item in an inventory
#[derive(Default, Debug, PartialEq)]
pub struct Item {
    /// Is Bound
    pub attr_b: bool,
    /// Count
    pub attr_c: u32,
    /// Is Equipped
    pub attr_eq: bool,
    /// Object ID
    pub attr_id: u64,
    /// LOT
    pub attr_l: u32,
    /// Slot
    pub attr_s: u32,
    /// Subkey
    pub attr_sk: u32,
    /// Extra Info
    pub x: Option<ItemExtra>,
}

#[derive(Default, Debug, PartialEq)]
pub struct ItemExtra {
    pub attr_b: String,
    /// Module Assembly
    pub attr_ma: String,
    pub attr_ub: String,
    pub attr_ud: String,
    pub attr_ui: String,
    pub attr_um: String,
    /// UGC name?
    pub attr_un: String,
    pub attr_uo: String,
    pub attr_up: String,
}

#[derive(Default, Debug, PartialEq)]
/// Minifigure Component
pub struct Minifig {
    /// Chest Decal
    pub attr_cd: u32,
    /// Eyebrow Style
    pub attr_es: u32,
    /// Eye Style.
    pub attr_ess: u32,
    /// Hair Color
    pub attr_hc: u32,
    /// Head Style
    pub attr_hd: u32,
    /// Head Color
    pub attr_hdc: u32,
    /// Hair Style
    pub attr_hs: u32,
    /// Legs
    pub attr_l: u32,
    /// Left Hand
    pub attr_lh: u32,
    /// Mouth Style.
    pub attr_ms: u32,
    /// Right Hand
    pub attr_rh: u32,
    /// Chest
    pub attr_t: u32,
}