1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-05-06 04:37:46 +00:00
kawari/src/inventory/storage.rs
Joshua Goins 8d384c4bd0 Overhaul how we send inventory packets again
I wanted to add armory chest support but the current state of the
inventory was a little frustrating. Adding new containers was too
difficult, so I made the system *even more* generic and easier to use. I
have also split it up into it's own module with a nicer file layout.

Oh yeah, and armory chest works too now.
2025-05-02 16:15:54 -04:00

38 lines
812 B
Rust

use binrw::binrw;
use super::Item;
#[binrw]
#[brw(little)]
#[brw(repr = u16)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub enum ContainerType {
#[default]
Inventory0 = 0,
Inventory1 = 1,
Inventory2 = 2,
Inventory3 = 3,
Equipped = 1000,
ArmoryOffWeapon = 3200,
ArmoryHead = 3201,
ArmoryBody = 3202,
ArmoryHand = 3203,
ArmoryLeg = 3205,
ArmoryFoot = 3206,
ArmoryEarring = 3207,
ArmoryNeck = 3208,
ArmoryWrist = 3209,
ArmoryRing = 3300,
ArmorySoulCrystal = 3400,
ArmoryWeapon = 3500,
}
/// Represents a generic item storage.
pub trait Storage: Sync {
fn max_slots(&self) -> u32;
fn num_items(&self) -> u32;
fn get_slot_mut(&mut self, index: u16) -> &mut Item;
fn get_slot(&self, index: u16) -> &Item;
}