Remove separate explicit messages from all room broadcasts
This commit is contained in:
parent
b666165ecc
commit
a68955deab
@ -118,11 +118,6 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
dir
|
dir
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} closes the door to the {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
dir
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -97,26 +97,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} prepares to cut {} from {}\n",
|
"{} prepares to cut {} from {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&what_part,
|
&what_part,
|
||||||
&corpse.display_for_sentence(true, 1, false)
|
&corpse.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} prepares to cut {} from {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&what_part,
|
|
||||||
&corpse.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,12 +221,6 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
possession_data.display,
|
possession_data.display,
|
||||||
corpse.display_for_sentence(true, 1, false)
|
corpse.display_for_sentence(true, 1, false)
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} tries to cut the {} from {}, but only leaves a mutilated mess.\n",
|
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
|
||||||
possession_data.display,
|
|
||||||
corpse.display_for_sentence(true, 1, false)
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
} else {
|
} else {
|
||||||
@ -258,12 +239,6 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
possession_data.display,
|
possession_data.display,
|
||||||
corpse.display_for_sentence(true, 1, false)
|
corpse.display_for_sentence(true, 1, false)
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} expertly cuts the {} from {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
|
||||||
possession_data.display,
|
|
||||||
corpse.display_for_sentence(true, 1, false)
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -46,24 +46,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} prepares to drink from {}\n",
|
"{} prepares to drink from {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} prepares to drink from {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,24 +124,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
};
|
};
|
||||||
let how_many_drunk = how_many_to_fill.min(how_many_left.min(10000) as u16).max(1);
|
let how_many_drunk = how_many_to_fill.min(how_many_left.min(10000) as u16).max(1);
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} drinks from {}\n",
|
"{} drinks from {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} drinks from {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
if let Some(urges) = ctx.item.urges.as_mut() {
|
if let Some(urges) = ctx.item.urges.as_mut() {
|
||||||
urges.hunger.last_value = urges.hunger.value;
|
urges.hunger.last_value = urges.hunger.value;
|
||||||
|
@ -136,24 +136,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
ansi!("You're wearing it - try using <bold>remove<reset> first").to_owned(),
|
ansi!("You're wearing it - try using <bold>remove<reset> first").to_owned(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} prepares to drop {}\n",
|
"{} prepares to drop {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} prepares to drop {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,24 +197,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} drops {}\n",
|
"{} drops {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} drops {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let mut item_mut = (*item).clone();
|
let mut item_mut = (*item).clone();
|
||||||
item_mut.location = ctx.item.location.clone();
|
item_mut.location = ctx.item.location.clone();
|
||||||
consider_expire_job_for_item(ctx.trans, &item_mut).await?;
|
consider_expire_job_for_item(ctx.trans, &item_mut).await?;
|
||||||
|
@ -44,24 +44,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} prepares to eat {}\n",
|
"{} prepares to eat {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} prepares to eat {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +117,7 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
};
|
};
|
||||||
let how_many_eaten = how_many_to_fill.min(how_many_left).max(1);
|
let how_many_eaten = how_many_to_fill.min(how_many_left).max(1);
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} {} {}\n",
|
"{} {} {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&(if how_many_eaten == how_many_left {
|
&(if how_many_eaten == how_many_left {
|
||||||
@ -143,24 +131,7 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
}),
|
}),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} {} {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&(if how_many_eaten == how_many_left {
|
|
||||||
"polishes off".to_owned()
|
|
||||||
} else {
|
|
||||||
format!("eats {} bites from", how_many_eaten)
|
|
||||||
}),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
if let Some(urges) = ctx.item.urges.as_mut() {
|
if let Some(urges) = ctx.item.urges.as_mut() {
|
||||||
urges.hunger.last_value = urges.hunger.value;
|
urges.hunger.last_value = urges.hunger.value;
|
||||||
|
@ -61,26 +61,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} prepares to fill {} from {}\n",
|
"{} prepares to fill {} from {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&to_item.display_for_sentence(true, 1, false),
|
&to_item.display_for_sentence(true, 1, false),
|
||||||
&from_item.display_for_sentence(true, 1, false),
|
&from_item.display_for_sentence(true, 1, false),
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} prepares to fill {} from {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&to_item.display_for_sentence(false, 1, false),
|
|
||||||
&from_item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,26 +228,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
ctx.trans.save_item_model(&from_item_mut).await?;
|
ctx.trans.save_item_model(&from_item_mut).await?;
|
||||||
ctx.trans.save_item_model(&to_item_mut).await?;
|
ctx.trans.save_item_model(&to_item_mut).await?;
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fills {} from {}\n",
|
"{} fills {} from {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&to_item.display_for_sentence(true, 1, false),
|
&to_item.display_for_sentence(true, 1, false),
|
||||||
&from_item.display_for_sentence(true, 1, false),
|
&from_item.display_for_sentence(true, 1, false),
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fills {} from {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&to_item.display_for_sentence(false, 1, false),
|
|
||||||
&from_item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -41,24 +41,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fumbles around trying to pick up {}\n",
|
"{} fumbles around trying to pick up {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fumbles around trying to pick up {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
}
|
}
|
||||||
QueueCommand::GetFromContainer {
|
QueueCommand::GetFromContainer {
|
||||||
from_possession_id,
|
from_possession_id,
|
||||||
@ -90,26 +78,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fumbles around trying to get {} from {}.\n",
|
"{} fumbles around trying to get {} from {}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false),
|
&item.display_for_sentence(true, 1, false),
|
||||||
&container.display_for_sentence(true, 1, false)
|
&container.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fumbles around trying to get {} from {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
&container.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
}
|
}
|
||||||
_ => user_error("Unexpected command".to_owned())?,
|
_ => user_error("Unexpected command".to_owned())?,
|
||||||
};
|
};
|
||||||
@ -140,24 +115,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} picks up {}\n",
|
"{} picks up {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} picks up {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
(item, None)
|
(item, None)
|
||||||
}
|
}
|
||||||
QueueCommand::GetFromContainer {
|
QueueCommand::GetFromContainer {
|
||||||
@ -190,26 +153,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} gets {} from {}.\n",
|
"{} gets {} from {}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false),
|
&item.display_for_sentence(true, 1, false),
|
||||||
&container.display_for_sentence(true, 1, false)
|
&container.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} gets {} from {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
&container.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
(item, Some(container))
|
(item, Some(container))
|
||||||
}
|
}
|
||||||
_ => user_error("Unexpected command".to_owned())?,
|
_ => user_error("Unexpected command".to_owned())?,
|
||||||
|
@ -69,12 +69,6 @@ impl QueueCommandHandler for WithQueueHandler {
|
|||||||
&ctx.item.pronouns.subject,
|
&ctx.item.pronouns.subject,
|
||||||
&item.display_for_sentence(true, 1, false),
|
&item.display_for_sentence(true, 1, false),
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} tries to work out what {} can make from {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&ctx.item.pronouns.subject,
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
@ -261,12 +255,6 @@ impl QueueCommandHandler for FromQueueHandler {
|
|||||||
&new_item.display_for_sentence(true, 1, false),
|
&new_item.display_for_sentence(true, 1, false),
|
||||||
&ctx.item.pronouns.subject
|
&ctx.item.pronouns.subject
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} proudly holds up the {} {} just made.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&new_item.display_for_sentence(false, 1, false),
|
|
||||||
&ctx.item.pronouns.subject
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -113,14 +113,6 @@ impl UserVerb for Verb {
|
|||||||
sep,
|
sep,
|
||||||
&npc.pronouns.intensive
|
&npc.pronouns.intensive
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} {}s {} {} {}\n",
|
|
||||||
&npc.display_for_sentence(false, 1, true),
|
|
||||||
verb,
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
sep,
|
|
||||||
&npc.pronouns.intensive
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -98,39 +98,23 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut msg_exp = format!(
|
let mut msg = format!(
|
||||||
"{} starts fiddling around trying to make something",
|
"{} starts fiddling around trying to make something",
|
||||||
&ctx.item.display_for_sentence(true, 1, true)
|
&ctx.item.display_for_sentence(true, 1, true)
|
||||||
);
|
);
|
||||||
let mut msg_nonexp = format!(
|
|
||||||
"{} starts fiddling around trying to make something",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true)
|
|
||||||
);
|
|
||||||
|
|
||||||
match bench_opt {
|
match bench_opt {
|
||||||
None => {}
|
None => {}
|
||||||
Some(bench) => {
|
Some(bench) => {
|
||||||
msg_exp.push_str(&format!(
|
msg.push_str(&format!(
|
||||||
" on {}",
|
" on {}",
|
||||||
bench.display_for_sentence(true, 1, false)
|
bench.display_for_sentence(true, 1, false)
|
||||||
));
|
));
|
||||||
msg_nonexp.push_str(&format!(
|
|
||||||
" on {}",
|
|
||||||
bench.display_for_sentence(false, 1, false)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg_exp.push_str(".\n");
|
msg.push_str(".\n");
|
||||||
msg_nonexp.push_str(".\n");
|
|
||||||
|
|
||||||
broadcast_to_room(
|
broadcast_to_room(&ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
&ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
@ -199,12 +183,9 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (on_what_exp, on_what_nonexp) = match bench_opt {
|
let on_what = match bench_opt {
|
||||||
None => ("".to_owned(), "".to_owned()),
|
None => "".to_owned(),
|
||||||
Some(bench) => (
|
Some(bench) => format!(" on {}", bench.display_for_sentence(true, 1, false)),
|
||||||
format!(" on {}", bench.display_for_sentence(true, 1, false)),
|
|
||||||
format!(" on {}", bench.display_for_sentence(false, 1, false)),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let craft_data = get_craft_data_for_instructions(&instructions)
|
let craft_data = get_craft_data_for_instructions(&instructions)
|
||||||
@ -258,14 +239,8 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
"{} makes a {}{}.\n",
|
"{} makes a {}{}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&new_item.display_for_sentence(true, 1, false),
|
&new_item.display_for_sentence(true, 1, false),
|
||||||
&on_what_exp
|
&on_what
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} makes a {}{}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&new_item.display_for_sentence(false, 1, false),
|
|
||||||
&on_what_nonexp
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -49,47 +49,29 @@ pub async fn announce_move(
|
|||||||
leaving: &Item,
|
leaving: &Item,
|
||||||
arriving: &Item,
|
arriving: &Item,
|
||||||
) -> DResult<()> {
|
) -> DResult<()> {
|
||||||
let msg_leaving_exp = format!(
|
let msg_leaving = format!(
|
||||||
"{} departs towards {}\n",
|
"{} departs towards {}\n",
|
||||||
&character.display_for_sentence(true, 1, true),
|
&character.display_for_sentence(true, 1, true),
|
||||||
&arriving.display
|
&arriving.display
|
||||||
);
|
);
|
||||||
let msg_leaving_nonexp = format!(
|
|
||||||
"{} departs towards {}\n",
|
|
||||||
character.display_for_sentence(true, 1, false),
|
|
||||||
arriving
|
|
||||||
.display_less_explicit
|
|
||||||
.as_ref()
|
|
||||||
.unwrap_or(&arriving.display)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
broadcast_to_room(
|
||||||
trans,
|
trans,
|
||||||
&format!("{}/{}", &leaving.item_type, &leaving.item_code),
|
&format!("{}/{}", &leaving.item_type, &leaving.item_code),
|
||||||
None,
|
None,
|
||||||
&msg_leaving_exp,
|
&msg_leaving,
|
||||||
Some(&msg_leaving_nonexp),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let msg_arriving_exp = format!(
|
let msg_arriving = format!(
|
||||||
"{} arrives from {}\n",
|
"{} arrives from {}\n",
|
||||||
&character.display_for_sentence(true, 1, true),
|
&character.display_for_sentence(true, 1, true),
|
||||||
&leaving.display
|
&leaving.display
|
||||||
);
|
);
|
||||||
let msg_arriving_nonexp = format!(
|
|
||||||
"{} arrives from {}\n",
|
|
||||||
character.display_for_sentence(true, 1, false),
|
|
||||||
leaving
|
|
||||||
.display_less_explicit
|
|
||||||
.as_ref()
|
|
||||||
.unwrap_or(&leaving.display)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
broadcast_to_room(
|
||||||
trans,
|
trans,
|
||||||
&format!("{}/{}", &arriving.item_type, &arriving.item_code),
|
&format!("{}/{}", &arriving.item_type, &arriving.item_code),
|
||||||
None,
|
None,
|
||||||
&msg_arriving_exp,
|
&msg_arriving,
|
||||||
Some(&msg_arriving_nonexp),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -321,7 +303,7 @@ pub async fn handle_fall(trans: &DBTrans, faller: &mut Item, fall_dist: u64) ->
|
|||||||
* Normal::new(1.0, 0.3)?.sample(&mut rand::thread_rng())) as i64;
|
* Normal::new(1.0, 0.3)?.sample(&mut rand::thread_rng())) as i64;
|
||||||
|
|
||||||
if damage > 0 {
|
if damage > 0 {
|
||||||
change_health(trans, -damage, faller, "You fell", "You fell").await?;
|
change_health(trans, -damage, faller, "You fell").await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let descriptor = if damage >= 30 {
|
let descriptor = if damage >= 30 {
|
||||||
@ -477,22 +459,15 @@ async fn attempt_move_immediate(
|
|||||||
};
|
};
|
||||||
ctx.item.active_climb = None;
|
ctx.item.active_climb = None;
|
||||||
let descriptor = handle_fall(&ctx.trans, ctx.item, fall_dist).await?;
|
let descriptor = handle_fall(&ctx.trans, ctx.item, fall_dist).await?;
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} loses {} grip from {} metres up and {}!\n",
|
"{} loses {} grip from {} metres up and {}!\n",
|
||||||
ctx.item.display_for_sentence(true, 1, true),
|
ctx.item.display_for_sentence(true, 1, true),
|
||||||
ctx.item.pronouns.possessive,
|
ctx.item.pronouns.possessive,
|
||||||
fall_dist,
|
fall_dist,
|
||||||
&descriptor
|
&descriptor
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &from_room, None, &msg).await?;
|
||||||
"{} loses {} grip from {} metres up and {}!\n",
|
broadcast_to_room(ctx.trans, &to_room, None, &msg).await?;
|
||||||
ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&ctx.item.pronouns.possessive,
|
|
||||||
fall_dist,
|
|
||||||
&descriptor
|
|
||||||
);
|
|
||||||
broadcast_to_room(ctx.trans, &from_room, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
broadcast_to_room(ctx.trans, &to_room, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
ctx.item.queue.truncate(0);
|
ctx.item.queue.truncate(0);
|
||||||
return Ok(got_there);
|
return Ok(got_there);
|
||||||
} else if skills <= 0.0 {
|
} else if skills <= 0.0 {
|
||||||
@ -566,17 +541,12 @@ async fn attempt_move_immediate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} starts climbing {}\n",
|
"{} starts climbing {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&direction.describe_climb(if climb.height > 0 { "up" } else { "down" })
|
&direction.describe_climb(if climb.height > 0 { "up" } else { "down" })
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(&ctx.trans, &use_location, None, &msg).await?;
|
||||||
"{} starts climbing {}\n",
|
|
||||||
&ctx.item.display_for_sentence(true, 1, false),
|
|
||||||
&direction.describe_climb(if climb.height > 0 { "up" } else { "down" })
|
|
||||||
);
|
|
||||||
broadcast_to_room(&ctx.trans, &use_location, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
|
|
||||||
ctx.item.active_climb = Some(ActiveClimb {
|
ctx.item.active_climb = Some(ActiveClimb {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -76,7 +76,7 @@ impl TaskHandler for SwingShutHandler {
|
|||||||
"The door to the {} swings shut with a click.\n",
|
"The door to the {} swings shut with a click.\n",
|
||||||
&direction.describe()
|
&direction.describe()
|
||||||
);
|
);
|
||||||
broadcast_to_room(&ctx.trans, &room_str, None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &room_str, None, &msg).await?;
|
||||||
|
|
||||||
if let Ok(Some(other_room)) = direction_to_item(&ctx.trans, &room_str, &direction).await {
|
if let Ok(Some(other_room)) = direction_to_item(&ctx.trans, &room_str, &direction).await {
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
@ -86,7 +86,7 @@ impl TaskHandler for SwingShutHandler {
|
|||||||
.map(|d| d.describe())
|
.map(|d| d.describe())
|
||||||
.unwrap_or_else(|| "outside".to_owned())
|
.unwrap_or_else(|| "outside".to_owned())
|
||||||
);
|
);
|
||||||
broadcast_to_room(&ctx.trans, &other_room.refstr(), None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &other_room.refstr(), None, &msg).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
@ -182,11 +182,6 @@ pub async fn attempt_open_immediate(
|
|||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
dir
|
dir
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} opens the door to the {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
dir
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -58,26 +58,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fumbles around trying to put {} in {}.\n",
|
"{} fumbles around trying to put {} in {}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false),
|
&item.display_for_sentence(true, 1, false),
|
||||||
&container.display_for_sentence(true, 1, false)
|
&container.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fumbles around trying to put {} in {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
&container.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,26 +126,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
})?;
|
})?;
|
||||||
container_data.checker.check_place(&container, &item)?;
|
container_data.checker.check_place(&container, &item)?;
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} puts {} in {}.\n",
|
"{} puts {} in {}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false),
|
&item.display_for_sentence(true, 1, false),
|
||||||
&container.display_for_sentence(true, 1, false)
|
&container.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} puts {} in {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
&container.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let possession_data = match item
|
let possession_data = match item
|
||||||
.possession_type
|
.possession_type
|
||||||
|
@ -107,8 +107,8 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
let (item, desc_exp, desc_nonexp) = match item_ref {
|
let (item, desc) = match item_ref {
|
||||||
None => (None, "the floor".to_owned(), "the floor".to_owned()),
|
None => (None, "the floor".to_owned()),
|
||||||
Some(item_ref) => {
|
Some(item_ref) => {
|
||||||
let (item_type, item_code) = match item_ref.split_once("/") {
|
let (item_type, item_code) = match item_ref.split_once("/") {
|
||||||
None => user_error("Invalid item ref in Sit command".to_owned())?,
|
None => user_error("Invalid item ref in Sit command".to_owned())?,
|
||||||
@ -130,30 +130,17 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
(
|
(
|
||||||
Some(item.clone()),
|
Some(item.clone()),
|
||||||
item.display_for_sentence(true, 1, false),
|
item.display_for_sentence(true, 1, false),
|
||||||
item.display_for_sentence(false, 1, false),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} reclines on {}.\n",
|
"{} reclines on {}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&desc_exp
|
&desc
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} reclines on {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&desc_nonexp
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
ctx.item.action_type = LocationActionType::Reclining(item.map(|it| it.refstr()));
|
ctx.item.action_type = LocationActionType::Reclining(item.map(|it| it.refstr()));
|
||||||
recalculate_urge_growth(&ctx.trans, &mut ctx.item).await?;
|
recalculate_urge_growth(&ctx.trans, &mut ctx.item).await?;
|
||||||
|
@ -101,24 +101,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
|
|
||||||
check_removeable(ctx, &item).await?;
|
check_removeable(ctx, &item).await?;
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fumbles around trying to take off {}\n",
|
"{} fumbles around trying to take off {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fumbles around trying to take off {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,24 +132,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
|
|
||||||
check_removeable(ctx, &item).await?;
|
check_removeable(ctx, &item).await?;
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} removes {}\n",
|
"{} removes {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} removes {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let mut item_mut = (*item).clone();
|
let mut item_mut = (*item).clone();
|
||||||
item_mut.action_type = LocationActionType::Normal;
|
item_mut.action_type = LocationActionType::Normal;
|
||||||
item_mut.action_type_started = None;
|
item_mut.action_type_started = None;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use super::{
|
use super::{
|
||||||
get_player_item_or_fail, is_likely_explicit, user_error, UResult, UserError, UserVerb,
|
get_player_item_or_fail, user_error, UResult, UserError, UserVerb, UserVerbRef, VerbContext,
|
||||||
UserVerbRef, VerbContext,
|
|
||||||
};
|
};
|
||||||
#[double]
|
#[double]
|
||||||
use crate::db::DBTrans;
|
use crate::db::DBTrans;
|
||||||
@ -17,7 +16,6 @@ pub async fn say_to_room<'l>(
|
|||||||
from_item: &Item,
|
from_item: &Item,
|
||||||
location: &str,
|
location: &str,
|
||||||
say_what: &str,
|
say_what: &str,
|
||||||
is_explicit: bool,
|
|
||||||
) -> UResult<()> {
|
) -> UResult<()> {
|
||||||
let (loc_type, loc_code) = location
|
let (loc_type, loc_code) = location
|
||||||
.split_once("/")
|
.split_once("/")
|
||||||
@ -33,29 +31,13 @@ pub async fn say_to_room<'l>(
|
|||||||
.to_owned(),
|
.to_owned(),
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
ansi!("<yellow>{} says: <reset><bold>\"{}\"<reset>\n"),
|
ansi!("<yellow>{} says: <reset><bold>\"{}\"<reset>\n"),
|
||||||
from_item.display_for_sentence(true, 1, true),
|
from_item.display_for_sentence(true, 1, true),
|
||||||
say_what
|
say_what
|
||||||
);
|
);
|
||||||
let msg_lessexp = format!(
|
|
||||||
ansi!("<yellow>{} says: <reset><bold>\"{}\"<reset>\n"),
|
|
||||||
from_item.display_for_sentence(false, 1, true),
|
|
||||||
say_what
|
|
||||||
);
|
|
||||||
|
|
||||||
broadcast_to_room(
|
broadcast_to_room(trans, location, Some(from_item), &msg).await?;
|
||||||
trans,
|
|
||||||
location,
|
|
||||||
Some(from_item),
|
|
||||||
&msg_exp,
|
|
||||||
if is_explicit {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(&msg_lessexp)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,14 +58,7 @@ impl UserVerb for Verb {
|
|||||||
if player_item.death_data.is_some() {
|
if player_item.death_data.is_some() {
|
||||||
user_error("Shush, the dead can't talk!".to_string())?;
|
user_error("Shush, the dead can't talk!".to_string())?;
|
||||||
}
|
}
|
||||||
say_to_room(
|
say_to_room(ctx.trans, &player_item, &player_item.location, &say_what).await
|
||||||
ctx.trans,
|
|
||||||
&player_item,
|
|
||||||
&player_item.location,
|
|
||||||
&say_what,
|
|
||||||
is_likely_explicit(&say_what),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static VERB_INT: Verb = Verb;
|
static VERB_INT: Verb = Verb;
|
||||||
|
@ -34,10 +34,6 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
ansi!("<blue>{} starts methodically searching the area.<reset>\n"),
|
ansi!("<blue>{} starts methodically searching the area.<reset>\n"),
|
||||||
ctx.item.display_for_sentence(true, 1, true),
|
ctx.item.display_for_sentence(true, 1, true),
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
ansi!("<blue>{} starts methodically searching the area.<reset>\n"),
|
|
||||||
ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(time::Duration::from_secs(3))
|
Ok(time::Duration::from_secs(3))
|
||||||
@ -97,10 +93,6 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
ctx.item.display_for_sentence(true, 1, true),
|
ctx.item.display_for_sentence(true, 1, true),
|
||||||
found.display_for_sentence(true, 1, false),
|
found.display_for_sentence(true, 1, false),
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} seems to have found {} - but can't carry it so drops it on the ground.\n",
|
|
||||||
ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
found.display_for_sentence(false, 1, false),)),
|
|
||||||
).await?;
|
).await?;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
@ -113,11 +105,6 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
ctx.item.display_for_sentence(true, 1, true),
|
ctx.item.display_for_sentence(true, 1, true),
|
||||||
found.display_for_sentence(true, 1, false),
|
found.display_for_sentence(true, 1, false),
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} seems to have found {}.\n",
|
|
||||||
ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
found.display_for_sentence(false, 1, false),
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
found.location = ctx.item.refstr();
|
found.location = ctx.item.refstr();
|
||||||
|
@ -99,8 +99,8 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
LocationActionType::Sitting { .. } => user_error("You're already sitting.".to_owned())?,
|
LocationActionType::Sitting { .. } => user_error("You're already sitting.".to_owned())?,
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
let (item, desc_exp, desc_nonexp) = match item_ref {
|
let (item, desc) = match item_ref {
|
||||||
None => (None, "the floor".to_owned(), "the floor".to_owned()),
|
None => (None, "the floor".to_owned()),
|
||||||
Some(item_ref) => {
|
Some(item_ref) => {
|
||||||
let (item_type, item_code) = match item_ref.split_once("/") {
|
let (item_type, item_code) = match item_ref.split_once("/") {
|
||||||
None => user_error("Invalid item ref in Sit command".to_owned())?,
|
None => user_error("Invalid item ref in Sit command".to_owned())?,
|
||||||
@ -122,30 +122,17 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
(
|
(
|
||||||
Some(item.clone()),
|
Some(item.clone()),
|
||||||
item.display_for_sentence(true, 1, false),
|
item.display_for_sentence(true, 1, false),
|
||||||
item.display_for_sentence(false, 1, false),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} sits on {}.\n",
|
"{} sits on {}.\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&desc_exp
|
&desc
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} sits on {}.\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&desc_nonexp
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
ctx.item.action_type = LocationActionType::Sitting(item.map(|it| it.refstr()));
|
ctx.item.action_type = LocationActionType::Sitting(item.map(|it| it.refstr()));
|
||||||
recalculate_urge_growth(&ctx.trans, &mut ctx.item).await?;
|
recalculate_urge_growth(&ctx.trans, &mut ctx.item).await?;
|
||||||
|
@ -17,9 +17,8 @@ pub async fn stand_if_needed(trans: &DBTrans, who: &mut Item) -> UResult<()> {
|
|||||||
LocationActionType::Sitting { .. } | LocationActionType::Reclining { .. } => {}
|
LocationActionType::Sitting { .. } | LocationActionType::Reclining { .. } => {}
|
||||||
_ => return Ok(()),
|
_ => return Ok(()),
|
||||||
}
|
}
|
||||||
let msg_exp = format!("{} stands up.\n", &who.display_for_sentence(true, 1, true),);
|
let msg = format!("{} stands up.\n", &who.display_for_sentence(true, 1, true));
|
||||||
let msg_nonexp = format!("{} stands up.\n", &who.display_for_sentence(false, 1, true),);
|
broadcast_to_room(trans, &who.location, None, &msg).await?;
|
||||||
broadcast_to_room(trans, &who.location, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
|
|
||||||
who.action_type = LocationActionType::Normal;
|
who.action_type = LocationActionType::Normal;
|
||||||
recalculate_urge_growth(trans, who).await?;
|
recalculate_urge_growth(trans, who).await?;
|
||||||
|
@ -80,7 +80,7 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
target_name
|
target_name
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} prepares to use {} {} on {}\n",
|
"{} prepares to use {} {} on {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&ctx.item.pronouns.possessive,
|
&ctx.item.pronouns.possessive,
|
||||||
@ -91,25 +91,7 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
target.display_for_sentence(true, 1, false)
|
target.display_for_sentence(true, 1, false)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} prepares to use {} {} on {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&ctx.item.pronouns.possessive,
|
|
||||||
&item.display_for_sentence(false, 0, false),
|
|
||||||
&if is_self_use {
|
|
||||||
ctx.item.pronouns.intensive.clone()
|
|
||||||
} else {
|
|
||||||
target.display_for_sentence(true, 1, false)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let mut draw_level: f64 = *ctx
|
let mut draw_level: f64 = *ctx
|
||||||
.item
|
.item
|
||||||
.total_skills
|
.total_skills
|
||||||
|
@ -60,24 +60,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| UserError("You can't wear that!".to_owned()))?;
|
.ok_or_else(|| UserError("You can't wear that!".to_owned()))?;
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fumbles around trying to put on {}\n",
|
"{} fumbles around trying to put on {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fumbles around trying to put on {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(time::Duration::from_secs(1))
|
Ok(time::Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,24 +140,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} wears {}\n",
|
"{} wears {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} wears {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let mut item_mut = (*item).clone();
|
let mut item_mut = (*item).clone();
|
||||||
item_mut.action_type = LocationActionType::Worn;
|
item_mut.action_type = LocationActionType::Worn;
|
||||||
item_mut.action_type_started = Some(Utc::now());
|
item_mut.action_type_started = Some(Utc::now());
|
||||||
|
@ -37,26 +37,13 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
if item.location != format!("player/{}", ctx.item.item_code) {
|
if item.location != format!("player/{}", ctx.item.item_code) {
|
||||||
user_error("You try to wield it but realise you no longer have it".to_owned())?
|
user_error("You try to wield it but realise you no longer have it".to_owned())?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} fumbles around with {} {}\n",
|
"{} fumbles around with {} {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&ctx.item.pronouns.possessive,
|
&ctx.item.pronouns.possessive,
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} fumbles around with {} {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&ctx.item.pronouns.possessive,
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let mut draw_level: f64 = ctx
|
let mut draw_level: f64 = ctx
|
||||||
.item
|
.item
|
||||||
.total_skills
|
.total_skills
|
||||||
@ -105,24 +92,12 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
if item.location != format!("player/{}", ctx.item.item_code) {
|
if item.location != format!("player/{}", ctx.item.item_code) {
|
||||||
user_error("You try to wield it but realise you no longer have it".to_owned())?
|
user_error("You try to wield it but realise you no longer have it".to_owned())?
|
||||||
}
|
}
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} wields {}\n",
|
"{} wields {}\n",
|
||||||
&ctx.item.display_for_sentence(true, 1, true),
|
&ctx.item.display_for_sentence(true, 1, true),
|
||||||
&item.display_for_sentence(true, 1, false)
|
&item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &ctx.item.location, None, &msg).await?;
|
||||||
"{} wields {}\n",
|
|
||||||
&ctx.item.display_for_sentence(false, 1, true),
|
|
||||||
&item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&ctx.item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
ctx.trans
|
ctx.trans
|
||||||
.set_exclusive_action_type_to(
|
.set_exclusive_action_type_to(
|
||||||
&item,
|
&item,
|
||||||
|
@ -15,10 +15,10 @@ pub struct EffectSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum Effect {
|
pub enum Effect {
|
||||||
// messagef takes player, causative item, target as the 3 parameters. Returns (explicit, non explicit) message.
|
// messagef takes player, causative item, target as the 3 parameters. Returns message.
|
||||||
BroadcastMessage {
|
BroadcastMessage {
|
||||||
delay_secs: u64,
|
delay_secs: u64,
|
||||||
messagef: Box<dyn Fn(&Item, &Item, &Item) -> (String, String) + Sync + Send>,
|
messagef: Box<dyn Fn(&Item, &Item, &Item) -> String + Sync + Send>,
|
||||||
},
|
},
|
||||||
// skill_multiplier is always positive - sign flipped for crit fails.
|
// skill_multiplier is always positive - sign flipped for crit fails.
|
||||||
ChangeTargetHealth {
|
ChangeTargetHealth {
|
||||||
@ -26,6 +26,6 @@ pub enum Effect {
|
|||||||
base_effect: i64,
|
base_effect: i64,
|
||||||
skill_multiplier: f64,
|
skill_multiplier: f64,
|
||||||
max_effect: i64,
|
max_effect: i64,
|
||||||
message: Box<dyn Fn(&Item) -> (String, String) + Sync + Send>,
|
message: Box<dyn Fn(&Item) -> String + Sync + Send>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -138,22 +138,11 @@ async fn start_next_attack(
|
|||||||
victim_item: &Item,
|
victim_item: &Item,
|
||||||
weapon: &WeaponData,
|
weapon: &WeaponData,
|
||||||
) -> DResult<()> {
|
) -> DResult<()> {
|
||||||
let msg_exp = &(weapon
|
let msg = &(weapon
|
||||||
.normal_attack
|
.normal_attack
|
||||||
.start_message(&attacker_item, victim_item, true)
|
.start_message(&attacker_item, victim_item, true)
|
||||||
+ ".\n");
|
+ ".\n");
|
||||||
let msg_nonexp = &(weapon
|
broadcast_to_room(ctx.trans, &attacker_item.location, None, msg).await?;
|
||||||
.normal_attack
|
|
||||||
.start_message(&attacker_item, victim_item, false)
|
|
||||||
+ ".\n");
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&attacker_item.location,
|
|
||||||
None,
|
|
||||||
msg_exp,
|
|
||||||
Some(msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,26 +161,13 @@ async fn process_attack(
|
|||||||
.unwrap_or(0)
|
.unwrap_or(0)
|
||||||
> 8000
|
> 8000
|
||||||
{
|
{
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} looks like {} wanted to attack {}, but was too tired and stressed to do it.\n",
|
"{} looks like {} wanted to attack {}, but was too tired and stressed to do it.\n",
|
||||||
attacker_item.display_for_sentence(true, 1, true),
|
attacker_item.display_for_sentence(true, 1, true),
|
||||||
attacker_item.pronouns.subject,
|
attacker_item.pronouns.subject,
|
||||||
victim_item.display_for_sentence(true, 1, false),
|
victim_item.display_for_sentence(true, 1, false),
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &attacker_item.location, None, &msg).await?;
|
||||||
"{} looks like {} wanted to attack {}, but was too tired and stressed to do it.\n",
|
|
||||||
attacker_item.display_for_sentence(false, 1, true),
|
|
||||||
attacker_item.pronouns.subject,
|
|
||||||
victim_item.display_for_sentence(false, 1, false),
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&attacker_item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
match attacker_item.active_combat.as_mut() {
|
match attacker_item.active_combat.as_mut() {
|
||||||
Some(ac) if ac.attack_mode != AttackMode::NORMAL => {
|
Some(ac) if ac.attack_mode != AttackMode::NORMAL => {
|
||||||
@ -240,24 +216,12 @@ async fn process_attack(
|
|||||||
change_stress_considering_cool(&ctx.trans, attacker_item, 100).await?;
|
change_stress_considering_cool(&ctx.trans, attacker_item, 100).await?;
|
||||||
|
|
||||||
if dodge_result > attack_result {
|
if dodge_result > attack_result {
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} dodges out of the way of {}'s attack.\n",
|
"{} dodges out of the way of {}'s attack.\n",
|
||||||
victim_item.display_for_sentence(true, 1, true),
|
victim_item.display_for_sentence(true, 1, true),
|
||||||
attacker_item.display_for_sentence(true, 1, false)
|
attacker_item.display_for_sentence(true, 1, false)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &attacker_item.location, None, &msg).await?;
|
||||||
"{} dodges out of the way of {}'s attack.\n",
|
|
||||||
victim_item.display_for_sentence(false, 1, true),
|
|
||||||
attacker_item.display_for_sentence(false, 1, false)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&attacker_item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
match attacker_item.active_combat.as_mut() {
|
match attacker_item.active_combat.as_mut() {
|
||||||
Some(ac) => ac.attack_mode = AttackMode::NORMAL,
|
Some(ac) => ac.attack_mode = AttackMode::NORMAL,
|
||||||
None => {}
|
None => {}
|
||||||
@ -298,38 +262,16 @@ async fn process_attack(
|
|||||||
&part,
|
&part,
|
||||||
)
|
)
|
||||||
.await? as i64;
|
.await? as i64;
|
||||||
let msg_exp = attack.success_message(&attacker_item, victim_item, &part, true);
|
let msg = attack.success_message(&attacker_item, victim_item, &part, true);
|
||||||
let msg_nonexp = attack.success_message(&attacker_item, victim_item, &part, false);
|
|
||||||
if actual_damage == 0 {
|
if actual_damage == 0 {
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{}'s attack bounces off {}'s {}.\n",
|
"{}'s attack bounces off {}'s {}.\n",
|
||||||
&attacker_item.display_for_sentence(true, 1, true),
|
&attacker_item.display_for_sentence(true, 1, true),
|
||||||
&victim_item.display_for_sentence(true, 1, false),
|
&victim_item.display_for_sentence(true, 1, false),
|
||||||
&part.display(victim_item.sex.clone())
|
&part.display(victim_item.sex.clone())
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(&ctx.trans, &victim_item.location, None, &msg).await?;
|
||||||
"{}'s attack bounces off {}'s {}.\n",
|
} else if change_health(ctx.trans, -actual_damage, victim_item, &msg).await? {
|
||||||
attacker_item.display_for_sentence(false, 1, true),
|
|
||||||
victim_item.display_for_sentence(false, 1, false),
|
|
||||||
&part.display(None)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
&ctx.trans,
|
|
||||||
&victim_item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
} else if change_health(
|
|
||||||
ctx.trans,
|
|
||||||
-actual_damage,
|
|
||||||
victim_item,
|
|
||||||
&msg_exp,
|
|
||||||
&msg_nonexp,
|
|
||||||
)
|
|
||||||
.await?
|
|
||||||
{
|
|
||||||
ctx.trans.save_item_model(victim_item).await?;
|
ctx.trans.save_item_model(victim_item).await?;
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
@ -375,26 +317,13 @@ async fn process_feint(
|
|||||||
.unwrap_or(0)
|
.unwrap_or(0)
|
||||||
> 8000
|
> 8000
|
||||||
{
|
{
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} looks like {} wanted to feint {}, but was too tired and stressed to do it.\n",
|
"{} looks like {} wanted to feint {}, but was too tired and stressed to do it.\n",
|
||||||
attacker_item.display_for_sentence(true, 1, true),
|
attacker_item.display_for_sentence(true, 1, true),
|
||||||
attacker_item.pronouns.subject,
|
attacker_item.pronouns.subject,
|
||||||
victim_item.display_for_sentence(true, 1, false),
|
victim_item.display_for_sentence(true, 1, false),
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &attacker_item.location, None, &msg).await?;
|
||||||
"{} looks like {} wanted to feint {}, but was too tired and stressed to do it.\n",
|
|
||||||
attacker_item.display_for_sentence(false, 1, true),
|
|
||||||
attacker_item.pronouns.subject,
|
|
||||||
victim_item.display_for_sentence(false, 1, false),
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&attacker_item.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
match attacker_item.active_combat.as_mut() {
|
match attacker_item.active_combat.as_mut() {
|
||||||
Some(ac) => {
|
Some(ac) => {
|
||||||
ac.attack_mode = AttackMode::NORMAL;
|
ac.attack_mode = AttackMode::NORMAL;
|
||||||
@ -426,12 +355,6 @@ async fn process_feint(
|
|||||||
&attacker_item.pronouns.object,
|
&attacker_item.pronouns.object,
|
||||||
&attacker_item.pronouns.intensive,
|
&attacker_item.pronouns.intensive,
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} seems to have pulled off the feint so poorly {} confused {}!\n",
|
|
||||||
&attacker_item.display_for_sentence(false, 1, true),
|
|
||||||
&attacker_item.pronouns.object,
|
|
||||||
&attacker_item.pronouns.intensive,
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
run_effects(
|
run_effects(
|
||||||
@ -460,11 +383,6 @@ async fn process_feint(
|
|||||||
&victim_item.display_for_sentence(true, 1, true),
|
&victim_item.display_for_sentence(true, 1, true),
|
||||||
&attacker_item.display_for_sentence(true, 1, false),
|
&attacker_item.display_for_sentence(true, 1, false),
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} is confused by {}'s antics!\n",
|
|
||||||
&victim_item.display_for_sentence(false, 1, true),
|
|
||||||
&attacker_item.display_for_sentence(false, 1, false),
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
run_effects(
|
run_effects(
|
||||||
@ -488,11 +406,6 @@ async fn process_feint(
|
|||||||
&victim_item.display_for_sentence(true, 1, true),
|
&victim_item.display_for_sentence(true, 1, true),
|
||||||
&attacker_item.display_for_sentence(true, 1, false)
|
&attacker_item.display_for_sentence(true, 1, false)
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} doesn't seem to have fallen for {}'s unenlightened attempt at a feint.\n",
|
|
||||||
&victim_item.display_for_sentence(false, 1, true),
|
|
||||||
&attacker_item.display_for_sentence(false, 1, false)
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
@ -608,8 +521,7 @@ pub async fn change_health(
|
|||||||
trans: &DBTrans,
|
trans: &DBTrans,
|
||||||
change: i64,
|
change: i64,
|
||||||
victim: &mut Item,
|
victim: &mut Item,
|
||||||
reason_exp: &str,
|
reason: &str,
|
||||||
reason_nonexp: &str,
|
|
||||||
) -> DResult<bool> {
|
) -> DResult<bool> {
|
||||||
let maxh = max_health(victim);
|
let maxh = max_health(victim);
|
||||||
let new_health = ((victim.health as i64 + change).max(0) as u64).min(maxh);
|
let new_health = ((victim.health as i64 + change).max(0) as u64).min(maxh);
|
||||||
@ -621,19 +533,15 @@ pub async fn change_health(
|
|||||||
} else {
|
} else {
|
||||||
ansi!("<red>")
|
ansi!("<red>")
|
||||||
};
|
};
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
ansi!("[ {}{}<reset> <bold>{}/{}<reset> ] {}.\n"),
|
ansi!("[ {}{}<reset> <bold>{}/{}<reset> ] {}.\n"),
|
||||||
colour,
|
colour,
|
||||||
change,
|
change,
|
||||||
new_health,
|
new_health,
|
||||||
max_health(&victim),
|
max_health(&victim),
|
||||||
reason_exp
|
reason
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(trans, &victim.location, None, &msg).await?;
|
||||||
ansi!("[ {}{}<reset> <bold>{}/{}<reset> ] {}.\n"),
|
|
||||||
colour, change, new_health, maxh, reason_nonexp
|
|
||||||
);
|
|
||||||
broadcast_to_room(trans, &victim.location, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
victim.health = new_health;
|
victim.health = new_health;
|
||||||
if new_health == 0 {
|
if new_health == 0 {
|
||||||
handle_death(trans, victim).await?;
|
handle_death(trans, victim).await?;
|
||||||
@ -739,15 +647,11 @@ pub async fn consider_reward_for(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_death(trans: &DBTrans, whom: &mut Item) -> DResult<()> {
|
pub async fn handle_death(trans: &DBTrans, whom: &mut Item) -> DResult<()> {
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
ansi!("<red>{} stiffens and collapses dead.<reset>\n"),
|
ansi!("<red>{} stiffens and collapses dead.<reset>\n"),
|
||||||
&whom.display_for_sentence(true, 1, true)
|
&whom.display_for_sentence(true, 1, true)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(trans, &whom.location, None, &msg).await?;
|
||||||
ansi!("<red>{} stiffens and collapses dead.<reset>\n"),
|
|
||||||
&whom.display_for_sentence(false, 1, true)
|
|
||||||
);
|
|
||||||
broadcast_to_room(trans, &whom.location, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
|
|
||||||
whom.death_data = Some(DeathData {
|
whom.death_data = Some(DeathData {
|
||||||
parts_remaining: species_info_map()
|
parts_remaining: species_info_map()
|
||||||
@ -1002,8 +906,7 @@ pub async fn start_attack_mut(
|
|||||||
by_whom: &mut Item,
|
by_whom: &mut Item,
|
||||||
to_whom: &mut Item,
|
to_whom: &mut Item,
|
||||||
) -> UResult<()> {
|
) -> UResult<()> {
|
||||||
let mut msg_exp = String::new();
|
let mut msg = String::new();
|
||||||
let mut msg_nonexp = String::new();
|
|
||||||
let mut verb: String = "attacks".to_string();
|
let mut verb: String = "attacks".to_string();
|
||||||
match by_whom.action_type {
|
match by_whom.action_type {
|
||||||
LocationActionType::Sitting { .. } | LocationActionType::Reclining { .. } => {
|
LocationActionType::Sitting { .. } | LocationActionType::Reclining { .. } => {
|
||||||
@ -1037,31 +940,17 @@ pub async fn start_attack_mut(
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_exp.push_str(&format!(
|
msg.push_str(&format!(
|
||||||
ansi!("<red>{} {} {}.<reset>\n"),
|
ansi!("<red>{} {} {}.<reset>\n"),
|
||||||
&by_whom.display_for_sentence(true, 1, true),
|
&by_whom.display_for_sentence(true, 1, true),
|
||||||
verb,
|
verb,
|
||||||
&to_whom.display_for_sentence(true, 1, false)
|
&to_whom.display_for_sentence(true, 1, false)
|
||||||
));
|
));
|
||||||
msg_nonexp.push_str(&format!(
|
|
||||||
ansi!("<red>{} {} {}.<reset>\n"),
|
|
||||||
&by_whom.display_for_sentence(false, 1, true),
|
|
||||||
verb,
|
|
||||||
&to_whom.display_for_sentence(false, 1, false)
|
|
||||||
));
|
|
||||||
|
|
||||||
let (_, wielded) = what_wielded(trans, &Arc::new(by_whom.clone())).await?;
|
let (_, wielded) = what_wielded(trans, &Arc::new(by_whom.clone())).await?;
|
||||||
msg_exp.push_str(&(wielded.normal_attack.start_message(by_whom, to_whom, true) + ".\n"));
|
msg.push_str(&(wielded.normal_attack.start_message(by_whom, to_whom, true) + ".\n"));
|
||||||
msg_nonexp.push_str(&(wielded.normal_attack.start_message(by_whom, to_whom, false) + ".\n"));
|
|
||||||
|
|
||||||
broadcast_to_room(
|
broadcast_to_room(trans, &by_whom.location, None::<&Item>, &msg).await?;
|
||||||
trans,
|
|
||||||
&by_whom.location,
|
|
||||||
None::<&Item>,
|
|
||||||
&msg_exp,
|
|
||||||
Some(msg_nonexp.as_str()),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let ac = by_whom
|
let ac = by_whom
|
||||||
.active_combat
|
.active_combat
|
||||||
@ -1164,9 +1053,8 @@ pub async fn switch_to_power_attack(ctx: &VerbContext<'_>, who: &Arc<Item>) -> U
|
|||||||
None => user_error("They seem to be gone!".to_owned())?,
|
None => user_error("They seem to be gone!".to_owned())?,
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
};
|
};
|
||||||
let msg_exp = pow_att.start_message(who, &to_whom, true) + ".\n";
|
let msg = pow_att.start_message(who, &to_whom, true) + ".\n";
|
||||||
let msg_nonexp = pow_att.start_message(who, &to_whom, false) + ".\n";
|
broadcast_to_room(ctx.trans, &who.location, None, &msg).await?;
|
||||||
broadcast_to_room(ctx.trans, &who.location, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
|
|
||||||
let mut who_mut = (**who).clone();
|
let mut who_mut = (**who).clone();
|
||||||
who_mut.active_combat.as_mut().map(|ac| {
|
who_mut.active_combat.as_mut().map(|ac| {
|
||||||
@ -1259,15 +1147,11 @@ pub async fn switch_to_feint(ctx: &VerbContext<'_>, who: &Arc<Item>) -> UResult<
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
let feint = feints.iter().choose(&mut thread_rng()).unwrap();
|
let feint = feints.iter().choose(&mut thread_rng()).unwrap();
|
||||||
let msg_exp = feint(
|
let msg = feint(
|
||||||
&who.display_for_sentence(true, 1, true),
|
&who.display_for_sentence(true, 1, true),
|
||||||
&to_whom.display_for_sentence(true, 1, false),
|
&to_whom.display_for_sentence(true, 1, false),
|
||||||
);
|
);
|
||||||
let msg_nonexp = feint(
|
broadcast_to_room(ctx.trans, &who.location, None, &msg).await?;
|
||||||
&who.display_for_sentence(false, 1, true),
|
|
||||||
&to_whom.display_for_sentence(false, 1, false),
|
|
||||||
);
|
|
||||||
broadcast_to_room(ctx.trans, &who.location, None, &msg_exp, Some(&msg_nonexp)).await?;
|
|
||||||
|
|
||||||
let mut who_mut = (**who).clone();
|
let mut who_mut = (**who).clone();
|
||||||
who_mut.active_combat.as_mut().map(|ac| {
|
who_mut.active_combat.as_mut().map(|ac| {
|
||||||
@ -1339,22 +1223,11 @@ impl TaskHandler for RotCorpseTaskHandler {
|
|||||||
};
|
};
|
||||||
destroy_container(ctx.trans, &corpse).await?;
|
destroy_container(ctx.trans, &corpse).await?;
|
||||||
|
|
||||||
let msg_exp = format!(
|
let msg = format!(
|
||||||
"{} rots away to nothing.\n",
|
"{} rots away to nothing.\n",
|
||||||
corpse.display_for_sentence(true, 1, true)
|
corpse.display_for_sentence(true, 1, true)
|
||||||
);
|
);
|
||||||
let msg_nonexp = format!(
|
broadcast_to_room(ctx.trans, &corpse.location, None, &msg).await?;
|
||||||
"{} rots away to nothing.\n",
|
|
||||||
corpse.display_for_sentence(false, 1, true)
|
|
||||||
);
|
|
||||||
broadcast_to_room(
|
|
||||||
ctx.trans,
|
|
||||||
&corpse.location,
|
|
||||||
None,
|
|
||||||
&msg_exp,
|
|
||||||
Some(&msg_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,26 +7,21 @@ pub async fn broadcast_to_room(
|
|||||||
trans: &DBTrans,
|
trans: &DBTrans,
|
||||||
location: &str,
|
location: &str,
|
||||||
from_item: Option<&Item>,
|
from_item: Option<&Item>,
|
||||||
message_explicit_ok: &str,
|
message: &str,
|
||||||
message_nonexplicit: Option<&str>,
|
|
||||||
) -> DResult<()> {
|
) -> DResult<()> {
|
||||||
for item in trans.find_items_by_location(location).await? {
|
for item in trans.find_items_by_location(location).await? {
|
||||||
if item.item_type != "player" || item.death_data.is_some() {
|
if item.item_type != "player" || item.death_data.is_some() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some((session, session_dat)) = trans.find_session_for_player(&item.item_code).await?
|
if let Some(exclude) = from_item {
|
||||||
{
|
if exclude.item_code == item.item_code && exclude.item_type == item.item_type {
|
||||||
if session_dat.less_explicit_mode
|
continue;
|
||||||
&& Some(&item.item_code) != from_item.map(|i| &i.item_code)
|
|
||||||
{
|
|
||||||
if let Some(msg) = message_nonexplicit {
|
|
||||||
trans.queue_for_session(&session, Some(msg)).await?;
|
|
||||||
}
|
}
|
||||||
return Ok(());
|
|
||||||
}
|
}
|
||||||
trans
|
if let Some((session, _session_dat)) =
|
||||||
.queue_for_session(&session, Some(message_explicit_ok))
|
trans.find_session_for_player(&item.item_code).await?
|
||||||
.await?;
|
{
|
||||||
|
trans.queue_for_session(&session, Some(message)).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -26,14 +26,12 @@ pub struct DelayedHealthEffect {
|
|||||||
magnitude: i64,
|
magnitude: i64,
|
||||||
delay: u64,
|
delay: u64,
|
||||||
message: String,
|
message: String,
|
||||||
message_nonexp: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
||||||
pub struct DelayedMessageEffect {
|
pub struct DelayedMessageEffect {
|
||||||
delay: u64,
|
delay: u64,
|
||||||
message: String,
|
message: String,
|
||||||
message_nonexp: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DelayedHealthTaskHandler;
|
pub struct DelayedHealthTaskHandler;
|
||||||
@ -73,20 +71,10 @@ impl TaskHandler for DelayedHealthTaskHandler {
|
|||||||
match item_effect_series.1.pop_front() {
|
match item_effect_series.1.pop_front() {
|
||||||
None => Ok(None),
|
None => Ok(None),
|
||||||
Some(DelayedHealthEffect {
|
Some(DelayedHealthEffect {
|
||||||
magnitude,
|
magnitude, message, ..
|
||||||
message,
|
|
||||||
message_nonexp,
|
|
||||||
..
|
|
||||||
}) => {
|
}) => {
|
||||||
let mut item_mut = (*item).clone();
|
let mut item_mut = (*item).clone();
|
||||||
change_health(
|
change_health(ctx.trans, magnitude, &mut item_mut, &message).await?;
|
||||||
ctx.trans,
|
|
||||||
magnitude,
|
|
||||||
&mut item_mut,
|
|
||||||
&message,
|
|
||||||
&message_nonexp,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
ctx.trans.save_item_model(&item_mut).await?;
|
ctx.trans.save_item_model(&item_mut).await?;
|
||||||
Ok(item_effect_series
|
Ok(item_effect_series
|
||||||
.1
|
.1
|
||||||
@ -135,19 +123,8 @@ impl TaskHandler for DelayedMessageTaskHandler {
|
|||||||
}
|
}
|
||||||
match item_effect_series.1.pop_front() {
|
match item_effect_series.1.pop_front() {
|
||||||
None => Ok(None),
|
None => Ok(None),
|
||||||
Some(DelayedMessageEffect {
|
Some(DelayedMessageEffect { message, .. }) => {
|
||||||
message,
|
broadcast_to_room(&ctx.trans, &item.location, None, &message).await?;
|
||||||
message_nonexp,
|
|
||||||
..
|
|
||||||
}) => {
|
|
||||||
broadcast_to_room(
|
|
||||||
&ctx.trans,
|
|
||||||
&item.location,
|
|
||||||
None,
|
|
||||||
&message,
|
|
||||||
Some(&message_nonexp),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(item_effect_series
|
Ok(item_effect_series
|
||||||
.1
|
.1
|
||||||
.front()
|
.front()
|
||||||
@ -214,20 +191,18 @@ pub async fn run_effects(
|
|||||||
delay_secs,
|
delay_secs,
|
||||||
messagef,
|
messagef,
|
||||||
} => {
|
} => {
|
||||||
let (msg_exp, msg_nonexp) = messagef(
|
let msg = messagef(
|
||||||
player,
|
player,
|
||||||
item,
|
item,
|
||||||
target.as_ref().map(|t| &**t).unwrap_or(player),
|
target.as_ref().map(|t| &**t).unwrap_or(player),
|
||||||
);
|
);
|
||||||
if *delay_secs == 0 {
|
if *delay_secs == 0 {
|
||||||
broadcast_to_room(trans, &player.location, None, &msg_exp, Some(&msg_nonexp))
|
broadcast_to_room(trans, &player.location, None, &msg).await?;
|
||||||
.await?;
|
|
||||||
} else {
|
} else {
|
||||||
dispel_time_secs = dispel_time_secs.max(*delay_secs);
|
dispel_time_secs = dispel_time_secs.max(*delay_secs);
|
||||||
let fx = DelayedMessageEffect {
|
let fx = DelayedMessageEffect {
|
||||||
delay: *delay_secs,
|
delay: *delay_secs,
|
||||||
message: msg_exp,
|
message: msg,
|
||||||
message_nonexp: msg_nonexp,
|
|
||||||
};
|
};
|
||||||
let actual_target: &mut Item = *target.as_mut().unwrap_or(&mut player);
|
let actual_target: &mut Item = *target.as_mut().unwrap_or(&mut player);
|
||||||
target_message_series
|
target_message_series
|
||||||
@ -248,14 +223,13 @@ pub async fn run_effects(
|
|||||||
} => {
|
} => {
|
||||||
let health_impact =
|
let health_impact =
|
||||||
(*base_effect + ((skill_multiplier * level) as i64)).min(*max_effect) as i64;
|
(*base_effect + ((skill_multiplier * level) as i64)).min(*max_effect) as i64;
|
||||||
let (msg, msg_nonexp) = message(target.as_ref().map(|t| &**t).unwrap_or(player));
|
let msg = message(target.as_ref().map(|t| &**t).unwrap_or(player));
|
||||||
if *delay_secs == 0 {
|
if *delay_secs == 0 {
|
||||||
change_health(
|
change_health(
|
||||||
trans,
|
trans,
|
||||||
health_impact,
|
health_impact,
|
||||||
*target.as_mut().unwrap_or(&mut player),
|
*target.as_mut().unwrap_or(&mut player),
|
||||||
&msg,
|
&msg,
|
||||||
&msg_nonexp,
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
} else {
|
} else {
|
||||||
@ -265,7 +239,6 @@ pub async fn run_effects(
|
|||||||
magnitude: health_impact,
|
magnitude: health_impact,
|
||||||
delay: *delay_secs,
|
delay: *delay_secs,
|
||||||
message: msg,
|
message: msg,
|
||||||
message_nonexp: msg_nonexp,
|
|
||||||
};
|
};
|
||||||
target_health_series
|
target_health_series
|
||||||
.entry(format!("{}/{}", target_it.item_type, target_it.item_code))
|
.entry(format!("{}/{}", target_it.item_type, target_it.item_code))
|
||||||
@ -376,105 +349,84 @@ pub fn default_effects_for_type() -> &'static BTreeMap<EffectType, EffectSet> {
|
|||||||
effects: vec![
|
effects: vec![
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 0,
|
delay_secs: 0,
|
||||||
messagef: Box::new(|_player, _item, target| (
|
messagef: Box::new(|_player, _item, target|
|
||||||
format!(ansi!("<red>You notice that {} has a fresh gaping wound that looks like it's about to {}!<reset>\n"),
|
format!(ansi!("<red>You notice that {} has a fresh gaping wound that looks like it's about to {}!<reset>\n"),
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
if target.species == SpeciesType::Robot { "leak coolant" } else { "bleed" }
|
if target.species == SpeciesType::Robot { "leak coolant" } else { "bleed" }
|
||||||
),
|
)
|
||||||
format!(ansi!("<red>You notice that {} has a fresh gaping wound that looks like it's about to {}!<reset>\n"),
|
)
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
if target.species == SpeciesType::Robot { "leak coolant" } else { "bleed" }
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 10,
|
delay_secs: 10,
|
||||||
base_effect: -12,
|
base_effect: -12,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: -12,
|
max_effect: -12,
|
||||||
message: Box::new(|target| (
|
message: Box::new(|target|
|
||||||
format!("{} pulses from {}'s wound",
|
format!("{} pulses from {}'s wound",
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
),
|
)
|
||||||
format!("{} pulses from {}'s wound",
|
)
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 20,
|
delay_secs: 20,
|
||||||
base_effect: -10,
|
base_effect: -10,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: -10,
|
max_effect: -10,
|
||||||
message: Box::new(|target| (
|
message: Box::new(|target|
|
||||||
format!("{} pulses from {}'s wound",
|
format!("{} pulses from {}'s wound",
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
),
|
)
|
||||||
format!("{} pulses from {}'s wound",
|
)
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 30,
|
delay_secs: 30,
|
||||||
base_effect: -8,
|
base_effect: -8,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: -8,
|
max_effect: -8,
|
||||||
message: Box::new(|target| (
|
message: Box::new(|target|
|
||||||
format!("{} pulses from {}'s wound",
|
format!("{} pulses from {}'s wound",
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
),
|
)
|
||||||
format!("{} pulses from {}'s wound",
|
)
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 40,
|
delay_secs: 40,
|
||||||
base_effect: -6,
|
base_effect: -6,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: -6,
|
max_effect: -6,
|
||||||
message: Box::new(|target| (
|
message: Box::new(|target|
|
||||||
format!("{} pulses from {}'s wound",
|
format!("{} pulses from {}'s wound",
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
),
|
)
|
||||||
format!("{} pulses from {}'s wound",
|
)
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 50,
|
delay_secs: 50,
|
||||||
base_effect: -4,
|
base_effect: -4,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: -4,
|
max_effect: -4,
|
||||||
message: Box::new(|target| (
|
message: Box::new(|target|
|
||||||
format!("{} pulses from {}'s wound",
|
format!("{} pulses from {}'s wound",
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
),
|
)
|
||||||
format!("{} pulses from {}'s wound",
|
)
|
||||||
if target.species == SpeciesType::Robot { "Coolant" } else { "Blood" },
|
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 60,
|
delay_secs: 60,
|
||||||
base_effect: -2,
|
base_effect: -2,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: -2,
|
max_effect: -2,
|
||||||
message: Box::new(|target| (
|
message: Box::new(|target|
|
||||||
format!("A final tiny drop of {} oozes from {}'s wound as it heals",
|
format!("A final tiny drop of {} oozes from {}'s wound as it heals",
|
||||||
if target.species == SpeciesType::Robot { "coolant" } else { "blood" },
|
if target.species == SpeciesType::Robot { "coolant" } else { "blood" },
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
),
|
)
|
||||||
format!("A final tiny drop of {} oozes from {}'s wound as it clots",
|
)
|
||||||
if target.species == SpeciesType::Robot { "coolant" } else { "blood" },
|
|
||||||
target.display_for_sentence(false, 1, false),
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -483,26 +435,20 @@ pub fn default_effects_for_type() -> &'static BTreeMap<EffectType, EffectSet> {
|
|||||||
effects: vec![
|
effects: vec![
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 0,
|
delay_secs: 0,
|
||||||
messagef: Box::new(|_player, _item, target| (
|
messagef: Box::new(|_player, _item, target|
|
||||||
format!(ansi!("<blue>{} is stunned!<reset>\n"),
|
format!(ansi!("<blue>{} is stunned!<reset>\n"),
|
||||||
target.display_for_sentence(true, 1, true),
|
target.display_for_sentence(true, 1, true),
|
||||||
),
|
)
|
||||||
format!(ansi!("<blue>{} is stunned!<reset>\n"),
|
)
|
||||||
target.display_for_sentence(false, 1, true))
|
|
||||||
))
|
|
||||||
},
|
},
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 30,
|
delay_secs: 30,
|
||||||
messagef: Box::new(|_player, _item, target| (
|
messagef: Box::new(|_player, _item, target|
|
||||||
format!(ansi!("<blue>{} seems to have returned to {} senses!<reset>\n"),
|
format!(ansi!("<blue>{} seems to have returned to {} senses!<reset>\n"),
|
||||||
target.display_for_sentence(true, 1, true),
|
target.display_for_sentence(true, 1, true),
|
||||||
&target.pronouns.object,
|
&target.pronouns.object,
|
||||||
),
|
|
||||||
format!(ansi!("<blue>{} seems to have returned to {} senses!<reset>\n"),
|
|
||||||
target.display_for_sentence(false, 1, true),
|
|
||||||
&target.pronouns.object,
|
|
||||||
)
|
)
|
||||||
))
|
)
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ impl TaskHandler for ShareTaskHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let msg = format!(ansi!("<magenta>{}<reset>\n"), &msg);
|
let msg = format!(ansi!("<magenta>{}<reset>\n"), &msg);
|
||||||
broadcast_to_room(&ctx.trans, &p1.location, None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &p1.location, None, &msg).await?;
|
||||||
|
|
||||||
let mut p1_mut = (*p1).clone();
|
let mut p1_mut = (*p1).clone();
|
||||||
let mut p2_mut = (*p2).clone();
|
let mut p2_mut = (*p2).clone();
|
||||||
@ -638,7 +638,6 @@ pub async fn start_conversation(
|
|||||||
&acceptor.display_for_sentence(false, 1, true),
|
&acceptor.display_for_sentence(false, 1, true),
|
||||||
&acceptor.pronouns.subject
|
&acceptor.pronouns.subject
|
||||||
),
|
),
|
||||||
None,
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@ -708,7 +707,6 @@ pub async fn stop_conversation_mut(
|
|||||||
leave_description,
|
leave_description,
|
||||||
&partner_mut.display_for_sentence(true, 1, false)
|
&partner_mut.display_for_sentence(true, 1, false)
|
||||||
),
|
),
|
||||||
None,
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@ -1078,7 +1076,7 @@ pub async fn change_conversational_style(
|
|||||||
topic.display_readable(),
|
topic.display_readable(),
|
||||||
&alt_topics_str
|
&alt_topics_str
|
||||||
);
|
);
|
||||||
broadcast_to_room(&ctx.trans, &player_item.location, None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &player_item.location, None, &msg).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -1128,7 +1126,7 @@ pub async fn change_conversation_topic(
|
|||||||
other_player.display_for_sentence(true, 1, false),
|
other_player.display_for_sentence(true, 1, false),
|
||||||
topic.display_readable(),
|
topic.display_readable(),
|
||||||
);
|
);
|
||||||
broadcast_to_room(&ctx.trans, &player_item.location, None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &player_item.location, None, &msg).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -1170,7 +1168,7 @@ pub async fn change_conversation_intensity(
|
|||||||
other_player.display_for_sentence(true, 1, false),
|
other_player.display_for_sentence(true, 1, false),
|
||||||
intensity.display_readable(),
|
intensity.display_readable(),
|
||||||
);
|
);
|
||||||
broadcast_to_room(&ctx.trans, &player_item.location, None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &player_item.location, None, &msg).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -473,6 +473,6 @@ pub async fn crit_fail_penalty_for_skill(
|
|||||||
.floor()
|
.floor()
|
||||||
.max(1.0);
|
.max(1.0);
|
||||||
let final_damage = soak_damage(trans, &dist, who, actual_damage_presoak, &part).await?;
|
let final_damage = soak_damage(trans, &dist, who, actual_damage_presoak, &part).await?;
|
||||||
change_health(trans, -final_damage as i64, who, &msg, &msg).await?;
|
change_health(trans, -final_damage as i64, who, &msg).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ pub async fn hunger_changed(trans: &DBTrans, who: &Item) -> DResult<()> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if who.species == SpeciesType::Human {
|
if who.species == SpeciesType::Human {
|
||||||
match say_to_room(&trans, who, &who.location, msg, false).await {
|
match say_to_room(&trans, who, &who.location, msg).await {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(SystemError(e)) => Err(e),
|
Err(SystemError(e)) => Err(e),
|
||||||
Err(UserError(_)) => Ok(()),
|
Err(UserError(_)) => Ok(()),
|
||||||
@ -183,7 +183,7 @@ pub async fn thirst_changed(trans: &DBTrans, who: &Item) -> DResult<()> {
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match say_to_room(&trans, who, &who.location, msg, false).await {
|
match say_to_room(&trans, who, &who.location, msg).await {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(SystemError(e)) => Err(e),
|
Err(SystemError(e)) => Err(e),
|
||||||
Err(UserError(_)) => Ok(()),
|
Err(UserError(_)) => Ok(()),
|
||||||
|
@ -53,8 +53,7 @@ pub trait NPCMessageHandler {
|
|||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum NPCSayType {
|
pub enum NPCSayType {
|
||||||
// Bool is true if it should be filtered for less-explicit.
|
FromFixedList(Vec<&'static str>),
|
||||||
FromFixedList(Vec<(bool, &'static str)>),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -393,7 +392,7 @@ impl TaskHandler for NPCSayTaskHandler {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (is_explicit, say_what) = match &say_info.talk_type {
|
let say_what = match &say_info.talk_type {
|
||||||
NPCSayType::FromFixedList(l) => {
|
NPCSayType::FromFixedList(l) => {
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
match l[..].choose(&mut rng) {
|
match l[..].choose(&mut rng) {
|
||||||
@ -404,20 +403,12 @@ impl TaskHandler for NPCSayTaskHandler {
|
|||||||
);
|
);
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
Some(r) => r.clone(),
|
Some(r) => r,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match say_to_room(
|
match say_to_room(ctx.trans, &npc_item, &npc_item.location, say_what).await {
|
||||||
ctx.trans,
|
|
||||||
&npc_item,
|
|
||||||
&npc_item.location,
|
|
||||||
say_what,
|
|
||||||
is_explicit,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(CommandHandlingError::UserError(e)) => {
|
Err(CommandHandlingError::UserError(e)) => {
|
||||||
info!(
|
info!(
|
||||||
|
@ -260,7 +260,7 @@ impl NPCMessageHandler for DoorbotMsgHandler {
|
|||||||
again, ready for the next candidate for the club - so I suggest you enter \
|
again, ready for the next candidate for the club - so I suggest you enter \
|
||||||
before it closes.\"<reset>. As if by magic, the puzzle resets back to \
|
before it closes.\"<reset>. As if by magic, the puzzle resets back to \
|
||||||
its starting state, and the door swings open with a creak.\n");
|
its starting state, and the door swings open with a creak.\n");
|
||||||
broadcast_to_room(&ctx.trans, &target.location, None, msg, Some(msg)).await?;
|
broadcast_to_room(&ctx.trans, &target.location, None, msg).await?;
|
||||||
ctx.trans
|
ctx.trans
|
||||||
.upsert_task(&Task {
|
.upsert_task(&Task {
|
||||||
meta: TaskMeta {
|
meta: TaskMeta {
|
||||||
@ -286,7 +286,7 @@ impl NPCMessageHandler for DoorbotMsgHandler {
|
|||||||
"Doorbot moves a disc to tower {}. The screen now shows: {}.\n",
|
"Doorbot moves a disc to tower {}. The screen now shows: {}.\n",
|
||||||
to, &descr
|
to, &descr
|
||||||
);
|
);
|
||||||
broadcast_to_room(&ctx.trans, &target.location, None, &msg, Some(&msg)).await?;
|
broadcast_to_room(&ctx.trans, &target.location, None, &msg).await?;
|
||||||
room_item.details_dyn_suffix = Some(descr);
|
room_item.details_dyn_suffix = Some(descr);
|
||||||
ctx.trans.save_item_model(&room_item).await?;
|
ctx.trans.save_item_model(&room_item).await?;
|
||||||
|
|
||||||
@ -375,22 +375,22 @@ pub fn npc_list() -> Vec<NPC> {
|
|||||||
say_code: "babble",
|
say_code: "babble",
|
||||||
frequency_secs: 120,
|
frequency_secs: 120,
|
||||||
talk_type: FromFixedList(vec!(
|
talk_type: FromFixedList(vec!(
|
||||||
(false, "I wish I could get into the secret hackers club - I heard they have a machine that hacks your wristpad to make you a super smart dork."),
|
("I wish I could get into the secret hackers club - I heard they have a machine that hacks your wristpad to make you a super smart dork."),
|
||||||
(false, "The basement here is pretty dangerous with all those robots."),
|
("The basement here is pretty dangerous with all those robots."),
|
||||||
(false, "I overhead a real dork bragging about how he managed to get all four rings onto the rightmost virtual peg. No idea what that was about!"),
|
("I overhead a real dork bragging about how he managed to get all four rings onto the rightmost virtual peg. No idea what that was about!"),
|
||||||
(false, "Why is it that all the dorks around here keep whispering stuff to each other about Towers of Hanoi?"),
|
("Why is it that all the dorks around here keep whispering stuff to each other about Towers of Hanoi?"),
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
let killbot_stdsay = NPCSayInfo {
|
let killbot_stdsay = NPCSayInfo {
|
||||||
say_code: "babble",
|
say_code: "babble",
|
||||||
frequency_secs: 20,
|
frequency_secs: 20,
|
||||||
talk_type: FromFixedList(vec!(
|
talk_type: FromFixedList(vec![
|
||||||
(false, "My mission is to EXTERMINATE"),
|
"My mission is to EXTERMINATE",
|
||||||
(false, "Intruder kill mode active"),
|
"Intruder kill mode active",
|
||||||
(false, "Recoverable Error: Preset Kill Limit not set. Treating as unlimited"),
|
"Recoverable Error: Preset Kill Limit not set. Treating as unlimited",
|
||||||
(false, "404 action module STUN not found. Falling back to action KILL underscore WITH underscore EXTREME underscore PREJUDICE"),
|
"404 action module STUN not found. Falling back to action KILL underscore WITH underscore EXTREME underscore PREJUDICE",
|
||||||
))
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
fn geek_gender_word(pronouns: &NPCPronounType) -> &'static str {
|
fn geek_gender_word(pronouns: &NPCPronounType) -> &'static str {
|
||||||
|
@ -19,16 +19,16 @@ pub fn npc_list() -> Vec<NPC> {
|
|||||||
let melbs_citizen_stdsay = NPCSayInfo {
|
let melbs_citizen_stdsay = NPCSayInfo {
|
||||||
say_code: "babble",
|
say_code: "babble",
|
||||||
frequency_secs: 120,
|
frequency_secs: 120,
|
||||||
talk_type: FromFixedList(vec!(
|
talk_type: FromFixedList(vec![
|
||||||
(false, "I'm so sick of being cloned."),
|
"I'm so sick of being cloned.",
|
||||||
(false, "I hope I don't die again today."),
|
"I hope I don't die again today.",
|
||||||
(false, "I wish the so-called king would do something about the damned zombies everywhere."),
|
"I wish the so-called king would do something about the damned zombies everywhere.",
|
||||||
(true, "I earn so many credits making babies for the body factory - it literally pays my bills."),
|
"I heard in the olden days before the empire babies grew up naturally instead of being taken away to the body factory.",
|
||||||
(false, "I know people hated the empire, but I kind of wish it was still intact - it was a lot better than what we have now."),
|
"I know people hated the empire, but I kind of wish it was still intact - it was a lot better than what we have now.",
|
||||||
(false, "I wish there wasn't so much radiation outside of Melbs CBD."),
|
"I wish there wasn't so much radiation outside of Melbs CBD.",
|
||||||
(false, "I heard about a guy who went to a special place somewhere around here, and there was a machine that enhanced his wristpad and gave him basically superpowers."),
|
"I heard about a guy who went to a special place somewhere around here, and there was a machine that enhanced his wristpad and gave him basically superpowers.",
|
||||||
(false, "The damn vampire movement... they are all so sneaky, and I never know when they are going to come for my blood."),
|
"The damn vampire movement... they are all so sneaky, and I never know when they are going to come for my blood.",
|
||||||
))
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
from_yaml_str::<Vec<Citizen>>(include_str!("melbs_citizen.yaml"))
|
from_yaml_str::<Vec<Citizen>>(include_str!("melbs_citizen.yaml"))
|
||||||
|
@ -50,34 +50,23 @@ impl HireHandler for RoboporterHandler {
|
|||||||
} else {
|
} else {
|
||||||
50 - stats.total_count
|
50 - stats.total_count
|
||||||
};
|
};
|
||||||
let mut msg_exp = String::new();
|
let mut msg = String::new();
|
||||||
let mut msg_nonexp = String::new();
|
let desc = target.display_for_sentence(true, 1, true);
|
||||||
let desc_exp = target.display_for_sentence(true, 1, true);
|
|
||||||
let desc_nonexp = target.display_for_sentence(false, 1, true);
|
|
||||||
for item in trans.find_items_by_location(&target.refstr()).await? {
|
for item in trans.find_items_by_location(&target.refstr()).await? {
|
||||||
if remaining_space > 0 {
|
if remaining_space > 0 {
|
||||||
msg_exp.push_str(&format!(
|
msg.push_str(&format!(
|
||||||
"{} unloads {} from {}\n",
|
"{} unloads {} from {}\n",
|
||||||
&desc_exp,
|
&desc,
|
||||||
&item.display_for_sentence(true, 1, false),
|
&item.display_for_sentence(true, 1, false),
|
||||||
&target.pronouns.intensive
|
&target.pronouns.intensive
|
||||||
));
|
));
|
||||||
msg_nonexp.push_str(&format!(
|
|
||||||
"{} unloads {} from {}\n",
|
|
||||||
&desc_nonexp,
|
|
||||||
&item.display_for_sentence(false, 1, false),
|
|
||||||
&target.pronouns.intensive
|
|
||||||
));
|
|
||||||
let mut item_mut = (*item).clone();
|
let mut item_mut = (*item).clone();
|
||||||
item_mut.location = target.location.clone();
|
item_mut.location = target.location.clone();
|
||||||
trans.save_item_model(&item_mut).await?;
|
trans.save_item_model(&item_mut).await?;
|
||||||
remaining_space -= 1;
|
remaining_space -= 1;
|
||||||
} else {
|
} else {
|
||||||
msg_exp.push_str(&format!("{} unloads {} - but since there isn't enough space to put it down, flicks it into the Roboporter's onboard furnace compartment!\n",
|
msg.push_str(&format!("{} unloads {} - but since there isn't enough space to put it down, flicks it into the Roboporter's onboard furnace compartment!\n",
|
||||||
&desc_exp, &item.display_for_sentence(true, 1, false),
|
&desc, &item.display_for_sentence(true, 1, false),
|
||||||
));
|
|
||||||
msg_nonexp.push_str(&format!("{} unloads {} - but since there isn't enough space to put it down, flicks it into the Roboporter's onboard furnace compartment!\n",
|
|
||||||
&desc_exp, &item.display_for_sentence(false, 1, false),
|
|
||||||
));
|
));
|
||||||
recursively_destroy_or_move_item(trans, &item).await?;
|
recursively_destroy_or_move_item(trans, &item).await?;
|
||||||
}
|
}
|
||||||
@ -89,22 +78,12 @@ impl HireHandler for RoboporterHandler {
|
|||||||
{
|
{
|
||||||
if return_to != &target.location {
|
if return_to != &target.location {
|
||||||
target.location = return_to.to_owned();
|
target.location = return_to.to_owned();
|
||||||
msg_exp.push_str(
|
msg.push_str(
|
||||||
&format!("By some marvel of modern engineering, {} disappears in a puff of smoke and is gone.\n",
|
&format!("By some marvel of modern engineering, {} disappears in a puff of smoke and is gone.\n",
|
||||||
desc_exp));
|
desc));
|
||||||
msg_nonexp.push_str(
|
|
||||||
&format!("By some marvel of modern engineering, {} disappears in a puff of smoke and is gone.\n",
|
|
||||||
desc_nonexp));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
broadcast_to_room(
|
broadcast_to_room(trans, &old_location, None, msg.as_str()).await?;
|
||||||
trans,
|
|
||||||
&old_location,
|
|
||||||
None,
|
|
||||||
msg_exp.as_str(),
|
|
||||||
Some(msg_nonexp.as_str()),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,11 +101,6 @@ impl ArglessHandler for CorpLicenceHandler {
|
|||||||
&player.display_for_sentence(true, 1, true),
|
&player.display_for_sentence(true, 1, true),
|
||||||
name
|
name
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} signs a contract establishing {} as a corp\n",
|
|
||||||
&player.display_for_sentence(false, 1, true),
|
|
||||||
name
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let corp_id = ctx
|
let corp_id = ctx
|
||||||
|
@ -91,12 +91,6 @@ impl InstallHandler for ScanLockInstall {
|
|||||||
&direction.describe(),
|
&direction.describe(),
|
||||||
&what.display_for_sentence(true, 1, false)
|
&what.display_for_sentence(true, 1, false)
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} bangs the door to the {} as he installs {} on it.\n",
|
|
||||||
&player.display_for_sentence(false, 1, true),
|
|
||||||
&direction.describe(),
|
|
||||||
&what.display_for_sentence(false, 1, false)
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -140,13 +134,6 @@ impl InstallHandler for ScanLockInstall {
|
|||||||
&what.display_for_sentence(true, 1, false),
|
&what.display_for_sentence(true, 1, false),
|
||||||
extra_text
|
extra_text
|
||||||
),
|
),
|
||||||
Some(&format!(
|
|
||||||
"{} bangs the door to the {} as he uninstalls {} from it{}.\n",
|
|
||||||
&player.display_for_sentence(false, 1, true),
|
|
||||||
&direction.describe(),
|
|
||||||
&what.display_for_sentence(false, 1, false),
|
|
||||||
extra_text
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -30,7 +30,7 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
effects: vec!(
|
effects: vec!(
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 0,
|
delay_secs: 0,
|
||||||
messagef: Box::new(|player, _item, target| (
|
messagef: Box::new(|player, _item, target|
|
||||||
format!(
|
format!(
|
||||||
"{} attempts to heal {} with a trauma kit, but fucks it up badly\n",
|
"{} attempts to heal {} with a trauma kit, but fucks it up badly\n",
|
||||||
&player.display_for_sentence(true, 1, true),
|
&player.display_for_sentence(true, 1, true),
|
||||||
@ -40,28 +40,17 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
target.display_for_sentence(true, 1, false)
|
target.display_for_sentence(true, 1, false)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
format!("{} attempts to heal {} with a trauma kit, but messes it up badly\n",
|
)
|
||||||
&player.display_for_sentence(false, 1, true),
|
|
||||||
&if target.item_type == player.item_type && target.item_code == player.item_code {
|
|
||||||
player.pronouns.intensive.clone()
|
|
||||||
} else {
|
|
||||||
target.display_for_sentence(false, 1, false)
|
|
||||||
}
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 0, base_effect: -2, skill_multiplier: -3.0,
|
delay_secs: 0, base_effect: -2, skill_multiplier: -3.0,
|
||||||
max_effect: -5,
|
max_effect: -5,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
|
||||||
"Fuck! The trauma kit makes {}'s condition worse",
|
|
||||||
target.display_for_sentence(true, 1, false)),
|
|
||||||
format!(
|
format!(
|
||||||
"The trauma kit makes {}'s condition worse",
|
"Fuck! The trauma kit makes {}'s condition worse",
|
||||||
target.display_for_sentence(false, 1, false)
|
target.display_for_sentence(true, 1, false))
|
||||||
)
|
)
|
||||||
))
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
@ -70,7 +59,7 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
effects: vec!(
|
effects: vec!(
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 0,
|
delay_secs: 0,
|
||||||
messagef: Box::new(|player, _item, target| (
|
messagef: Box::new(|player, _item, target|
|
||||||
format!(
|
format!(
|
||||||
"{} attempts unsuccessfully to heal {} with a trauma kit\n",
|
"{} attempts unsuccessfully to heal {} with a trauma kit\n",
|
||||||
&player.display_for_sentence(true, 1, true),
|
&player.display_for_sentence(true, 1, true),
|
||||||
@ -79,15 +68,8 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
} else {
|
} else {
|
||||||
target.display_for_sentence(true, 1, false)
|
target.display_for_sentence(true, 1, false)
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
format!("{} attempts unsuccessfully to heal {} with a trauma kit\n",
|
)
|
||||||
&player.display_for_sentence(false, 1, true),
|
|
||||||
&if target.item_type == player.item_type && target.item_code == player.item_code {
|
|
||||||
player.pronouns.intensive.clone()
|
|
||||||
} else {
|
|
||||||
target.display_for_sentence(false, 1, false)
|
|
||||||
}
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
@ -96,7 +78,7 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
effects: vec!(
|
effects: vec!(
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 0,
|
delay_secs: 0,
|
||||||
messagef: Box::new(|player, _item, target| (
|
messagef: Box::new(|player, _item, target|
|
||||||
format!(
|
format!(
|
||||||
"{} expertly heals {} with a trauma kit\n",
|
"{} expertly heals {} with a trauma kit\n",
|
||||||
&player.display_for_sentence(true, 1, true),
|
&player.display_for_sentence(true, 1, true),
|
||||||
@ -105,31 +87,19 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
} else {
|
} else {
|
||||||
target.display_for_sentence(true, 1, false)
|
target.display_for_sentence(true, 1, false)
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
format!("{} expertly heals {} with a trauma kit\n",
|
)
|
||||||
&player.display_for_sentence(false, 1, true),
|
|
||||||
&if target.item_type == player.item_type && target.item_code == player.item_code {
|
|
||||||
player.pronouns.intensive.clone()
|
|
||||||
} else {
|
|
||||||
target.display_for_sentence(false, 1, false)
|
|
||||||
}
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 0, base_effect: 2, skill_multiplier: 8.0,
|
delay_secs: 0, base_effect: 2, skill_multiplier: 8.0,
|
||||||
max_effect: 10,
|
max_effect: 10,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
format!(
|
||||||
"FUUUCK! It hurts {}, but also starts to soothe {}",
|
"FUUUCK! It hurts {}, but also starts to soothe {}",
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
&target.pronouns.object
|
&target.pronouns.object
|
||||||
),
|
)
|
||||||
format!(
|
|
||||||
"It hurts {}, but also starts to soothe {}",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
&target.pronouns.object
|
|
||||||
))
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
@ -137,16 +107,11 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
max_effect: 9,
|
max_effect: 9,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
format!(
|
||||||
"FUUUCK! It hurts {}, but also starts to soothe {}",
|
"FUUUCK! It hurts {}, but also starts to soothe {}",
|
||||||
target.display_for_sentence(true, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
&target.pronouns.object
|
&target.pronouns.object
|
||||||
),
|
)
|
||||||
format!(
|
|
||||||
"It hurts {}, but also starts to soothe {}",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
&target.pronouns.object
|
|
||||||
))
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
@ -154,14 +119,10 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
max_effect: 7,
|
max_effect: 7,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
|
||||||
"The bandages soothe {}'s wounds",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
),
|
|
||||||
format!(
|
format!(
|
||||||
"The bandages soothe {}'s wounds",
|
"The bandages soothe {}'s wounds",
|
||||||
target.display_for_sentence(false, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
))
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
@ -169,14 +130,10 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
max_effect: 6,
|
max_effect: 6,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
|
||||||
"The bandages soothe {}'s wounds",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
),
|
|
||||||
format!(
|
format!(
|
||||||
"The bandages soothe {}'s wounds",
|
"The bandages soothe {}'s wounds",
|
||||||
target.display_for_sentence(false, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
))
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
@ -184,14 +141,10 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
max_effect: 4,
|
max_effect: 4,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
|
||||||
"The bandages soothe {}'s wounds",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
),
|
|
||||||
format!(
|
format!(
|
||||||
"The bandages soothe {}'s wounds",
|
"The bandages soothe {}'s wounds",
|
||||||
target.display_for_sentence(false, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
))
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
@ -199,14 +152,10 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
max_effect: 3,
|
max_effect: 3,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
|
||||||
"The bandages soothe {}'s wounds",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
),
|
|
||||||
format!(
|
format!(
|
||||||
"The bandages soothe {}'s wounds",
|
"The bandages soothe {}'s wounds",
|
||||||
target.display_for_sentence(false, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
))
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
@ -214,27 +163,20 @@ pub fn data() -> &'static Vec<(PossessionType, PossessionData)> {
|
|||||||
max_effect: 2,
|
max_effect: 2,
|
||||||
message: Box::new(
|
message: Box::new(
|
||||||
|target|
|
|target|
|
||||||
(format!(
|
|
||||||
"The bandages soothe {}'s wounds",
|
|
||||||
target.display_for_sentence(true, 1, false),
|
|
||||||
),
|
|
||||||
format!(
|
format!(
|
||||||
"The bandages soothe {}'s wounds",
|
"The bandages soothe {}'s wounds",
|
||||||
target.display_for_sentence(false, 1, false),
|
target.display_for_sentence(true, 1, false),
|
||||||
))
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Effect::BroadcastMessage {
|
Effect::BroadcastMessage {
|
||||||
delay_secs: 60,
|
delay_secs: 60,
|
||||||
messagef: Box::new(|_player, _item, target| (
|
messagef: Box::new(|_player, _item, target|
|
||||||
format!(
|
format!(
|
||||||
"The bandages wrapping {} crumble and fall away, their healing capabilities fully expended.\n",
|
"The bandages wrapping {} crumble and fall away, their healing capabilities fully expended.\n",
|
||||||
target.display_for_sentence(true, 1, false)
|
target.display_for_sentence(true, 1, false)
|
||||||
),
|
)
|
||||||
format!(
|
)
|
||||||
"The bandages wrapping {} crumble and fall away, their healing capabilities fully expended.\n",
|
|
||||||
target.display_for_sentence(false, 1, false)
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
@ -121,48 +121,28 @@ impl TaskHandler for SeePatientTaskHandler {
|
|||||||
base_effect: 10,
|
base_effect: 10,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: 10,
|
max_effect: 10,
|
||||||
message: Box::new(|_item| {
|
message: Box::new(|_item| "That feels better".to_owned()),
|
||||||
(
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 10,
|
delay_secs: 10,
|
||||||
base_effect: 9,
|
base_effect: 9,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: 10,
|
max_effect: 10,
|
||||||
message: Box::new(|_item| {
|
message: Box::new(|_item| "That feels better".to_owned()),
|
||||||
(
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 20,
|
delay_secs: 20,
|
||||||
base_effect: 8,
|
base_effect: 8,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: 10,
|
max_effect: 10,
|
||||||
message: Box::new(|_item| {
|
message: Box::new(|_item| "That feels better".to_owned()),
|
||||||
(
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
Effect::ChangeTargetHealth {
|
Effect::ChangeTargetHealth {
|
||||||
delay_secs: 30,
|
delay_secs: 30,
|
||||||
base_effect: 7,
|
base_effect: 7,
|
||||||
skill_multiplier: 0.0,
|
skill_multiplier: 0.0,
|
||||||
max_effect: 10,
|
max_effect: 10,
|
||||||
message: Box::new(|_item| {
|
message: Box::new(|_item| "That feels better".to_owned()),
|
||||||
(
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
"That feels better".to_owned(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user