Merge branch 'vfoulon80/trading-dialogues' into 'master'

Add dialogue when the Merchant is busy and randomize some trading dialogues

See merge request veloren/veloren!2038
This commit is contained in:
Marcel 2021-04-01 18:08:44 +00:00
commit 3b7e3f8e74
3 changed files with 130 additions and 55 deletions

View File

@ -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!",

View File

@ -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 !",

View File

@ -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 => {
@ -932,7 +933,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 +945,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 +1094,36 @@ 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::Stand);
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 +1132,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 +1158,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;