mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-24 08:07:45 +00:00
Add display flags
This is based off of the display flags from Sapphire, and the weird UNK one that I see in game.
This commit is contained in:
parent
93409a3c49
commit
d47779c8d6
8 changed files with 43 additions and 16 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -385,6 +385,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"binrw",
|
"binrw",
|
||||||
|
"bitflags 1.3.2",
|
||||||
"md5",
|
"md5",
|
||||||
"minijinja",
|
"minijinja",
|
||||||
"physis",
|
"physis",
|
||||||
|
|
|
@ -75,3 +75,7 @@ physis = { git = "https://github.com/redstrate/physis" }
|
||||||
|
|
||||||
# Used for data persistence
|
# Used for data persistence
|
||||||
rusqlite = { version = "0.34", features = ["bundled"], default-features = false }
|
rusqlite = { version = "0.34", features = ["bundled"], default-features = false }
|
||||||
|
|
||||||
|
# needed for c-style bitflags
|
||||||
|
# cannot upgrade to 2.0.0, breaking changes that aren't recoverable: https://github.com/bitflags/bitflags/issues/314
|
||||||
|
bitflags = { version = "1.3", default-features = false }
|
||||||
|
|
|
@ -11,9 +11,7 @@ use kawari::packet::{
|
||||||
send_packet,
|
send_packet,
|
||||||
};
|
};
|
||||||
use kawari::world::ipc::{
|
use kawari::world::ipc::{
|
||||||
ClientZoneIpcData, CommonSpawn, GameMasterCommandType, GameMasterRank, ObjectKind,
|
ClientZoneIpcData, CommonSpawn, DisplayFlag, GameMasterCommandType, GameMasterRank, ObjectKind, OnlineStatus, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType, SocialListRequestType, StatusEffect
|
||||||
OnlineStatus, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType,
|
|
||||||
SocialListRequestType, StatusEffect,
|
|
||||||
};
|
};
|
||||||
use kawari::world::{
|
use kawari::world::{
|
||||||
ChatHandler, Zone, ZoneConnection,
|
ChatHandler, Zone, ZoneConnection,
|
||||||
|
@ -344,6 +342,7 @@ async fn main() {
|
||||||
),
|
),
|
||||||
look: chara_details.chara_make.customize,
|
look: chara_details.chara_make.customize,
|
||||||
fc_tag: "LOCAL".to_string(),
|
fc_tag: "LOCAL".to_string(),
|
||||||
|
display_flags: DisplayFlag::UNK,
|
||||||
models: [
|
models: [
|
||||||
0, // head
|
0, // head
|
||||||
89, // body
|
89, // body
|
||||||
|
|
|
@ -111,10 +111,11 @@ impl ChatHandler {
|
||||||
common: CommonSpawn {
|
common: CommonSpawn {
|
||||||
class_job: 35,
|
class_job: 35,
|
||||||
name: "Test Actor".to_string(),
|
name: "Test Actor".to_string(),
|
||||||
hp_curr: 100,
|
hp_curr: 250,
|
||||||
hp_max: 100,
|
hp_max: 250,
|
||||||
mp_curr: 100,
|
mp_curr: 10000,
|
||||||
mp_max: 100,
|
mp_max: 10000,
|
||||||
|
level: 5,
|
||||||
object_kind: ObjectKind::Player(PlayerSubKind::Player),
|
object_kind: ObjectKind::Player(PlayerSubKind::Player),
|
||||||
spawn_index: connection.get_free_spawn_index(),
|
spawn_index: connection.get_free_spawn_index(),
|
||||||
look: CUSTOMIZE_DATA,
|
look: CUSTOMIZE_DATA,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use binrw::binrw;
|
use binrw::binrw;
|
||||||
|
|
||||||
|
use bitflags::bitflags;
|
||||||
|
|
||||||
use crate::common::{
|
use crate::common::{
|
||||||
CHAR_NAME_MAX_LENGTH, CustomizeData, INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position,
|
CHAR_NAME_MAX_LENGTH, CustomizeData, INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position,
|
||||||
read_string, write_string,
|
read_string, write_string,
|
||||||
|
@ -112,6 +114,26 @@ pub enum GameMasterRank {
|
||||||
Debug = 90,
|
Debug = 90,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bitflags! {
|
||||||
|
#[binrw]
|
||||||
|
pub struct DisplayFlag : u32 {
|
||||||
|
const NONE = 0x0;
|
||||||
|
// Can be made visible with ActorControl I think
|
||||||
|
const INVISIBLE = 0x20;
|
||||||
|
const HIDE_HEAD = 0x40;
|
||||||
|
const HIDE_WEAPON = 0x80;
|
||||||
|
const FADED = 0x100;
|
||||||
|
const VISOR = 0x800;
|
||||||
|
const UNK = 0x40000; // FIXME: what is this?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for DisplayFlag {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::NONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
|
@ -135,8 +157,8 @@ pub struct CommonSpawn {
|
||||||
pub parent_actor_id: ObjectId,
|
pub parent_actor_id: ObjectId,
|
||||||
pub hp_max: u32,
|
pub hp_max: u32,
|
||||||
pub hp_curr: u32,
|
pub hp_curr: u32,
|
||||||
pub display_flags: u32, // assumed
|
pub display_flags: DisplayFlag,
|
||||||
pub fate_id: u16, // assumed
|
pub fate_id: u16, // assumed
|
||||||
pub mp_curr: u16,
|
pub mp_curr: u16,
|
||||||
pub mp_max: u16,
|
pub mp_max: u16,
|
||||||
pub unk: u16,
|
pub unk: u16,
|
||||||
|
|
|
@ -37,8 +37,8 @@ pub use npc_spawn::NpcSpawn;
|
||||||
|
|
||||||
mod common_spawn;
|
mod common_spawn;
|
||||||
pub use common_spawn::{
|
pub use common_spawn::{
|
||||||
BattleNpcSubKind, CharacterMode, CommonSpawn, GameMasterRank, ObjectKind, OnlineStatus,
|
BattleNpcSubKind, CharacterMode, CommonSpawn, DisplayFlag, GameMasterRank, ObjectKind,
|
||||||
PlayerSubKind,
|
OnlineStatus, PlayerSubKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod status_effect_list;
|
mod status_effect_list;
|
||||||
|
|
|
@ -31,7 +31,7 @@ mod tests {
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common::INVALID_OBJECT_ID,
|
common::INVALID_OBJECT_ID,
|
||||||
world::ipc::{BattleNpcSubKind, CharacterMode, ObjectKind, OnlineStatus},
|
world::ipc::{BattleNpcSubKind, CharacterMode, DisplayFlag, ObjectKind, OnlineStatus},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -49,7 +49,7 @@ mod tests {
|
||||||
assert_eq!(npc_spawn.common.hp_curr, 1393);
|
assert_eq!(npc_spawn.common.hp_curr, 1393);
|
||||||
assert_eq!(npc_spawn.common.mp_curr, 10000);
|
assert_eq!(npc_spawn.common.mp_curr, 10000);
|
||||||
assert_eq!(npc_spawn.common.mp_max, 10000);
|
assert_eq!(npc_spawn.common.mp_max, 10000);
|
||||||
assert_eq!(npc_spawn.common.display_flags, 0);
|
assert_eq!(npc_spawn.common.display_flags, DisplayFlag::NONE);
|
||||||
assert_eq!(npc_spawn.common.pos.x, -64.17707);
|
assert_eq!(npc_spawn.common.pos.x, -64.17707);
|
||||||
assert_eq!(npc_spawn.common.pos.y, -2.0206506);
|
assert_eq!(npc_spawn.common.pos.y, -2.0206506);
|
||||||
assert_eq!(npc_spawn.common.pos.z, 15.913875);
|
assert_eq!(npc_spawn.common.pos.z, 15.913875);
|
||||||
|
@ -80,7 +80,7 @@ mod tests {
|
||||||
assert_eq!(npc_spawn.common.hp_curr, 91);
|
assert_eq!(npc_spawn.common.hp_curr, 91);
|
||||||
assert_eq!(npc_spawn.common.mp_curr, 0);
|
assert_eq!(npc_spawn.common.mp_curr, 0);
|
||||||
assert_eq!(npc_spawn.common.mp_max, 0);
|
assert_eq!(npc_spawn.common.mp_max, 0);
|
||||||
assert_eq!(npc_spawn.common.display_flags, 0);
|
assert_eq!(npc_spawn.common.display_flags, DisplayFlag::NONE);
|
||||||
assert_eq!(npc_spawn.common.pos.x, 116.99154);
|
assert_eq!(npc_spawn.common.pos.x, 116.99154);
|
||||||
assert_eq!(npc_spawn.common.pos.y, 76.64936);
|
assert_eq!(npc_spawn.common.pos.y, 76.64936);
|
||||||
assert_eq!(npc_spawn.common.pos.z, -187.02414);
|
assert_eq!(npc_spawn.common.pos.z, -187.02414);
|
||||||
|
|
|
@ -39,7 +39,7 @@ mod tests {
|
||||||
|
|
||||||
use binrw::BinRead;
|
use binrw::BinRead;
|
||||||
|
|
||||||
use crate::world::ipc::{CharacterMode, ObjectKind, OnlineStatus, PlayerSubKind};
|
use crate::world::ipc::{CharacterMode, DisplayFlag, ObjectKind, OnlineStatus, PlayerSubKind};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ mod tests {
|
||||||
player_spawn.common.object_kind,
|
player_spawn.common.object_kind,
|
||||||
ObjectKind::Player(PlayerSubKind::Player)
|
ObjectKind::Player(PlayerSubKind::Player)
|
||||||
);
|
);
|
||||||
assert_eq!(player_spawn.common.display_flags, 262144);
|
assert_eq!(player_spawn.common.display_flags, DisplayFlag::UNK);
|
||||||
assert_eq!(player_spawn.online_status, OnlineStatus::Offline);
|
assert_eq!(player_spawn.online_status, OnlineStatus::Offline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue