2025-05-02 16:15:54 -04:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
/// Represents an item, or if the quanity is zero an empty slot.
|
|
|
|
#[derive(Default, Copy, Clone, Serialize, Deserialize, Debug)]
|
|
|
|
pub struct Item {
|
|
|
|
pub quantity: u32,
|
|
|
|
pub id: u32,
|
2025-06-28 14:29:12 -04:00
|
|
|
pub condition: u16,
|
|
|
|
pub glamour_catalog_id: u32,
|
2025-05-02 16:15:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Item {
|
|
|
|
pub fn new(quantity: u32, id: u32) -> Self {
|
2025-06-28 14:29:12 -04:00
|
|
|
Self {
|
|
|
|
quantity,
|
|
|
|
id,
|
|
|
|
condition: 30000,
|
|
|
|
..Default::default()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns the catalog ID of the glamour, if applicable.
|
|
|
|
pub fn apparent_id(&self) -> u32 {
|
|
|
|
if self.glamour_catalog_id > 0 {
|
|
|
|
return self.glamour_catalog_id;
|
|
|
|
}
|
|
|
|
self.id
|
2025-05-02 16:15:54 -04:00
|
|
|
}
|
|
|
|
}
|