diff --git a/src/ship/packet/builder/message.rs b/src/ship/packet/builder/message.rs index d7bfe75..e57f626 100644 --- a/src/ship/packet/builder/message.rs +++ b/src/ship/packet/builder/message.rs @@ -118,8 +118,8 @@ pub fn character_leveled_up(area_client: AreaClient, level: u32, before_stats: C } } -// TOOD: meseta -pub fn bank_item_list(bank: &CharacterBank) -> BankItemList { +// TOOD: checksum? +pub fn bank_item_list(bank: &CharacterBank, char_bank_meseta: u32) -> BankItemList { BankItemList { aflag: 0, cmd: 0xBC, @@ -127,7 +127,7 @@ pub fn bank_item_list(bank: &CharacterBank) -> BankItemList { size: bank.count() as u32 * 0x18 + 0x14, checksum: 0x123434, item_count: bank.count() as u32, - meseta: 12345, + meseta: char_bank_meseta, items: bank.as_client_bank_request() } } diff --git a/src/ship/packet/handler/direct_message.rs b/src/ship/packet/handler/direct_message.rs index 7084516..7513838 100644 --- a/src/ship/packet/handler/direct_message.rs +++ b/src/ship/packet/handler/direct_message.rs @@ -19,6 +19,9 @@ const SHOP_OPTION_TOOL: u8 = 0; const SHOP_OPTION_WEAPON: u8 = 1; const SHOP_OPTION_ARMOR: u8 = 2; +const INVENTORY_MESETA_CAPACITY: u32 = 999999; +const BANK_MESETA_CAPACITY: u32 = 999999; + //const BANK_ACTION_: u8 = 1; fn send_to_client(id: ClientId, target: u8, msg: DirectMessage, client_location: &ClientLocation) @@ -213,7 +216,7 @@ pub async fn send_bank_list(id: ClientId, let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?; let bank_items = item_manager.get_character_bank(&client.character)?; - let bank_items_pkt = builder::message::bank_item_list(&bank_items); + let bank_items_pkt = builder::message::bank_item_list(&bank_items, client.character.bank_meseta); Ok(Box::new(vec![(id, SendShipPacket::BankItemList(bank_items_pkt))].into_iter())) } @@ -233,7 +236,7 @@ where let bank_action_pkts = match bank_interaction.action { BANK_ACTION_DEPOSIT => { if bank_interaction.item_id == 0xFFFFFFFF { - if client.character.meseta > bank_interaction.meseta_amount && (bank_interaction.meseta_amount + client.character.bank_meseta) <= 999999 { + if client.character.meseta >= bank_interaction.meseta_amount && (bank_interaction.meseta_amount + client.character.bank_meseta) <= BANK_MESETA_CAPACITY { client.character.meseta -= bank_interaction.meseta_amount; client.character.bank_meseta += bank_interaction.meseta_amount; entity_gateway.save_character(&client.character).await?; @@ -248,7 +251,7 @@ where }, BANK_ACTION_WITHDRAW => { if bank_interaction.item_id == 0xFFFFFFFF { - if client.character.meseta + bank_interaction.meseta_amount <= 999999 { + if client.character.meseta + bank_interaction.meseta_amount <= INVENTORY_MESETA_CAPACITY { client.character.meseta += bank_interaction.meseta_amount; client.character.bank_meseta -= bank_interaction.meseta_amount; entity_gateway.save_character(&client.character).await?;