1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-25 08:27:44 +00:00

Add OnlineStatus and GameMasterRank enums

This commit is contained in:
Joshua Goins 2025-03-23 11:31:03 -04:00
parent 3f23eea9c7
commit 45f92e9e54
7 changed files with 48 additions and 13 deletions

View file

@ -11,8 +11,9 @@ use kawari::packet::{
send_packet,
};
use kawari::world::ipc::{
ClientZoneIpcData, CommonSpawn, GameMasterCommandType, ObjectKind, ServerZoneIpcData,
ServerZoneIpcSegment, ServerZoneIpcType, SocialListRequestType, StatusEffect,
ClientZoneIpcData, CommonSpawn, GameMasterCommandType, GameMasterRank, ObjectKind,
OnlineStatus, ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType,
SocialListRequestType, StatusEffect,
};
use kawari::world::{
ChatHandler, Zone, ZoneConnection,
@ -329,7 +330,6 @@ async fn main() {
common: CommonSpawn {
current_world_id: config.world.world_id,
home_world_id: config.world.world_id,
title: 1,
class_job: 35,
name: chara_details.name,
hp_curr: 100,
@ -337,7 +337,8 @@ async fn main() {
mp_curr: 100,
mp_max: 100,
object_kind: ObjectKind::Player,
gm_rank: 3,
gm_rank: GameMasterRank::Debug,
online_status: OnlineStatus::GameMasterBlue,
look: chara_details.chara_make.customize,
fc_tag: "LOCAL".to_string(),
subtype: 4,

View file

@ -20,7 +20,7 @@ pub use position::Position;
#[binrw]
#[brw(little)]
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub struct ObjectId(pub u32);
impl Default for ObjectId {

View file

@ -108,7 +108,6 @@ impl ChatHandler {
common: CommonSpawn {
current_world_id: config.world.world_id,
home_world_id: config.world.world_id,
title: 1,
class_job: 35,
name: "Test Actor".to_string(),
hp_curr: 100,
@ -116,7 +115,6 @@ impl ChatHandler {
mp_curr: 100,
mp_max: 100,
object_kind: ObjectKind::Player,
gm_rank: 3,
spawn_index: connection.get_free_spawn_index(),
look: CUSTOMIZE_DATA,
fc_tag: "LOCAL".to_string(),

View file

@ -42,19 +42,52 @@ pub enum CharacterMode {
Dead = 0x2,
}
// See https://github.com/aers/FFXIVClientStructs/blob/28d9f0f77fdf388f596ba65768c7d6441e962d06/FFXIVClientStructs/FFXIV/Client/UI/Info/InfoProxyCommonList.cs#L86
#[binrw]
#[brw(little)]
#[brw(repr = u8)]
#[derive(Debug, Clone, Default, PartialEq)]
pub enum OnlineStatus {
Offline = 0x0,
GameQA = 1,
GameMaster = 2,
GameMasterBlue = 3,
EventParticipant = 4, // used by NPCs?
#[default]
Online = 47,
}
// From https://github.com/SapphireServer/Sapphire/blob/bf3368224a00c180cbb7ba413b52395eba58ec0b/src/common/Common.h#L212
// Where did they get this list from??
#[binrw]
#[brw(little)]
#[brw(repr = u8)]
#[derive(Debug, Clone, Default, PartialEq)]
pub enum GameMasterRank {
#[default]
NormalUser,
GameMaster = 1,
EventJunior = 3,
EventSenior = 4,
Support = 5,
Senior = 7,
Debug = 90,
}
#[binrw]
#[brw(little)]
#[derive(Debug, Clone, Default)]
pub struct CommonSpawn {
pub title: u16,
/// See Title Excel sheet
pub title_id: u16,
pub u1b: u16,
pub current_world_id: u16,
pub home_world_id: u16,
pub gm_rank: u8,
pub gm_rank: GameMasterRank,
pub u3c: u8,
pub u4: u8,
pub online_status: u8,
pub online_status: OnlineStatus,
pub pose: u8,
pub u5a: u8,

View file

@ -36,7 +36,7 @@ mod npc_spawn;
pub use npc_spawn::NpcSpawn;
mod common_spawn;
pub use common_spawn::{CharacterMode, CommonSpawn, ObjectKind};
pub use common_spawn::{CharacterMode, CommonSpawn, GameMasterRank, ObjectKind, OnlineStatus};
mod status_effect_list;
pub use status_effect_list::StatusEffectList;

View file

@ -18,7 +18,7 @@ mod tests {
use crate::{
common::INVALID_OBJECT_ID,
world::ipc::{CharacterMode, ObjectKind},
world::ipc::{CharacterMode, ObjectKind, OnlineStatus},
};
use super::*;
@ -48,6 +48,7 @@ mod tests {
assert_eq!(npc_spawn.common.object_kind, ObjectKind::BattleNpc);
assert_eq!(npc_spawn.common.subtype, 2);
assert_eq!(npc_spawn.common.battalion, 0);
assert_eq!(npc_spawn.common.online_status, OnlineStatus::Offline); // TODO: why is this guy offline?
}
#[test]
@ -77,5 +78,6 @@ mod tests {
assert_eq!(npc_spawn.common.battalion, 4);
assert_eq!(npc_spawn.common.parent_actor_id, INVALID_OBJECT_ID);
assert_eq!(npc_spawn.common.spawner_id, INVALID_OBJECT_ID);
assert_eq!(npc_spawn.common.online_status, OnlineStatus::EventParticipant);
}
}

View file

@ -23,7 +23,7 @@ mod tests {
use binrw::BinRead;
use crate::world::ipc::{CharacterMode, ObjectKind};
use crate::world::ipc::{CharacterMode, ObjectKind, OnlineStatus};
use super::*;
@ -59,5 +59,6 @@ mod tests {
assert_eq!(player_spawn.common.model_chara, 0);
assert_eq!(player_spawn.common.object_kind, ObjectKind::Player);
assert_eq!(player_spawn.common.display_flags, 262144);
assert_eq!(player_spawn.common.online_status, OnlineStatus::Offline);
}
}