diff --git a/Cargo.lock b/Cargo.lock index 7fdfbc5..27328ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -724,6 +724,7 @@ dependencies = [ "minijinja", "mlua", "physis", + "physis-sheets", "reqwest", "rkon", "rusqlite", @@ -1016,7 +1017,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "physis" version = "0.4.0" -source = "git+https://github.com/redstrate/physis#e751ffa765ccd316112b3cb6ccdbb7a80fab8ccf" +source = "git+https://github.com/redstrate/physis#70343e12125c70cffa1998e68ff28a8d2dc4f3df" dependencies = [ "binrw", "bitflags", @@ -1024,6 +1025,14 @@ dependencies = [ "libz-rs-sys", ] +[[package]] +name = "physis-sheets" +version = "0.0.0" +source = "git+https://github.com/redstrate/PhysisSheets#1b746c17e8ae8abf4ac613165e63de9f047e567e" +dependencies = [ + "physis", +] + [[package]] name = "pin-project-lite" version = "0.2.16" diff --git a/Cargo.toml b/Cargo.toml index f79530f..2cabb8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,3 +102,6 @@ rkon = { version = "0.1" } # For serving static files on the website tower-http = { version = "0.6", features = ["fs"] } + +# excel sheet data +physis-sheets = { git = "https://github.com/redstrate/PhysisSheets", features = ["Warp"], default-features = false } diff --git a/src/common/gamedata.rs b/src/common/gamedata.rs index f21e9e9..fc154b3 100644 --- a/src/common/gamedata.rs +++ b/src/common/gamedata.rs @@ -1,6 +1,7 @@ use physis::common::{Language, Platform}; use physis::exd::{EXD, ExcelRowKind}; use physis::exh::EXH; +use physis_sheets::Warp::Warp; use crate::{common::Attributes, config::get_config}; @@ -132,21 +133,15 @@ impl GameData { /// Returns the pop range object id that's associated with the warp id pub fn get_warp(&mut self, warp_id: u32) -> (u32, u16) { - let exh = self.game_data.read_excel_sheet_header("Warp").unwrap(); - let exd = self - .game_data - .read_excel_sheet("Warp", &exh, Language::English, 0) - .unwrap(); + let warp_sheet = Warp::read_from(&mut self.game_data, Language::English); - let ExcelRowKind::SingleRow(row) = &exd.get_row(warp_id).unwrap() else { - panic!("Expected a single row!") - }; + let row = warp_sheet.get_row(warp_id); - let physis::exd::ColumnData::UInt32(pop_range_id) = &row.columns[0] else { + let physis::exd::ColumnData::UInt32(pop_range_id) = row.PopRange() else { panic!("Unexpected type!"); }; - let physis::exd::ColumnData::UInt16(zone_id) = &row.columns[1] else { + let physis::exd::ColumnData::UInt16(zone_id) = row.TerritoryType() else { panic!("Unexpected type!"); };