1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-22 23:27:46 +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,15 +329,7 @@ impl ZoneConnection {
.await; .await;
} }
pub async fn change_zone(&mut self, new_zone_id: u16) { pub async fn update_class_info(&mut self) {
{
let mut game_data = self.gamedata.lock().unwrap();
self.zone = Some(Zone::load(&mut game_data.game_data, new_zone_id));
}
self.player_data.zone_id = new_zone_id;
// Player Class Info
{
let ipc = ServerZoneIpcSegment { let ipc = ServerZoneIpcSegment {
op_code: ServerZoneIpcType::UpdateClassInfo, op_code: ServerZoneIpcType::UpdateClassInfo,
timestamp: timestamp_secs(), timestamp: timestamp_secs(),
@ -359,6 +351,16 @@ impl ZoneConnection {
.await; .await;
} }
pub async fn change_zone(&mut self, new_zone_id: u16) {
{
let mut game_data = self.gamedata.lock().unwrap();
self.zone = Some(Zone::load(&mut game_data.game_data, new_zone_id));
}
self.player_data.zone_id = new_zone_id;
// Player Class Info
self.update_class_info().await;
// link shell information // link shell information
/*{ /*{
let ipc = ServerZoneIpcSegment { let ipc = ServerZoneIpcSegment {

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,