mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-26 16:37:46 +00:00
Send a message when logging in
This commit is contained in:
parent
151117baef
commit
8bfc6cafb3
2 changed files with 40 additions and 0 deletions
|
@ -354,6 +354,34 @@ async fn main() {
|
|||
"Client has finished loading... spawning in!"
|
||||
);
|
||||
|
||||
// send welcome message
|
||||
{
|
||||
let ipc = IPCSegment {
|
||||
unk1: 0,
|
||||
unk2: 0,
|
||||
op_code: IPCOpCode::ServerChatMessage,
|
||||
server_id: 0,
|
||||
timestamp: timestamp_secs(),
|
||||
data: IPCStructData::ServerChatMessage {
|
||||
message: "Welcome to Kawari!".to_string(),
|
||||
unk: 0,
|
||||
},
|
||||
};
|
||||
|
||||
let response_packet = PacketSegment {
|
||||
source_actor: state.player_id.unwrap(),
|
||||
target_actor: state.player_id.unwrap(),
|
||||
segment_type: SegmentType::Ipc { data: ipc },
|
||||
};
|
||||
send_packet(
|
||||
&mut write,
|
||||
&[response_packet],
|
||||
&mut state,
|
||||
CompressionType::Oodle,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
// send player spawn
|
||||
{
|
||||
let ipc = IPCSegment {
|
||||
|
|
12
src/ipc.rs
12
src/ipc.rs
|
@ -83,6 +83,8 @@ pub enum IPCOpCode {
|
|||
GameMasterCommand = 0x3B3,
|
||||
// Sent by the server to modify the client's position
|
||||
ActorSetPos = 0x223,
|
||||
// Sent by the server when they send a chat message
|
||||
ServerChatMessage = 0x196,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
|
@ -430,6 +432,15 @@ pub enum IPCStructData {
|
|||
},
|
||||
#[br(pre_assert(false))]
|
||||
ActorSetPos(ActorSetPos),
|
||||
#[br(pre_assert(false))]
|
||||
ServerChatMessage {
|
||||
unk: u8, // channel?
|
||||
#[brw(pad_after = 775)]
|
||||
#[br(count = 775)]
|
||||
#[br(map = read_string)]
|
||||
#[bw(map = write_string)]
|
||||
message: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
|
@ -488,6 +499,7 @@ impl IPCSegment {
|
|||
IPCStructData::ChatMessage { .. } => 1056,
|
||||
IPCStructData::GameMasterCommand { .. } => todo!(),
|
||||
IPCStructData::ActorSetPos { .. } => 24,
|
||||
IPCStructData::ServerChatMessage { .. } => 776,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue