Browse Source

Added 0x83 (LobbyList), LobbyEntry, 0x84 (LobbySelect)

minor struct changes

minor struct changes

minor struct changes
sd

oops
pull/3/head
mht8355 5 years ago
parent
commit
49c0d6a261
  1. 45
      src/packet/ship.rs

45
src/packet/ship.rs

@ -9,6 +9,7 @@ use std::io::Read;
const BLOCK_MENU_ID: u32 = 1;
pub const ROOM_MENU_ID: u32 = 2;
pub const LOBBY_MENU_ID: u32 = 3;
#[pso_packet(0x03)]
pub struct ShipWelcome {
@ -88,6 +89,12 @@ pub struct MenuSelect {
pub item: u32,
}
#[pso_packet(0x84)]
pub struct LobbySelect {
pub menu: u32,
pub lobby: u32,
}
#[pso_packet(0xE7)]
pub struct FullCharacter {
#[no_debug]
@ -359,3 +366,41 @@ pub struct RoomListResponse {
pub baseroom: RoomList,
pub rooms: Vec<RoomList>,
}
#[derive(PSOPacketData, Clone, Copy, Default)]
pub struct LobbyEntry {
menu_id: u32,
item_id: u32,
padding: u32,
}
impl LobbyEntry {
pub fn new(menu_id: u32, lobby_id: u32) -> LobbyEntry {
LobbyEntry {
menu_id: menu_id,
item_id: lobby_id,
padding: 0,
}
}
}
#[pso_packet(0x83, manual_flag)]
pub struct LobbyList {
flag: u32,
entries: [LobbyEntry; 16],
}
impl LobbyList {
pub fn new() -> LobbyList {
let lobbies = (0..16).fold([LobbyEntry::default(); 16],
|mut acc, index| {
acc[index].menu_id = LOBBY_MENU_ID;
acc[index].item_id = index as u32;
acc
});
LobbyList {
flag: 0x0F,
entries: lobbies,
}
}
}
Loading…
Cancel
Save