1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-23 15:47:45 +00:00

Add //gm lv command to set your current level

This commit is contained in:
Joshua Goins 2025-04-01 20:39:57 -04:00
parent f1b674320e
commit 6d1e9d4e73
4 changed files with 29 additions and 21 deletions

View file

@ -102,3 +102,4 @@ These GM commands are implemented in the FFXIV protocol, but only some of them a
* `//gm weather <id>`: Changes the weather * `//gm weather <id>`: Changes the weather
* `//gm wireframe`: Toggle wireframe rendering for the environment * `//gm wireframe`: Toggle wireframe rendering for the environment
* `//gm item <id>`: Gives yourself an item. This can only place a single item in the first page of your inventory currently. * `//gm item <id>`: Gives yourself an item. This can only place a single item in the first page of your inventory currently.
* `//gm lv <level>`: Sets your current level

View file

@ -588,6 +588,10 @@ async fn client_loop(
tracing::info!("Got a game master command!"); tracing::info!("Got a game master command!");
match &command { match &command {
GameMasterCommandType::SetLevel => {
connection.player_data.level = *arg as u8;
connection.update_class_info().await;
}
GameMasterCommandType::ChangeWeather => { GameMasterCommandType::ChangeWeather => {
connection.change_weather(*arg as u16).await connection.change_weather(*arg as u16).await
} }

View file

@ -329,6 +329,28 @@ impl ZoneConnection {
.await; .await;
} }
pub async fn update_class_info(&mut self) {
let ipc = ServerZoneIpcSegment {
op_code: ServerZoneIpcType::UpdateClassInfo,
timestamp: timestamp_secs(),
data: ServerZoneIpcData::UpdateClassInfo(UpdateClassInfo {
class_id: self.player_data.classjob_id as u16,
unknown: 1,
synced_level: self.player_data.level as u16,
class_level: self.player_data.level as u16,
..Default::default()
}),
..Default::default()
};
self.send_segment(PacketSegment {
source_actor: self.player_data.actor_id,
target_actor: self.player_data.actor_id,
segment_type: SegmentType::Ipc { data: ipc },
})
.await;
}
pub async fn change_zone(&mut self, new_zone_id: u16) { pub async fn change_zone(&mut self, new_zone_id: u16) {
{ {
let mut game_data = self.gamedata.lock().unwrap(); let mut game_data = self.gamedata.lock().unwrap();
@ -337,27 +359,7 @@ impl ZoneConnection {
self.player_data.zone_id = new_zone_id; self.player_data.zone_id = new_zone_id;
// Player Class Info // Player Class Info
{ self.update_class_info().await;
let ipc = ServerZoneIpcSegment {
op_code: ServerZoneIpcType::UpdateClassInfo,
timestamp: timestamp_secs(),
data: ServerZoneIpcData::UpdateClassInfo(UpdateClassInfo {
class_id: self.player_data.classjob_id as u16,
unknown: 1,
synced_level: self.player_data.level as u16,
class_level: self.player_data.level as u16,
..Default::default()
}),
..Default::default()
};
self.send_segment(PacketSegment {
source_actor: self.player_data.actor_id,
target_actor: self.player_data.actor_id,
segment_type: SegmentType::Ipc { data: ipc },
})
.await;
}
// link shell information // link shell information
/*{ /*{

View file

@ -132,6 +132,7 @@ impl Default for ServerZoneIpcSegment {
#[brw(repr = u8)] #[brw(repr = u8)]
#[derive(Clone, PartialEq, Debug)] #[derive(Clone, PartialEq, Debug)]
pub enum GameMasterCommandType { pub enum GameMasterCommandType {
SetLevel = 0x1,
ChangeWeather = 0x6, ChangeWeather = 0x6,
ToggleInvisibility = 0xD, ToggleInvisibility = 0xD,
ToggleWireframe = 0x26, ToggleWireframe = 0x26,