pub struct LogMessageBuilder<'a> { /* private fields */ }
Expand description

Builder for creating dungeon message log messages.

By default message will be shown ‘quiet’, meaning there will be no popup shown when the message is logged. You can force a popup to be shown with Self::popup, but please also note that with some configurations, a popup will always be displayed, even if Self::popup is not called. See the implementation for more details.

Also see crate::api::messages::GameStringBuilder; this is using pretty much the same principles for building the actual message strings.

Implementations§

source§

impl<'a> LogMessageBuilder<'a>

source

pub fn popup(&mut self) -> &mut Self

Show a message popup when the message is displayed.

source

pub fn check_user_fainted(&'a mut self) -> &'a mut Self

Do not show the message if the user is fainted.

Note

Self::target_check_fainted will take precedence over this, both can not be active at the same time.

source

pub fn target_check_fainted( &'a mut self, target: &'a DungeonEntity ) -> &'a mut Self

source

pub fn string(&mut self, string_id: u16, entity: &DungeonEntity) -> &mut Self

Replaces instances of a given placeholder tag by the string representation of the given entity. Concretely this means that any occurrences of \[string:<string_id>\] will be replaced by the name of the given entity. Example: If use pass string_id with 1, it will replace all occurrences of \[string:1\].

Note

As a performance optimization this will immediately reserve that string with the game when called. This can have weird effects if you expect to show the message built by this builder at a later time.

source

pub fn log_msg(&mut self, user: &DungeonEntity, message_id: i32)

Writes a log entry using the message with the given message ID.

source

pub fn log_str<S: AsRef<str> + Debug>( &mut self, user: &DungeonEntity, message: S )

source

pub fn log_cstr<S: AsRef<CStr>>(&mut self, user: &DungeonEntity, message: S)

Trait Implementations§

source§

impl<'a> CreatableWithLease<29> for LogMessageBuilder<'a>

source§

fn lease(&self) -> &OverlayLoadLease<29>

Returns a reference to the overlay lease.
source§

fn new(lease: OverlayLoadLease<N>) -> Self

Create a new instance by providing a lease. Read more
source§

fn new_checked() -> Self

Create a new instance by checking if the overlay is loaded and acquiring a lease on it. This will panic if the overlay is not loaded. Read more
source§

unsafe fn new_unchecked() -> Self

Create a new lease. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for LogMessageBuilder<'a>

§

impl<'a> !Send for LogMessageBuilder<'a>

§

impl<'a> !Sync for LogMessageBuilder<'a>

§

impl<'a> Unpin for LogMessageBuilder<'a>

§

impl<'a> UnwindSafe for LogMessageBuilder<'a>

Blanket Implementations§

§

impl<T> Any for Twhere T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

source§

impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.