mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-05 20:27:45 +00:00
Use Default trait in more segment construction
This commit is contained in:
parent
ff33bd446a
commit
de5e6cfb94
6 changed files with 48 additions and 134 deletions
|
@ -913,15 +913,12 @@ async fn client_loop(
|
||||||
segment_type: SegmentType::KawariIpc,
|
segment_type: SegmentType::KawariIpc,
|
||||||
data: SegmentData::KawariIpc {
|
data: SegmentData::KawariIpc {
|
||||||
data: CustomIpcSegment {
|
data: CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::CharacterCreated,
|
op_code: CustomIpcType::CharacterCreated,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::CharacterCreated {
|
data: CustomIpcData::CharacterCreated {
|
||||||
actor_id,
|
actor_id,
|
||||||
content_id,
|
content_id,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -941,12 +938,9 @@ async fn client_loop(
|
||||||
segment_type: SegmentType::KawariIpc,
|
segment_type: SegmentType::KawariIpc,
|
||||||
data: SegmentData::KawariIpc {
|
data: SegmentData::KawariIpc {
|
||||||
data: CustomIpcSegment {
|
data: CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::ActorIdFound,
|
op_code: CustomIpcType::ActorIdFound,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::ActorIdFound { actor_id },
|
data: CustomIpcData::ActorIdFound { actor_id },
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -964,14 +958,11 @@ async fn client_loop(
|
||||||
segment_type: SegmentType::KawariIpc,
|
segment_type: SegmentType::KawariIpc,
|
||||||
data: SegmentData::KawariIpc {
|
data: SegmentData::KawariIpc {
|
||||||
data: CustomIpcSegment {
|
data: CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::NameIsAvailableResponse,
|
op_code: CustomIpcType::NameIsAvailableResponse,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::NameIsAvailableResponse {
|
data: CustomIpcData::NameIsAvailableResponse {
|
||||||
free: is_name_free,
|
free: is_name_free,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1011,14 +1002,11 @@ async fn client_loop(
|
||||||
segment_type: SegmentType::KawariIpc,
|
segment_type: SegmentType::KawariIpc,
|
||||||
data: SegmentData::KawariIpc {
|
data: SegmentData::KawariIpc {
|
||||||
data: CustomIpcSegment {
|
data: CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::RequestCharacterListRepsonse,
|
op_code: CustomIpcType::RequestCharacterListRepsonse,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::RequestCharacterListRepsonse {
|
data: CustomIpcData::RequestCharacterListRepsonse {
|
||||||
characters
|
characters
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1041,14 +1029,11 @@ async fn client_loop(
|
||||||
segment_type: SegmentType::KawariIpc,
|
segment_type: SegmentType::KawariIpc,
|
||||||
data: SegmentData::KawariIpc {
|
data: SegmentData::KawariIpc {
|
||||||
data: CustomIpcSegment {
|
data: CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::CharacterDeleted,
|
op_code: CustomIpcType::CharacterDeleted,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::CharacterDeleted {
|
data: CustomIpcData::CharacterDeleted {
|
||||||
deleted: 1,
|
deleted: 1,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1078,14 +1063,11 @@ async fn client_loop(
|
||||||
segment_type: SegmentType::KawariIpc,
|
segment_type: SegmentType::KawariIpc,
|
||||||
data: SegmentData::KawariIpc {
|
data: SegmentData::KawariIpc {
|
||||||
data: CustomIpcSegment {
|
data: CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::CharacterRemade,
|
op_code: CustomIpcType::CharacterRemade,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::CharacterRemade {
|
data: CustomIpcData::CharacterRemade {
|
||||||
content_id: *content_id,
|
content_id: *content_id,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -29,6 +29,19 @@ impl ReadWriteIpcSegment for CustomIpcSegment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for CustomIpcSegment {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
unk1: 0,
|
||||||
|
unk2: 0,
|
||||||
|
op_code: CustomIpcType::GetActorId,
|
||||||
|
option: 0,
|
||||||
|
timestamp: 0,
|
||||||
|
data: CustomIpcData::GetActorId { content_id: 0 },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(repr = u16)]
|
#[brw(repr = u16)]
|
||||||
#[derive(Default, Clone, PartialEq, Debug)]
|
#[derive(Default, Clone, PartialEq, Debug)]
|
||||||
|
|
|
@ -88,12 +88,10 @@ impl LobbyConnection {
|
||||||
});
|
});
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::LoginReply,
|
op_code: ServerLobbyIpcType::LoginReply,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: service_account_list,
|
data: service_account_list,
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -113,10 +111,8 @@ impl LobbyConnection {
|
||||||
|
|
||||||
let mut servers = [Server {
|
let mut servers = [Server {
|
||||||
id: config.world.world_id,
|
id: config.world.world_id,
|
||||||
index: 0,
|
|
||||||
flags: 0,
|
|
||||||
icon: 0,
|
|
||||||
name: self.world_name.clone(),
|
name: self.world_name.clone(),
|
||||||
|
..Default::default()
|
||||||
}]
|
}]
|
||||||
.to_vec();
|
.to_vec();
|
||||||
// add any empty boys
|
// add any empty boys
|
||||||
|
@ -125,18 +121,16 @@ impl LobbyConnection {
|
||||||
let lobby_server_list = ServerLobbyIpcData::DistWorldInfo(DistWorldInfo {
|
let lobby_server_list = ServerLobbyIpcData::DistWorldInfo(DistWorldInfo {
|
||||||
sequence: 0,
|
sequence: 0,
|
||||||
unk1: 1,
|
unk1: 1,
|
||||||
offset: 0,
|
|
||||||
num_servers: 1,
|
num_servers: 1,
|
||||||
servers,
|
servers,
|
||||||
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::DistWorldInfo,
|
op_code: ServerLobbyIpcType::DistWorldInfo,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: lobby_server_list,
|
data: lobby_server_list,
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let response_packet = PacketSegment {
|
let response_packet = PacketSegment {
|
||||||
|
@ -152,12 +146,10 @@ impl LobbyConnection {
|
||||||
let lobby_retainer_list = ServerLobbyIpcData::DistRetainerInfo { unk1: 1 };
|
let lobby_retainer_list = ServerLobbyIpcData::DistRetainerInfo { unk1: 1 };
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::DistRetainerInfo,
|
op_code: ServerLobbyIpcType::DistRetainerInfo,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: lobby_retainer_list,
|
data: lobby_retainer_list,
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let response_packet = PacketSegment {
|
let response_packet = PacketSegment {
|
||||||
|
@ -180,14 +172,11 @@ impl LobbyConnection {
|
||||||
// now send them the character list
|
// now send them the character list
|
||||||
{
|
{
|
||||||
let charlist_request = CustomIpcSegment {
|
let charlist_request = CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::RequestCharacterList,
|
op_code: CustomIpcType::RequestCharacterList,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::RequestCharacterList {
|
data: CustomIpcData::RequestCharacterList {
|
||||||
service_account_id: self.selected_service_account.unwrap(),
|
service_account_id: self.selected_service_account.unwrap(),
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let name_response = send_custom_world_packet(charlist_request)
|
let name_response = send_custom_world_packet(charlist_request)
|
||||||
|
@ -214,14 +203,7 @@ impl LobbyConnection {
|
||||||
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,
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
unk3: 0,
|
|
||||||
unk4: 128,
|
unk4: 128,
|
||||||
unk5: [0; 7],
|
|
||||||
unk6: 0,
|
|
||||||
veteran_rank: 0,
|
|
||||||
unk7: 0,
|
|
||||||
days_subscribed: 30,
|
days_subscribed: 30,
|
||||||
remaining_days: 30,
|
remaining_days: 30,
|
||||||
days_to_next_rank: 0,
|
days_to_next_rank: 0,
|
||||||
|
@ -229,37 +211,23 @@ impl LobbyConnection {
|
||||||
max_characters_on_world: 8,
|
max_characters_on_world: 8,
|
||||||
entitled_expansion: 5,
|
entitled_expansion: 5,
|
||||||
characters: characters_in_packet,
|
characters: characters_in_packet,
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ServiceLoginReply {
|
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,
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
unk3: 0,
|
|
||||||
unk4: 0,
|
|
||||||
unk5: [0; 7],
|
|
||||||
unk6: 0,
|
|
||||||
veteran_rank: 0,
|
|
||||||
unk7: 0,
|
|
||||||
days_subscribed: 0,
|
|
||||||
remaining_days: 0,
|
|
||||||
days_to_next_rank: 0,
|
|
||||||
max_characters_on_world: 0,
|
|
||||||
unk8: 0,
|
|
||||||
entitled_expansion: 0,
|
|
||||||
characters: characters_in_packet,
|
characters: characters_in_packet,
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::ServiceLoginReply,
|
op_code: ServerLobbyIpcType::ServiceLoginReply,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerLobbyIpcData::ServiceLoginReply(lobby_character_list),
|
data: ServerLobbyIpcData::ServiceLoginReply(lobby_character_list),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -286,12 +254,10 @@ impl LobbyConnection {
|
||||||
};
|
};
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::GameLoginReply,
|
op_code: ServerLobbyIpcType::GameLoginReply,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: enter_world,
|
data: enter_world,
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -313,12 +279,10 @@ impl LobbyConnection {
|
||||||
};
|
};
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::NackReply,
|
op_code: ServerLobbyIpcType::NackReply,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: lobby_error,
|
data: lobby_error,
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -339,14 +303,11 @@ impl LobbyConnection {
|
||||||
|
|
||||||
// check with the world server if the name is available
|
// check with the world server if the name is available
|
||||||
let name_request = CustomIpcSegment {
|
let name_request = CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::CheckNameIsAvailable,
|
op_code: CustomIpcType::CheckNameIsAvailable,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::CheckNameIsAvailable {
|
data: CustomIpcData::CheckNameIsAvailable {
|
||||||
name: character_action.name.clone(),
|
name: character_action.name.clone(),
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let name_response = send_custom_world_packet(name_request)
|
let name_response = send_custom_world_packet(name_request)
|
||||||
|
@ -362,11 +323,7 @@ impl LobbyConnection {
|
||||||
self.stored_character_creation_name = character_action.name.clone();
|
self.stored_character_creation_name = character_action.name.clone();
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::CharaMakeReply,
|
op_code: ServerLobbyIpcType::CharaMakeReply,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: ServerLobbyIpcData::CharaMakeReply {
|
data: ServerLobbyIpcData::CharaMakeReply {
|
||||||
sequence: character_action.sequence + 1,
|
sequence: character_action.sequence + 1,
|
||||||
unk1: 0x1,
|
unk1: 0x1,
|
||||||
|
@ -379,6 +336,7 @@ impl LobbyConnection {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -389,11 +347,7 @@ impl LobbyConnection {
|
||||||
.await;
|
.await;
|
||||||
} else {
|
} else {
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::NackReply,
|
op_code: ServerLobbyIpcType::NackReply,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: ServerLobbyIpcData::NackReply {
|
data: ServerLobbyIpcData::NackReply {
|
||||||
sequence: character_action.sequence,
|
sequence: character_action.sequence,
|
||||||
error: 0x00000bdb,
|
error: 0x00000bdb,
|
||||||
|
@ -401,6 +355,7 @@ impl LobbyConnection {
|
||||||
value: 0,
|
value: 0,
|
||||||
unk1: 0,
|
unk1: 0,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let response_packet = PacketSegment {
|
let response_packet = PacketSegment {
|
||||||
|
@ -420,16 +375,13 @@ impl LobbyConnection {
|
||||||
// tell the world server to create this character
|
// tell the world server to create this character
|
||||||
{
|
{
|
||||||
let ipc_segment = CustomIpcSegment {
|
let ipc_segment = CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::RequestCreateCharacter,
|
op_code: CustomIpcType::RequestCreateCharacter,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::RequestCreateCharacter {
|
data: CustomIpcData::RequestCreateCharacter {
|
||||||
service_account_id: self.selected_service_account.unwrap(),
|
service_account_id: self.selected_service_account.unwrap(),
|
||||||
name: self.stored_character_creation_name.clone(), // TODO: worth double-checking, but AFAIK we have to store it this way?
|
name: self.stored_character_creation_name.clone(), // TODO: worth double-checking, but AFAIK we have to store it this way?
|
||||||
chara_make_json: character_action.json.clone(),
|
chara_make_json: character_action.json.clone(),
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let response_segment = send_custom_world_packet(ipc_segment).await.unwrap();
|
let response_segment = send_custom_world_packet(ipc_segment).await.unwrap();
|
||||||
|
@ -452,11 +404,7 @@ impl LobbyConnection {
|
||||||
// a slightly different character created packet now
|
// a slightly different character created packet now
|
||||||
{
|
{
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::CharaMakeReply,
|
op_code: ServerLobbyIpcType::CharaMakeReply,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: ServerLobbyIpcData::CharaMakeReply {
|
data: ServerLobbyIpcData::CharaMakeReply {
|
||||||
sequence: character_action.sequence + 1,
|
sequence: character_action.sequence + 1,
|
||||||
unk1: 0x1,
|
unk1: 0x1,
|
||||||
|
@ -471,6 +419,7 @@ impl LobbyConnection {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -486,14 +435,11 @@ impl LobbyConnection {
|
||||||
// tell the world server to yeet this guy
|
// tell the world server to yeet this guy
|
||||||
{
|
{
|
||||||
let ipc_segment = CustomIpcSegment {
|
let ipc_segment = CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::DeleteCharacter,
|
op_code: CustomIpcType::DeleteCharacter,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::DeleteCharacter {
|
data: CustomIpcData::DeleteCharacter {
|
||||||
content_id: character_action.content_id,
|
content_id: character_action.content_id,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let _ = send_custom_world_packet(ipc_segment).await.unwrap();
|
let _ = send_custom_world_packet(ipc_segment).await.unwrap();
|
||||||
|
@ -504,11 +450,7 @@ impl LobbyConnection {
|
||||||
// send a confirmation that the deletion was successful
|
// send a confirmation that the deletion was successful
|
||||||
{
|
{
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::CharaMakeReply,
|
op_code: ServerLobbyIpcType::CharaMakeReply,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: ServerLobbyIpcData::CharaMakeReply {
|
data: ServerLobbyIpcData::CharaMakeReply {
|
||||||
sequence: character_action.sequence + 1,
|
sequence: character_action.sequence + 1,
|
||||||
unk1: 0x1,
|
unk1: 0x1,
|
||||||
|
@ -523,6 +465,7 @@ impl LobbyConnection {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -539,15 +482,12 @@ impl LobbyConnection {
|
||||||
// tell the world server to turn this guy into a catgirl
|
// tell the world server to turn this guy into a catgirl
|
||||||
{
|
{
|
||||||
let ipc_segment = CustomIpcSegment {
|
let ipc_segment = CustomIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: CustomIpcType::RemakeCharacter,
|
op_code: CustomIpcType::RemakeCharacter,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: CustomIpcData::RemakeCharacter {
|
data: CustomIpcData::RemakeCharacter {
|
||||||
content_id: character_action.content_id,
|
content_id: character_action.content_id,
|
||||||
chara_make_json: character_action.json.clone(),
|
chara_make_json: character_action.json.clone(),
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let _ = send_custom_world_packet(ipc_segment).await.unwrap();
|
let _ = send_custom_world_packet(ipc_segment).await.unwrap();
|
||||||
|
@ -558,11 +498,7 @@ impl LobbyConnection {
|
||||||
// send a confirmation that the remakewas successful
|
// send a confirmation that the remakewas successful
|
||||||
{
|
{
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
unk1: 0,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerLobbyIpcType::CharaMakeReply,
|
op_code: ServerLobbyIpcType::CharaMakeReply,
|
||||||
option: 0,
|
|
||||||
timestamp: 0,
|
|
||||||
data: ServerLobbyIpcData::CharaMakeReply {
|
data: ServerLobbyIpcData::CharaMakeReply {
|
||||||
sequence: character_action.sequence + 1,
|
sequence: character_action.sequence + 1,
|
||||||
unk1: 0x1,
|
unk1: 0x1,
|
||||||
|
@ -577,6 +513,7 @@ impl LobbyConnection {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
|
|
@ -129,10 +129,7 @@ impl ChatHandler {
|
||||||
// zone in
|
// zone in
|
||||||
{
|
{
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::ActorControl,
|
op_code: ServerZoneIpcType::ActorControl,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::ActorControl(ActorControl {
|
data: ServerZoneIpcData::ActorControl(ActorControl {
|
||||||
category: ActorControlCategory::ZoneIn {
|
category: ActorControlCategory::ZoneIn {
|
||||||
|
@ -140,6 +137,7 @@ impl ChatHandler {
|
||||||
raise_anim: 0x0,
|
raise_anim: 0x0,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
connection
|
connection
|
||||||
|
@ -154,10 +152,7 @@ impl ChatHandler {
|
||||||
}
|
}
|
||||||
"!spawnnpc" => {
|
"!spawnnpc" => {
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::NpcSpawn,
|
op_code: ServerZoneIpcType::NpcSpawn,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
||||||
common: CommonSpawn {
|
common: CommonSpawn {
|
||||||
|
@ -192,6 +187,7 @@ impl ChatHandler {
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
connection
|
connection
|
||||||
|
@ -209,10 +205,7 @@ impl ChatHandler {
|
||||||
// spawn a tiny mandragora
|
// spawn a tiny mandragora
|
||||||
{
|
{
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::NpcSpawn,
|
op_code: ServerZoneIpcType::NpcSpawn,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
||||||
aggression_mode: 1,
|
aggression_mode: 1,
|
||||||
|
@ -233,6 +226,7 @@ impl ChatHandler {
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
connection
|
connection
|
||||||
|
@ -258,10 +252,7 @@ impl ChatHandler {
|
||||||
// Load the game script for this event on the client
|
// Load the game script for this event on the client
|
||||||
{
|
{
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::EventStart,
|
op_code: ServerZoneIpcType::EventStart,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::EventStart(EventStart {
|
data: ServerZoneIpcData::EventStart(EventStart {
|
||||||
target_id: ObjectTypeId {
|
target_id: ObjectTypeId {
|
||||||
|
@ -273,6 +264,7 @@ impl ChatHandler {
|
||||||
flags: 0,
|
flags: 0,
|
||||||
event_arg: 182, // zone?
|
event_arg: 182, // zone?
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
connection
|
connection
|
||||||
|
@ -288,16 +280,14 @@ impl ChatHandler {
|
||||||
// set our status icon to viewing cutscene
|
// set our status icon to viewing cutscene
|
||||||
{
|
{
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::ActorControl,
|
op_code: ServerZoneIpcType::ActorControl,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::ActorControl(ActorControl {
|
data: ServerZoneIpcData::ActorControl(ActorControl {
|
||||||
category: ActorControlCategory::SetStatusIcon {
|
category: ActorControlCategory::SetStatusIcon {
|
||||||
icon: OnlineStatus::ViewingCutscene,
|
icon: OnlineStatus::ViewingCutscene,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
connection
|
connection
|
||||||
|
@ -333,15 +323,13 @@ impl ChatHandler {
|
||||||
common.spawn_index = connection.get_free_spawn_index();
|
common.spawn_index = connection.get_free_spawn_index();
|
||||||
|
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::NpcSpawn,
|
op_code: ServerZoneIpcType::NpcSpawn,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
||||||
common,
|
common,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
connection
|
connection
|
||||||
|
|
|
@ -282,15 +282,13 @@ impl ZoneConnection {
|
||||||
common.spawn_index = actor.spawn_index as u8;
|
common.spawn_index = actor.spawn_index as u8;
|
||||||
|
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::NpcSpawn,
|
op_code: ServerZoneIpcType::NpcSpawn,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
data: ServerZoneIpcData::NpcSpawn(NpcSpawn {
|
||||||
common,
|
common,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
@ -309,15 +307,13 @@ impl ZoneConnection {
|
||||||
tracing::info!("Removing actor {actor_id} {}!", actor.spawn_index);
|
tracing::info!("Removing actor {actor_id} {}!", actor.spawn_index);
|
||||||
|
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::Delete,
|
op_code: ServerZoneIpcType::Delete,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::Delete {
|
data: ServerZoneIpcData::Delete {
|
||||||
spawn_index: actor.spawn_index as u8,
|
spawn_index: actor.spawn_index as u8,
|
||||||
actor_id,
|
actor_id,
|
||||||
},
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
|
|
|
@ -55,10 +55,7 @@ impl LuaPlayer {
|
||||||
|
|
||||||
fn play_scene(&mut self, event_id: u32, scene: u16, scene_flags: u32, param: u8) {
|
fn play_scene(&mut self, event_id: u32, scene: u16, scene_flags: u32, param: u8) {
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
unk1: 20,
|
|
||||||
unk2: 0,
|
|
||||||
op_code: ServerZoneIpcType::EventScene,
|
op_code: ServerZoneIpcType::EventScene,
|
||||||
option: 0,
|
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::EventScene(EventScene {
|
data: ServerZoneIpcData::EventScene(EventScene {
|
||||||
actor_id: ObjectTypeId {
|
actor_id: ObjectTypeId {
|
||||||
|
@ -71,6 +68,7 @@ impl LuaPlayer {
|
||||||
unk2: param,
|
unk2: param,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.queue_segment(PacketSegment {
|
self.queue_segment(PacketSegment {
|
||||||
|
|
Loading…
Add table
Reference in a new issue