diff --git a/assets/voxygen/i18n/en/hud/chat.ron b/assets/voxygen/i18n/en/hud/chat.ron index 91feeeda4e..1e46dea342 100644 --- a/assets/voxygen/i18n/en/hud/chat.ron +++ b/assets/voxygen/i18n/en/hud/chat.ron @@ -3,6 +3,11 @@ /// Localization for "global" English ( string_map: { + // Debuff outcomes + "hud.outcome.burning": "died of: burning", + "hud.outcome.curse": "died of: curse", + "hud.outcome.bleeding": "died of: bleeding", + // Chat outputs "hud.chat.online_msg": "[{name}] is online now", "hud.chat.offline_msg": "[{name}] went offline", @@ -12,15 +17,15 @@ "hud.chat.fall_kill_msg": "[{name}] died from fall damage", "hud.chat.suicide_msg": "[{name}] died from self-inflicted wounds", - "hud.chat.pvp_buff_kill_msg": "[{victim}] died of {buff} caused by [{attacker}]", + "hud.chat.died_of_pvp_buff_msg": "[{victim}] {died_of_buff} caused by [{attacker}]", "hud.chat.pvp_melee_kill_msg": "[{attacker}] defeated [{victim}]", "hud.chat.pvp_ranged_kill_msg": "[{attacker}] shot [{victim}]", "hud.chat.pvp_explosion_kill_msg": "[{attacker}] blew up [{victim}]", "hud.chat.pvp_energy_kill_msg": "[{attacker}] killed [{victim}] with magic", - "hud.chat.nonexistent_buff_kill_msg": "[{victim}] died of {buff}", + "hud.chat.died_of_buff_nonexistent_msg": "[{victim}] {died_of_buff}", - "hud.chat.npc_buff_kill_msg": "[{victim}] died of {buff} caused by {attacker}", + "hud.chat.died_of_npc_buff_msg": "[{victim}] {died_of_buff} caused by {attacker}", "hud.chat.npc_melee_kill_msg": "{attacker} killed [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} shot [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} blew up [{victim}]", diff --git a/assets/voxygen/i18n/uk_UA/hud/chat.ron b/assets/voxygen/i18n/uk_UA/hud/chat.ron index a01413ecb8..a603cd2975 100644 --- a/assets/voxygen/i18n/uk_UA/hud/chat.ron +++ b/assets/voxygen/i18n/uk_UA/hud/chat.ron @@ -3,6 +3,10 @@ /// Localization for Ukrainian ( string_map: { + // Outcomes + "hud.outcome.bleeding": "померли від обескровлення", + "hud.outcome.burning": "згоріли живцем", + "hud.outcome.curse": "померли від прокльону", // Chat outputs "hud.chat.online_msg": "[{name}] зайшли на сервер", "hud.chat.offline_msg": "[{name}] вийшли з серверу", @@ -12,15 +16,15 @@ "hud.chat.fall_kill_msg": "[{name}] померли від падіння", "hud.chat.suicide_msg": "[{name}] померли від самозаподіяних ран", - "hud.chat.pvp_buff_kill_msg": "[{attacker}] вбили [{victim}]", + "hud.chat.died_of_pvp_buff_msg": "[{victim}] {died_of_buff} через [{attacker}]", "hud.chat.pvp_melee_kill_msg": "[{attacker}] перемогли [{victim}]", "hud.chat.pvp_ranged_kill_msg": "[{attacker}] застрелили [{victim}]", "hud.chat.pvp_explosion_kill_msg": "[{attacker}] підірвали [{victim}]", "hud.chat.pvp_energy_kill_msg": "[{attacker}] вбили [{victim}] магією", - "hud.chat.nonexistent_buff_kill_msg": "[{victim}] померли від: {buff}", + "hud.chat.died_of_buff_nonexistent_msg": "[{victim}] {died_of_buff}", - "hud.chat.npc_buff_kill_msg": "[{victim}] померли від: {buff} через: {attacker}", + "hud.chat.died_of_npc_buff_msg": "[{victim}] {died_of_buff} через {attacker}", "hud.chat.npc_melee_kill_msg": "{attacker} вбили [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} застрелили [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} підірвали [{victim}]", diff --git a/client/src/lib.rs b/client/src/lib.rs index 72eeca7acf..a3d6e9798e 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -2362,45 +2362,13 @@ impl Client { } } else { match kill_source { - KillSource::Player(attacker_uid, KillType::Buff(buff_kind)) => message - .replace("{attacker}", &alias_of_uid(attacker_uid)) - .replace("{buff}", format!("{:?}", buff_kind).to_lowercase().as_str()) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::Player(attacker_uid, KillType::Melee) => message + KillSource::Player(attacker_uid, _) => message .replace("{attacker}", &alias_of_uid(attacker_uid)) .replace("{victim}", &alias_of_uid(victim)), - KillSource::Player(attacker_uid, KillType::Projectile) => message - .replace("{attacker}", &alias_of_uid(attacker_uid)) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::Player(attacker_uid, KillType::Explosion) => message - .replace("{attacker}", &alias_of_uid(attacker_uid)) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::Player(attacker_uid, KillType::Energy) => message - .replace("{attacker}", &alias_of_uid(attacker_uid)) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::Player(attacker_uid, KillType::Other) => message - .replace("{attacker}", &alias_of_uid(attacker_uid)) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonExistent(KillType::Buff(buff_kind)) => message - .replace("{buff}", format!("{:?}", buff_kind).to_lowercase().as_str()) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonPlayer(attacker_name, KillType::Buff(buff_kind)) => message - .replace("{attacker}", attacker_name) - .replace("{buff}", format!("{:?}", buff_kind).to_lowercase().as_str()) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonPlayer(attacker_name, KillType::Melee) => message - .replace("{attacker}", attacker_name) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonPlayer(attacker_name, KillType::Projectile) => message - .replace("{attacker}", attacker_name) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonPlayer(attacker_name, KillType::Explosion) => message - .replace("{attacker}", attacker_name) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonPlayer(attacker_name, KillType::Energy) => message - .replace("{attacker}", attacker_name) - .replace("{victim}", &alias_of_uid(victim)), - KillSource::NonPlayer(attacker_name, KillType::Other) => message + KillSource::NonExistent(KillType::Buff(_)) => { + message.replace("{victim}", &alias_of_uid(victim)) + }, + KillSource::NonPlayer(attacker_name, _) => message .replace("{attacker}", attacker_name) .replace("{victim}", &alias_of_uid(victim)), KillSource::Environment(environment) => message diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index af6b331632..f91a5a0182 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -6,7 +6,7 @@ use crate::{i18n::Localization, ui::fonts::Fonts, GlobalState}; use client::{cmd, Client}; use common::comp::{ chat::{KillSource, KillType}, - ChatMode, ChatMsg, ChatType, + BuffKind, ChatMode, ChatMsg, ChatType, }; use common_net::msg::validate_chat_msg; use conrod_core::{ @@ -385,10 +385,11 @@ impl<'a> Widget for Chat<'a> { .get("hud.chat.offline_msg") .to_string(), ChatType::Kill(kill_source, _) => match kill_source { - KillSource::Player(_, KillType::Buff(_)) => self - .localized_strings - .get("hud.chat.pvp_buff_kill_msg") - .to_string(), + KillSource::Player(_, KillType::Buff(buffkind)) => insert_killing_buff( + *buffkind, + self.localized_strings, + self.localized_strings.get("hud.chat.died_of_pvp_buff_msg"), + ), KillSource::Player(_, KillType::Melee) => self .localized_strings .get("hud.chat.pvp_melee_kill_msg") @@ -409,14 +410,17 @@ impl<'a> Widget for Chat<'a> { .localized_strings .get("hud.chat.pvp_other_kill_msg") .to_string(), - KillSource::NonExistent(KillType::Buff(_)) => self - .localized_strings - .get("hud.chat.nonexistent_buff_kill_msg") - .to_string(), - KillSource::NonPlayer(_, KillType::Buff(_)) => self - .localized_strings - .get("hud.chat.npc_buff_kill_msg") - .to_string(), + KillSource::NonExistent(KillType::Buff(buffkind)) => insert_killing_buff( + *buffkind, + self.localized_strings, + self.localized_strings + .get("hud.chat.died_of_buff_nonexistent_msg"), + ), + KillSource::NonPlayer(_, KillType::Buff(buffkind)) => insert_killing_buff( + *buffkind, + self.localized_strings, + self.localized_strings.get("hud.chat.died_of_npc_buff_msg"), + ), KillSource::NonPlayer(_, KillType::Melee) => self .localized_strings .get("hud.chat.npc_melee_kill_msg") @@ -618,3 +622,24 @@ fn render_chat_line(chat_type: &ChatType, imgs: &Imgs) -> (Color, conrod ChatType::Meta => (INFO_COLOR, imgs.chat_command_info_small), } } + +fn insert_killing_buff(buff: BuffKind, localized_strings: &Localization, template: &str) -> String { + let buff_outcome = match buff { + BuffKind::Burning => localized_strings.get("hud.outcome.burning"), + BuffKind::Bleeding => localized_strings.get("hud.outcome.bleeding"), + BuffKind::Cursed => localized_strings.get("hud.outcome.curse"), + BuffKind::Regeneration + | BuffKind::Saturation + | BuffKind::Potion + | BuffKind::CampfireHeal + | BuffKind::IncreaseMaxEnergy + | BuffKind::IncreaseMaxHealth + | BuffKind::Invulnerability + | BuffKind::ProtectingWard => { + tracing::error!("Player was killed by a positive buff!"); + localized_strings.get("hud.outcome.mysterious") + }, + }; + + template.replace("{died_of_buff}", buff_outcome) +}