1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-25 16:27:46 +00:00

Create CharacterMode enum

This commit is contained in:
Joshua Goins 2025-03-16 14:13:26 -04:00
parent 3bbf345cd6
commit 0bf4cd1264
4 changed files with 15 additions and 5 deletions

View file

@ -286,7 +286,6 @@ async fn main() {
mp_curr: 100,
mp_max: 100,
model_type: 1,
state: 1,
gm_rank: 3,
look: CUSTOMIZE_DATA,
fc_tag: "LOCAL".to_string(),

View file

@ -3,7 +3,7 @@ use crate::{
ipc::{IPCOpCode, IPCSegment, IPCStructData},
packet::{PacketSegment, SegmentType},
timestamp_secs,
world::PlayerSpawn,
world::{CharacterMode, PlayerSpawn},
};
use super::{ChatMessage, Position, ZoneConnection};
@ -53,7 +53,6 @@ impl ChatHandler {
mp_curr: 100,
mp_max: 100,
model_type: 1,
state: 1,
gm_rank: 3,
spawn_index: connection.get_free_spawn_index(),
look: CUSTOMIZE_DATA,

View file

@ -1,4 +1,5 @@
mod player_spawn;
pub use player_spawn::CharacterMode;
pub use player_spawn::PlayerSpawn;
mod position;

View file

@ -7,6 +7,17 @@ use crate::common::{read_string, write_string};
use super::position::Position;
use super::status_effect::StatusEffect;
#[binrw]
#[brw(little)]
#[brw(repr = u8)]
#[derive(Debug, Clone, Default, PartialEq)]
pub enum CharacterMode {
None = 0x0,
#[default]
Normal = 0x1,
Dead = 0x2,
}
#[binrw]
#[brw(little)]
#[derive(Debug, Clone, Default)]
@ -64,7 +75,7 @@ pub struct PlayerSpawn {
pub u25: u8,
pub u26: u8,
pub spawn_index: u8,
pub state: u8,
pub mode: CharacterMode,
pub persistent_emote: u8,
pub model_type: u8,
pub subtype: u8,
@ -124,7 +135,7 @@ mod tests {
assert_eq!(player_spawn.hp_max, 159);
assert_eq!(player_spawn.mp_curr, 10000);
assert_eq!(player_spawn.mp_max, 10000);
assert_eq!(player_spawn.state, 1);
assert_eq!(player_spawn.mode, CharacterMode::Normal);
assert_eq!(player_spawn.spawn_index, 0);
assert_eq!(player_spawn.level, 1);
assert_eq!(player_spawn.class_job, 1); // adventurer