Skip to content

Commit

Permalink
fix: handle split text maps
Browse files Browse the repository at this point in the history
  • Loading branch information
juliuskreutz committed Nov 18, 2024
1 parent d2508e7 commit cb93f8d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lettre = { version = "0.11.10", default-features = false, features = [
"builder",
"smtp-transport",
] }
quick-xml = { version = "0.37.0", features = ["serialize"] }
quick-xml = { version = "0.37.1", features = ["serialize"] }
rand = "0.8.5"
regex = "1.11.1"
reqwest = { version = "0.12.9", default-features = false, features = [
Expand All @@ -36,7 +36,7 @@ reqwest = { version = "0.12.9", default-features = false, features = [
] }
rust-argon2 = "2.1.0"
serde = { version = "1.0.215", features = ["derive"] }
serde_json = "1.0.132"
serde_json = "1.0.133"
sqlx = { version = "0.8.2", features = [
"postgres",
"chrono",
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions src/update/dimbreath/gi/texts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,27 @@ pub async fn update(configs: &Configs, pool: &PgPool) -> anyhow::Result<()> {

info!("Starting {}", language);

let text_map: HashMap<String, String> =
serde_json::from_reader(BufReader::new(File::open(format!(
"dimbreath/AnimeGameData/TextMap/TextMap{language_str}.json",
))?))?;
let text_map: HashMap<String, String> = if let Ok(file) = File::open(format!(
"dimbreath/AnimeGameData/TextMap/TextMap{language_str}.json",
)) {
serde_json::from_reader(BufReader::new(file))?
} else {
let mut text_map = HashMap::new();

for i in 1.. {
let Ok(file) = File::open(format!(
"dimbreath/AnimeGameData/TextMap/TextMap{language_str}_{i}.json",
)) else {
break;
};

let text_map_part: HashMap<String, String> =
serde_json::from_reader(BufReader::new(file))?;
text_map.extend(text_map_part);
}

text_map
};

info!("Starting {} achievement series", language);
for achievement_goal in &configs.achievement_goal_data {
Expand Down

0 comments on commit cb93f8d

Please sign in to comment.