forked from blasthavers/blastmud
Cleanup most of the less_explicit mode support
This commit is contained in:
parent
58c815f8b4
commit
68fc094c15
@ -386,6 +386,7 @@ impl DBTrans {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub async fn save_session_model<'a>(
|
pub async fn save_session_model<'a>(
|
||||||
self: &'a Self,
|
self: &'a Self,
|
||||||
session: &'a ListenerSession,
|
session: &'a ListenerSession,
|
||||||
@ -455,9 +456,7 @@ impl DBTrans {
|
|||||||
// be reset on restart.
|
// be reset on restart.
|
||||||
for to_copy in [
|
for to_copy in [
|
||||||
"display",
|
"display",
|
||||||
"display_less_explicit",
|
|
||||||
"details",
|
"details",
|
||||||
"details_less_explicit",
|
|
||||||
"total_xp",
|
"total_xp",
|
||||||
"total_stats",
|
"total_stats",
|
||||||
"total_skills",
|
"total_skills",
|
||||||
@ -1022,8 +1021,7 @@ impl DBTrans {
|
|||||||
&format!(
|
&format!(
|
||||||
"WITH {} SELECT details FROM relevant_items \
|
"WITH {} SELECT details FROM relevant_items \
|
||||||
WHERE \
|
WHERE \
|
||||||
((lower(details->>'display') LIKE $1) \
|
(lower(details->>'display') LIKE $1) \
|
||||||
OR (lower(details ->>'display_less_explicit') LIKE $1) \
|
|
||||||
OR EXISTS (SELECT 1 FROM jsonb_array_elements(aliases) AS al(alias) WHERE \
|
OR EXISTS (SELECT 1 FROM jsonb_array_elements(aliases) AS al(alias) WHERE \
|
||||||
LOWER(alias#>>'{{}}') LIKE $1)) {} \
|
LOWER(alias#>>'{{}}') LIKE $1)) {} \
|
||||||
ORDER BY {} ABS(length(details->>'display')-$3) ASC \
|
ORDER BY {} ABS(length(details->>'display')-$3) ASC \
|
||||||
|
@ -60,10 +60,6 @@ impl UserVerb for Verb {
|
|||||||
.display
|
.display
|
||||||
.to_lowercase()
|
.to_lowercase()
|
||||||
.starts_with(&match_item)
|
.starts_with(&match_item)
|
||||||
|| possession_type
|
|
||||||
.display_less_explicit
|
|
||||||
.map(|d| d.to_lowercase().starts_with(&match_item))
|
|
||||||
.unwrap_or(false)
|
|
||||||
|| possession_type
|
|| possession_type
|
||||||
.aliases
|
.aliases
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -25,11 +25,6 @@ impl UserVerb for Verb {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|it| {
|
.filter(|it| {
|
||||||
it.display.to_lowercase().starts_with(&npc_name)
|
it.display.to_lowercase().starts_with(&npc_name)
|
||||||
|| it
|
|
||||||
.display_less_explicit
|
|
||||||
.as_ref()
|
|
||||||
.map(|v| v.to_lowercase().starts_with(&npc_name))
|
|
||||||
.unwrap_or(false)
|
|
||||||
|| it
|
|| it
|
||||||
.aliases
|
.aliases
|
||||||
.iter()
|
.iter()
|
||||||
@ -54,7 +49,7 @@ impl UserVerb for Verb {
|
|||||||
&ctx.session,
|
&ctx.session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"A hushed silence falls over the room as you fire {}.\n",
|
"A hushed silence falls over the room as you fire {}.\n",
|
||||||
npc.display_for_session(&ctx.session_dat),
|
npc.display_for_sentence(1, false),
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -123,7 +123,7 @@ pub async fn stop_following(trans: &DBTrans, follower: &mut Item) -> UResult<()>
|
|||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
if follower.item_type == "player" {
|
if follower.item_type == "player" {
|
||||||
if let Some((session, session_dat)) =
|
if let Some((session, _session_dat)) =
|
||||||
trans.find_session_for_player(&follower.item_code).await?
|
trans.find_session_for_player(&follower.item_code).await?
|
||||||
{
|
{
|
||||||
trans
|
trans
|
||||||
@ -131,7 +131,7 @@ pub async fn stop_following(trans: &DBTrans, follower: &mut Item) -> UResult<()>
|
|||||||
&session,
|
&session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"You are no longer following {}.\n",
|
"You are no longer following {}.\n",
|
||||||
old_item.display_for_session(&session_dat)
|
old_item.display_for_sentence(1, false)
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -243,7 +243,7 @@ impl UserVerb for Verb {
|
|||||||
&ctx.session,
|
&ctx.session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"You are now following {}.\n",
|
"You are now following {}.\n",
|
||||||
&follow_whom.display_for_session(&ctx.session_dat)
|
&follow_whom.display_for_sentence(1, false)
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -70,13 +70,13 @@ impl TaskHandler for ChargeWagesTaskHandler {
|
|||||||
let sess_and_dat = ctx.trans.find_session_for_player(&hired_by).await?;
|
let sess_and_dat = ctx.trans.find_session_for_player(&hired_by).await?;
|
||||||
|
|
||||||
if hire_dat.price > bill_user.credits {
|
if hire_dat.price > bill_user.credits {
|
||||||
if let Some((sess, sess_dat)) = sess_and_dat {
|
if let Some((sess, _sess_dat)) = sess_and_dat {
|
||||||
ctx.trans
|
ctx.trans
|
||||||
.queue_for_session(
|
.queue_for_session(
|
||||||
&sess,
|
&sess,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"<yellow>{} says: <reset><bold>\"{}\"<reset>\n",
|
"<yellow>{} says: <reset><bold>\"{}\"<reset>\n",
|
||||||
&npc.display_for_session(&sess_dat),
|
&npc.display_for_sentence(1, false),
|
||||||
RESIGNATION_NOTICE
|
RESIGNATION_NOTICE
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -96,10 +96,10 @@ impl TaskHandler for ChargeWagesTaskHandler {
|
|||||||
ctx.trans.save_user_model(&bill_user).await?;
|
ctx.trans.save_user_model(&bill_user).await?;
|
||||||
match sess_and_dat.as_ref() {
|
match sess_and_dat.as_ref() {
|
||||||
None => {},
|
None => {},
|
||||||
Some((sess, sess_dat)) => ctx.trans.queue_for_session(
|
Some((sess, _sess_dat)) => ctx.trans.queue_for_session(
|
||||||
sess, Some(&format!(
|
sess, Some(&format!(
|
||||||
ansi!("<yellow>Your wristpad beeps for a deduction of ${} for wages for {}.<reset>\n"),
|
ansi!("<yellow>Your wristpad beeps for a deduction of ${} for wages for {}.<reset>\n"),
|
||||||
&hire_dat.price, &npc.display_for_session(&sess_dat)
|
&hire_dat.price, &npc.display_for_sentence(1, false)
|
||||||
))
|
))
|
||||||
).await?
|
).await?
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ impl UserVerb for Verb {
|
|||||||
{
|
{
|
||||||
msg.push_str(&format!(
|
msg.push_str(&format!(
|
||||||
"* {} @ ${} / {}\n",
|
"* {} @ ${} / {}\n",
|
||||||
emp.display_for_session(&ctx.session_dat),
|
emp.display_for_sentence(1, false),
|
||||||
hire_dat.price,
|
hire_dat.price,
|
||||||
humantime::format_duration(std::time::Duration::from_secs(
|
humantime::format_duration(std::time::Duration::from_secs(
|
||||||
hire_dat.frequency_secs,
|
hire_dat.frequency_secs,
|
||||||
@ -185,7 +185,7 @@ impl UserVerb for Verb {
|
|||||||
ansi!(
|
ansi!(
|
||||||
"<yellow>{} says: <reset><bold>\"You wouldn't be able to afford me.\"<reset>"
|
"<yellow>{} says: <reset><bold>\"You wouldn't be able to afford me.\"<reset>"
|
||||||
),
|
),
|
||||||
npc.display_for_session(&ctx.session_dat)
|
npc.display_for_sentence(1, false)
|
||||||
))?;
|
))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ impl UserVerb for Verb {
|
|||||||
&ctx.session,
|
&ctx.session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"You hire {}, and your wristpad beeps for a deduction of ${}.\n",
|
"You hire {}, and your wristpad beeps for a deduction of ${}.\n",
|
||||||
npc.display_for_session(&ctx.session_dat),
|
npc.display_for_sentence(1, false),
|
||||||
hire_dat.price
|
hire_dat.price
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
@ -436,7 +436,7 @@ impl UserVerb for Verb {
|
|||||||
if item.item_type != "possession" {
|
if item.item_type != "possession" {
|
||||||
user_error(format!(
|
user_error(format!(
|
||||||
"You can't improvise with {}!",
|
"You can't improvise with {}!",
|
||||||
&item.display_for_session(&ctx.session_dat)
|
&item.display_for_sentence(1, false)
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
input_ids.insert(item.item_code.to_owned());
|
input_ids.insert(item.item_code.to_owned());
|
||||||
|
@ -6,14 +6,10 @@ pub struct Verb;
|
|||||||
impl UserVerb for Verb {
|
impl UserVerb for Verb {
|
||||||
async fn handle(
|
async fn handle(
|
||||||
self: &Self,
|
self: &Self,
|
||||||
ctx: &mut VerbContext,
|
_ctx: &mut VerbContext,
|
||||||
_verb: &str,
|
_verb: &str,
|
||||||
_remaining: &str,
|
_remaining: &str,
|
||||||
) -> UResult<()> {
|
) -> UResult<()> {
|
||||||
(*ctx.session_dat).less_explicit_mode = true;
|
|
||||||
ctx.trans
|
|
||||||
.save_session_model(ctx.session, ctx.session_dat)
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ impl UserVerb for Verb {
|
|||||||
}) if hired_by == &player_item.item_code => {}
|
}) if hired_by == &player_item.item_code => {}
|
||||||
_ => user_error(format!(
|
_ => user_error(format!(
|
||||||
"{} doesn't seem to be letting you do that. Try hiring {} first!",
|
"{} doesn't seem to be letting you do that. Try hiring {} first!",
|
||||||
npc.display_for_session(&ctx.session_dat),
|
npc.display_for_sentence(1, false),
|
||||||
npc.pronouns.object
|
npc.pronouns.object
|
||||||
))?,
|
))?,
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ pub async fn describe_normal_item(
|
|||||||
.map(|(it, _)| it)
|
.map(|(it, _)| it)
|
||||||
{
|
{
|
||||||
any_part_text = true;
|
any_part_text = true;
|
||||||
let display = top_item.display_for_session(&ctx.session_dat);
|
let display = top_item.display_for_sentence(1, false);
|
||||||
if !seen_clothes.contains(&display) {
|
if !seen_clothes.contains(&display) {
|
||||||
seen_clothes.insert(display.clone());
|
seen_clothes.insert(display.clone());
|
||||||
contents_desc.push_str(&format!(
|
contents_desc.push_str(&format!(
|
||||||
@ -333,8 +333,8 @@ pub async fn describe_normal_item(
|
|||||||
ctx.session,
|
ctx.session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"{}\n{}\n{}",
|
"{}\n{}\n{}",
|
||||||
&item.display_for_session(&ctx.session_dat),
|
&item.display_for_sentence(1, false),
|
||||||
item.details_for_session(&ctx.session_dat).unwrap_or(""),
|
&item.details.as_ref().map(|d| d.as_str()).unwrap_or(""),
|
||||||
contents_desc,
|
contents_desc,
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -396,9 +396,9 @@ pub async fn describe_room(
|
|||||||
&word_wrap(
|
&word_wrap(
|
||||||
&format!(
|
&format!(
|
||||||
ansi!("<yellow>{}<reset> (<blue>{}<reset>)\n{}{}.{}\n{}\n"),
|
ansi!("<yellow>{}<reset> (<blue>{}<reset>)\n{}{}.{}\n{}\n"),
|
||||||
item.display_for_session(&ctx.session_dat),
|
item.display_for_sentence(1, false),
|
||||||
zone,
|
zone,
|
||||||
item.details_for_session(&ctx.session_dat).unwrap_or(""),
|
&item.details.as_ref().map(|d| d.as_str()).unwrap_or(""),
|
||||||
item.details_dyn_suffix
|
item.details_dyn_suffix
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|d| d.as_str())
|
.map(|d| d.as_str())
|
||||||
@ -432,9 +432,9 @@ pub async fn describe_dynroom(
|
|||||||
&word_wrap(
|
&word_wrap(
|
||||||
&format!(
|
&format!(
|
||||||
ansi!("<yellow>{}<reset> (<blue>{}<reset>)\n{}.{}\n{}\n"),
|
ansi!("<yellow>{}<reset> (<blue>{}<reset>)\n{}.{}\n{}\n"),
|
||||||
item.display_for_session(&ctx.session_dat),
|
item.display_for_sentence(1, false),
|
||||||
dynzone.zonename,
|
dynzone.zonename,
|
||||||
item.details_for_session(&ctx.session_dat).unwrap_or(""),
|
&item.details.as_ref().map(|d| d.as_str()).unwrap_or(""),
|
||||||
contents,
|
contents,
|
||||||
exits_for_dyn(dynroom)
|
exits_for_dyn(dynroom)
|
||||||
),
|
),
|
||||||
@ -463,7 +463,7 @@ async fn describe_door(
|
|||||||
.await?
|
.await?
|
||||||
.first()
|
.first()
|
||||||
{
|
{
|
||||||
let lock_desc = lock.display_for_session(&ctx.session_dat);
|
let lock_desc = lock.display_for_sentence(1, false);
|
||||||
msg.push_str(&format!(" The door is locked with {}", &lock_desc));
|
msg.push_str(&format!(" The door is locked with {}", &lock_desc));
|
||||||
}
|
}
|
||||||
msg.push('\n');
|
msg.push('\n');
|
||||||
@ -511,7 +511,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
|||||||
if let Some(sit_on) = ctx.trans.find_item_by_type_code(on_type, on_code).await?
|
if let Some(sit_on) = ctx.trans.find_item_by_type_code(on_type, on_code).await?
|
||||||
{
|
{
|
||||||
buf.push_str("on ");
|
buf.push_str("on ");
|
||||||
buf.push_str(&sit_on.display_for_session(&ctx.session_dat));
|
buf.push_str(&sit_on.display_for_sentence(1, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
|||||||
if let Some(sit_on) = ctx.trans.find_item_by_type_code(on_type, on_code).await?
|
if let Some(sit_on) = ctx.trans.find_item_by_type_code(on_type, on_code).await?
|
||||||
{
|
{
|
||||||
buf.push_str("on ");
|
buf.push_str("on ");
|
||||||
buf.push_str(&sit_on.display_for_session(&ctx.session_dat));
|
buf.push_str(&sit_on.display_for_sentence(1, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,7 +557,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
|||||||
Some((ttype, tcode)) => {
|
Some((ttype, tcode)) => {
|
||||||
match ctx.trans.find_item_by_type_code(ttype, tcode).await? {
|
match ctx.trans.find_item_by_type_code(ttype, tcode).await? {
|
||||||
None => buf.push_str("someone"),
|
None => buf.push_str("someone"),
|
||||||
Some(it) => buf.push_str(&it.display_for_session(&ctx.session_dat)),
|
Some(it) => buf.push_str(&it.display_for_sentence(1, false)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -379,7 +379,7 @@ impl UserVerb for Verb {
|
|||||||
match (recipe_craft.bench.as_ref(), bench.as_ref()) {
|
match (recipe_craft.bench.as_ref(), bench.as_ref()) {
|
||||||
(Some(bench_type), None) => user_error(format!(
|
(Some(bench_type), None) => user_error(format!(
|
||||||
"The {} can only be made on the {}.",
|
"The {} can only be made on the {}.",
|
||||||
&instructions.display_for_session(&ctx.session_dat),
|
&instructions.display_for_sentence(1, false),
|
||||||
possession_data()
|
possession_data()
|
||||||
.get(bench_type)
|
.get(bench_type)
|
||||||
.map(|pd| pd.display)
|
.map(|pd| pd.display)
|
||||||
@ -390,7 +390,7 @@ impl UserVerb for Verb {
|
|||||||
{
|
{
|
||||||
user_error(format!(
|
user_error(format!(
|
||||||
"The {} can only be made on the {}.",
|
"The {} can only be made on the {}.",
|
||||||
&instructions.display_for_session(&ctx.session_dat),
|
&instructions.display_for_sentence(1, false),
|
||||||
possession_data()
|
possession_data()
|
||||||
.get(bench_type)
|
.get(bench_type)
|
||||||
.map(|pd| pd.display)
|
.map(|pd| pd.display)
|
||||||
|
@ -594,9 +594,7 @@ async fn attempt_move_immediate(
|
|||||||
for attacker in &attackers[..] {
|
for attacker in &attackers[..] {
|
||||||
if let Some((atype, acode)) = attacker.split_once("/") {
|
if let Some((atype, acode)) = attacker.split_once("/") {
|
||||||
if let Some(aitem) = ctx.trans.find_item_by_type_code(atype, acode).await? {
|
if let Some(aitem) = ctx.trans.find_item_by_type_code(atype, acode).await? {
|
||||||
if let Some((_, session_dat)) = session.as_ref() {
|
attacker_names.push(aitem.display_for_sentence(1, false));
|
||||||
attacker_names.push(aitem.display_for_session(session_dat));
|
|
||||||
}
|
|
||||||
// We don't push the actual attacker Item, because another attacker
|
// We don't push the actual attacker Item, because another attacker
|
||||||
// might re-target this attacker when we escape, causing the structure
|
// might re-target this attacker when we escape, causing the structure
|
||||||
// to be out of date. Instead, we push the type, code pair and look it
|
// to be out of date. Instead, we push the type, code pair and look it
|
||||||
|
@ -60,7 +60,7 @@ impl UserVerb for Verb {
|
|||||||
ctx.session,
|
ctx.session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
ansi!("<blue>You page {} on your wristpad: \"{}\"<reset>\n"),
|
ansi!("<blue>You page {} on your wristpad: \"{}\"<reset>\n"),
|
||||||
to_whom.display_for_session(&ctx.session_dat),
|
to_whom.display_for_sentence(1, false),
|
||||||
say_what
|
say_what
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -90,7 +90,7 @@ impl UserVerb for Verb {
|
|||||||
&other_session,
|
&other_session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
ansi!("<blue>Your wristpad beeps with page from {}: \"{}\"<reset>\n"),
|
ansi!("<blue>Your wristpad beeps with page from {}: \"{}\"<reset>\n"),
|
||||||
player_item.display_for_session(&ctx.session_dat),
|
player_item.display_for_sentence(1, false),
|
||||||
say_what
|
say_what
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
@ -248,8 +248,8 @@ impl UserVerb for Verb {
|
|||||||
.queue_for_session(&ctx.session,
|
.queue_for_session(&ctx.session,
|
||||||
Some(
|
Some(
|
||||||
&format!("For ease of later use, you decide to rip the pages out of {} before placing them in {}.\n",
|
&format!("For ease of later use, you decide to rip the pages out of {} before placing them in {}.\n",
|
||||||
&target.display_for_session(&ctx.session_dat),
|
&target.display_for_sentence(1, false),
|
||||||
&into_what.display_for_session(&ctx.session_dat)),
|
&into_what.display_for_sentence(1, false)),
|
||||||
)
|
)
|
||||||
).await?;
|
).await?;
|
||||||
for page in pages {
|
for page in pages {
|
||||||
|
@ -267,11 +267,7 @@ impl QueueCommandHandler for QueueHandler {
|
|||||||
{
|
{
|
||||||
item_mut.possession_type = Some(new_poss.clone());
|
item_mut.possession_type = Some(new_poss.clone());
|
||||||
item_mut.display = new_poss_dat.display.to_owned();
|
item_mut.display = new_poss_dat.display.to_owned();
|
||||||
item_mut.display_less_explicit =
|
|
||||||
new_poss_dat.display_less_explicit.map(|d| d.to_owned());
|
|
||||||
item_mut.details = Some(new_poss_dat.details.to_owned());
|
item_mut.details = Some(new_poss_dat.details.to_owned());
|
||||||
item_mut.details_less_explicit =
|
|
||||||
new_poss_dat.details_less_explicit.map(|d| d.to_owned());
|
|
||||||
item_mut.aliases = new_poss_dat
|
item_mut.aliases = new_poss_dat
|
||||||
.aliases
|
.aliases
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -49,8 +49,8 @@ impl UserVerb for Verb {
|
|||||||
ctx.session,
|
ctx.session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
||||||
player_item.display_for_session(&ctx.session_dat),
|
player_item.display_for_sentence(1, false),
|
||||||
to_whom.display_for_session(&ctx.session_dat),
|
to_whom.display_for_sentence(1, false),
|
||||||
say_what
|
say_what
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -85,8 +85,8 @@ impl UserVerb for Verb {
|
|||||||
&other_session,
|
&other_session,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
||||||
player_item.display_for_session(&ctx.session_dat),
|
player_item.display_for_sentence(1, false),
|
||||||
to_whom.display_for_session(&ctx.session_dat),
|
to_whom.display_for_sentence(1, false),
|
||||||
say_what
|
say_what
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::{effect::EffectType, session::Session};
|
use super::effect::EffectType;
|
||||||
use crate::{
|
use crate::{
|
||||||
language,
|
language,
|
||||||
regular_tasks::queued_command::QueueCommand,
|
regular_tasks::queued_command::QueueCommand,
|
||||||
@ -672,9 +672,7 @@ pub struct Item {
|
|||||||
pub death_data: Option<DeathData>,
|
pub death_data: Option<DeathData>,
|
||||||
pub details: Option<String>,
|
pub details: Option<String>,
|
||||||
pub details_dyn_suffix: Option<String>,
|
pub details_dyn_suffix: Option<String>,
|
||||||
pub details_less_explicit: Option<String>,
|
|
||||||
pub display: String,
|
pub display: String,
|
||||||
pub display_less_explicit: Option<String>,
|
|
||||||
pub door_states: Option<BTreeMap<Direction, DoorState>>,
|
pub door_states: Option<BTreeMap<Direction, DoorState>>,
|
||||||
pub dynamic_entrance: Option<DynamicEntrance>,
|
pub dynamic_entrance: Option<DynamicEntrance>,
|
||||||
pub flags: Vec<ItemFlag>,
|
pub flags: Vec<ItemFlag>,
|
||||||
@ -732,18 +730,6 @@ impl Item {
|
|||||||
buf
|
buf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn display_for_session<'l>(self: &'l Self, _session: &Session) -> String {
|
|
||||||
self.display_for_sentence(1, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn details_for_session<'l>(self: &'l Self, session: &Session) -> Option<&'l str> {
|
|
||||||
self.details.as_ref().map(|dets| {
|
|
||||||
session.explicit_if_allowed(
|
|
||||||
dets.as_str(),
|
|
||||||
self.details_less_explicit.as_ref().map(String::as_str),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn refstr(&self) -> String {
|
pub fn refstr(&self) -> String {
|
||||||
format!("{}/{}", &self.item_type, &self.item_code)
|
format!("{}/{}", &self.item_type, &self.item_code)
|
||||||
@ -794,9 +780,7 @@ impl Default for Item {
|
|||||||
death_data: None,
|
death_data: None,
|
||||||
details: None,
|
details: None,
|
||||||
details_dyn_suffix: None,
|
details_dyn_suffix: None,
|
||||||
details_less_explicit: None,
|
|
||||||
display: "Item".to_owned(),
|
display: "Item".to_owned(),
|
||||||
display_less_explicit: None,
|
|
||||||
door_states: None,
|
door_states: None,
|
||||||
dynamic_entrance: None,
|
dynamic_entrance: None,
|
||||||
flags: vec![],
|
flags: vec![],
|
||||||
|
@ -5,32 +5,16 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct Session {
|
pub struct Session {
|
||||||
pub source: String,
|
pub source: String,
|
||||||
pub less_explicit_mode: bool, // DEPRECATED
|
|
||||||
pub last_active: Option<DateTime<Utc>>,
|
pub last_active: Option<DateTime<Utc>>,
|
||||||
// Reminder: Consider backwards compatibility when updating this. New fields should generally
|
// Reminder: Consider backwards compatibility when updating this. New fields should generally
|
||||||
// be an Option, or you should ensure the default value is sensible, or things will
|
// be an Option, or you should ensure the default value is sensible, or things will
|
||||||
// crash out for existing sessions.
|
// crash out for existing sessions.
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Session {
|
|
||||||
pub fn explicit_if_allowed<'l>(
|
|
||||||
self: &Self,
|
|
||||||
explicit: &'l str,
|
|
||||||
non_explicit: Option<&'l str>,
|
|
||||||
) -> &'l str {
|
|
||||||
if self.less_explicit_mode {
|
|
||||||
non_explicit.unwrap_or(explicit)
|
|
||||||
} else {
|
|
||||||
explicit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Session {
|
impl Default for Session {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Session {
|
Session {
|
||||||
source: "unknown".to_owned(),
|
source: "unknown".to_owned(),
|
||||||
less_explicit_mode: false,
|
|
||||||
last_active: None,
|
last_active: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
|||||||
if clothes_damage > 0 {
|
if clothes_damage > 0 {
|
||||||
clothing.health -= clothes_damage;
|
clothing.health -= clothes_damage;
|
||||||
if victim.item_type == "player" {
|
if victim.item_type == "player" {
|
||||||
if let Some((vic_sess, sess_dat)) =
|
if let Some((vic_sess, _sess_dat)) =
|
||||||
trans.find_session_for_player(&victim.item_code).await?
|
trans.find_session_for_player(&victim.item_code).await?
|
||||||
{
|
{
|
||||||
trans
|
trans
|
||||||
@ -94,7 +94,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
|||||||
&vic_sess,
|
&vic_sess,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"A few bits and pieces fly off your {}.\n",
|
"A few bits and pieces fly off your {}.\n",
|
||||||
clothing.display_for_session(&sess_dat)
|
clothing.display_for_sentence(1, false)
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -112,7 +112,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
|||||||
.delete_item(&clothing.item_type, &clothing.item_code)
|
.delete_item(&clothing.item_type, &clothing.item_code)
|
||||||
.await?;
|
.await?;
|
||||||
if victim.item_type == "player" {
|
if victim.item_type == "player" {
|
||||||
if let Some((vic_sess, sess_dat)) =
|
if let Some((vic_sess, _sess_dat)) =
|
||||||
trans.find_session_for_player(&victim.item_code).await?
|
trans.find_session_for_player(&victim.item_code).await?
|
||||||
{
|
{
|
||||||
trans
|
trans
|
||||||
@ -120,7 +120,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
|||||||
&vic_sess,
|
&vic_sess,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"Your {} is completely destroyed; it crumbles away to nothing.\n",
|
"Your {} is completely destroyed; it crumbles away to nothing.\n",
|
||||||
clothing.display_for_session(&sess_dat)
|
clothing.display_for_sentence(1, false)
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -1114,7 +1114,7 @@ pub async fn switch_to_feint(ctx: &VerbContext<'_>, who: &Arc<Item>) -> UResult<
|
|||||||
if to_whom.species != SpeciesType::Human && to_whom.species != SpeciesType::Robot {
|
if to_whom.species != SpeciesType::Human && to_whom.species != SpeciesType::Robot {
|
||||||
user_error(format!(
|
user_error(format!(
|
||||||
"You don't think {} will pay any attention to a feint.",
|
"You don't think {} will pay any attention to a feint.",
|
||||||
to_whom.display_for_session(&ctx.session_dat)
|
to_whom.display_for_sentence(1, false)
|
||||||
))?;
|
))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ pub async fn start_conversation(
|
|||||||
if initiator.item_type != "player" {
|
if initiator.item_type != "player" {
|
||||||
user_error("Only players can initiate conversation with players".to_owned())?;
|
user_error("Only players can initiate conversation with players".to_owned())?;
|
||||||
}
|
}
|
||||||
let (_other_sess, other_sessdat) =
|
let (_other_sess, _other_sessdat) =
|
||||||
trans
|
trans
|
||||||
.find_session_for_player(&acceptor.item_code)
|
.find_session_for_player(&acceptor.item_code)
|
||||||
.await?
|
.await?
|
||||||
@ -579,7 +579,7 @@ pub async fn start_conversation(
|
|||||||
),
|
),
|
||||||
&acceptor.display_for_sentence(1, false),
|
&acceptor.display_for_sentence(1, false),
|
||||||
&acceptor.pronouns.subject,
|
&acceptor.pronouns.subject,
|
||||||
initiator.display_for_session(&other_sessdat)
|
initiator.display_for_sentence(1, false)
|
||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,7 +35,6 @@ fn room_to_simpleroom(room: &Room) -> Option<SimpleRoom<()>> {
|
|||||||
short: room.short.clone(),
|
short: room.short.clone(),
|
||||||
grid_coords: room.grid_coords.clone(),
|
grid_coords: room.grid_coords.clone(),
|
||||||
description: room.description.clone(),
|
description: room.description.clone(),
|
||||||
description_less_explicit: room.description_less_explicit.clone(),
|
|
||||||
exits: simple_exits,
|
exits: simple_exits,
|
||||||
should_caption: room.should_caption.clone(),
|
should_caption: room.should_caption.clone(),
|
||||||
repel_npc: room.repel_npc.clone(),
|
repel_npc: room.repel_npc.clone(),
|
||||||
|
@ -97,7 +97,6 @@ impl Dynzone {
|
|||||||
item_code: roomcode,
|
item_code: roomcode,
|
||||||
display: room.name.to_owned(),
|
display: room.name.to_owned(),
|
||||||
details: Some(room.description.to_owned()),
|
details: Some(room.description.to_owned()),
|
||||||
details_less_explicit: room.description_less_explicit.map(|s| s.to_owned()),
|
|
||||||
location: format!("dynzone/{}", &code),
|
location: format!("dynzone/{}", &code),
|
||||||
special_data: Some(ItemSpecialData::DynroomData {
|
special_data: Some(ItemSpecialData::DynroomData {
|
||||||
dynzone_code: self.zonetype.to_str().to_owned(),
|
dynzone_code: self.zonetype.to_str().to_owned(),
|
||||||
@ -179,7 +178,6 @@ pub struct Dynroom {
|
|||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
pub short: &'static str,
|
pub short: &'static str,
|
||||||
pub description: &'static str,
|
pub description: &'static str,
|
||||||
pub description_less_explicit: Option<&'static str>,
|
|
||||||
pub exits: Vec<Exit>,
|
pub exits: Vec<Exit>,
|
||||||
pub should_caption: bool,
|
pub should_caption: bool,
|
||||||
pub item_flags: Vec<ItemFlag>,
|
pub item_flags: Vec<ItemFlag>,
|
||||||
@ -194,7 +192,6 @@ impl Default for Dynroom {
|
|||||||
name: "Undefined",
|
name: "Undefined",
|
||||||
short: "XX",
|
short: "XX",
|
||||||
description: "A generic room",
|
description: "A generic room",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec![],
|
exits: vec![],
|
||||||
should_caption: false,
|
should_caption: false,
|
||||||
item_flags: vec![],
|
item_flags: vec![],
|
||||||
|
@ -13,7 +13,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "Door step",
|
name: "Door step",
|
||||||
short: "DS",
|
short: "DS",
|
||||||
description: "A sleek hallway, painted white, and lit by futuristic looking bluish-white strip lights that run along the edges of the ceiling. Soft navy blue carpet covers the floor. A beige painted door seems to lead into a private studio apartment",
|
description: "A sleek hallway, painted white, and lit by futuristic looking bluish-white strip lights that run along the edges of the ceiling. Soft navy blue carpet covers the floor. A beige painted door seems to lead into a private studio apartment",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::WEST,
|
direction: Direction::WEST,
|
||||||
@ -36,7 +35,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "Studio apartment",
|
name: "Studio apartment",
|
||||||
short: "ST",
|
short: "ST",
|
||||||
description: "An oddly comfortable studio apartment, with worn grey carpet covering the floor. A window to the east has spectacular views of Melbs and the bleak and desolate wasteland beyond it",
|
description: "An oddly comfortable studio apartment, with worn grey carpet covering the floor. A window to the east has spectacular views of Melbs and the bleak and desolate wasteland beyond it",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::WEST,
|
direction: Direction::WEST,
|
||||||
|
@ -16,7 +16,6 @@ pub fn zone() -> Dynzone {
|
|||||||
of the bleak wasteland to the north. The walls are painted white, and a long reception \
|
of the bleak wasteland to the north. The walls are painted white, and a long reception \
|
||||||
desk, enamelled to look like dark wood, is built into the room. It is well lit \
|
desk, enamelled to look like dark wood, is built into the room. It is well lit \
|
||||||
with cool white LED lights recessed into the ceiling above",
|
with cool white LED lights recessed into the ceiling above",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::WEST,
|
direction: Direction::WEST,
|
||||||
@ -39,7 +38,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "Common Room",
|
name: "Common Room",
|
||||||
short: "CO",
|
short: "CO",
|
||||||
description: "A large central room, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
description: "A large central room, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::WEST,
|
direction: Direction::WEST,
|
||||||
@ -79,7 +77,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "North Wing",
|
name: "North Wing",
|
||||||
short: "NW",
|
short: "NW",
|
||||||
description: "A spacious office, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
description: "A spacious office, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::NORTH,
|
direction: Direction::NORTH,
|
||||||
@ -104,7 +101,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "North Balcony",
|
name: "North Balcony",
|
||||||
short: "NB",
|
short: "NB",
|
||||||
description: "A timber balcony cantilevered on to the north side of the building, complete with an auto-irrigated garden, and glass front panels exposing a breath-taking view of the desolate lands to the north",
|
description: "A timber balcony cantilevered on to the north side of the building, complete with an auto-irrigated garden, and glass front panels exposing a breath-taking view of the desolate lands to the north",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::SOUTH,
|
direction: Direction::SOUTH,
|
||||||
@ -124,7 +120,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "East Wing",
|
name: "East Wing",
|
||||||
short: "EW",
|
short: "EW",
|
||||||
description: "A spacious office, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
description: "A spacious office, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::EAST,
|
direction: Direction::EAST,
|
||||||
@ -149,7 +144,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "Store room",
|
name: "Store room",
|
||||||
short: "SR",
|
short: "SR",
|
||||||
description: "A strong-room apparently designed to preserve people or things in any emergency. The walls, floor, and ceiling all appear to be made of thick steel",
|
description: "A strong-room apparently designed to preserve people or things in any emergency. The walls, floor, and ceiling all appear to be made of thick steel",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::WEST,
|
direction: Direction::WEST,
|
||||||
@ -169,7 +163,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "Health centre",
|
name: "Health centre",
|
||||||
short: "HC",
|
short: "HC",
|
||||||
description: "A room apparently designed as a kind of corporate sick-bay. The floor is tiled, and the walls are painted with white glossy easy-wipe paint",
|
description: "A room apparently designed as a kind of corporate sick-bay. The floor is tiled, and the walls are painted with white glossy easy-wipe paint",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::NORTHEAST,
|
direction: Direction::NORTHEAST,
|
||||||
@ -189,7 +182,6 @@ pub fn zone() -> Dynzone {
|
|||||||
name: "Kitchen",
|
name: "Kitchen",
|
||||||
short: "KT",
|
short: "KT",
|
||||||
description: "A room apparently designed for food preparation. It is tiled with small light green tiles that cover the walls and floor, and has an abundance of water and drain fittings",
|
description: "A room apparently designed for food preparation. It is tiled with small light green tiles that cover the walls and floor, and has an abundance of water and drain fittings",
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
direction: Direction::NORTH,
|
direction: Direction::NORTH,
|
||||||
|
@ -14,7 +14,6 @@ pub struct FixedItem {
|
|||||||
pub code: String,
|
pub code: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub description_less_explicit: Option<String>,
|
|
||||||
pub location: String,
|
pub location: String,
|
||||||
pub proper_noun: bool,
|
pub proper_noun: bool,
|
||||||
pub aliases: Vec<String>,
|
pub aliases: Vec<String>,
|
||||||
@ -27,7 +26,6 @@ impl Default for FixedItem {
|
|||||||
code: "default".to_owned(),
|
code: "default".to_owned(),
|
||||||
name: "default".to_owned(),
|
name: "default".to_owned(),
|
||||||
description: "A thingy".to_owned(),
|
description: "A thingy".to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
location: "unset".to_owned(),
|
location: "unset".to_owned(),
|
||||||
proper_noun: true,
|
proper_noun: true,
|
||||||
aliases: vec![],
|
aliases: vec![],
|
||||||
@ -55,7 +53,6 @@ fn fixed_item_list() -> &'static Vec<FixedItem> {
|
|||||||
and I have a robot police force to keep you safe from the worst baddies, \
|
and I have a robot police force to keep you safe from the worst baddies, \
|
||||||
but be warned - there still are some dangers near by, and the world \
|
but be warned - there still are some dangers near by, and the world \
|
||||||
further out, outside my realm, is a dangerous and radioactive place.\"".to_owned(),
|
further out, outside my realm, is a dangerous and radioactive place.\"".to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
location: "room/repro_xv_updates".to_owned(),
|
location: "room/repro_xv_updates".to_owned(),
|
||||||
proper_noun: false,
|
proper_noun: false,
|
||||||
aliases: vec!["poster".to_owned()],
|
aliases: vec!["poster".to_owned()],
|
||||||
@ -71,7 +68,6 @@ fn fixed_item_list() -> &'static Vec<FixedItem> {
|
|||||||
dogs were friendly companions and not the menace they are today. It smells \
|
dogs were friendly companions and not the menace they are today. It smells \
|
||||||
faintly of iron. [Try <bold>drink from fountain<reset> or, if you have a suitable \
|
faintly of iron. [Try <bold>drink from fountain<reset> or, if you have a suitable \
|
||||||
container, <bold>fill<reset> container <bold>from fountain<reset>].").to_owned(),
|
container, <bold>fill<reset> container <bold>from fountain<reset>].").to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
location: "room/melbs_kingst_40".to_owned(),
|
location: "room/melbs_kingst_40".to_owned(),
|
||||||
proper_noun: false,
|
proper_noun: false,
|
||||||
aliases: vec!["fountain".to_owned()],
|
aliases: vec!["fountain".to_owned()],
|
||||||
@ -109,7 +105,6 @@ pub fn static_items() -> Box<dyn Iterator<Item = StaticItem>> {
|
|||||||
item_type: "fixed_item".to_owned(),
|
item_type: "fixed_item".to_owned(),
|
||||||
display: r.name.clone(),
|
display: r.name.clone(),
|
||||||
details: Some(r.description.clone()),
|
details: Some(r.description.clone()),
|
||||||
details_less_explicit: r.description_less_explicit.as_ref().map(|d| d.clone()),
|
|
||||||
location: r.location.clone(),
|
location: r.location.clone(),
|
||||||
is_static: true,
|
is_static: true,
|
||||||
aliases: r.aliases.iter().map(|s| (*s).clone()).collect(),
|
aliases: r.aliases.iter().map(|s| (*s).clone()).collect(),
|
||||||
|
@ -310,9 +310,7 @@ pub struct SitData {
|
|||||||
pub struct PossessionData {
|
pub struct PossessionData {
|
||||||
pub weapon_data: Option<WeaponData>,
|
pub weapon_data: Option<WeaponData>,
|
||||||
pub display: &'static str,
|
pub display: &'static str,
|
||||||
pub display_less_explicit: Option<&'static str>,
|
|
||||||
pub details: &'static str,
|
pub details: &'static str,
|
||||||
pub details_less_explicit: Option<&'static str>,
|
|
||||||
pub aliases: Vec<&'static str>,
|
pub aliases: Vec<&'static str>,
|
||||||
pub max_health: u64,
|
pub max_health: u64,
|
||||||
pub charge_data: Option<ChargeData>,
|
pub charge_data: Option<ChargeData>,
|
||||||
@ -338,9 +336,7 @@ impl Default for PossessionData {
|
|||||||
Self {
|
Self {
|
||||||
weapon_data: None,
|
weapon_data: None,
|
||||||
display: "Thingy",
|
display: "Thingy",
|
||||||
display_less_explicit: None,
|
|
||||||
details: "A generic looking thing",
|
details: "A generic looking thing",
|
||||||
details_less_explicit: None,
|
|
||||||
aliases: vec![],
|
aliases: vec![],
|
||||||
max_health: 10,
|
max_health: 10,
|
||||||
weight: 250,
|
weight: 250,
|
||||||
@ -441,9 +437,7 @@ impl Into<Item> for PossessionType {
|
|||||||
item_type: "possession".to_owned(),
|
item_type: "possession".to_owned(),
|
||||||
possession_type: Some(self.clone()),
|
possession_type: Some(self.clone()),
|
||||||
display: possession_dat.display.to_owned(),
|
display: possession_dat.display.to_owned(),
|
||||||
display_less_explicit: possession_dat.display_less_explicit.map(|d| d.to_owned()),
|
|
||||||
details: Some(possession_dat.details.to_owned()),
|
details: Some(possession_dat.details.to_owned()),
|
||||||
details_less_explicit: possession_dat.details_less_explicit.map(|d| d.to_owned()),
|
|
||||||
aliases: possession_dat
|
aliases: possession_dat
|
||||||
.aliases
|
.aliases
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -383,7 +383,6 @@ pub struct Room {
|
|||||||
pub short: String,
|
pub short: String,
|
||||||
pub grid_coords: GridCoords,
|
pub grid_coords: GridCoords,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub description_less_explicit: Option<String>,
|
|
||||||
pub exits: Vec<Exit>,
|
pub exits: Vec<Exit>,
|
||||||
pub should_caption: bool,
|
pub should_caption: bool,
|
||||||
pub repel_npc: bool,
|
pub repel_npc: bool,
|
||||||
@ -411,7 +410,6 @@ impl Default for Room {
|
|||||||
short: "DF".to_owned(),
|
short: "DF".to_owned(),
|
||||||
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
||||||
description: "default".to_owned(),
|
description: "default".to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec![],
|
exits: vec![],
|
||||||
should_caption: true,
|
should_caption: true,
|
||||||
repel_npc: false,
|
repel_npc: false,
|
||||||
@ -440,7 +438,6 @@ pub struct SimpleRoom<T> {
|
|||||||
pub short: String,
|
pub short: String,
|
||||||
pub grid_coords: GridCoords,
|
pub grid_coords: GridCoords,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub description_less_explicit: Option<String>,
|
|
||||||
pub exits: Vec<SimpleExit>,
|
pub exits: Vec<SimpleExit>,
|
||||||
pub should_caption: bool,
|
pub should_caption: bool,
|
||||||
pub repel_npc: bool,
|
pub repel_npc: bool,
|
||||||
@ -477,7 +474,6 @@ impl<T> Into<Room> for SimpleRoom<T> {
|
|||||||
short: parse_ansi_markup(&self.short).unwrap(),
|
short: parse_ansi_markup(&self.short).unwrap(),
|
||||||
grid_coords: self.grid_coords,
|
grid_coords: self.grid_coords,
|
||||||
description: parse_ansi_markup(&self.description).unwrap(),
|
description: parse_ansi_markup(&self.description).unwrap(),
|
||||||
description_less_explicit: self.description_less_explicit,
|
|
||||||
exits: self.exits.into_iter().map(|e| e.into()).collect(),
|
exits: self.exits.into_iter().map(|e| e.into()).collect(),
|
||||||
should_caption: self.should_caption,
|
should_caption: self.should_caption,
|
||||||
repel_npc: self.repel_npc,
|
repel_npc: self.repel_npc,
|
||||||
@ -505,7 +501,6 @@ impl<'a, T: Default> Default for SimpleRoom<T> {
|
|||||||
short: "DF".to_owned(),
|
short: "DF".to_owned(),
|
||||||
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
||||||
description: "default".to_owned(),
|
description: "default".to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
exits: vec![],
|
exits: vec![],
|
||||||
should_caption: true,
|
should_caption: true,
|
||||||
repel_npc: false,
|
repel_npc: false,
|
||||||
@ -569,7 +564,6 @@ pub fn room_static_items() -> Box<dyn Iterator<Item = StaticItem>> {
|
|||||||
item_type: "room".to_owned(),
|
item_type: "room".to_owned(),
|
||||||
display: r.name.to_owned(),
|
display: r.name.to_owned(),
|
||||||
details: Some(r.description.to_owned()),
|
details: Some(r.description.to_owned()),
|
||||||
details_less_explicit: r.description_less_explicit.as_ref().map(|d| d.to_owned()),
|
|
||||||
location: format!("zone/{}", r.zone),
|
location: format!("zone/{}", r.zone),
|
||||||
is_static: true,
|
is_static: true,
|
||||||
flags: r.item_flags.clone(),
|
flags: r.item_flags.clone(),
|
||||||
|
@ -22,7 +22,6 @@ pub fn fixed_items() -> Vec<FixedItem> {
|
|||||||
code: "computer_museum_club_door_lock".to_owned(),
|
code: "computer_museum_club_door_lock".to_owned(),
|
||||||
name: "basic keyed lock".to_owned(),
|
name: "basic keyed lock".to_owned(),
|
||||||
description: "A basic lock that looks like it needs a key to open".to_owned(),
|
description: "A basic lock that looks like it needs a key to open".to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
location: "room/computer_museum_hackers_club".to_owned(),
|
location: "room/computer_museum_hackers_club".to_owned(),
|
||||||
proper_noun: false,
|
proper_noun: false,
|
||||||
aliases: vec!["lock".to_owned()],
|
aliases: vec!["lock".to_owned()],
|
||||||
|
@ -181,7 +181,6 @@ pub fn room_list() -> Vec<Room> {
|
|||||||
stretchers. It smells strongly of phenolic cleaners. At the front of the room \
|
stretchers. It smells strongly of phenolic cleaners. At the front of the room \
|
||||||
a triage nurse assures everyone coming in they will be assessed by doctors \
|
a triage nurse assures everyone coming in they will be assessed by doctors \
|
||||||
a minute after arriving. Doctors pace the floor treating patients").to_owned(),
|
a minute after arriving. Doctors pace the floor treating patients").to_owned(),
|
||||||
description_less_explicit: None,
|
|
||||||
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
||||||
exits: vec!(
|
exits: vec!(
|
||||||
Exit {
|
Exit {
|
||||||
|
@ -28,7 +28,6 @@ CREATE INDEX item_by_loc ON items ((details->>'location'));
|
|||||||
CREATE INDEX item_by_static ON items ((cast(details->>'is_static' as boolean)));
|
CREATE INDEX item_by_static ON items ((cast(details->>'is_static' as boolean)));
|
||||||
CREATE INDEX item_by_display ON items (lower(details->>'display'));
|
CREATE INDEX item_by_display ON items (lower(details->>'display'));
|
||||||
CREATE INDEX item_by_owner ON items (lower(details->>'owner'));
|
CREATE INDEX item_by_owner ON items (lower(details->>'owner'));
|
||||||
CREATE INDEX item_by_display_less_explicit ON items (lower(details->>'display_less_explicit'));
|
|
||||||
CREATE INDEX item_by_following ON items ((details->'following'->>'follow_whom'));
|
CREATE INDEX item_by_following ON items ((details->'following'->>'follow_whom'));
|
||||||
CREATE UNIQUE INDEX item_dynamic_entrance ON items (
|
CREATE UNIQUE INDEX item_dynamic_entrance ON items (
|
||||||
(details->'dynamic_entrance'->>'source_item'),
|
(details->'dynamic_entrance'->>'source_item'),
|
||||||
|
Loading…
Reference in New Issue
Block a user