From 5a358dd1b67cdbbc94549fb095bcce20df8d5447 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 29 Mar 2025 14:42:38 -0400 Subject: [PATCH] Don't extract game data each time an action is recieved This makes sending actions waaay more reliable, and shouldn't crash the server as often. --- src/bin/kawari-world.rs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 775e909..52ec9f1 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -86,6 +86,16 @@ async fn main() { let mut lua_player = LuaPlayer::default(); + let config = get_config(); + + let mut game_data = + GameData::from_existing(Platform::Win32, &config.game_location).unwrap(); + + let exh = game_data.read_excel_sheet_header("Action").unwrap(); + let exd = game_data + .read_excel_sheet("Action", &exh, Language::English, 0) + .unwrap(); + tokio::spawn(async move { let mut buf = [0; 2056]; loop { @@ -764,20 +774,6 @@ async fn main() { ClientZoneIpcData::ActionRequest(request) => { tracing::info!("Recieved action request: {:#?}!", request); - let config = get_config(); - - let mut game_data = GameData::from_existing( - Platform::Win32, - &config.game_location, - ) - .unwrap(); - - let exh = - game_data.read_excel_sheet_header("Action").unwrap(); - let exd = game_data - .read_excel_sheet("Action", &exh, Language::English, 0) - .unwrap(); - let action_row = &exd.read_row(&exh, request.action_id).unwrap()[0];