1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Hash)]
5#[repr(u8)]
6pub enum Universe {
7 #[default]
8 Invalid = 0,
9 Public = 1,
10 Beta = 2,
11 Internal = 3,
12 Dev = 4,
13}
14
15impl Universe {
16 pub fn from_u8(value: u8) -> Self {
18 match value {
19 1 => Universe::Public,
20 2 => Universe::Beta,
21 3 => Universe::Internal,
22 4 => Universe::Dev,
23 _ => Universe::Invalid,
24 }
25 }
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Hash)]
30#[repr(u8)]
31pub enum AccountType {
32 #[default]
33 Invalid = 0,
34 Individual = 1,
35 Multiseat = 2,
36 GameServer = 3,
37 AnonGameServer = 4,
38 Pending = 5,
39 ContentServer = 6,
40 Clan = 7,
41 Chat = 8,
42 P2PSuperSeeder = 9,
43 AnonUser = 10,
44}
45
46impl AccountType {
47 pub fn from_u8(value: u8) -> Self {
49 match value {
50 1 => AccountType::Individual,
51 2 => AccountType::Multiseat,
52 3 => AccountType::GameServer,
53 4 => AccountType::AnonGameServer,
54 5 => AccountType::Pending,
55 6 => AccountType::ContentServer,
56 7 => AccountType::Clan,
57 8 => AccountType::Chat,
58 9 => AccountType::P2PSuperSeeder,
59 10 => AccountType::AnonUser,
60 _ => AccountType::Invalid,
61 }
62 }
63
64 pub fn to_char(self) -> char {
66 match self {
67 AccountType::Invalid => 'I',
68 AccountType::Individual => 'U',
69 AccountType::Multiseat => 'M',
70 AccountType::GameServer => 'G',
71 AccountType::AnonGameServer => 'A',
72 AccountType::Pending => 'P',
73 AccountType::ContentServer => 'C',
74 AccountType::Clan => 'g',
75 AccountType::Chat => 'T',
76 AccountType::P2PSuperSeeder => 'i', AccountType::AnonUser => 'a',
78 }
79 }
80
81 pub fn from_char(c: char) -> Self {
83 match c {
84 'I' => AccountType::Invalid,
85 'U' => AccountType::Individual,
86 'M' => AccountType::Multiseat,
87 'G' => AccountType::GameServer,
88 'A' => AccountType::AnonGameServer,
89 'P' => AccountType::Pending,
90 'C' => AccountType::ContentServer,
91 'g' => AccountType::Clan,
92 'T' => AccountType::Chat,
93 'a' => AccountType::AnonUser,
94 _ => AccountType::Invalid,
95 }
96 }
97}
98
99#[derive(Debug, Clone, Copy, PartialEq, Eq)]
101#[repr(u32)]
102pub enum Instance {
103 All = 0,
104 Desktop = 1,
105 Console = 2,
106 Web = 4,
107}
108
109pub mod masks {
111 pub const ACCOUNT_ID_MASK: u64 = 0xFFFFFFFF;
113 pub const ACCOUNT_INSTANCE_MASK: u32 = 0x000FFFFF;
115}
116
117pub mod chat_instance_flags {
119 use super::masks::ACCOUNT_INSTANCE_MASK;
120
121 pub const CLAN: u32 = (ACCOUNT_INSTANCE_MASK + 1) >> 1; pub const LOBBY: u32 = (ACCOUNT_INSTANCE_MASK + 1) >> 2; pub const MMS_LOBBY: u32 = (ACCOUNT_INSTANCE_MASK + 1) >> 3; }