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