|
@ -19,6 +19,9 @@ const SHOP_OPTION_TOOL: u8 = 0; |
|
|
const SHOP_OPTION_WEAPON: u8 = 1;
|
|
|
const SHOP_OPTION_WEAPON: u8 = 1;
|
|
|
const SHOP_OPTION_ARMOR: u8 = 2;
|
|
|
const SHOP_OPTION_ARMOR: u8 = 2;
|
|
|
|
|
|
|
|
|
|
|
|
const INVENTORY_MESETA_CAPACITY: u32 = 999999;
|
|
|
|
|
|
const BANK_MESETA_CAPACITY: u32 = 999999;
|
|
|
|
|
|
|
|
|
//const BANK_ACTION_: u8 = 1;
|
|
|
//const BANK_ACTION_: u8 = 1;
|
|
|
|
|
|
|
|
|
fn send_to_client(id: ClientId, target: u8, msg: DirectMessage, client_location: &ClientLocation)
|
|
|
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 client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
let bank_items = item_manager.get_character_bank(&client.character)?;
|
|
|
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()))
|
|
|
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 {
|
|
|
let bank_action_pkts = match bank_interaction.action {
|
|
|
BANK_ACTION_DEPOSIT => {
|
|
|
BANK_ACTION_DEPOSIT => {
|
|
|
if bank_interaction.item_id == 0xFFFFFFFF {
|
|
|
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.meseta -= bank_interaction.meseta_amount;
|
|
|
client.character.bank_meseta += bank_interaction.meseta_amount;
|
|
|
client.character.bank_meseta += bank_interaction.meseta_amount;
|
|
|
entity_gateway.save_character(&client.character).await?;
|
|
|
entity_gateway.save_character(&client.character).await?;
|
|
@ -248,7 +251,7 @@ where |
|
|
},
|
|
|
},
|
|
|
BANK_ACTION_WITHDRAW => {
|
|
|
BANK_ACTION_WITHDRAW => {
|
|
|
if bank_interaction.item_id == 0xFFFFFFFF {
|
|
|
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.meseta += bank_interaction.meseta_amount;
|
|
|
client.character.bank_meseta -= bank_interaction.meseta_amount;
|
|
|
client.character.bank_meseta -= bank_interaction.meseta_amount;
|
|
|
entity_gateway.save_character(&client.character).await?;
|
|
|
entity_gateway.save_character(&client.character).await?;
|
|
|