6d is bullshit
This commit is contained in:
parent
4942a4ff28
commit
7cdf7348cd
35
src/lib.rs
35
src/lib.rs
@ -111,6 +111,23 @@ impl PSOPacketData for String {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ConsumingBlob {
|
||||
pub blob: Vec<u8>,
|
||||
}
|
||||
|
||||
impl PSOPacketData for ConsumingBlob {
|
||||
fn from_bytes<R: Read>(cursor: &mut R) -> Result<ConsumingBlob, PacketParseError> {
|
||||
let mut blob: Vec<u8> = Vec::new();
|
||||
cursor.read_to_end(&mut blob).map_err(|_| PacketParseError::ReadError)?;
|
||||
Ok(ConsumingBlob {
|
||||
blob: blob,
|
||||
})
|
||||
}
|
||||
fn as_bytes(&self) -> Vec<u8> {
|
||||
self.blob.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait PSOPacket: std::fmt::Debug {
|
||||
// const CMD: u16;
|
||||
@ -545,4 +562,22 @@ mod test {
|
||||
let bytes = test.as_bytes();
|
||||
assert!(bytes[1] == 101);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_consuming_blob() {
|
||||
#[pso_packet(0x6D, manual_flag)]
|
||||
struct SixDee {
|
||||
flag: u32,
|
||||
blob: ConsumingBlob,
|
||||
}
|
||||
|
||||
let pkt = vec![76, 0, 109, 0, 1, 0, 0, 0, 109, 0, 0, 0, 68, 0, 0, 0, 140, 0, 0, 0,
|
||||
51, 0, 0, 0, 84, 220, 255, 254, 253, 1, 254, 240, 33, 254, 240,
|
||||
65, 254, 240, 85, 97, 254, 240, 129, 254, 240, 161, 254, 240, 193,
|
||||
254, 240, 169, 225, 13, 1, 16, 0, 33, 16, 0, 65, 16, 0, 97, 0, 16,
|
||||
1, 64, 15, 82, 15, 100, 15, 118, 0, 0];
|
||||
|
||||
let data = SixDee::from_bytes(&pkt);
|
||||
assert!(pkt == data.unwrap().as_bytes());
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ use crate::utf8_to_utf16_array;
|
||||
use crate::packet::messages::GameMessage;
|
||||
//use character::character::FullCharacter;
|
||||
use crate::character::character as character;
|
||||
use crate::ConsumingBlob;
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
@ -136,6 +137,11 @@ impl DirectMessage {
|
||||
}
|
||||
}
|
||||
|
||||
#[pso_packet(0x6D, manual_flag)]
|
||||
struct Like62ButCooler {
|
||||
pub flag: u32,
|
||||
pub blob: ConsumingBlob,
|
||||
}
|
||||
|
||||
|
||||
#[derive(PSOPacketData, Clone, Copy, Default)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user