Receive server message on give_item cmd success

This commit is contained in:
coffee-compiler 2024-07-30 18:21:18 +00:00 committed by crabman
parent 2a3ed498d0
commit c64bddee68
2 changed files with 14 additions and 2 deletions

View File

@ -14,6 +14,7 @@ command-give-inventory-full = Player inventory full. Gave { $given ->
[1] only one
*[other] { $given }
} of { $total } items.
command-give-inventory-success = Added { $total } x { $item } to the inventory.
command-invalid-item = Invalid item: { $item }
command-invalid-block-kind = Invalid block kind: { $kind }
command-nof-entities-at-least = Number of entities should be at least 1

View File

@ -38,7 +38,7 @@ use common::{
invite::InviteKind,
misc::PortalData,
AdminRole, Aura, AuraKind, BuffCategory, ChatType, Content, Inventory, Item, LightEmitter,
WaypointArea,
LocalizationArg, WaypointArea,
},
depot,
effect::Effect,
@ -515,7 +515,7 @@ fn handle_drop_all(
fn handle_give_item(
server: &mut Server,
_client: EcsEntity,
client: EcsEntity,
target: EcsEntity,
args: Vec<String>,
action: &ServerChatCommand,
@ -572,6 +572,17 @@ fn handle_give_item(
});
}
if res.is_ok() {
let msg = ServerGeneral::server_msg(
ChatType::CommandInfo,
Content::localized_with_args("command-give-inventory-success", [
("total", LocalizationArg::from(give_amount as u64)),
("item", LocalizationArg::from(item_name)),
]),
);
server.notify_client(client, msg);
}
let mut inventory_update = server
.state
.ecs_mut()