mirror of
https://github.com/redstrate/Physis.git
synced 2025-05-05 10:17:45 +00:00
Add retail game test to find an item from the EXD sheet
This commit is contained in:
parent
e29e1bfde9
commit
ebbb4c27d1
1 changed files with 38 additions and 3 deletions
|
@ -3,18 +3,53 @@
|
|||
|
||||
use std::env;
|
||||
|
||||
use physis::common::Platform;
|
||||
use physis::{
|
||||
common::{Language, Platform},
|
||||
exd::{ColumnData, ExcelRowKind},
|
||||
};
|
||||
|
||||
/// Test to see if we can find the root EXL. It exists in every version, and is a pretty safe indicator whether our SqPack reading works.
|
||||
#[test]
|
||||
fn test_gamedata_extract() {
|
||||
let game_dir = env::var("FFXIV_GAME_DIR").unwrap();
|
||||
|
||||
let mut gamedata = physis::gamedata::GameData::from_existing(
|
||||
let mut game_data = physis::gamedata::GameData::from_existing(
|
||||
Platform::Win32,
|
||||
format!("{}/game", game_dir).as_str(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert!(gamedata.extract("exd/root.exl").is_some());
|
||||
assert!(game_data.extract("exd/root.exl").is_some());
|
||||
}
|
||||
|
||||
/// Test reading items, by finding the "Dated Canvas Beret", an item that existed since 2.x and should be on the first sheet page
|
||||
#[test]
|
||||
fn test_item_read() {
|
||||
let game_dir = env::var("FFXIV_GAME_DIR").unwrap();
|
||||
|
||||
let mut game_data = physis::gamedata::GameData::from_existing(
|
||||
Platform::Win32,
|
||||
format!("{}/game", game_dir).as_str(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let exh = game_data.read_excel_sheet_header("Item").unwrap();
|
||||
let exd = game_data
|
||||
.read_excel_sheet("Item", &exh, Language::English, 0)
|
||||
.unwrap();
|
||||
for row in exd.rows {
|
||||
match &row.kind {
|
||||
ExcelRowKind::SingleRow(row) => match &row.columns[9] {
|
||||
ColumnData::String(val) => {
|
||||
if (val == "Dated Canvas Beret") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
_ => panic!("Expected a string column!"),
|
||||
},
|
||||
_ => panic!("Expected a single row!"),
|
||||
}
|
||||
}
|
||||
|
||||
panic!("Item not found!");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue