Browse Source

Merge pull request 'Added 0x83 (LobbyList), LobbyEntry, 0x84 (LobbySelect)' (#23) from changing_lobbies into master

Reviewed-by: jake <jake@sharnoth.com>
pull/3/head
jake 5 years ago
parent
commit
82f87da7aa
  1. 45
      src/packet/ship.rs

45
src/packet/ship.rs

@ -10,6 +10,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 {
@ -89,6 +90,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]
@ -365,3 +372,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