I18n loot_scroller correct name

This commit is contained in:
evgenkot 2024-02-10 15:34:14 +05:00 committed by evgenkot
parent f9ee398a17
commit eee330c9e9
9 changed files with 72 additions and 86 deletions

View File

@ -81,7 +81,13 @@ hud-chat-chat_tab_hover_tooltip = Right click for settings
## HUD Pickup message ## HUD Pickup message
hud-loot-pickup-msg = { $amount -> hud-loot-pickup-msg = { $is_you ->
[one] { $actor } picked up { $item } [true] You picked up { $amount ->
*[other] { $actor } picked up {$amount}x {$item} [1] { $item }
} *[other] {$amount}x {$item}
}
*[false] { $actor } picked up { $amount ->
[1] { $item }
*[other] { $amount }x { $item }
}
}

View File

@ -53,10 +53,25 @@ hud-chat-default_death_msg = { "[" }{ $name }] умер
hud-chat-all = Все hud-chat-all = Все
hud-chat-chat_tab_hover_tooltip = ПКМ для настроек hud-chat-chat_tab_hover_tooltip = ПКМ для настроек
hud-loot-pickup-msg = hud-loot-pickup-msg = { $is_you ->
{ $actor } подобрал { $amount -> [true] Вы подобрали { $amount ->
[one] { $item } [1] { $item }
*[other] { $amount }x { $item } *[other] {$amount}x {$item}
} }
*[false] { $gender ->
[she] { $actor } подобрала { $amount ->
[1] { $item }
*[other] { $amount }x { $item }
}
[he] { $actor } подобрал { $amount ->
[1] { $item }
*[other] { $amount }x { $item }
}
*[other] { $actor } подняло { $amount ->
[1] { $item }
*[other] { $amount }x { $item }
}
}
}
hud-chat-goodbye = До свидания! hud-chat-goodbye = До свидания!
hud-chat-connection_lost = Соединение потеряно. Выход через { $time } секунд. hud-chat-connection_lost = Соединение потеряно. Выход через { $time } секунд.

View File

