mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-23 15:47:45 +00:00
Begin moving IPC structures to their own files
This commit is contained in:
parent
4b409e4417
commit
aa6e818bfb
7 changed files with 124 additions and 180 deletions
|
@ -1,10 +1,11 @@
|
|||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use kawari::ipc::{ActorControlType, IPCOpCode, IPCSegment, IPCStructData, Position, StatusEffect};
|
||||
use kawari::ipc::{ActorControlType, IPCOpCode, IPCSegment, IPCStructData};
|
||||
use kawari::oodle::FFXIVOodle;
|
||||
use kawari::packet::{
|
||||
CompressionType, PacketSegment, SegmentType, State, parse_packet, send_keep_alive, send_packet,
|
||||
};
|
||||
use kawari::world::{PlayerSpawnData, Position};
|
||||
use kawari::{CONTENT_ID, WORLD_ID, ZONE_ID};
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio::net::TcpListener;
|
||||
|
@ -479,11 +480,7 @@ async fn main() {
|
|||
unk5: 0,
|
||||
unk6: [0; 4],
|
||||
unk7: [0; 3],
|
||||
position: Position {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
position: Position::default(),
|
||||
unk8: [0; 4],
|
||||
unk9: 0,
|
||||
},
|
||||
|
@ -516,84 +513,9 @@ async fn main() {
|
|||
op_code: IPCOpCode::PlayerSpawn,
|
||||
server_id: 0,
|
||||
timestamp: timestamp_secs(),
|
||||
data: IPCStructData::PlayerSpawn {
|
||||
title: 0,
|
||||
u1b: 0,
|
||||
current_world_id: 0,
|
||||
home_world_id: 0,
|
||||
gm_rank: 0,
|
||||
u3c: 0,
|
||||
u4: 0,
|
||||
online_status: 0,
|
||||
pose: 0,
|
||||
u5a: 0,
|
||||
u5b: 0,
|
||||
u5c: 0,
|
||||
target_id: 0,
|
||||
u6: 0,
|
||||
u7: 0,
|
||||
main_weapon_model: 0,
|
||||
sec_weapon_model: 0,
|
||||
craft_tool_model: 0,
|
||||
u14: 0,
|
||||
u15: 0,
|
||||
b_npc_base: 0,
|
||||
b_npc_name: 0,
|
||||
u18: 0,
|
||||
u19: 0,
|
||||
director_id: 0,
|
||||
owner_id: 0,
|
||||
u22: 0,
|
||||
padding4: [0; 16],
|
||||
hp_max: 0,
|
||||
hp_curr: 0,
|
||||
display_flags: 0,
|
||||
fate_id: 0,
|
||||
mp_curr: 0,
|
||||
mp_max: 0,
|
||||
unk: 0,
|
||||
model_chara: 0,
|
||||
rotation: 0,
|
||||
current_mount: 0,
|
||||
active_minion: 0,
|
||||
u23: 0,
|
||||
u24: 0,
|
||||
u25: 0,
|
||||
u26: 0,
|
||||
spawn_index: 0,
|
||||
state: 0,
|
||||
persistent_emote: 0,
|
||||
model_type: 0,
|
||||
subtype: 0,
|
||||
voice: 0,
|
||||
enemy_type: 0,
|
||||
unk27: 0,
|
||||
level: 0,
|
||||
class_job: 0,
|
||||
unk28: 0,
|
||||
unk29: 0,
|
||||
unk30: 0,
|
||||
mount_head: 0,
|
||||
mount_body: 0,
|
||||
mount_feet: 0,
|
||||
mount_color: 0,
|
||||
scale: 0,
|
||||
element_data: [0; 6],
|
||||
padding2: [0; 12],
|
||||
effect: [StatusEffect::default(); 30],
|
||||
pos: Position {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
models: [0; 10],
|
||||
unknown6_58: [0; 10],
|
||||
padding3: [0; 7],
|
||||
name: [0; 32],
|
||||
look: [0; 26],
|
||||
fc_tag: [0; 6],
|
||||
padding: [0; 26],
|
||||
},
|
||||
data: IPCStructData::PlayerSpawn(
|
||||
PlayerSpawnData::default(),
|
||||
),
|
||||
};
|
||||
|
||||
let response_packet = PacketSegment {
|
||||
|
|
101
src/ipc.rs
101
src/ipc.rs
|
@ -1,6 +1,9 @@
|
|||
use binrw::binrw;
|
||||
|
||||
use crate::common::{read_string, write_string};
|
||||
use crate::{
|
||||
common::{read_string, write_string},
|
||||
world::{PlayerSpawnData, Position},
|
||||
};
|
||||
|
||||
// NOTE: See https://github.com/karashiiro/FFXIVOpcodes/blob/master/FFXIVOpcodes/Ipcs.cs for opcodes
|
||||
|
||||
|
@ -147,14 +150,6 @@ pub enum LobbyCharacterAction {
|
|||
Request = 0x15,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Position {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
pub z: f32,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
#[brw(repr = u16)]
|
||||
|
@ -162,15 +157,6 @@ pub enum ActorControlType {
|
|||
SetCharaGearParamUI = 0x260,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub struct StatusEffect {
|
||||
effect_id: u16,
|
||||
param: u16,
|
||||
duration: f32,
|
||||
source_actor_id: u32,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[br(import(magic: &IPCOpCode))]
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -569,84 +555,7 @@ pub enum IPCStructData {
|
|||
role_actions: [u32; 10],
|
||||
},
|
||||
#[br(pre_assert(false))]
|
||||
PlayerSpawn {
|
||||
title: u16,
|
||||
u1b: u16,
|
||||
current_world_id: u16,
|
||||
home_world_id: u16,
|
||||
|
||||
gm_rank: u8,
|
||||
u3c: u8,
|
||||
u4: u8,
|
||||
online_status: u8,
|
||||
|
||||
pose: u8,
|
||||
u5a: u8,
|
||||
u5b: u8,
|
||||
u5c: u8,
|
||||
|
||||
target_id: u64,
|
||||
u6: u32,
|
||||
u7: u32,
|
||||
main_weapon_model: u64,
|
||||
sec_weapon_model: u64,
|
||||
craft_tool_model: u64,
|
||||
|
||||
u14: u32,
|
||||
u15: u32,
|
||||
b_npc_base: u32,
|
||||
b_npc_name: u32,
|
||||
u18: u32,
|
||||
u19: u32,
|
||||
director_id: u32,
|
||||
owner_id: u32,
|
||||
u22: u32,
|
||||
padding4: [u8; 16],
|
||||
hp_max: u32,
|
||||
hp_curr: u32,
|
||||
display_flags: u32,
|
||||
fate_id: u16,
|
||||
mp_curr: u16,
|
||||
mp_max: u16,
|
||||
unk: u16,
|
||||
model_chara: u16,
|
||||
rotation: u16,
|
||||
current_mount: u16,
|
||||
active_minion: u16,
|
||||
u23: u8,
|
||||
u24: u8,
|
||||
u25: u8,
|
||||
u26: u8,
|
||||
spawn_index: u8,
|
||||
state: u8,
|
||||
persistent_emote: u8,
|
||||
model_type: u8,
|
||||
subtype: u8,
|
||||
voice: u8,
|
||||
enemy_type: u8,
|
||||
unk27: u8,
|
||||
level: u8,
|
||||
class_job: u8,
|
||||
unk28: u8,
|
||||
unk29: u8,
|
||||
unk30: u8,
|
||||
mount_head: u8,
|
||||
mount_body: u8,
|
||||
mount_feet: u8,
|
||||
mount_color: u8,
|
||||
scale: u8,
|
||||
element_data: [u8; 6],
|
||||
padding2: [u8; 12],
|
||||
effect: [StatusEffect; 30],
|
||||
pos: Position,
|
||||
models: [u32; 10],
|
||||
unknown6_58: [u8; 10],
|
||||
padding3: [u8; 7],
|
||||
name: [u8; 32],
|
||||
look: [u8; 26],
|
||||
fc_tag: [u8; 6],
|
||||
padding: [u8; 26],
|
||||
},
|
||||
PlayerSpawn(PlayerSpawnData),
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
|
|
|
@ -12,6 +12,7 @@ pub mod ipc;
|
|||
pub mod oodle;
|
||||
pub mod packet;
|
||||
pub mod patchlist;
|
||||
pub mod world;
|
||||
|
||||
// TODO: make this configurable
|
||||
// See https://ffxiv.consolegameswiki.com/wiki/Servers for a list of possible IDs
|
||||
|
|
8
src/world/mod.rs
Normal file
8
src/world/mod.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
mod player_spawn;
|
||||
pub use player_spawn::PlayerSpawnData;
|
||||
|
||||
mod position;
|
||||
pub use position::Position;
|
||||
|
||||
mod status_effect;
|
||||
pub use status_effect::StatusEffect;
|
85
src/world/player_spawn.rs
Normal file
85
src/world/player_spawn.rs
Normal file
|
@ -0,0 +1,85 @@
|
|||
use binrw::binrw;
|
||||
|
||||
use super::position::Position;
|
||||
use super::status_effect::StatusEffect;
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct PlayerSpawnData {
|
||||
pub title: u16,
|
||||
pub u1b: u16,
|
||||
pub current_world_id: u16,
|
||||
pub home_world_id: u16,
|
||||
|
||||
pub gm_rank: u8,
|
||||
pub u3c: u8,
|
||||
pub u4: u8,
|
||||
pub online_status: u8,
|
||||
|
||||
pub pose: u8,
|
||||
pub u5a: u8,
|
||||
pub u5b: u8,
|
||||
pub u5c: u8,
|
||||
|
||||
pub target_id: u64,
|
||||
pub u6: u32,
|
||||
pub u7: u32,
|
||||
pub main_weapon_model: u64,
|
||||
pub sec_weapon_model: u64,
|
||||
pub craft_tool_model: u64,
|
||||
|
||||
pub u14: u32,
|
||||
pub u15: u32,
|
||||
pub b_npc_base: u32,
|
||||
pub b_npc_name: u32,
|
||||
pub u18: u32,
|
||||
pub u19: u32,
|
||||
pub director_id: u32,
|
||||
pub owner_id: u32,
|
||||
pub u22: u32,
|
||||
pub padding4: [u8; 16],
|
||||
pub hp_max: u32,
|
||||
pub hp_curr: u32,
|
||||
pub display_flags: u32,
|
||||
pub fate_id: u16,
|
||||
pub mp_curr: u16,
|
||||
pub mp_max: u16,
|
||||
pub unk: u16,
|
||||
pub model_chara: u16,
|
||||
pub rotation: u16,
|
||||
pub current_mount: u16,
|
||||
pub active_minion: u16,
|
||||
pub u23: u8,
|
||||
pub u24: u8,
|
||||
pub u25: u8,
|
||||
pub u26: u8,
|
||||
pub spawn_index: u8,
|
||||
pub state: u8,
|
||||
pub persistent_emote: u8,
|
||||
pub model_type: u8,
|
||||
pub subtype: u8,
|
||||
pub voice: u8,
|
||||
pub enemy_type: u8,
|
||||
pub unk27: u8,
|
||||
pub level: u8,
|
||||
pub class_job: u8,
|
||||
pub unk28: u8,
|
||||
pub unk29: u8,
|
||||
pub unk30: u8,
|
||||
pub mount_head: u8,
|
||||
pub mount_body: u8,
|
||||
pub mount_feet: u8,
|
||||
pub mount_color: u8,
|
||||
pub scale: u8,
|
||||
pub element_data: [u8; 6],
|
||||
pub padding2: [u8; 12],
|
||||
pub effect: [StatusEffect; 30],
|
||||
pub pos: Position,
|
||||
pub models: [u32; 10],
|
||||
pub unknown6_58: [u8; 10],
|
||||
pub padding3: [u8; 7],
|
||||
pub name: [u8; 32],
|
||||
pub look: [u8; 26],
|
||||
pub fc_tag: [u8; 6],
|
||||
pub padding: [u8; 26],
|
||||
}
|
9
src/world/position.rs
Normal file
9
src/world/position.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use binrw::binrw;
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Position {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
pub z: f32,
|
||||
}
|
10
src/world/status_effect.rs
Normal file
10
src/world/status_effect.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use binrw::binrw;
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub struct StatusEffect {
|
||||
effect_id: u16,
|
||||
param: u16,
|
||||
duration: f32,
|
||||
source_actor_id: u32,
|
||||
}
|
Loading…
Add table
Reference in a new issue