mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-06 04:37:46 +00:00
Update IPC struct names and filenames to match their opcode name
This commit is contained in:
parent
056ab27d39
commit
ff33bd446a
17 changed files with 68 additions and 71 deletions
|
@ -15,7 +15,7 @@ use kawari::ipc::zone::{
|
||||||
GameMasterRank, OnlineStatus, ServerZoneIpcData, ServerZoneIpcSegment, SocialListRequestType,
|
GameMasterRank, OnlineStatus, ServerZoneIpcData, ServerZoneIpcSegment, SocialListRequestType,
|
||||||
};
|
};
|
||||||
use kawari::ipc::zone::{
|
use kawari::ipc::zone::{
|
||||||
ActorControlCategory, ActorControlSelf, CommonSpawn, PlayerEntry, PlayerSetup, PlayerSpawn,
|
ActorControlCategory, ActorControlSelf, CommonSpawn, PlayerEntry, PlayerSpawn, PlayerStatus,
|
||||||
SocialList,
|
SocialList,
|
||||||
};
|
};
|
||||||
use kawari::opcodes::{ServerChatIpcType, ServerZoneIpcType};
|
use kawari::opcodes::{ServerChatIpcType, ServerZoneIpcType};
|
||||||
|
@ -393,7 +393,7 @@ async fn client_loop(
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
op_code: ServerZoneIpcType::PlayerStatus,
|
op_code: ServerZoneIpcType::PlayerStatus,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::PlayerStatus(PlayerSetup {
|
data: ServerZoneIpcData::PlayerStatus(PlayerStatus {
|
||||||
content_id: connection.player_data.content_id,
|
content_id: connection.player_data.content_id,
|
||||||
exp: [10000; 32],
|
exp: [10000; 32],
|
||||||
levels: [100; 32],
|
levels: [100; 32],
|
||||||
|
@ -632,7 +632,7 @@ async fn client_loop(
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
ClientZoneIpcData::GameMasterCommand { command, arg0, .. } => {
|
ClientZoneIpcData::GMCommand { command, arg0, .. } => {
|
||||||
tracing::info!("Got a game master command!");
|
tracing::info!("Got a game master command!");
|
||||||
|
|
||||||
match &command {
|
match &command {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::common::GameData;
|
use crate::common::GameData;
|
||||||
|
|
||||||
use crate::ipc::zone::InventoryModify;
|
use crate::ipc::zone::ItemOperation;
|
||||||
|
|
||||||
mod equipped;
|
mod equipped;
|
||||||
pub use equipped::EquippedStorage;
|
pub use equipped::EquippedStorage;
|
||||||
|
@ -159,7 +159,7 @@ impl Inventory {
|
||||||
self.equipped.left_ring = Item::new(1, 0x00003b1d);
|
self.equipped.left_ring = Item::new(1, 0x00003b1d);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_action(&mut self, action: &InventoryModify) {
|
pub fn process_action(&mut self, action: &ItemOperation) {
|
||||||
if action.operation_type == 78 {
|
if action.operation_type == 78 {
|
||||||
// discard
|
// discard
|
||||||
let src_container = self.get_container_mut(&action.src_storage_id);
|
let src_container = self.get_container_mut(&action.src_storage_id);
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub enum LobbyCharacterActionKind {
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub struct LobbyCharacterAction {
|
pub struct CharaMake {
|
||||||
pub sequence: u64,
|
pub sequence: u64,
|
||||||
pub content_id: u64,
|
pub content_id: u64,
|
||||||
#[br(pad_before = 8)]
|
#[br(pad_before = 8)]
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub struct ServiceAccount {
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct LobbyServiceAccountList {
|
pub struct LoginReply {
|
||||||
pub sequence: u64,
|
pub sequence: u64,
|
||||||
#[brw(pad_before = 1)]
|
#[brw(pad_before = 1)]
|
||||||
pub num_service_accounts: u8,
|
pub num_service_accounts: u8,
|
|
@ -1,18 +1,16 @@
|
||||||
use binrw::binrw;
|
use binrw::binrw;
|
||||||
|
|
||||||
mod character_action;
|
mod chara_make;
|
||||||
pub use character_action::{LobbyCharacterAction, LobbyCharacterActionKind};
|
pub use chara_make::{CharaMake, LobbyCharacterActionKind};
|
||||||
|
|
||||||
mod character_list;
|
mod service_login_reply;
|
||||||
pub use character_list::{CharacterDetails, CharacterFlag, LobbyCharacterList};
|
pub use service_login_reply::{CharacterDetails, CharacterFlag, ServiceLoginReply};
|
||||||
|
|
||||||
mod client_version_info;
|
|
||||||
|
|
||||||
mod server_list;
|
mod server_list;
|
||||||
pub use server_list::{LobbyServerList, Server};
|
pub use server_list::{DistWorldInfo, Server};
|
||||||
|
|
||||||
mod service_account_list;
|
mod login_reply;
|
||||||
pub use service_account_list::{LobbyServiceAccountList, ServiceAccount};
|
pub use login_reply::{LoginReply, ServiceAccount};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common::{read_string, write_string},
|
common::{read_string, write_string},
|
||||||
|
@ -120,7 +118,7 @@ pub enum ClientLobbyIpcData {
|
||||||
},
|
},
|
||||||
/// Sent by the client when they request something about the character (e.g. deletion.)
|
/// Sent by the client when they request something about the character (e.g. deletion.)
|
||||||
#[br(pre_assert(*magic == ClientLobbyIpcType::CharaMake))]
|
#[br(pre_assert(*magic == ClientLobbyIpcType::CharaMake))]
|
||||||
CharaMake(LobbyCharacterAction),
|
CharaMake(CharaMake),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
|
@ -137,9 +135,9 @@ pub enum ServerLobbyIpcData {
|
||||||
unk1: u16,
|
unk1: u16,
|
||||||
},
|
},
|
||||||
/// Sent by the server to inform the client of their service accounts.
|
/// Sent by the server to inform the client of their service accounts.
|
||||||
LoginReply(LobbyServiceAccountList),
|
LoginReply(LoginReply),
|
||||||
/// Sent by the server to inform the client of their characters.
|
/// Sent by the server to inform the client of their characters.
|
||||||
ServiceLoginReply(LobbyCharacterList),
|
ServiceLoginReply(ServiceLoginReply),
|
||||||
// Assumed what this is, but probably incorrect
|
// Assumed what this is, but probably incorrect
|
||||||
CharaMakeReply {
|
CharaMakeReply {
|
||||||
sequence: u64,
|
sequence: u64,
|
||||||
|
@ -172,7 +170,7 @@ pub enum ServerLobbyIpcData {
|
||||||
host: String,
|
host: String,
|
||||||
},
|
},
|
||||||
/// Sent by the server to inform the client of their servers.
|
/// Sent by the server to inform the client of their servers.
|
||||||
DistWorldInfo(LobbyServerList),
|
DistWorldInfo(DistWorldInfo),
|
||||||
/// Sent by the server to inform the client of their retainers.
|
/// Sent by the server to inform the client of their retainers.
|
||||||
DistRetainerInfo {
|
DistRetainerInfo {
|
||||||
// TODO: what is in here?
|
// TODO: what is in here?
|
||||||
|
@ -196,11 +194,11 @@ mod tests {
|
||||||
let ipc_types = [
|
let ipc_types = [
|
||||||
(
|
(
|
||||||
ServerLobbyIpcType::LoginReply,
|
ServerLobbyIpcType::LoginReply,
|
||||||
ServerLobbyIpcData::LoginReply(LobbyServiceAccountList::default()),
|
ServerLobbyIpcData::LoginReply(LoginReply::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerLobbyIpcType::DistWorldInfo,
|
ServerLobbyIpcType::DistWorldInfo,
|
||||||
ServerLobbyIpcData::DistWorldInfo(LobbyServerList::default()),
|
ServerLobbyIpcData::DistWorldInfo(DistWorldInfo::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerLobbyIpcType::DistRetainerInfo,
|
ServerLobbyIpcType::DistRetainerInfo,
|
||||||
|
@ -208,7 +206,7 @@ mod tests {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerLobbyIpcType::ServiceLoginReply,
|
ServerLobbyIpcType::ServiceLoginReply,
|
||||||
ServerLobbyIpcData::ServiceLoginReply(LobbyCharacterList::default()),
|
ServerLobbyIpcData::ServiceLoginReply(ServiceLoginReply::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerLobbyIpcType::GameLoginReply,
|
ServerLobbyIpcType::GameLoginReply,
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct Server {
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct LobbyServerList {
|
pub struct DistWorldInfo {
|
||||||
pub sequence: u64,
|
pub sequence: u64,
|
||||||
pub unk1: u16,
|
pub unk1: u16,
|
||||||
pub offset: u16,
|
pub offset: u16,
|
||||||
|
|
|
@ -67,7 +67,7 @@ pub struct CharacterDetails {
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct LobbyCharacterList {
|
pub struct ServiceLoginReply {
|
||||||
pub sequence: u64,
|
pub sequence: u64,
|
||||||
pub counter: u8,
|
pub counter: u8,
|
||||||
#[brw(pad_after = 2)]
|
#[brw(pad_after = 2)]
|
|
@ -5,7 +5,7 @@ use crate::common::ObjectTypeId;
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct EventPlay {
|
pub struct EventScene {
|
||||||
pub actor_id: ObjectTypeId,
|
pub actor_id: ObjectTypeId,
|
||||||
pub event_id: u32,
|
pub event_id: u32,
|
||||||
pub scene: u16,
|
pub scene: u16,
|
||||||
|
@ -37,7 +37,7 @@ mod tests {
|
||||||
let buffer = read(d).unwrap();
|
let buffer = read(d).unwrap();
|
||||||
let mut buffer = Cursor::new(&buffer);
|
let mut buffer = Cursor::new(&buffer);
|
||||||
|
|
||||||
let event_play = EventPlay::read_le(&mut buffer).unwrap();
|
let event_play = EventScene::read_le(&mut buffer).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
event_play.actor_id,
|
event_play.actor_id,
|
||||||
ObjectTypeId {
|
ObjectTypeId {
|
|
@ -4,7 +4,7 @@ use crate::inventory::ContainerType;
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct InventoryModify {
|
pub struct ItemOperation {
|
||||||
pub context_id: u32,
|
pub context_id: u32,
|
||||||
pub operation_type: u8,
|
pub operation_type: u8,
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ mod tests {
|
||||||
let buffer = read(d).unwrap();
|
let buffer = read(d).unwrap();
|
||||||
let mut buffer = Cursor::new(&buffer);
|
let mut buffer = Cursor::new(&buffer);
|
||||||
|
|
||||||
let modify_inventory = InventoryModify::read_le(&mut buffer).unwrap();
|
let modify_inventory = ItemOperation::read_le(&mut buffer).unwrap();
|
||||||
assert_eq!(modify_inventory.context_id, 0x10000000);
|
assert_eq!(modify_inventory.context_id, 0x10000000);
|
||||||
assert_eq!(modify_inventory.operation_type, 60);
|
assert_eq!(modify_inventory.operation_type, 60);
|
||||||
assert_eq!(modify_inventory.src_actor_id, 0);
|
assert_eq!(modify_inventory.src_actor_id, 0);
|
|
@ -18,7 +18,7 @@ mod update_class_info;
|
||||||
pub use update_class_info::UpdateClassInfo;
|
pub use update_class_info::UpdateClassInfo;
|
||||||
|
|
||||||
mod player_setup;
|
mod player_setup;
|
||||||
pub use player_setup::PlayerSetup;
|
pub use player_setup::PlayerStatus;
|
||||||
|
|
||||||
mod player_stats;
|
mod player_stats;
|
||||||
pub use player_stats::PlayerStats;
|
pub use player_stats::PlayerStats;
|
||||||
|
@ -53,8 +53,8 @@ pub use container_info::ContainerInfo;
|
||||||
mod item_info;
|
mod item_info;
|
||||||
pub use item_info::ItemInfo;
|
pub use item_info::ItemInfo;
|
||||||
|
|
||||||
mod event_play;
|
mod event_scene;
|
||||||
pub use event_play::EventPlay;
|
pub use event_scene::EventScene;
|
||||||
|
|
||||||
mod event_start;
|
mod event_start;
|
||||||
pub use event_start::EventStart;
|
pub use event_start::EventStart;
|
||||||
|
@ -64,14 +64,14 @@ pub use action_result::{
|
||||||
ActionEffect, ActionResult, DamageElement, DamageKind, DamageType, EffectKind,
|
ActionEffect, ActionResult, DamageElement, DamageKind, DamageType, EffectKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod actor_move;
|
mod r#move;
|
||||||
pub use actor_move::ActorMove;
|
pub use r#move::Move;
|
||||||
|
|
||||||
mod actor_set_pos;
|
mod warp;
|
||||||
pub use actor_set_pos::ActorSetPos;
|
pub use warp::Warp;
|
||||||
|
|
||||||
mod inventory_modify;
|
mod item_operation;
|
||||||
pub use inventory_modify::InventoryModify;
|
pub use item_operation::ItemOperation;
|
||||||
|
|
||||||
mod equip;
|
mod equip;
|
||||||
pub use equip::Equip;
|
pub use equip::Equip;
|
||||||
|
@ -159,7 +159,7 @@ pub enum ServerZoneIpcData {
|
||||||
/// Sent by the server containing character stats
|
/// Sent by the server containing character stats
|
||||||
PlayerStats(PlayerStats),
|
PlayerStats(PlayerStats),
|
||||||
/// Sent by the server to setup the player on the client
|
/// Sent by the server to setup the player on the client
|
||||||
PlayerStatus(PlayerSetup),
|
PlayerStatus(PlayerStatus),
|
||||||
/// Sent by the server to setup class info
|
/// Sent by the server to setup class info
|
||||||
UpdateClassInfo(UpdateClassInfo),
|
UpdateClassInfo(UpdateClassInfo),
|
||||||
/// Sent by the server to spawn the player in
|
/// Sent by the server to spawn the player in
|
||||||
|
@ -170,7 +170,7 @@ pub enum ServerZoneIpcData {
|
||||||
unk: [u8; 8],
|
unk: [u8; 8],
|
||||||
},
|
},
|
||||||
/// Sent by the server to modify the client's position
|
/// Sent by the server to modify the client's position
|
||||||
Warp(ActorSetPos),
|
Warp(Warp),
|
||||||
/// Sent by the server when they send a chat message
|
/// Sent by the server when they send a chat message
|
||||||
ServerChatMessage {
|
ServerChatMessage {
|
||||||
unk: u8, // channel?
|
unk: u8, // channel?
|
||||||
|
@ -187,7 +187,7 @@ pub enum ServerZoneIpcData {
|
||||||
/// Sent by the server
|
/// Sent by the server
|
||||||
ActorControl(ActorControl),
|
ActorControl(ActorControl),
|
||||||
/// Sent by the server
|
/// Sent by the server
|
||||||
Move(ActorMove),
|
Move(Move),
|
||||||
/// Sent by the server in response to SocialListRequest
|
/// Sent by the server in response to SocialListRequest
|
||||||
SocialList(SocialList),
|
SocialList(SocialList),
|
||||||
/// Sent by the server to spawn an NPC
|
/// Sent by the server to spawn an NPC
|
||||||
|
@ -201,7 +201,7 @@ pub enum ServerZoneIpcData {
|
||||||
/// Sent to inform the client of container status
|
/// Sent to inform the client of container status
|
||||||
ContainerInfo(ContainerInfo),
|
ContainerInfo(ContainerInfo),
|
||||||
/// Sent to tell the client to play a scene
|
/// Sent to tell the client to play a scene
|
||||||
EventScene(EventPlay),
|
EventScene(EventScene),
|
||||||
/// Sent to tell the client to load a scene, but not play it
|
/// Sent to tell the client to load a scene, but not play it
|
||||||
EventStart(EventStart),
|
EventStart(EventStart),
|
||||||
/// Sent to update an actor's hp & mp values
|
/// Sent to update an actor's hp & mp values
|
||||||
|
@ -308,7 +308,7 @@ pub enum ClientZoneIpcData {
|
||||||
ChatMessage(ChatMessage),
|
ChatMessage(ChatMessage),
|
||||||
/// Sent by the client when they send a GM command. This can only be sent by the client if they are sent a GM rank.
|
/// Sent by the client when they send a GM command. This can only be sent by the client if they are sent a GM rank.
|
||||||
#[br(pre_assert(*magic == ClientZoneIpcType::GMCommand))]
|
#[br(pre_assert(*magic == ClientZoneIpcType::GMCommand))]
|
||||||
GameMasterCommand {
|
GMCommand {
|
||||||
#[brw(pad_after = 3)] // padding
|
#[brw(pad_after = 3)] // padding
|
||||||
command: GameMasterCommandType,
|
command: GameMasterCommandType,
|
||||||
arg0: u32,
|
arg0: u32,
|
||||||
|
@ -353,7 +353,7 @@ pub enum ClientZoneIpcData {
|
||||||
unk: [u8; 16], // TODO: unknown
|
unk: [u8; 16], // TODO: unknown
|
||||||
},
|
},
|
||||||
#[br(pre_assert(*magic == ClientZoneIpcType::ItemOperation))]
|
#[br(pre_assert(*magic == ClientZoneIpcType::ItemOperation))]
|
||||||
ItemOperation(InventoryModify),
|
ItemOperation(ItemOperation),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -392,7 +392,7 @@ mod tests {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::PlayerStatus,
|
ServerZoneIpcType::PlayerStatus,
|
||||||
ServerZoneIpcData::PlayerStatus(PlayerSetup::default()),
|
ServerZoneIpcData::PlayerStatus(PlayerStatus::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::UpdateClassInfo,
|
ServerZoneIpcType::UpdateClassInfo,
|
||||||
|
@ -408,7 +408,7 @@ mod tests {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::Warp,
|
ServerZoneIpcType::Warp,
|
||||||
ServerZoneIpcData::Warp(ActorSetPos::default()),
|
ServerZoneIpcData::Warp(Warp::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::ServerChatMessage,
|
ServerZoneIpcType::ServerChatMessage,
|
||||||
|
@ -427,7 +427,7 @@ mod tests {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::Move,
|
ServerZoneIpcType::Move,
|
||||||
ServerZoneIpcData::Move(ActorMove::default()),
|
ServerZoneIpcData::Move(Move::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::NpcSpawn,
|
ServerZoneIpcType::NpcSpawn,
|
||||||
|
@ -451,7 +451,7 @@ mod tests {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::EventScene,
|
ServerZoneIpcType::EventScene,
|
||||||
ServerZoneIpcData::EventScene(EventPlay::default()),
|
ServerZoneIpcData::EventScene(EventScene::default()),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ServerZoneIpcType::EventStart,
|
ServerZoneIpcType::EventStart,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::common::{
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct ActorMove {
|
pub struct Move {
|
||||||
#[bw(map = write_packed_rotation_float)]
|
#[bw(map = write_packed_rotation_float)]
|
||||||
#[br(map = read_packed_rotation_float)]
|
#[br(map = read_packed_rotation_float)]
|
||||||
pub rotation: f32,
|
pub rotation: f32,
|
|
@ -4,7 +4,7 @@ use crate::common::{CHAR_NAME_MAX_LENGTH, read_string, write_string};
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct PlayerSetup {
|
pub struct PlayerStatus {
|
||||||
pub content_id: u64,
|
pub content_id: u64,
|
||||||
pub crest: u64,
|
pub crest: u64,
|
||||||
pub unknown10: u64,
|
pub unknown10: u64,
|
||||||
|
@ -180,7 +180,7 @@ mod tests {
|
||||||
let buffer = read(d).unwrap();
|
let buffer = read(d).unwrap();
|
||||||
let mut buffer = Cursor::new(&buffer);
|
let mut buffer = Cursor::new(&buffer);
|
||||||
|
|
||||||
let player_setup = PlayerSetup::read_le(&mut buffer).unwrap();
|
let player_setup = PlayerStatus::read_le(&mut buffer).unwrap();
|
||||||
assert_eq!(player_setup.content_id, 0x004000174c50560d);
|
assert_eq!(player_setup.content_id, 0x004000174c50560d);
|
||||||
assert_eq!(player_setup.char_id, 0x107476e7);
|
assert_eq!(player_setup.char_id, 0x107476e7);
|
||||||
assert_eq!(player_setup.name, "Lavenaa Warren");
|
assert_eq!(player_setup.name, "Lavenaa Warren");
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::common::Position;
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct ActorSetPos {
|
pub struct Warp {
|
||||||
pub dir: u16,
|
pub dir: u16,
|
||||||
pub warp_type: u8,
|
pub warp_type: u8,
|
||||||
pub warp_type_arg: u8,
|
pub warp_type_arg: u8,
|
|
@ -17,9 +17,9 @@ use crate::{
|
||||||
|
|
||||||
use crate::ipc::kawari::{CustomIpcData, CustomIpcSegment, CustomIpcType};
|
use crate::ipc::kawari::{CustomIpcData, CustomIpcSegment, CustomIpcType};
|
||||||
use crate::ipc::lobby::{
|
use crate::ipc::lobby::{
|
||||||
CharacterDetails, ClientLobbyIpcSegment, LobbyCharacterAction, LobbyCharacterActionKind,
|
CharaMake, CharacterDetails, ClientLobbyIpcSegment, DistWorldInfo, LobbyCharacterActionKind,
|
||||||
LobbyCharacterList, LobbyServerList, LobbyServiceAccountList, Server, ServerLobbyIpcData,
|
LoginReply, Server, ServerLobbyIpcData, ServerLobbyIpcSegment, ServiceAccount,
|
||||||
ServerLobbyIpcSegment, ServiceAccount,
|
ServiceLoginReply,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Represents a single connection between an instance of the client and the lobby server.
|
/// Represents a single connection between an instance of the client and the lobby server.
|
||||||
|
@ -79,7 +79,7 @@ impl LobbyConnection {
|
||||||
|
|
||||||
/// Send the service account list to the client.
|
/// Send the service account list to the client.
|
||||||
pub async fn send_account_list(&mut self) {
|
pub async fn send_account_list(&mut self) {
|
||||||
let service_account_list = ServerLobbyIpcData::LoginReply(LobbyServiceAccountList {
|
let service_account_list = ServerLobbyIpcData::LoginReply(LoginReply {
|
||||||
sequence: 0,
|
sequence: 0,
|
||||||
num_service_accounts: self.service_accounts.len() as u8,
|
num_service_accounts: self.service_accounts.len() as u8,
|
||||||
unk1: 3,
|
unk1: 3,
|
||||||
|
@ -122,7 +122,7 @@ impl LobbyConnection {
|
||||||
// add any empty boys
|
// add any empty boys
|
||||||
servers.resize(6, Server::default());
|
servers.resize(6, Server::default());
|
||||||
|
|
||||||
let lobby_server_list = ServerLobbyIpcData::DistWorldInfo(LobbyServerList {
|
let lobby_server_list = ServerLobbyIpcData::DistWorldInfo(DistWorldInfo {
|
||||||
sequence: 0,
|
sequence: 0,
|
||||||
unk1: 1,
|
unk1: 1,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
|
@ -210,7 +210,7 @@ impl LobbyConnection {
|
||||||
|
|
||||||
let lobby_character_list = if i == 3 {
|
let lobby_character_list = if i == 3 {
|
||||||
// On the last packet, add the account-wide information
|
// On the last packet, add the account-wide information
|
||||||
LobbyCharacterList {
|
ServiceLoginReply {
|
||||||
sequence,
|
sequence,
|
||||||
counter: (i * 4) + 1, // TODO: why the + 1 here?
|
counter: (i * 4) + 1, // TODO: why the + 1 here?
|
||||||
num_in_packet: characters_in_packet.len() as u8,
|
num_in_packet: characters_in_packet.len() as u8,
|
||||||
|
@ -231,7 +231,7 @@ impl LobbyConnection {
|
||||||
characters: characters_in_packet,
|
characters: characters_in_packet,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LobbyCharacterList {
|
ServiceLoginReply {
|
||||||
sequence,
|
sequence,
|
||||||
counter: i * 4,
|
counter: i * 4,
|
||||||
num_in_packet: characters_in_packet.len() as u8,
|
num_in_packet: characters_in_packet.len() as u8,
|
||||||
|
@ -329,7 +329,7 @@ impl LobbyConnection {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_character_action(&mut self, character_action: &LobbyCharacterAction) {
|
pub async fn handle_character_action(&mut self, character_action: &CharaMake) {
|
||||||
match &character_action.action {
|
match &character_action.action {
|
||||||
LobbyCharacterActionKind::ReserveName => {
|
LobbyCharacterActionKind::ReserveName => {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
|
|
|
@ -16,10 +16,10 @@ use crate::{
|
||||||
ipc::{
|
ipc::{
|
||||||
chat::ServerChatIpcSegment,
|
chat::ServerChatIpcSegment,
|
||||||
zone::{
|
zone::{
|
||||||
ActorControlSelf, ActorMove, ActorSetPos, ClientZoneIpcSegment, CommonSpawn,
|
ActorControlSelf, ClientZoneIpcSegment, CommonSpawn, ContainerInfo, DisplayFlag, Equip,
|
||||||
ContainerInfo, DisplayFlag, Equip, InitZone, ItemInfo, NpcSpawn, ObjectKind,
|
InitZone, ItemInfo, Move, NpcSpawn, ObjectKind, PlayerStats, PlayerSubKind,
|
||||||
PlayerStats, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, StatusEffect,
|
ServerZoneIpcData, ServerZoneIpcSegment, StatusEffect, StatusEffectList,
|
||||||
StatusEffectList, UpdateClassInfo, WeatherChange,
|
UpdateClassInfo, Warp, WeatherChange,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opcodes::ServerZoneIpcType,
|
opcodes::ServerZoneIpcType,
|
||||||
|
@ -233,7 +233,7 @@ impl ZoneConnection {
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
op_code: ServerZoneIpcType::Warp,
|
op_code: ServerZoneIpcType::Warp,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::Warp(ActorSetPos {
|
data: ServerZoneIpcData::Warp(Warp {
|
||||||
position,
|
position,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
@ -254,7 +254,7 @@ impl ZoneConnection {
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
op_code: ServerZoneIpcType::Move,
|
op_code: ServerZoneIpcType::Move,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::Move(ActorMove {
|
data: ServerZoneIpcData::Move(Move {
|
||||||
rotation,
|
rotation,
|
||||||
dir_before_slip: 0x7F,
|
dir_before_slip: 0x7F,
|
||||||
flag1: 0,
|
flag1: 0,
|
||||||
|
|
|
@ -3,8 +3,8 @@ use mlua::{FromLua, Lua, LuaSerdeExt, UserData, UserDataMethods, Value};
|
||||||
use crate::{
|
use crate::{
|
||||||
common::{ObjectId, ObjectTypeId, Position, timestamp_secs, workdefinitions::RemakeMode},
|
common::{ObjectId, ObjectTypeId, Position, timestamp_secs, workdefinitions::RemakeMode},
|
||||||
ipc::zone::{
|
ipc::zone::{
|
||||||
ActionEffect, ActorSetPos, DamageElement, DamageKind, DamageType, EffectKind, EventPlay,
|
ActionEffect, DamageElement, DamageKind, DamageType, EffectKind, EventScene,
|
||||||
ServerZoneIpcData, ServerZoneIpcSegment,
|
ServerZoneIpcData, ServerZoneIpcSegment, Warp,
|
||||||
},
|
},
|
||||||
opcodes::ServerZoneIpcType,
|
opcodes::ServerZoneIpcType,
|
||||||
packet::{PacketSegment, SegmentData, SegmentType},
|
packet::{PacketSegment, SegmentData, SegmentType},
|
||||||
|
@ -60,7 +60,7 @@ impl LuaPlayer {
|
||||||
op_code: ServerZoneIpcType::EventScene,
|
op_code: ServerZoneIpcType::EventScene,
|
||||||
option: 0,
|
option: 0,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::EventScene(EventPlay {
|
data: ServerZoneIpcData::EventScene(EventScene {
|
||||||
actor_id: ObjectTypeId {
|
actor_id: ObjectTypeId {
|
||||||
object_id: ObjectId(self.player_data.actor_id),
|
object_id: ObjectId(self.player_data.actor_id),
|
||||||
object_type: 0,
|
object_type: 0,
|
||||||
|
@ -85,7 +85,7 @@ impl LuaPlayer {
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
op_code: ServerZoneIpcType::Warp,
|
op_code: ServerZoneIpcType::Warp,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::Warp(ActorSetPos {
|
data: ServerZoneIpcData::Warp(Warp {
|
||||||
position,
|
position,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Reference in a new issue