2023-01-12 23:12:50 +11:00
|
|
|
use crate::{
|
|
|
|
db::DBTrans,
|
2023-01-20 23:08:40 +11:00
|
|
|
DResult,
|
2023-01-22 22:43:44 +11:00
|
|
|
models::item::Item,
|
2023-01-12 23:12:50 +11:00
|
|
|
};
|
2023-01-20 23:08:40 +11:00
|
|
|
|
|
|
|
pub mod skills;
|
2023-01-22 22:43:44 +11:00
|
|
|
pub mod combat;
|
2023-02-03 23:26:24 +11:00
|
|
|
pub mod capacity;
|
2023-01-12 23:12:50 +11:00
|
|
|
pub async fn broadcast_to_room(trans: &DBTrans, location: &str, from_item: Option<&Item>,
|
|
|
|
message_explicit_ok: &str, message_nonexplicit: Option<&str>) -> DResult<()> {
|
|
|
|
for item in trans.find_items_by_location(location).await? {
|
2023-01-27 00:36:49 +11:00
|
|
|
if item.item_type != "player" || item.is_dead {
|
2023-01-12 23:12:50 +11:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if let Some((session, session_dat)) = trans.find_session_for_player(&item.item_code).await? {
|
|
|
|
if session_dat.less_explicit_mode && 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.queue_for_session(&session, Some(message_explicit_ok)).await?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|