@ -163,33 +163,12 @@ hud-chat-chat_tab_hover_tooltip = Правий клік для налаштув
## HUD Pickup message ## HUD Pickup message
# hud-loot-pickup-msg = {$actor} підняли { $amount ->
# [1] { $item }
# *[other] {$amount}x {$item}
# }
# hud-loot-pickup-msg = { $user_gender ->
# [she] { $actor } підняла { $amount ->
# [1] { $item }
# *[other] { $amount }x { $item }
# }
# [he] { $actor } підняв { $amount ->
# [1] { $item }
# *[other] { $amount }x { $item }
# }
# *[other] { $actor } підняло { $amount ->
# [1] { $item }
# *[other] { $amount }x { $item }
# }
# }
hud-loot-pickup-msg = { $is_you -> hud-loot-pickup-msg = { $is_you ->
[true] Ви підняли { $amount -> [true] Ви підняли { $amount ->
[1] { $item } [1] { $item }
*[other] {$amount}x {$item} *[other] {$amount}x {$item}
} }
*[false] { $gender ->
*[false] { $user_gender ->
[she] { $actor } підняла { $amount -> [she] { $actor } підняла { $amount ->
[1] { $item } [1] { $item }
*[other] { $amount }x { $item } *[other] { $amount }x { $item }

View File

@ -96,7 +96,7 @@ const PING_ROLLING_AVERAGE_SECS: usize = 10;
#[derive(Debug)] #[derive(Debug)]
pub enum Event { pub enum Event {
Chat(comp::ChatMsg), Chat(comp::ChatMsg),
GroupInventoryUpdate(comp::Item, String, Uid), GroupInventoryUpdate(comp::Item, Uid),
InviteComplete { InviteComplete {
target: Uid, target: Uid,
answer: InviteAnswer, answer: InviteAnswer,
@ -2657,8 +2657,8 @@ impl Client {
kind, kind,
}); });
}, },
ServerGeneral::GroupInventoryUpdate(item, taker, uid) => { ServerGeneral::GroupInventoryUpdate(item, uid) => {
frontend_events.push(Event::GroupInventoryUpdate(item, taker, uid)); frontend_events.push(Event::GroupInventoryUpdate(item, uid));
}, },
// Cleanup for when the client goes back to the `presence = None` // Cleanup for when the client goes back to the `presence = None`
ServerGeneral::ExitInGameSuccess => { ServerGeneral::ExitInGameSuccess => {

View File

@ -162,7 +162,7 @@ pub enum ServerGeneral {
/// currently pending /// currently pending
InvitePending(Uid), InvitePending(Uid),
/// Update the HUD of the clients in the group /// Update the HUD of the clients in the group
GroupInventoryUpdate(comp::Item, String, Uid), GroupInventoryUpdate(comp::Item, Uid),
/// Note: this could potentially include all the failure cases such as /// Note: this could potentially include all the failure cases such as
/// inviting yourself in which case the `InvitePending` message could be /// inviting yourself in which case the `InvitePending` message could be
/// removed and the client could consider their invite pending until /// removed and the client could consider their invite pending until
@ -330,7 +330,7 @@ impl ServerMsg {
| ServerGeneral::InviteComplete { .. } | ServerGeneral::InviteComplete { .. }
| ServerGeneral::ExitInGameSuccess | ServerGeneral::ExitInGameSuccess
| ServerGeneral::InventoryUpdate(_, _) | ServerGeneral::InventoryUpdate(_, _)
| ServerGeneral::GroupInventoryUpdate(_, _, _) | ServerGeneral::GroupInventoryUpdate(_, _)
| ServerGeneral::TerrainChunkUpdate { .. } | ServerGeneral::TerrainChunkUpdate { .. }
| ServerGeneral::TerrainBlockUpdates(_) | ServerGeneral::TerrainBlockUpdates(_)
| ServerGeneral::SetViewDistance(_) | ServerGeneral::SetViewDistance(_)

View File

@ -183,7 +183,7 @@ impl Client {
| ServerGeneral::InviteComplete { .. } | ServerGeneral::InviteComplete { .. }
| ServerGeneral::ExitInGameSuccess | ServerGeneral::ExitInGameSuccess
| ServerGeneral::InventoryUpdate(_, _) | ServerGeneral::InventoryUpdate(_, _)
| ServerGeneral::GroupInventoryUpdate(_, _, _) | ServerGeneral::GroupInventoryUpdate(_, _)
| ServerGeneral::SetViewDistance(_) | ServerGeneral::SetViewDistance(_)
| ServerGeneral::Outcomes(_) | ServerGeneral::Outcomes(_)
| ServerGeneral::Knockback(_) | ServerGeneral::Knockback(_)

View File

@ -269,7 +269,6 @@ impl ServerEvent for InventoryManipEvent {
&data.uids, &data.uids,
&data.groups, &data.groups,
&data.alignments, &data.alignments,
&data.stats,
&data.entities, &data.entities,
&data.ability_map, &data.ability_map,
&data.msm, &data.msm,
@ -322,7 +321,6 @@ impl ServerEvent for InventoryManipEvent {
&data.uids, &data.uids,
&data.groups, &data.groups,
&data.alignments, &data.alignments,
&data.stats,
&data.entities, &data.entities,
&data.ability_map, &data.ability_map,
&data.msm, &data.msm,
@ -1081,7 +1079,6 @@ fn announce_loot_to_group(
uids: &ReadStorage<Uid>, uids: &ReadStorage<Uid>,
groups: &ReadStorage<comp::Group>, groups: &ReadStorage<comp::Group>,
alignments: &ReadStorage<comp::Alignment>, alignments: &ReadStorage<comp::Alignment>,
stats: &ReadStorage<comp::Stats>,
entities: &Entities, entities: &Entities,
ability_map: &AbilityMap, ability_map: &AbilityMap,
msm: &MaterialStatManifest, msm: &MaterialStatManifest,
@ -1090,14 +1087,12 @@ fn announce_loot_to_group(
members(*group_id, groups, entities, alignments, uids) members(*group_id, groups, entities, alignments, uids)
.filter(|(member_e, _)| member_e != &entity) .filter(|(member_e, _)| member_e != &entity)
.for_each(|(e, _)| { .for_each(|(e, _)| {
clients.get(e).and_then(|c| { clients.get(e).map(|c| {
stats.get(entity).map(|stats| { c.send_fallible(ServerGeneral::GroupInventoryUpdate(
c.send_fallible(ServerGeneral::GroupInventoryUpdate( item.duplicate(ability_map, msm),
item.duplicate(ability_map, msm), *uid,
stats.name.to_string(), ));
*uid, Some(())
))
})
}); });
}); });
} }

View File

@ -10,6 +10,7 @@ use common::{
comp::inventory::item::{Item, ItemDesc, ItemI18n, MaterialStatManifest, Quality}, comp::inventory::item::{Item, ItemDesc, ItemI18n, MaterialStatManifest, Quality},
uid::Uid, uid::Uid,
}; };
use common_net::sync::WorldSyncExt;
use conrod_core::{ use conrod_core::{
color, color,
position::Dimension, position::Dimension,
@ -353,51 +354,41 @@ impl<'a> Widget for LootScroller<'a> {
&item_tooltip, &item_tooltip,
) )
.set(state.ids.message_icons[i], ui); .set(state.ids.message_icons[i], ui);
let target_name = match self.client.player_list().get(taken_by) {
// let info = self.client.player_list().get(&taken_by.unwrap()).unwrap(); Some(info) => info.player_alias.clone(),
// info.character.unwrap().gender; None => match self.client.state().ecs().entity_from_uid(*taken_by) {
Some(entity) => {
// let you_uid = self.client.uid().unwrap(); let stats = self.client.state().read_storage::<common::comp::Stats>();
stats
// // Based on voxygen/i18n-helpers/src/lib.rs gender_str function .get(entity)
// let gender_str = |uid: &Uid| { .map_or(format!("<entity {}>", *taken_by), |e| e.name.to_owned())
// if let Some(pi) = info.character.as_ref().unwrap().gender{ },
// match pi { None => format!("<uid {}>", *taken_by),
// common::comp::Gender::Feminine=> "she".to_owned(), },
// common::comp::Gender::Masculine=> "he".to_owned(), };
// }
// } else { let (user_gender, is_you) = match self.client.player_list().get(taken_by) {
// "??".to_owned() Some(player_info) => match player_info.character.as_ref() {
// } Some(character_info) => (
// }; match character_info.gender {
Some(common::comp::Gender::Feminine) => "she".to_string(),
Some(common::comp::Gender::Masculine) => "he".to_string(),
// pub fn personalize_alias(&self, uid: Uid, alias: String) -> String { None => "??".to_string(),
// let client_uid = self.uid().expect("Client doesn't have a Uid!!!"); },
self.client.uid().expect("Client doesn't have a Uid!!!") == *taken_by,
let (user_gender, actor, is_you) = match self.client.player_list().get(taken_by) { ),
Some(player_info) => match player_info.character.as_ref() { None => ("??".to_string(), false),
Some(character_info) => (match character_info.gender { },
Some(common::comp::Gender::Feminine)=> "she".to_string(), None => ("??".to_string(), false),
Some(common::comp::Gender::Masculine)=> "he".to_string(),
None => "??".to_string(),
}, character_info.name.to_string(), self.client.uid().expect("Client doesn't have a Uid!!!") == *taken_by),
None => ("??".to_string(), "Someone".to_string(), false),
}
None => ("??".to_string(), "Som!!".to_string(), false),
}; };
// client_uid == uid;
// info.character.as_ref().unwrap().name.to_string()
let label = self.localized_strings.get_msg_ctx( let label = self.localized_strings.get_msg_ctx(
"hud-loot-pickup-msg", "hud-loot-pickup-msg",
&i18n::fluent_args! { &i18n::fluent_args! {
"user_gender" => user_gender,
"is_you" => is_you.to_string(), "is_you" => is_you.to_string(),
"actor" => actor, "gender" => user_gender,
"actor" => target_name,
"amount" => amount, "amount" => amount,
"item" => { "item" => {
let (name, _) = let (name, _) =

View File

@ -289,7 +289,7 @@ impl SessionState {
client::Event::Chat(m) => { client::Event::Chat(m) => {
self.hud.new_message(m); self.hud.new_message(m);
}, },
client::Event::GroupInventoryUpdate(item, taker, uid) => { client::Event::GroupInventoryUpdate(item, uid) => {
self.hud.new_loot_message(LootMessage { self.hud.new_loot_message(LootMessage {
amount: item.amount(), amount: item.amount(),
item, item,