mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-27 08:57:45 +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!"
|
"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
|
// send player spawn
|
||||||
{
|
{
|
||||||
let ipc = IPCSegment {
|
let ipc = IPCSegment {
|
||||||
|
|
12
src/ipc.rs
12
src/ipc.rs
|
@ -83,6 +83,8 @@ pub enum IPCOpCode {
|
||||||
GameMasterCommand = 0x3B3,
|
GameMasterCommand = 0x3B3,
|
||||||
// Sent by the server to modify the client's position
|
// Sent by the server to modify the client's position
|
||||||
ActorSetPos = 0x223,
|
ActorSetPos = 0x223,
|
||||||
|
// Sent by the server when they send a chat message
|
||||||
|
ServerChatMessage = 0x196,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
|
@ -430,6 +432,15 @@ pub enum IPCStructData {
|
||||||
},
|
},
|
||||||
#[br(pre_assert(false))]
|
#[br(pre_assert(false))]
|
||||||
ActorSetPos(ActorSetPos),
|
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]
|
#[binrw]
|
||||||
|
@ -488,6 +499,7 @@ impl IPCSegment {
|
||||||
IPCStructData::ChatMessage { .. } => 1056,
|
IPCStructData::ChatMessage { .. } => 1056,
|
||||||
IPCStructData::GameMasterCommand { .. } => todo!(),
|
IPCStructData::GameMasterCommand { .. } => todo!(),
|
||||||
IPCStructData::ActorSetPos { .. } => 24,
|
IPCStructData::ActorSetPos { .. } => 24,
|
||||||
|
IPCStructData::ServerChatMessage { .. } => 776,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue