Remove most references to less_explicit_mode
Instead add one basic illegality filter for everyone.
This commit is contained in:
parent
a68955deab
commit
3c302136d5
@ -389,20 +389,86 @@ pub async fn handle(_session: &ListenerSession, _msg: &str, _pool: &DBPool) -> D
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
pub fn is_likely_explicit(msg: &str) -> bool {
|
||||
static EXPLICIT_MARKER_WORDS: OnceCell<Vec<&'static str>> = OnceCell::new();
|
||||
let markers = EXPLICIT_MARKER_WORDS.get_or_init(|| {
|
||||
pub fn is_likely_illegal(msg: &str) -> bool {
|
||||
static ILLEGAL_MARKER_WORDS: OnceCell<Vec<&'static str>> = OnceCell::new();
|
||||
let illegal_markers = ILLEGAL_MARKER_WORDS.get_or_init(|| {
|
||||
vec![
|
||||
"fuck", "sex", "cock", "cunt", "dick", "pussy", "whore", "orgasm", "erection",
|
||||
"nipple", "boob", "tit",
|
||||
"lolita",
|
||||
"jailbait",
|
||||
"abu sayyaf",
|
||||
"al-qa’ida",
|
||||
"al-qaida",
|
||||
"al-shabaab",
|
||||
"boko haram",
|
||||
"hamas",
|
||||
"tahrir al-sham",
|
||||
"hizballah",
|
||||
"hezbollah",
|
||||
"hurras al-din",
|
||||
"islamic state",
|
||||
"jaish-e-mohammad",
|
||||
"jama’at mujahideen",
|
||||
"jamaat mujahideen",
|
||||
"jama’at nusrat",
|
||||
"jamaat nusrat",
|
||||
"jemaah islamiyah",
|
||||
"kurdistan workers",
|
||||
"lashkar-e-tayyiba",
|
||||
"likud",
|
||||
"national socialist order",
|
||||
"palestinian islamic jihad",
|
||||
"sonnenkrieg",
|
||||
"race war",
|
||||
// For now we'll block all URLs - we could allow by domain perhaps?
|
||||
"http:",
|
||||
"https:",
|
||||
"ftp:",
|
||||
]
|
||||
});
|
||||
for word in markers {
|
||||
if msg.contains(word) {
|
||||
static MINOR_MARKER_WORDS: OnceCell<Vec<&'static str>> = OnceCell::new();
|
||||
let minor_markers =
|
||||
MINOR_MARKER_WORDS.get_or_init(|| vec!["young", "underage", "child", "teen", "minor"]);
|
||||
static EXPLICIT_MARKER_WORDS: OnceCell<Vec<&'static str>> = OnceCell::new();
|
||||
let explicit_markers = EXPLICIT_MARKER_WORDS.get_or_init(|| {
|
||||
vec![
|
||||
"fuck",
|
||||
"sex",
|
||||
"cock",
|
||||
"cunt",
|
||||
"dick",
|
||||
"pussy",
|
||||
"whore",
|
||||
"orgasm",
|
||||
"erection",
|
||||
"nipple",
|
||||
"boob",
|
||||
"tit",
|
||||
"xxx",
|
||||
"nsfw",
|
||||
"uncensored",
|
||||
]
|
||||
});
|
||||
let msg_lower = msg.to_lowercase();
|
||||
for word in illegal_markers {
|
||||
if msg_lower.contains(word) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
|
||||
let mut minor_word = false;
|
||||
let mut explicit_word = false;
|
||||
for word in minor_markers {
|
||||
if msg_lower.contains(word) {
|
||||
minor_word = true;
|
||||
}
|
||||
}
|
||||
for word in explicit_markers {
|
||||
if msg_lower.contains(word) {
|
||||
explicit_word = true;
|
||||
}
|
||||
}
|
||||
|
||||
explicit_word && minor_word
|
||||
}
|
||||
|
||||
pub fn get_user_or_fail<'l>(ctx: &'l VerbContext) -> UResult<&'l User> {
|
||||
|
@ -55,7 +55,7 @@ async fn corp_invite(ctx: &mut VerbContext<'_>, remaining: &str) -> UResult<()>
|
||||
user_error("Only players can be hired.".to_owned())?;
|
||||
}
|
||||
|
||||
let (their_sess, their_sess_dat) = match ctx
|
||||
let (their_sess, _their_sess_dat) = match ctx
|
||||
.trans
|
||||
.find_session_for_player(&target_user.item_code)
|
||||
.await?
|
||||
@ -109,7 +109,7 @@ async fn corp_invite(ctx: &mut VerbContext<'_>, remaining: &str) -> UResult<()>
|
||||
|
||||
ctx.trans.queue_for_session(&their_sess, Some(&format!(
|
||||
ansi!("{} wants to hire you into {}! Type <bold>corp join {}<reset> to accept.{}\n"),
|
||||
&player.display_for_sentence(!their_sess_dat.less_explicit_mode, 1, true),
|
||||
&player.display_for_sentence(true, 1, true),
|
||||
&corp.name,
|
||||
&corp.name,
|
||||
if new_mem.allow_combat {
|
||||
|
@ -60,11 +60,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
Some(it) => it,
|
||||
};
|
||||
|
||||
let explicit = ctx.explicit().await?;
|
||||
if corpse.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to cut {} but realise it is no longer there.",
|
||||
corpse.display_for_sentence(explicit, 1, false)
|
||||
corpse.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
ensure_has_butcher_tool(&ctx.trans, &ctx.item).await?;
|
||||
@ -131,11 +130,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
Some(it) => it,
|
||||
};
|
||||
|
||||
let explicit = ctx.explicit().await?;
|
||||
if corpse.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to cut {} but realise it is no longer there.",
|
||||
corpse.display_for_sentence(explicit, 1, false)
|
||||
corpse.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location && item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to drink {} but realise you no longer have it",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
let msg = format!(
|
||||
@ -81,7 +81,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location && item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to drink {} but realise you no longer have it!",
|
||||
&item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
let liquid_details = item
|
||||
|
@ -128,7 +128,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != format!("{}/{}", &ctx.item.item_type, &ctx.item.item_code) {
|
||||
user_error(format!(
|
||||
"You try to drop {} but realise you no longer have it",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
if item.action_type == LocationActionType::Worn {
|
||||
@ -168,7 +168,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != format!("{}/{}", &ctx.item.item_type, &ctx.item.item_code) {
|
||||
user_error(format!(
|
||||
"You try to drop {} but realise you no longer have it!",
|
||||
&item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
if item.action_type == LocationActionType::Worn {
|
||||
@ -192,7 +192,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
{
|
||||
CapacityLevel::AboveItemLimit => user_error(format!(
|
||||
"You can't drop {}, because it is so cluttered here there is no where to put it!",
|
||||
&item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?,
|
||||
_ => (),
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != format!("{}/{}", &ctx.item.item_type, &ctx.item.item_code) {
|
||||
user_error(format!(
|
||||
"You try to eat {} but realise you no longer have it",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
let msg = format!(
|
||||
@ -76,7 +76,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != format!("{}/{}", &ctx.item.item_type, &ctx.item.item_code) {
|
||||
user_error(format!(
|
||||
"You try to eat {} but realise you no longer have it!",
|
||||
&item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
if item.action_type == LocationActionType::Worn {
|
||||
|
@ -51,13 +51,13 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if to_item.location != ctx.item.location && to_item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to fill {} but realise you no longer have it",
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
if from_item.location != ctx.item.location && from_item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to fill from {} but realise you no longer have it",
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
@ -106,20 +106,20 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if to_item.location != ctx.item.location && to_item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to fill {} but realise you no longer have it",
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
if from_item.location != ctx.item.location && from_item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to fill from {} but realise you no longer have it",
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
let from_liquid_details = match from_item.liquid_details.as_ref() {
|
||||
None => user_error(format!(
|
||||
"{} appears to be empty.",
|
||||
from_item.display_for_sentence(ctx.explicit().await?, 1, true)
|
||||
from_item.display_for_sentence(true, 1, true)
|
||||
))?,
|
||||
Some(v) => v,
|
||||
};
|
||||
@ -132,7 +132,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if available_vol == 0 {
|
||||
user_error(format!(
|
||||
"{} appears to be empty.",
|
||||
from_item.display_for_sentence(ctx.explicit().await?, 1, true)
|
||||
from_item.display_for_sentence(true, 1, true)
|
||||
))?
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
{
|
||||
None => user_error(format!(
|
||||
"You can't find a way to fill {}.",
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?,
|
||||
Some(v) => v,
|
||||
};
|
||||
@ -153,7 +153,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
user_error(format!(
|
||||
"You don't think putting {} into {} is a good idea.",
|
||||
liq_type.display(),
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?;
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if actually_transferred == 0 {
|
||||
user_error(format!(
|
||||
"You don't think you can get any more into {}.",
|
||||
to_item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
to_item.display_for_sentence(true, 1, false)
|
||||
))?;
|
||||
}
|
||||
|
||||
|
@ -60,14 +60,7 @@ impl UserVerb for Verb {
|
||||
if !worn.is_empty() {
|
||||
worn.push_str(", ");
|
||||
}
|
||||
worn.push_str(if ctx.session_dat.less_explicit_mode {
|
||||
item.display_less_explicit
|
||||
.as_ref()
|
||||
.map(|s| s.as_str())
|
||||
.unwrap_or(&item.display)
|
||||
} else {
|
||||
&item.display
|
||||
});
|
||||
worn.push_str(&item.display);
|
||||
for entry in damage_ranges.iter_mut() {
|
||||
if let Some(soak_data) = wear_data.soaks.get(entry.0) {
|
||||
let (old_min, old_max) = entry.1;
|
||||
|
@ -38,7 +38,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to get {} but realise it is no longer there",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
let msg = format!(
|
||||
@ -62,8 +62,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
{
|
||||
user_error(format!(
|
||||
"You try to get something from {} but realise {} is no longer there",
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let item = ctx
|
||||
@ -74,8 +74,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != container.refstr() {
|
||||
user_error(format!(
|
||||
"You try to get {} but realise it is no longer in {}",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let msg = format!(
|
||||
@ -111,7 +111,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to get {} but realise it is no longer there",
|
||||
&item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
@ -137,8 +137,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
{
|
||||
user_error(format!(
|
||||
"You try to get something from {} but realise {} is no longer there",
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let item = ctx
|
||||
@ -149,8 +149,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != container.refstr() {
|
||||
user_error(format!(
|
||||
"You try to get {} but realise it is no longer in {}",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let msg = format!(
|
||||
@ -180,14 +180,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
CapacityLevel::AboveItemLimit => {
|
||||
user_error("You just can't hold that many things!".to_owned())?
|
||||
}
|
||||
CapacityLevel::OverBurdened => {
|
||||
let explicit = ctx.explicit().await?;
|
||||
user_error(format!(
|
||||
"{} You can't get {} because it is too heavy!",
|
||||
if explicit { "Fuck!" } else { "Rats!" },
|
||||
&item.display_for_sentence(explicit, 1, false)
|
||||
))?
|
||||
}
|
||||
CapacityLevel::OverBurdened => user_error(format!(
|
||||
"Fuck! You can't get {} because it is too heavy!",
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
@ -101,10 +101,6 @@ impl QueueCommandHandler for WithQueueHandler {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let explicit = session
|
||||
.as_ref()
|
||||
.map(|s| !s.1.less_explicit_mode)
|
||||
.unwrap_or(false);
|
||||
let opts: Vec<&'static PossessionData> = improv_by_ingredient()
|
||||
.get(
|
||||
item.possession_type
|
||||
@ -114,12 +110,11 @@ impl QueueCommandHandler for WithQueueHandler {
|
||||
.ok_or_else(|| {
|
||||
UserError(format!(
|
||||
"You can't think of anything you could make with {}",
|
||||
item.display_for_sentence(explicit, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))
|
||||
})?
|
||||
.iter()
|
||||
.filter_map(|it| possession_data().get(&it.output).map(|v| *v))
|
||||
.filter(|pd| explicit || pd.display_less_explicit.is_none())
|
||||
.collect();
|
||||
let result_data = opts
|
||||
.as_slice()
|
||||
@ -127,7 +122,7 @@ impl QueueCommandHandler for WithQueueHandler {
|
||||
.ok_or_else(|| {
|
||||
UserError(format!(
|
||||
"You can't think of anything you could make with {}",
|
||||
item.display_for_sentence(explicit, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))
|
||||
})?;
|
||||
if let Some((sess, _)) = session {
|
||||
@ -138,7 +133,7 @@ impl QueueCommandHandler for WithQueueHandler {
|
||||
"You think you could make {} {} from {}\n",
|
||||
indefinite_article(result_data.display),
|
||||
result_data.display,
|
||||
item.display_for_sentence(explicit, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
@ -225,10 +220,6 @@ impl QueueCommandHandler for FromQueueHandler {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let explicit = session
|
||||
.as_ref()
|
||||
.map(|s| !s.1.less_explicit_mode)
|
||||
.unwrap_or(false);
|
||||
match possession_id_iter.next() {
|
||||
None => {
|
||||
let choice = ingredients_left
|
||||
@ -292,7 +283,7 @@ impl QueueCommandHandler for FromQueueHandler {
|
||||
) {
|
||||
user_error(format!(
|
||||
"You try adding {}, but it doesn't really seem to fit right.",
|
||||
&item.display_for_sentence(explicit, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?;
|
||||
}
|
||||
let skill_result = skill_check_and_grind(
|
||||
@ -314,7 +305,7 @@ impl QueueCommandHandler for FromQueueHandler {
|
||||
&sess,
|
||||
Some(&format!(
|
||||
"You try adding {}, but it goes badly and you waste it.\n",
|
||||
&item.display_for_sentence(explicit, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
@ -327,7 +318,7 @@ impl QueueCommandHandler for FromQueueHandler {
|
||||
&sess,
|
||||
Some(&format!(
|
||||
"You try and fail at adding {}.\n",
|
||||
&item.display_for_sentence(explicit, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
@ -339,7 +330,7 @@ impl QueueCommandHandler for FromQueueHandler {
|
||||
&sess,
|
||||
Some(&format!(
|
||||
"You try adding {}.\n",
|
||||
&item.display_for_sentence(explicit, 1, false),
|
||||
&item.display_for_sentence(true, 1, false),
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
|
@ -49,7 +49,7 @@ impl UserVerb for Verb {
|
||||
total += it_total;
|
||||
response.push_str(&format!(
|
||||
"{} [{}]{}\n",
|
||||
item.display_for_sentence(!ctx.session_dat.less_explicit_mode, items.len(), true),
|
||||
item.display_for_sentence(true, items.len(), true),
|
||||
weight(it_total),
|
||||
match item.action_type {
|
||||
LocationActionType::Worn => " (worn)",
|
||||
|
@ -47,14 +47,7 @@ impl UserVerb for Verb {
|
||||
|
||||
for stock in &room.stock_list {
|
||||
if let Some(possession_type) = possession_data().get(&stock.possession_type) {
|
||||
let display = if ctx.session_dat.less_explicit_mode {
|
||||
possession_type
|
||||
.display_less_explicit
|
||||
.as_ref()
|
||||
.unwrap_or(&possession_type.display)
|
||||
} else {
|
||||
&possession_type.display
|
||||
};
|
||||
let display = &possession_type.display;
|
||||
|
||||
let mut price = stock.list_price;
|
||||
if stock.poverty_discount && price > user.credits {
|
||||
|
@ -21,7 +21,7 @@ use crate::{
|
||||
dynzone,
|
||||
possession_type::{possession_data, recipe_craft_by_recipe},
|
||||
room::{self, Direction},
|
||||
species::{species_info_map, SpeciesType},
|
||||
species::species_info_map,
|
||||
},
|
||||
};
|
||||
use ansi::{ansi, flow_around, word_wrap};
|
||||
@ -66,11 +66,7 @@ pub async fn describe_normal_item(
|
||||
let mut phrases = Vec::<String>::new();
|
||||
for group_items in all_groups {
|
||||
let head = &group_items[0];
|
||||
let mut details = head.display_for_sentence(
|
||||
!ctx.session_dat.less_explicit_mode,
|
||||
group_items.len(),
|
||||
false,
|
||||
);
|
||||
let mut details = head.display_for_sentence(true, group_items.len(), false);
|
||||
match head.action_type {
|
||||
LocationActionType::Wielded => details.push_str(" (wielded)"),
|
||||
LocationActionType::Worn => continue,
|
||||
@ -171,28 +167,18 @@ pub async fn describe_normal_item(
|
||||
));
|
||||
}
|
||||
} else {
|
||||
if !ctx.session_dat.less_explicit_mode {
|
||||
any_part_text = true;
|
||||
contents_desc.push_str(&format!(
|
||||
"{} {} {} completely bare. ",
|
||||
&language::caps_first(&item.pronouns.possessive),
|
||||
part.display(item.sex.clone()),
|
||||
part.copula(item.sex.clone())
|
||||
));
|
||||
}
|
||||
any_part_text = true;
|
||||
contents_desc.push_str(&format!(
|
||||
"{} {} {} completely bare. ",
|
||||
&language::caps_first(&item.pronouns.possessive),
|
||||
part.display(item.sex.clone()),
|
||||
part.copula(item.sex.clone())
|
||||
));
|
||||
}
|
||||
}
|
||||
if any_part_text {
|
||||
contents_desc.push_str("\n");
|
||||
}
|
||||
} else if (item.item_type == "npc" || item.item_type == "player")
|
||||
&& item.species == SpeciesType::Human
|
||||
&& !ctx.session_dat.less_explicit_mode
|
||||
{
|
||||
contents_desc.push_str(&format!(
|
||||
"{} is completely naked.\n",
|
||||
&language::caps_first(&item.pronouns.subject)
|
||||
));
|
||||
}
|
||||
|
||||
let health_max = max_health(&item);
|
||||
@ -293,11 +279,7 @@ pub async fn describe_normal_item(
|
||||
contents_desc.push_str("You will need:\n");
|
||||
for (input_pt, count) in &recipe_craft_data.craft_data.inputs.iter().counts() {
|
||||
if let Some(pd) = possession_data().get(&input_pt) {
|
||||
let thing = if ctx.session_dat.less_explicit_mode {
|
||||
pd.display_less_explicit.unwrap_or(pd.display)
|
||||
} else {
|
||||
pd.display
|
||||
};
|
||||
let thing = pd.display;
|
||||
contents_desc.push_str(&format!(
|
||||
" {} {}\n",
|
||||
count,
|
||||
@ -313,14 +295,8 @@ pub async fn describe_normal_item(
|
||||
None => contents_desc.push_str("You can make this without any special bench.\n"),
|
||||
Some(bench) => {
|
||||
if let Some(pd) = possession_data().get(bench) {
|
||||
contents_desc.push_str(&format!(
|
||||
"You'll need to make this on a {}.\n",
|
||||
if ctx.session_dat.less_explicit_mode {
|
||||
pd.display_less_explicit.unwrap_or(pd.display)
|
||||
} else {
|
||||
pd.display
|
||||
}
|
||||
))
|
||||
contents_desc
|
||||
.push_str(&format!("You'll need to make this on a {}.\n", pd.display))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -520,11 +496,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
||||
let head = &group_items[0];
|
||||
let is_creature = head.item_type == "player" || head.item_type.starts_with("npc");
|
||||
buf.push(' ');
|
||||
buf.push_str(&head.display_for_sentence(
|
||||
!ctx.session_dat.less_explicit_mode,
|
||||
group_items.len(),
|
||||
true,
|
||||
));
|
||||
buf.push_str(&head.display_for_sentence(true, group_items.len(), true));
|
||||
buf.push_str(if group_items.len() > 1 {
|
||||
" are "
|
||||
} else {
|
||||
|
@ -396,11 +396,7 @@ impl UserVerb for Verb {
|
||||
&instructions.display_for_session(&ctx.session_dat),
|
||||
possession_data()
|
||||
.get(bench_type)
|
||||
.map(|pd| if ctx.session_dat.less_explicit_mode {
|
||||
pd.display_less_explicit.unwrap_or(pd.display)
|
||||
} else {
|
||||
pd.display
|
||||
})
|
||||
.map(|pd| pd.display)
|
||||
.unwrap_or("bench")
|
||||
))?,
|
||||
(Some(bench_type), Some(bench))
|
||||
@ -411,13 +407,7 @@ impl UserVerb for Verb {
|
||||
&instructions.display_for_session(&ctx.session_dat),
|
||||
possession_data()
|
||||
.get(bench_type)
|
||||
.map(|pd| {
|
||||
if ctx.session_dat.less_explicit_mode {
|
||||
pd.display_less_explicit.unwrap_or(pd.display)
|
||||
} else {
|
||||
pd.display
|
||||
}
|
||||
})
|
||||
.map(|pd| pd.display)
|
||||
.unwrap_or("bench")
|
||||
))?
|
||||
}
|
||||
|
@ -450,11 +450,9 @@ impl MapType for LmapType {
|
||||
None => None,
|
||||
Some((ex_t, ex_c)) => {
|
||||
match ctx.trans.find_item_by_type_code(ex_t, ex_c).await?.as_ref() {
|
||||
Some(dest_item) => Some(dest_item.display_for_sentence(
|
||||
!ctx.session_dat.less_explicit_mode,
|
||||
1,
|
||||
true,
|
||||
)),
|
||||
Some(dest_item) => {
|
||||
Some(dest_item.display_for_sentence(true, 1, true))
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{
|
||||
get_player_item_or_fail, is_likely_explicit, parsing::parse_to_space, search_item_for_user,
|
||||
get_player_item_or_fail, is_likely_illegal, parsing::parse_to_space, search_item_for_user,
|
||||
user_error, ItemSearchParams, UResult, UserVerb, UserVerbRef, VerbContext,
|
||||
};
|
||||
use ansi::{ansi, ignore_special_characters};
|
||||
@ -51,6 +51,10 @@ impl UserVerb for Verb {
|
||||
_ => user_error("Only players accept pages".to_string())?,
|
||||
}
|
||||
|
||||
if is_likely_illegal(&say_what) {
|
||||
user_error("Your message was rejected by the content filter".to_string())?;
|
||||
}
|
||||
|
||||
ctx.trans
|
||||
.queue_for_session(
|
||||
ctx.session,
|
||||
@ -74,24 +78,23 @@ impl UserVerb for Verb {
|
||||
.await?
|
||||
{
|
||||
None => user_error("That character is asleep.".to_string())?,
|
||||
Some((other_session, other_session_dets)) => {
|
||||
if other_session_dets.less_explicit_mode && is_likely_explicit(&say_what) {
|
||||
user_error("That player is on a client that doesn't allow explicit \
|
||||
content, and your message looked explicit, so it wasn't sent."
|
||||
.to_owned())?
|
||||
} else {
|
||||
if let Some(mut user) =
|
||||
ctx.trans.find_by_username(&to_whom.item_code).await?
|
||||
{
|
||||
user.last_page_from = Some(player_item.item_code.clone());
|
||||
ctx.trans.save_user_model(&user).await?;
|
||||
}
|
||||
ctx.trans.queue_for_session(&other_session, Some(&format!(
|
||||
ansi!("<blue>Your wristpad beeps with page from {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
say_what
|
||||
))).await?;
|
||||
Some((other_session, _other_session_dets)) => {
|
||||
if let Some(mut user) =
|
||||
ctx.trans.find_by_username(&to_whom.item_code).await?
|
||||
{
|
||||
user.last_page_from = Some(player_item.item_code.clone());
|
||||
ctx.trans.save_user_model(&user).await?;
|
||||
}
|
||||
ctx.trans
|
||||
.queue_for_session(
|
||||
&other_session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>Your wristpad beeps with page from {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if container.location != ctx.item.location && container.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to put something in {} but realise {} is no longer there",
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let item = ctx
|
||||
@ -54,8 +54,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to put {} in {}, but realise you no longer have it",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
container.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let msg = format!(
|
||||
@ -83,7 +83,6 @@ impl QueueCommandHandler for QueueHandler {
|
||||
_ => user_error("Expected Put command".to_owned())?,
|
||||
};
|
||||
|
||||
let is_explicit = ctx.explicit().await?;
|
||||
let container = ctx
|
||||
.trans
|
||||
.find_item_by_type_code("possession", &container_code)
|
||||
@ -92,8 +91,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if container.location != ctx.item.location && container.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to put something in {} but realise {} is no longer there",
|
||||
container.display_for_sentence(is_explicit, 1, false),
|
||||
container.display_for_sentence(is_explicit, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
let item = ctx
|
||||
@ -104,8 +103,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to put {} in {}, but realise you no longer have it",
|
||||
item.display_for_sentence(is_explicit, 1, false),
|
||||
container.display_for_sentence(is_explicit, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))?
|
||||
}
|
||||
|
||||
@ -120,8 +119,8 @@ impl QueueCommandHandler for QueueHandler {
|
||||
.ok_or_else(|| {
|
||||
UserError(format!(
|
||||
"You try to put {} in {}, but can't find out a way to get anything in it",
|
||||
item.display_for_sentence(is_explicit, 1, false),
|
||||
container.display_for_sentence(is_explicit, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
container.display_for_sentence(true, 1, false),
|
||||
))
|
||||
})?;
|
||||
container_data.checker.check_place(&container, &item)?;
|
||||
@ -148,12 +147,12 @@ impl QueueCommandHandler for QueueHandler {
|
||||
match check_item_capacity(ctx.trans, &container, possession_data.weight).await? {
|
||||
CapacityLevel::AboveItemLimit => user_error(format!(
|
||||
"{} just can't hold that many things!",
|
||||
container.display_for_sentence(is_explicit, 1, true),
|
||||
container.display_for_sentence(true, 1, true),
|
||||
))?,
|
||||
CapacityLevel::OverBurdened => user_error(format!(
|
||||
"{} You can't place {} because it is too heavy!",
|
||||
if is_explicit { "Fuck!" } else { "Rats!" },
|
||||
&ctx.item.display_for_sentence(is_explicit, 1, false)
|
||||
if true { "Fuck!" } else { "Rats!" },
|
||||
&ctx.item.display_for_sentence(true, 1, false)
|
||||
))?,
|
||||
_ => (),
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to reclining on {} but realise it's no longer here",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
}
|
||||
@ -124,7 +124,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to recline on {} but realise it's no longer here",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
(
|
||||
|
@ -17,7 +17,7 @@ async fn check_removeable(ctx: &mut QueuedCommandContext<'_>, item: &Item) -> UR
|
||||
if item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to remove {} but realise you no longer have it.",
|
||||
&item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ async fn check_removeable(ctx: &mut QueuedCommandContext<'_>, item: &Item) -> UR
|
||||
}) {
|
||||
user_error(format!(
|
||||
"You can't do that without first removing your {} from your {}.",
|
||||
&other_item.display_for_sentence(ctx.explicit().await?, 1, false),
|
||||
&other_item.display_for_sentence(true, 1, false),
|
||||
part.display(ctx.item.sex.clone())
|
||||
))?;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::{
|
||||
get_player_item_or_fail, user_error, UResult, UserError, UserVerb, UserVerbRef, VerbContext,
|
||||
get_player_item_or_fail, is_likely_illegal, user_error, UResult, UserError, UserVerb,
|
||||
UserVerbRef, VerbContext,
|
||||
};
|
||||
#[double]
|
||||
use crate::db::DBTrans;
|
||||
@ -31,6 +32,11 @@ pub async fn say_to_room<'l>(
|
||||
.to_owned(),
|
||||
)?
|
||||
}
|
||||
|
||||
if is_likely_illegal(&say_what) {
|
||||
user_error("Your message was rejected by the content filter".to_string())?;
|
||||
}
|
||||
|
||||
let msg = format!(
|
||||
ansi!("<yellow>{} says: <reset><bold>\"{}\"<reset>\n"),
|
||||
from_item.display_for_sentence(true, 1, true),
|
||||
|
@ -60,7 +60,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to sit on {} but realise it's no longer here",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != ctx.item.location {
|
||||
user_error(format!(
|
||||
"You try to sit on {} but realise it's no longer here",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
(
|
||||
|
@ -44,7 +44,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != format!("player/{}", ctx.item.item_code) {
|
||||
user_error(format!(
|
||||
"You try to use {} but realise you no longer have it",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
let (target_type, target_code) = match target_type_code.split_once("/") {
|
||||
@ -71,11 +71,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
&& target.location != ctx.item.location
|
||||
&& target.location != format!("player/{}", ctx.item.item_code)
|
||||
{
|
||||
let explicit = ctx.explicit().await?;
|
||||
let target_name = target.display_for_sentence(explicit, 1, false);
|
||||
let target_name = target.display_for_sentence(true, 1, false);
|
||||
user_error(format!(
|
||||
"You try to use {} on {}, but realise {} is no longer here",
|
||||
item.display_for_sentence(explicit, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
target_name,
|
||||
target_name
|
||||
))?
|
||||
@ -143,7 +142,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.location != format!("player/{}", ctx.item.item_code) {
|
||||
user_error(format!(
|
||||
"You try to use {} but realise you no longer have it",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
let (ref target_type, ref target_code) = match target_type_code.split_once("/") {
|
||||
@ -161,11 +160,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if target.location != ctx.item.location
|
||||
&& target.location != format!("player/{}", ctx.item.item_code)
|
||||
{
|
||||
let explicit = ctx.explicit().await?;
|
||||
let target_name = target.display_for_sentence(explicit, 1, false);
|
||||
let target_name = target.display_for_sentence(true, 1, false);
|
||||
user_error(format!(
|
||||
"You try to use {} on {}, but realise {} is no longer here",
|
||||
item.display_for_sentence(explicit, 1, false),
|
||||
item.display_for_sentence(true, 1, false),
|
||||
target_name,
|
||||
target_name
|
||||
))?
|
||||
@ -183,7 +181,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if !check_consent(ctx.trans, "use", consent_type, &ctx.item, &target).await? {
|
||||
user_error(format!(
|
||||
"{} doesn't allow {} from you",
|
||||
&target.display_for_sentence(ctx.explicit().await?, 1, true),
|
||||
&target.display_for_sentence(true, 1, true),
|
||||
consent_type.to_str()
|
||||
))?
|
||||
}
|
||||
@ -197,7 +195,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
if item.charges < 1 {
|
||||
user_error(format!(
|
||||
"{} has no {} {} left",
|
||||
item.display_for_sentence(ctx.explicit().await?, 1, true),
|
||||
item.display_for_sentence(true, 1, true),
|
||||
&language::pluralise(charge_data.charge_name_prefix),
|
||||
charge_data.charge_name_suffix
|
||||
))?;
|
||||
|
@ -35,11 +35,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
None => user_error("Item not found".to_owned())?,
|
||||
Some(it) => it,
|
||||
};
|
||||
let explicit = ctx.explicit().await?;
|
||||
if item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to wear {} but realise you no longer have it",
|
||||
item.display_for_sentence(explicit, 1, false)
|
||||
item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
@ -88,11 +87,10 @@ impl QueueCommandHandler for QueueHandler {
|
||||
None => user_error("Item not found".to_owned())?,
|
||||
Some(it) => it,
|
||||
};
|
||||
let explicit = ctx.explicit().await?;
|
||||
if item.location != ctx.item.refstr() {
|
||||
user_error(format!(
|
||||
"You try to wear {} but realise it is no longer there.",
|
||||
&item.display_for_sentence(explicit, 1, false)
|
||||
&item.display_for_sentence(true, 1, false)
|
||||
))?
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{
|
||||
get_player_item_or_fail, is_likely_explicit, parsing::parse_to_space, search_item_for_user,
|
||||
get_player_item_or_fail, is_likely_illegal, parsing::parse_to_space, search_item_for_user,
|
||||
user_error, ItemSearchParams, UResult, UserVerb, UserVerbRef, VerbContext,
|
||||
};
|
||||
use crate::static_content::npc::npc_by_code;
|
||||
@ -40,6 +40,10 @@ impl UserVerb for Verb {
|
||||
_ => user_error("Only characters (players / NPCs) accept whispers".to_string())?,
|
||||
}
|
||||
|
||||
if is_likely_illegal(&say_what) {
|
||||
user_error("Your message was rejected by the content filter".to_string())?;
|
||||
}
|
||||
|
||||
ctx.trans
|
||||
.queue_for_session(
|
||||
ctx.session,
|
||||
@ -75,24 +79,18 @@ impl UserVerb for Verb {
|
||||
.await?
|
||||
{
|
||||
None => user_error("That character is asleep.".to_string())?,
|
||||
Some((other_session, other_session_dets)) => {
|
||||
if other_session_dets.less_explicit_mode && is_likely_explicit(&say_what) {
|
||||
user_error("That player is on a client that doesn't allow explicit \
|
||||
content, and your message looked explicit, so it wasn't sent."
|
||||
.to_owned())?
|
||||
} else {
|
||||
ctx.trans
|
||||
.queue_for_session(
|
||||
&other_session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
to_whom.display_for_session(&ctx.session_dat),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Some((other_session, _other_session_dets)) => {
|
||||
ctx.trans
|
||||
.queue_for_session(
|
||||
&other_session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
to_whom.display_for_session(&ctx.session_dat),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -736,8 +736,8 @@ impl Item {
|
||||
buf
|
||||
}
|
||||
}
|
||||
pub fn display_for_session<'l>(self: &'l Self, session: &Session) -> String {
|
||||
self.display_for_sentence(!session.less_explicit_mode, 1, false)
|
||||
pub fn display_for_session<'l>(self: &'l Self, _session: &Session) -> String {
|
||||
self.display_for_sentence(true, 1, false)
|
||||
}
|
||||
|
||||
pub fn details_for_session<'l>(self: &'l Self, session: &Session) -> Option<&'l str> {
|
||||
|
@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
#[serde(default)]
|
||||
pub struct Session {
|
||||
pub source: String,
|
||||
pub less_explicit_mode: bool,
|
||||
pub less_explicit_mode: bool, // DEPRECATED
|
||||
pub last_active: Option<DateTime<Utc>>,
|
||||
// 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
|
||||
|
@ -173,14 +173,6 @@ impl<'l> QueuedCommandContext<'l> {
|
||||
.await?
|
||||
})
|
||||
}
|
||||
pub async fn explicit(&self) -> UResult<bool> {
|
||||
Ok(self
|
||||
.trans
|
||||
.find_session_for_player(&self.item.item_code)
|
||||
.await?
|
||||
.map(|(_, sess)| !sess.less_explicit_mode)
|
||||
.unwrap_or(false))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
@ -1017,7 +1017,7 @@ pub async fn switch_to_power_attack(ctx: &VerbContext<'_>, who: &Arc<Item>) -> U
|
||||
let pow_att = match wielded.power_attack.as_ref() {
|
||||
None => user_error(format!(
|
||||
"{} is unsuitable for powerattacking",
|
||||
wield_it.display_for_sentence(!ctx.session_dat.less_explicit_mode, 1, true)
|
||||
wield_it.display_for_sentence(true, 1, true)
|
||||
))?,
|
||||
Some(v) => v,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user