Implement basic chat functionality

This commit is contained in:
NGnius (Graham) committed 2025-04-14 21:17:41 -04:00
1 parent 4d2ddaeafb
commit 792a6362e3
37 files changed
+1119 -34

No files matched your search

+18 -1
View File
@@ -44,7 +44,7 @@ impl ChatChannelMember {
#[allow(dead_code)]
#[repr(u8)]
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
pub enum ChatChannelType {
None = 0,
Public = 1,
@@ -57,6 +57,23 @@ pub enum ChatChannelType {
CustomGame = 8,
}
impl ChatChannelType {
pub fn from_u8(num: u8) -> Result<Self, i16> {
match num {
0 => Ok(Self::None),
1 => Ok(Self::Public),
2 => Ok(Self::Battle),
3 => Ok(Self::BattleTeam),
4 => Ok(Self::Platoon),
5 => Ok(Self::Custom),
6 => Ok(Self::Clan),
7 => Ok(Self::Private),
8 => Ok(Self::CustomGame),
_ => Err(rc_core::data::error_codes::ChatErrorCodes::UnexpectedError as i16)
}
}
}
#[allow(dead_code)]
#[repr(u8)]
#[derive(Copy, Clone)]