From c64bddee686075fc400b508e8e337e5e9b2effdf Mon Sep 17 00:00:00 2001 From: coffee-compiler <22056268-coffee-compiler@users.noreply.gitlab.com> Date: Tue, 30 Jul 2024 18:21:18 +0000 Subject: [PATCH] Receive server message on give_item cmd success --- assets/voxygen/i18n/en/command.ftl | 1 + server/src/cmd.rs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/assets/voxygen/i18n/en/command.ftl b/assets/voxygen/i18n/en/command.ftl index 6168b95f36..3881a5ad8e 100644 --- a/assets/voxygen/i18n/en/command.ftl +++ b/assets/voxygen/i18n/en/command.ftl @@ -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 diff --git a/server/src/cmd.rs b/server/src/cmd.rs index b38aa8f296..34b78de8fc 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -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, 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()