Browse Source

sub commands

pull/3/head
andy 5 years ago
parent
commit
18f8e7552b
  1. 109
      src/packet/messages.rs

109
src/packet/messages.rs

@ -68,8 +68,15 @@ pub struct PlayerLoadedIn {
#[pso_message(0x23)]
pub struct PlayerDoneChangingMap {
}
#[pso_message(0x75)]
pub struct PlayerChangedFloor {
map: u32,
}
#[pso_message(0x52)]
pub struct TalkToNpc {
unknown1: u32,
@ -104,7 +111,7 @@ pub struct PhotonChairMove {
}
#[pso_message(0x3B)]
pub struct Unknown3B {
pub struct PlayerSpawnedIntoArea {
}
@ -132,7 +139,65 @@ pub struct KillMonster {
_unknown: [u8; 4],
}
#[pso_message(0x43)]
pub struct ComboStep1 {
}
#[pso_message(0x44)]
pub struct ComboStep2 {
}
#[pso_message(0x45)]
pub struct ComboStep3 {
}
#[pso_message(0x46)]
pub struct ComboStepDone {
}
#[pso_message(0x8D)]
pub struct PlayerTechStart {
}
#[pso_message(0x47)]
pub struct PlayerTechCast {
technique: u8,
unknown1: u8,
unknown2: u8,
num_of_targets: u8,
}
#[pso_message(0x48)]
pub struct PlayerTechDone {
}
#[pso_message(0x0A)]
pub struct MobAttack {
}
#[pso_message(0x4A)]
pub struct PlayerBlockedDamage {
}
#[pso_message(0x83)]
pub struct PlayerTrapSet {
trap_type: u16,
trap_count: u16,
}
#[pso_message(0x80)]
pub struct PlayerTrapActivate {
}
#[derive(Debug, Clone, PartialEq)]
@ -144,6 +209,7 @@ pub enum GameMessage {
PlayerChangedMap(PlayerChangedMap),
PlayerChangedMap2(PlayerChangedMap2),
PlayerDoneChangingMap(PlayerDoneChangingMap),
PlayerChangedFloor(PlayerChangedFloor),
TellOtherPlayerMyLocation(TellOtherPlayerMyLocation),
LobbyEmote(LobbyEmote),
TalkToNpc(TalkToNpc),
@ -151,10 +217,21 @@ pub enum GameMessage {
PhotonChairSit(PhotonChairSit),
PhotonChairTurn(PhotonChairTurn),
PhotonChairMove(PhotonChairMove),
Unknown3B(Unknown3B),
PlayerSpawnedIntoArea(PlayerSpawnedIntoArea),
RequestExp(RequestExp),
RequestItem(RequestItem),
KillMonster(KillMonster),
ComboStep1(ComboStep1),
ComboStep2(ComboStep2),
ComboStep3(ComboStep3),
ComboStepDone(ComboStepDone),
PlayerTechStart(PlayerTechStart),
PlayerTechCast(PlayerTechCast),
PlayerTechDone(PlayerTechDone),
MobAttack(MobAttack),
PlayerBlockedDamage(PlayerBlockedDamage),
PlayerTrapSet(PlayerTrapSet),
PlayerTrapActivate(PlayerTrapActivate),
}
impl PSOPacketData for GameMessage {
@ -172,6 +249,7 @@ impl PSOPacketData for GameMessage {
PlayerChangedMap::CMD if len[0] == 6 => Ok(GameMessage::PlayerChangedMap(PlayerChangedMap::from_bytes(&mut cur)?)),
PlayerChangedMap2::CMD if len[0] == 2 => Ok(GameMessage::PlayerChangedMap2(PlayerChangedMap2::from_bytes(&mut cur)?)),
PlayerDoneChangingMap::CMD => Ok(GameMessage::PlayerDoneChangingMap(PlayerDoneChangingMap::from_bytes(&mut cur)?)),
PlayerChangedFloor::CMD => Ok(GameMessage::PlayerChangedFloor(PlayerChangedFloor::from_bytes(&mut cur)?)),
TellOtherPlayerMyLocation::CMD => Ok(GameMessage::TellOtherPlayerMyLocation(TellOtherPlayerMyLocation::from_bytes(&mut cur)?)),
LobbyEmote::CMD => Ok(GameMessage::LobbyEmote(LobbyEmote::from_bytes(&mut cur)?)),
TalkToNpc::CMD => Ok(GameMessage::TalkToNpc(TalkToNpc::from_bytes(&mut cur)?)),
@ -179,10 +257,21 @@ impl PSOPacketData for GameMessage {
PhotonChairSit::CMD => Ok(GameMessage::PhotonChairSit(PhotonChairSit::from_bytes(&mut cur)?)),
PhotonChairTurn::CMD => Ok(GameMessage::PhotonChairTurn(PhotonChairTurn::from_bytes(&mut cur)?)),
PhotonChairMove::CMD => Ok(GameMessage::PhotonChairMove(PhotonChairMove::from_bytes(&mut cur)?)),
Unknown3B::CMD => Ok(GameMessage::Unknown3B(Unknown3B::from_bytes(&mut cur)?)),
PlayerSpawnedIntoArea::CMD => Ok(GameMessage::PlayerSpawnedIntoArea(PlayerSpawnedIntoArea::from_bytes(&mut cur)?)),
RequestExp::CMD => Ok(GameMessage::RequestExp(RequestExp::from_bytes(&mut cur)?)),
RequestItem::CMD => Ok(GameMessage::RequestItem(RequestItem::from_bytes(&mut cur)?)),
KillMonster::CMD => Ok(GameMessage::KillMonster(KillMonster::from_bytes(&mut cur)?)),
ComboStep1::CMD => Ok(GameMessage::ComboStep1(ComboStep1::from_bytes(&mut cur)?)),
ComboStep2::CMD => Ok(GameMessage::ComboStep2(ComboStep2::from_bytes(&mut cur)?)),
ComboStep3::CMD => Ok(GameMessage::ComboStep3(ComboStep3::from_bytes(&mut cur)?)),
ComboStepDone::CMD => Ok(GameMessage::ComboStepDone(ComboStepDone::from_bytes(&mut cur)?)),
PlayerTechStart::CMD => Ok(GameMessage::PlayerTechStart(PlayerTechStart::from_bytes(&mut cur)?)),
PlayerTechCast::CMD => Ok(GameMessage::PlayerTechCast(PlayerTechCast::from_bytes(&mut cur)?)),
PlayerTechDone::CMD => Ok(GameMessage::PlayerTechDone(PlayerTechDone::from_bytes(&mut cur)?)),
MobAttack::CMD => Ok(GameMessage::MobAttack(MobAttack::from_bytes(&mut cur)?)),
PlayerBlockedDamage::CMD => Ok(GameMessage::PlayerBlockedDamage(PlayerBlockedDamage::from_bytes(&mut cur)?)),
PlayerTrapSet::CMD => Ok(GameMessage::PlayerTrapSet(PlayerTrapSet::from_bytes(&mut cur)?)),
PlayerTrapActivate::CMD => Ok(GameMessage::PlayerTrapActivate(PlayerTrapActivate::from_bytes(&mut cur)?)),
_ => Err(PacketParseError::UnknownMessage(byte[0],
{
let mut b = vec![0; len[0] as usize * 4];
@ -208,10 +297,22 @@ impl PSOPacketData for GameMessage {
GameMessage::PhotonChairSit(data) => data.as_bytes(),
GameMessage::PhotonChairTurn(data) => data.as_bytes(),
GameMessage::PhotonChairMove(data) => data.as_bytes(),
GameMessage::Unknown3B(data) => data.as_bytes(),
GameMessage::PlayerSpawnedIntoArea(data) => data.as_bytes(),
GameMessage::RequestExp(data) => data.as_bytes(),
GameMessage::RequestItem(data) => data.as_bytes(),
GameMessage::KillMonster(data) => data.as_bytes(),
GameMessage::ComboStep1(data) => data.as_bytes(),
GameMessage::ComboStep2(data) => data.as_bytes(),
GameMessage::ComboStep3(data) => data.as_bytes(),
GameMessage::ComboStepDone(data) => data.as_bytes(),
GameMessage::PlayerTechStart(data) => data.as_bytes(),
GameMessage::PlayerTechCast(data) => data.as_bytes(),
GameMessage::PlayerTechDone(data) => data.as_bytes(),
GameMessage::MobAttack(data) => data.as_bytes(),
GameMessage::PlayerBlockedDamage(data) => data.as_bytes(),
GameMessage::PlayerTrapSet(data) => data.as_bytes(),
GameMessage::PlayerTrapActivate(data) => data.as_bytes(),
GameMessage::PlayerChangedFloor(data) => data.as_bytes(),
}
}
}

Loading…
Cancel
Save