mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-29 01:47:45 +00:00
Create CharacterMode enum
This commit is contained in:
parent
3bbf345cd6
commit
0bf4cd1264
4 changed files with 15 additions and 5 deletions
|
@ -286,7 +286,6 @@ async fn main() {
|
||||||
mp_curr: 100,
|
mp_curr: 100,
|
||||||
mp_max: 100,
|
mp_max: 100,
|
||||||
model_type: 1,
|
model_type: 1,
|
||||||
state: 1,
|
|
||||||
gm_rank: 3,
|
gm_rank: 3,
|
||||||
look: CUSTOMIZE_DATA,
|
look: CUSTOMIZE_DATA,
|
||||||
fc_tag: "LOCAL".to_string(),
|
fc_tag: "LOCAL".to_string(),
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
||||||
ipc::{IPCOpCode, IPCSegment, IPCStructData},
|
ipc::{IPCOpCode, IPCSegment, IPCStructData},
|
||||||
packet::{PacketSegment, SegmentType},
|
packet::{PacketSegment, SegmentType},
|
||||||
timestamp_secs,
|
timestamp_secs,
|
||||||
world::PlayerSpawn,
|
world::{CharacterMode, PlayerSpawn},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{ChatMessage, Position, ZoneConnection};
|
use super::{ChatMessage, Position, ZoneConnection};
|
||||||
|
@ -53,7 +53,6 @@ impl ChatHandler {
|
||||||
mp_curr: 100,
|
mp_curr: 100,
|
||||||
mp_max: 100,
|
mp_max: 100,
|
||||||
model_type: 1,
|
model_type: 1,
|
||||||
state: 1,
|
|
||||||
gm_rank: 3,
|
gm_rank: 3,
|
||||||
spawn_index: connection.get_free_spawn_index(),
|
spawn_index: connection.get_free_spawn_index(),
|
||||||
look: CUSTOMIZE_DATA,
|
look: CUSTOMIZE_DATA,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
mod player_spawn;
|
mod player_spawn;
|
||||||
|
pub use player_spawn::CharacterMode;
|
||||||
pub use player_spawn::PlayerSpawn;
|
pub use player_spawn::PlayerSpawn;
|
||||||
|
|
||||||
mod position;
|
mod position;
|
||||||
|
|
|
@ -7,6 +7,17 @@ use crate::common::{read_string, write_string};
|
||||||
use super::position::Position;
|
use super::position::Position;
|
||||||
use super::status_effect::StatusEffect;
|
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]
|
#[binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
|
@ -64,7 +75,7 @@ pub struct PlayerSpawn {
|
||||||
pub u25: u8,
|
pub u25: u8,
|
||||||
pub u26: u8,
|
pub u26: u8,
|
||||||
pub spawn_index: u8,
|
pub spawn_index: u8,
|
||||||
pub state: u8,
|
pub mode: CharacterMode,
|
||||||
pub persistent_emote: u8,
|
pub persistent_emote: u8,
|
||||||
pub model_type: u8,
|
pub model_type: u8,
|
||||||
pub subtype: u8,
|
pub subtype: u8,
|
||||||
|
@ -124,7 +135,7 @@ mod tests {
|
||||||
assert_eq!(player_spawn.hp_max, 159);
|
assert_eq!(player_spawn.hp_max, 159);
|
||||||
assert_eq!(player_spawn.mp_curr, 10000);
|
assert_eq!(player_spawn.mp_curr, 10000);
|
||||||
assert_eq!(player_spawn.mp_max, 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.spawn_index, 0);
|
||||||
assert_eq!(player_spawn.level, 1);
|
assert_eq!(player_spawn.level, 1);
|
||||||
assert_eq!(player_spawn.class_job, 1); // adventurer
|
assert_eq!(player_spawn.class_job, 1); // adventurer
|
||||||
|
|
Loading…
Add table
Reference in a new issue