pub struct Event { /* private fields */ }Expand description
An event on a specific map.
An event is any NPC or item that can interact with the player or can be interacted with. This struct contains detailed information about the position of the event and one or more pages containing extra details on how to render the event, plus the scripts related to this event.
Implementations§
Source§impl Event
impl Event
Sourcepub fn parse(bytes: &[u8]) -> (usize, Self)
pub fn parse(bytes: &[u8]) -> (usize, Self)
Parse raw bytes into a single Event struct.
Use of this method is highly discouraged unless you know exactly what you are doing.
Prefer using Map::parse and then extract what you want from the structure tree.
§Panics
This function will panic if the given bytes do not represent a valid event structure.
This might be caused by unaligned bytes, corrupt files, incompatible format updates and library bugs. If you are confident you are doing everything right, feel free to report an issue on GitHub.
Sourcepub fn parse_multiple(bytes: &[u8], count: u32) -> (usize, Vec<Self>)
pub fn parse_multiple(bytes: &[u8], count: u32) -> (usize, Vec<Self>)
Parse raw bytes into an Event collection.
Use of this method is highly discouraged unless you know exactly what you are doing.
Prefer using Map::parse and then extract what you want from the structure tree.
§Panics
This function will panic if the given bytes do not represent a valid event list structure.
This might be caused by unaligned bytes, corrupt files, incompatible format updates and library bugs. If you are confident you are doing everything right, feel free to report an issue on GitHub.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The name of this event.
This is only useful to recognize different events from a programming standpoint and is not shown in game whatsoever.
Sourcepub fn name_mut(&mut self) -> &mut String
pub fn name_mut(&mut self) -> &mut String
Mutable reference accessor for Event::name .
Sourcepub fn position_x(&self) -> u32
pub fn position_x(&self) -> u32
The x coordinate of this event, in tiles.
Sourcepub fn position_x_mut(&mut self) -> &mut u32
pub fn position_x_mut(&mut self) -> &mut u32
Mutable reference accessor for Event::position_x.
Sourcepub fn position_y(&self) -> u32
pub fn position_y(&self) -> u32
The y coordinate of this event, in tiles.
Sourcepub fn position_y_mut(&mut self) -> &mut u32
pub fn position_y_mut(&mut self) -> &mut u32
Mutable reference accessor for Event::position_y.
Sourcepub fn pages(&self) -> &Vec<Page>
pub fn pages(&self) -> &Vec<Page>
A collection of pages representing the different states this event can be in.
Each event can have up to ten pages describing its behaviour. The page that is actually run
is the one with the highest index that meets the requirements of its Page::event_trigger
and Page::conditions fields.
Sourcepub fn pages_mut(&mut self) -> &mut Vec<Page>
pub fn pages_mut(&mut self) -> &mut Vec<Page>
Mutable reference accessor for Event::pages.