|
|
@ -358,7 +358,7 @@ impl BankItem { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub enum FloorItemDetail {
|
|
|
|
Individual(IndividualItemDetail),
|
|
|
|
Stacked(StackedItemDetail),
|
|
|
@ -374,7 +374,7 @@ impl FloorItemDetail { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct FloorItem {
|
|
|
|
pub item_id: ClientItemId,
|
|
|
|
pub item: FloorItemDetail,
|
|
|
@ -465,12 +465,10 @@ pub enum AddItemResult { |
|
|
|
Meseta,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Default)]
|
|
|
|
#[derive(Debug, Clone, Default)]
|
|
|
|
pub struct LocalFloor(Vec<FloorItem>);
|
|
|
|
#[derive(Clone, Default)]
|
|
|
|
#[derive(Debug, Clone, Default)]
|
|
|
|
pub struct SharedFloor(Vec<FloorItem>);
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct RoomFloorItems(Vec<FloorItem>);
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct InventoryState {
|
|
|
@ -549,7 +547,7 @@ impl InventoryState { |
|
|
|
Err(InventoryError::MesetaFull)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.meseta.0 = std::cmp::min(self.meseta.0 + meseta.0 ,999999);
|
|
|
|
self.meseta.0 = std::cmp::min(self.meseta.0 + meseta.0, 999999);
|
|
|
|
Ok(AddItemResult::Meseta)
|
|
|
|
}
|
|
|
|
},
|
|
|
@ -607,7 +605,7 @@ impl InventoryState { |
|
|
|
Some(self.inventory.0.remove(idx))
|
|
|
|
},
|
|
|
|
InventoryItemDetail::Stacked(stacked_item) => {
|
|
|
|
let remove_all = match stacked_item.entity_ids.len().cmp(&(amount as usize)) {
|
|
|
|
let remove_all = (amount == 0) || match stacked_item.entity_ids.len().cmp(&(amount as usize)) {
|
|
|
|
Ordering::Equal => true,
|
|
|
|
Ordering::Greater => false,
|
|
|
|
Ordering::Less => return None,
|
|
|
@ -708,7 +706,6 @@ impl InventoryState { |
|
|
|
|
|
|
|
match (a_index, b_index) {
|
|
|
|
(Some(a_index), Some(b_index)) => {
|
|
|
|
dbg!("sort!", a.item_id, a_index, b.item_id, b_index);
|
|
|
|
a_index.cmp(&b_index)
|
|
|
|
},
|
|
|
|
_ => Ordering::Equal
|
|
|
@ -1025,6 +1022,7 @@ impl std::cmp::Ord for BankItem { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct FloorState {
|
|
|
|
character_id: CharacterEntityId,
|
|
|
|
local: LocalFloor,
|
|
|
@ -1123,7 +1121,7 @@ impl ItemState { |
|
|
|
Ok(match item {
|
|
|
|
InventoryItemEntity::Individual(item) => {
|
|
|
|
InventoryItem {
|
|
|
|
item_id: self.new_item_id()?,
|
|
|
|
item_id: ClientItemId(0),
|
|
|
|
item: InventoryItemDetail::Individual(IndividualItemDetail {
|
|
|
|
entity_id: item.id,
|
|
|
|
item: item.item,
|
|
|
@ -1132,7 +1130,7 @@ impl ItemState { |
|
|
|
},
|
|
|
|
InventoryItemEntity::Stacked(items) => {
|
|
|
|
InventoryItem {
|
|
|
|
item_id: self.new_item_id()?,
|
|
|
|
item_id: ClientItemId(0),
|
|
|
|
item: InventoryItemDetail::Stacked(StackedItemDetail {
|
|
|
|
entity_ids: items.iter().map(|i| i.id).collect(),
|
|
|
|
tool: items.get(0)
|
|
|
|