1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-22 04:37:46 +00:00

Improve log documentation

This commit is contained in:
Joshua Goins 2023-12-02 20:26:34 -05:00
parent 67eab58c24
commit c79cfc3df6

View file

@ -21,7 +21,7 @@ pub struct ChatLogHeader {
#[binrw]
#[brw(repr = u8)]
#[derive(Debug)]
enum EventFilter {
pub enum EventFilter {
SystemMessages = 3,
Unknown = 20,
ProgressionMessage = 64,
@ -35,7 +35,7 @@ enum EventFilter {
#[binrw]
#[derive(Debug)]
#[brw(repr = u8)]
enum EventChannel {
pub enum EventChannel {
System = 0,
ServerAnnouncement = 3,
Unknown1 = 50,
@ -52,26 +52,32 @@ enum EventChannel {
#[derive(Debug)]
#[allow(dead_code)]
#[brw(little)]
/// Represents an entry in the chat log
pub struct ChatLogEntry {
timestamp: u32,
filter: EventFilter,
channel: EventChannel,
/// The event filter
pub filter: EventFilter,
/// The event channel
pub channel: EventChannel,
#[br(temp)]
#[bw(calc = 1)]
_garbage: u32,
/// The message
#[brw(ignore)]
message: String,
pub message: String,
}
#[derive(Debug)]
#[allow(dead_code)]
/// Chat log, which contains previously recorded messages from other players
pub struct ChatLog {
entries: Vec<ChatLogEntry>,
pub entries: Vec<ChatLogEntry>,
}
impl ChatLog {
/// Reads an existing LOG file
pub fn from_existing(buffer: ByteSpan) -> Option<ChatLog> {
let mut cursor = Cursor::new(buffer);