From c2a8feada56eb21821c0676fff7d7698248b8c7d Mon Sep 17 00:00:00 2001 From: Vincent Foulon Date: Wed, 31 Mar 2021 19:06:41 +0200 Subject: [PATCH 1/2] Add dialogue when the Merchant is busy and randomize some trading dialogues --- assets/voxygen/i18n/en/_manifest.ron | 74 +++++++++++++++------- assets/voxygen/i18n/fr_FR/_manifest.ron | 26 ++++++++ server/src/sys/agent.rs | 83 ++++++++++++++++--------- 3 files changed, 128 insertions(+), 55 deletions(-) diff --git a/assets/voxygen/i18n/en/_manifest.ron b/assets/voxygen/i18n/en/_manifest.ron index fb574c80df..854d254f3c 100644 --- a/assets/voxygen/i18n/en/_manifest.ron +++ b/assets/voxygen/i18n/en/_manifest.ron @@ -94,30 +94,56 @@ "I love honey! And I hate bees.", "I want to see the world one day. There's got to be more to life than this village.", ], - "npc.speech.villager_cultist_alarm": [ - "Lookout! There is a cultist on the loose!", - "To arms! The cultists are attacking!", - "How dare the cultists attack our village!", - "Death to the cultists!", - "Cultists will not be tolerated here!", - "Murderous cultist!", - "Taste the edge of my sword, you dirty cultist!", - "Nothing can clean the blood from your hands, cultist!", - "Billions of blistering blue barnacles! A cultist among us!", - "The evils of this cultist are about to be over!", - "This cultist is mine!", - "Prepare to meet your maker, foul cultist!", - "I see a cultist! Get them!", - "I see a cultist! Attack!", - "I see a cultist! Don't let them escape!", - "Would the most honorable cultist care for some DEATH?!", - "Never forgive! Never forget! Cultist, regret!", - "Die, cultist!", - "Your reign of terror will seize!", - "Here's for all that you've done!", - "We don't take kindly to your types around here.", - "You should have stayed underground!", - ], + "npc.speech.villager_decline_trade": [ + "Sorry, I don't have anything to trade.", + "Trade ? Like I got anything that may interest you.", + "My house is mine, I won't trade it for anything.", + ], + "npc.speech.merchant_advertisement": [ + "Can I interest you in a trade?", + "Do you want to trade with me?", + "I have plenty of goods, Do you want to take a look?" + ], + "npc.speech.merchant_busy": [ + "Hey, wait your turn.", + "Please wait, I'm only one person.", + "Do you see the other person in front of you?", + "Just a moment, let me finish.", + "No cutting in line.", + "I'm busy, come back later." + ], + "npc.speech.merchant_trade_successful": [ + "Thank you for trading with me!", + "Thank you!", + ], + "npc.speech.merchant_trade_declined": [ + "Maybe another time, have a good day!", + "Too bad, maybe next time, then!" + ], + "npc.speech.villager_cultist_alarm": [ + "Lookout! There is a cultist on the loose!", + "To arms! The cultists are attacking!", + "How dare the cultists attack our village!", + "Death to the cultists!", + "Cultists will not be tolerated here!", + "Murderous cultist!", + "Taste the edge of my sword, you dirty cultist!", + "Nothing can clean the blood from your hands, cultist!", + "Billions of blistering blue barnacles! A cultist among us!", + "The evils of this cultist are about to be over!", + "This cultist is mine!", + "Prepare to meet your maker, foul cultist!", + "I see a cultist! Get them!", + "I see a cultist! Attack!", + "I see a cultist! Don't let them escape!", + "Would the most honorable cultist care for some DEATH?!", + "Never forgive! Never forget! Cultist, regret!", + "Die, cultist!", + "Your reign of terror will seize!", + "Here's for all that you've done!", + "We don't take kindly to your types around here.", + "You should have stayed underground!", + ], "npc.speech.villager_under_attack": [ "Help, I'm under attack!", "Help! I'm under attack!", diff --git a/assets/voxygen/i18n/fr_FR/_manifest.ron b/assets/voxygen/i18n/fr_FR/_manifest.ron index 14317cd3b7..48105b287a 100644 --- a/assets/voxygen/i18n/fr_FR/_manifest.ron +++ b/assets/voxygen/i18n/fr_FR/_manifest.ron @@ -86,6 +86,32 @@ "J'aimerais que quelqu'un garde les loups loin du village.", "J'ai fait un merveilleux rêve sur le fromage la nuit dernière. Qu'est-ce que cela signifie ?", ], + "npc.speech.villager_decline_trade": [ + "Désolé, je n'ai rien à vous échanger.", + "Un échange ? Comme si que j'avais quoi que ce soit qui vous intéresserait.", + "Ma maison n'est pas à vendre.", + ], + "npc.speech.merchant_advertisement": [ + "Seriez-vous intéressé par un échange ?", + "Voulez-vous faire un échange ?", + "J'ai pu amasser beaucoup d'objets, vous voulez y jeter un oeil ?" + ], + "npc.speech.merchant_busy": [ + "Hey, attendez votre tour.", + "Attendez s'il vous plait, je ne suis pas une pieuvre.", + "Un moment, laissez-moi terminer.", + "On ne dépasse pas.", + "Je suis occupé, revenez plus tard." + ], + "npc.speech.merchant_trade_successful": [ + "Merci d'avoir échangé avec moi", + "Merci!", + "Ce fut un plaisir d'échanger avec vous!" + ], + "npc.speech.merchant_trade_declined": [ + "Peut-être pour un autre jour, bonne journée !", + "Dommage, à la revoyure !" + ], "npc.speech.villager_cultist_alarm": [ "Attention ! Il y a un cultiste en liberté !", "Aux armes ! Les cultistes attaquent !", diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index b4777ae6a4..87161c96dd 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -932,7 +932,7 @@ impl<'a> AgentData<'a> { UnresolvedChatMsg::npc(*self.uid, msg), )); } else if agent.trade_for_site.is_some() { - let msg = "Can I interest you in a trade?".to_string(); + let msg = "npc.speech.merchant_advertisement".to_string(); event_emitter.emit(ServerEvent::Chat( UnresolvedChatMsg::npc(*self.uid, msg), )); @@ -944,23 +944,32 @@ impl<'a> AgentData<'a> { } }, Subject::Trade => { - if agent.trade_for_site.is_some() && !agent.trading { - controller.events.push(ControlEvent::InitiateInvite( - by, - InviteKind::Trade, - )); - let msg = "Can I interest you in a trade?".to_string(); - event_emitter.emit(ServerEvent::Chat( - UnresolvedChatMsg::npc(*self.uid, msg), - )); + if agent.trade_for_site.is_some() { + if !agent.trading { + controller.events.push(ControlEvent::InitiateInvite( + by, + InviteKind::Trade, + )); + let msg = + "npc.speech.merchant_advertisement".to_string(); + event_emitter.emit(ServerEvent::Chat( + UnresolvedChatMsg::npc(*self.uid, msg), + )); + } else { + event_emitter.emit(ServerEvent::Chat( + UnresolvedChatMsg::npc( + *self.uid, + "npc.speech.merchant_busy".to_string(), + ), + )); + } } else { // TODO: maybe make some travellers willing to trade with // simpler goods like potions event_emitter.emit(ServerEvent::Chat( UnresolvedChatMsg::npc( *self.uid, - "Sorry, I don't have anything to trade." - .to_string(), + "npc.speech.villager_decline_trade".to_string(), ), )); } @@ -1084,23 +1093,35 @@ impl<'a> AgentData<'a> { } }, Some(AgentEvent::TradeInvite(with)) => { - if agent.trade_for_site.is_some() && !agent.trading { - // stand still and looking towards the trading player - controller.actions.push(ControlAction::Talk); - if let Some(target) = - read_data.uid_allocator.retrieve_entity_internal(with.id()) - { - agent.target = Some(Target { - target, - hostile: false, - selected_at: read_data.time.0, - }); + if agent.trade_for_site.is_some() { + if !agent.trading { + // stand still and looking towards the trading player + controller.actions.push(ControlAction::Talk); + if let Some(target) = + read_data.uid_allocator.retrieve_entity_internal(with.id()) + { + agent.target = Some(Target { + target, + hostile: false, + selected_at: read_data.time.0, + }); + } + controller + .events + .push(ControlEvent::InviteResponse(InviteResponse::Accept)); + agent.trading_issuer = false; + agent.trading = true; + } else { + controller + .events + .push(ControlEvent::InviteResponse(InviteResponse::Decline)); + if agent.can_speak { + event_emitter.emit(ServerEvent::Chat(UnresolvedChatMsg::npc( + *self.uid, + "npc.speech.merchant_busy".to_string(), + ))); + } } - controller - .events - .push(ControlEvent::InviteResponse(InviteResponse::Accept)); - agent.trading_issuer = false; - agent.trading = true; } else { // TODO: Provide a hint where to find the closest merchant? controller @@ -1109,7 +1130,7 @@ impl<'a> AgentData<'a> { if agent.can_speak { event_emitter.emit(ServerEvent::Chat(UnresolvedChatMsg::npc( *self.uid, - "Sorry, I don't have anything to trade.".to_string(), + "npc.speech.villager_decline_trade".to_string(), ))); } } @@ -1135,12 +1156,12 @@ impl<'a> AgentData<'a> { TradeResult::Completed => { event_emitter.emit(ServerEvent::Chat(UnresolvedChatMsg::npc( *self.uid, - "Thank you for trading with me!".to_string(), + "npc.speech.merchant_trade_successful".to_string(), ))) }, _ => event_emitter.emit(ServerEvent::Chat(UnresolvedChatMsg::npc( *self.uid, - "Maybe another time, have a good day!".to_string(), + "npc.speech.merchant_trade_declined".to_string(), ))), } agent.trading = false; From dcde8df365953f2dc396e9720f4d37110fb01a35 Mon Sep 17 00:00:00 2001 From: Vincent Foulon Date: Thu, 1 Apr 2021 19:13:08 +0200 Subject: [PATCH 2/2] address review comments --- assets/voxygen/i18n/en/_manifest.ron | 2 +- server/src/sys/agent.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/voxygen/i18n/en/_manifest.ron b/assets/voxygen/i18n/en/_manifest.ron index 854d254f3c..50d569f994 100644 --- a/assets/voxygen/i18n/en/_manifest.ron +++ b/assets/voxygen/i18n/en/_manifest.ron @@ -96,7 +96,7 @@ ], "npc.speech.villager_decline_trade": [ "Sorry, I don't have anything to trade.", - "Trade ? Like I got anything that may interest you.", + "Trade? Like I got anything that may interest you.", "My house is mine, I won't trade it for anything.", ], "npc.speech.merchant_advertisement": [ diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 87161c96dd..531d5d7a47 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -889,6 +889,7 @@ impl<'a> AgentData<'a> { }); if self.look_toward(controller, read_data, &target) { + controller.actions.push(ControlAction::Stand); controller.actions.push(ControlAction::Talk); match subject { Subject::Regular => { @@ -1096,6 +1097,7 @@ impl<'a> AgentData<'a> { if agent.trade_for_site.is_some() { if !agent.trading { // stand still and looking towards the trading player + controller.actions.push(ControlAction::Stand); controller.actions.push(ControlAction::Talk); if let Some(target) = read_data.uid_allocator.retrieve_entity_internal(with.id())