|
@ -401,7 +401,7 @@ impl ItemStateProxy { |
|
|
if let Some(element) = master
|
|
|
if let Some(element) = master
|
|
|
.read()
|
|
|
.read()
|
|
|
.await
|
|
|
.await
|
|
|
.get(&key) {
|
|
|
|
|
|
|
|
|
.get(key) {
|
|
|
*element
|
|
|
*element
|
|
|
.write()
|
|
|
.write()
|
|
|
.await = value.clone();
|
|
|
.await = value.clone();
|
|
@ -453,7 +453,7 @@ impl ItemStateProxy { |
|
|
|
|
|
|
|
|
pub async fn inventory(&mut self, character_id: &CharacterEntityId) -> Result<InventoryState, ItemStateError> {
|
|
|
pub async fn inventory(&mut self, character_id: &CharacterEntityId) -> Result<InventoryState, ItemStateError> {
|
|
|
get_or_clone(&self.item_state.character_inventory,
|
|
|
get_or_clone(&self.item_state.character_inventory,
|
|
|
&mut self.proxied_state.character_inventory,
|
|
|
|
|
|
|
|
|
&self.proxied_state.character_inventory,
|
|
|
*character_id,
|
|
|
*character_id,
|
|
|
ItemStateError::NoCharacter).await
|
|
|
ItemStateError::NoCharacter).await
|
|
|
}
|
|
|
}
|
|
@ -464,7 +464,7 @@ impl ItemStateProxy { |
|
|
|
|
|
|
|
|
pub async fn bank(&mut self, character_id: &CharacterEntityId) -> Result<BankState, ItemStateError> {
|
|
|
pub async fn bank(&mut self, character_id: &CharacterEntityId) -> Result<BankState, ItemStateError> {
|
|
|
get_or_clone(&self.item_state.character_bank,
|
|
|
get_or_clone(&self.item_state.character_bank,
|
|
|
&mut self.proxied_state.character_bank,
|
|
|
|
|
|
|
|
|
&self.proxied_state.character_bank,
|
|
|
*character_id,
|
|
|
*character_id,
|
|
|
ItemStateError::NoCharacter).await
|
|
|
ItemStateError::NoCharacter).await
|
|
|
}
|
|
|
}
|
|
@ -477,8 +477,8 @@ impl ItemStateProxy { |
|
|
let room_id = *self.item_state.character_room.read().await.get(character_id).unwrap();
|
|
|
let room_id = *self.item_state.character_room.read().await.get(character_id).unwrap();
|
|
|
Ok(FloorState {
|
|
|
Ok(FloorState {
|
|
|
character_id: *character_id,
|
|
|
character_id: *character_id,
|
|
|
local: get_or_clone(&self.item_state.character_floor, &mut self.proxied_state.character_floor, *character_id, ItemStateError::NoCharacter).await?,
|
|
|
|
|
|
shared: get_or_clone(&self.item_state.room_floor, &mut self.proxied_state.room_floor, room_id, ItemStateError::NoRoom).await?,
|
|
|
|
|
|
|
|
|
local: get_or_clone(&self.item_state.character_floor, &self.proxied_state.character_floor, *character_id, ItemStateError::NoCharacter).await?,
|
|
|
|
|
|
shared: get_or_clone(&self.item_state.room_floor, &self.proxied_state.room_floor, room_id, ItemStateError::NoRoom).await?,
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|