-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
227 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
mod go_to_lobby; | ||
mod check_char_name; | ||
mod send_client_ini; | ||
mod req_user_ban_info; | ||
|
||
pub use go_to_lobby::*; | ||
pub use check_char_name::*; | ||
pub use check_char_name::*; | ||
pub use send_client_ini::*; | ||
pub use req_user_ban_info::*; |
25 changes: 25 additions & 0 deletions
25
game/src/packets/from_client/extended/req_user_ban_info.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::client_thread::ClientHandler; | ||
use crate::packets::HandleablePacket; | ||
use async_trait::async_trait; | ||
use l2_core::shared_packets::common::ReadablePacket; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct RequestUserBanInfo; | ||
|
||
impl ReadablePacket for RequestUserBanInfo { | ||
const PACKET_ID: u8 = 0xD0; | ||
const EX_PACKET_ID: Option<u16> = Some(0x138); | ||
|
||
fn read(_: &[u8]) -> anyhow::Result<Self> { | ||
Ok(Self {}) | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl HandleablePacket for RequestUserBanInfo { | ||
type HandlerType = ClientHandler; | ||
async fn handle(&self, _: &mut Self::HandlerType) -> anyhow::Result<()> { | ||
//todo: I don't know what this packet is needed for, in L2J it is also not handled | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::client_thread::ClientHandler; | ||
use crate::packets::HandleablePacket; | ||
use async_trait::async_trait; | ||
use l2_core::shared_packets::common::ReadablePacket; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct SendClientIni; | ||
|
||
impl ReadablePacket for SendClientIni { | ||
const PACKET_ID: u8 = 0xD0; | ||
const EX_PACKET_ID: Option<u16> = Some(0x104); | ||
|
||
fn read(_: &[u8]) -> anyhow::Result<Self> { | ||
Ok(Self {}) | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl HandleablePacket for SendClientIni { | ||
type HandlerType = ClientHandler; | ||
async fn handle(&self, _: &mut Self::HandlerType) -> anyhow::Result<()> { | ||
//todo: I don't know what this packet is needed for, in L2J it is also not handled | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::client_thread::ClientHandler; | ||
use crate::ls_thread::LoginHandler; | ||
use crate::packets::HandleablePacket; | ||
use async_trait::async_trait; | ||
use l2_core::shared_packets::common::ReadablePacket; | ||
use l2_core::shared_packets::gs_2_ls::PlayerLogout; | ||
use l2_core::traits::handlers::PacketHandler; | ||
use l2_core::traits::Shutdown; | ||
use tracing::info; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Logout; | ||
|
||
impl ReadablePacket for Logout { | ||
const PACKET_ID: u8 = 0x00; | ||
const EX_PACKET_ID: Option<u16> = None; | ||
fn read(_: &[u8]) -> anyhow::Result<Self> { | ||
Ok(Self {}) | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl HandleablePacket for Logout { | ||
type HandlerType = ClientHandler; | ||
async fn handle(&self, handler: &mut Self::HandlerType) -> anyhow::Result<()> { | ||
//todo handle proper logout mechanism: olympiad, | ||
// in battle state, on RB and so on, offline trade, etc... | ||
info!("Player logged out: {:?}", handler.user); | ||
handler.get_shutdown_listener().notify_one(); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
use crate as l2_core; | ||
use crate::shared_packets::common::ReadablePacket; | ||
use crate::shared_packets::read::ReadablePacketBuffer; | ||
use crate::shared_packets::write::SendablePacketBuffer; | ||
use macro_common::SendablePacketImpl; | ||
|
||
#[derive(Clone, Debug)] | ||
#[derive(Clone, Debug, SendablePacketImpl)] | ||
pub struct PlayerLogout { | ||
pub acc: String, | ||
pub buffer: SendablePacketBuffer, | ||
} | ||
impl PlayerLogout { | ||
pub fn new(acc: &str) -> anyhow::Result<Self> { | ||
let mut inst = Self { | ||
acc: String::new(), | ||
buffer: SendablePacketBuffer::new(), | ||
}; | ||
inst.buffer.write(Self::PACKET_ID)?; | ||
inst.buffer.write_string(Some(acc))?; | ||
Ok(inst) | ||
} | ||
} | ||
|
||
impl ReadablePacket for PlayerLogout { | ||
const PACKET_ID: u8 = 0x03; | ||
const EX_PACKET_ID: Option<u16> = None; | ||
const EX_PACKET_ID: Option<u16> = None; | ||
|
||
fn read(data: &[u8]) -> anyhow::Result<Self> { | ||
let mut buffer = ReadablePacketBuffer::new(data.to_vec()); | ||
buffer.read_byte(); | ||
let acc = buffer.read_string(); | ||
Ok(Self { acc }) | ||
Ok(Self { | ||
acc, | ||
buffer: SendablePacketBuffer::empty(), | ||
}) | ||
} | ||
} |
Oops, something went wrong.