Merge branch 'coffee-compiler/give_item_cmd_success_msg' into 'master'

Receive server message on give_item cmd success

See merge request veloren/veloren!4539
This commit is contained in:
crabman 2024-07-30 18:21:18 +00:00
commit 126f9f8502
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 [1] only one
*[other] { $given } *[other] { $given }
} of { $total } items. } of { $total } items.
command-give-inventory-success = Added { $total } x { $item } to the inventory.
command-invalid-item = Invalid item: { $item } command-invalid-item = Invalid item: { $item }
command-invalid-block-kind = Invalid block kind: { $kind } command-invalid-block-kind = Invalid block kind: { $kind }
command-nof-entities-at-least = Number of entities should be at least 1 command-nof-entities-at-least = Number of entities should be at least 1

View File

@ -38,7 +38,7 @@ use common::{
invite::InviteKind, invite::InviteKind,
misc::PortalData, misc::PortalData,
AdminRole, Aura, AuraKind, BuffCategory, ChatType, Content, Inventory, Item, LightEmitter, AdminRole, Aura, AuraKind, BuffCategory, ChatType, Content, Inventory, Item, LightEmitter,
WaypointArea, LocalizationArg, WaypointArea,
}, },
depot, depot,
effect::Effect, effect::Effect,
@ -515,7 +515,7 @@ fn handle_drop_all(
fn handle_give_item( fn handle_give_item(
server: &mut Server, server: &mut Server,
_client: EcsEntity, client: EcsEntity,
target: EcsEntity, target: EcsEntity,
args: Vec<String>, args: Vec<String>,
action: &ServerChatCommand, 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 let mut inventory_update = server
.state .state
.ecs_mut() .ecs_mut()