| Crates.io | royal |
| lib.rs | royal |
| version | 0.1.5 |
| created_at | 2024-12-02 16:36:18.788767+00 |
| updated_at | 2024-12-13 06:58:38.316118+00 |
| description | A parser for Persona 5 Royal dialogue message format |
| homepage | |
| repository | https://github.com/emirsassan/royal |
| max_upload_size | |
| id | 1468892 |
| size | 48,440 |
A Rust library for parsing Persona 5 Royal dialogue message format.
Add this to your Cargo.toml:
[dependencies]
royal = "0.1.5"
Example usage:
use royal::Message;
fn main() {
let input = "[msg MSG_BTTL_2 [Morgana]][s][f 4 10 65535 0 0]Hello world![f 1 3 65535][w][e]";
if let Some(message) = Message::parse(input) {
println!("Character: {}", message.header.character.unwrap_or_default());
println!("Content: {}", message.content);
}
}
Parse a file:
use royal::Message;
fn main() {
let messages = Message::parse_msg("test/test_data.msg");
for message in messages {
println!("Message ID: {}", message.header.message_id);
println!("Content: {}", message.content);
}
}
The parser handles messages in the following format:
[msg MESSAGE_TYPE_MESSAGE_ID [CHARACTER]][s]: Start of message[f 4 10 65535 0 0]: Lipsync marker[f 5 13 confidant_id points model_id]: Confidant points parser[f 1 3 65535]: Message end marker[w]: Wait for input[e]: End of messageThis project is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details.