+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

feat: burning crusade classic #629

Merged
merged 25 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cb0a8b2
begun splitting into burning_crusade flavor
casperstorm Apr 23, 2021
18329c7
migrated classic to classic_era
casperstorm May 18, 2021
15860e1
rename rather than alias to serde classic to classic_era
casperstorm May 19, 2021
5a39d81
removed println
casperstorm May 19, 2021
5ee856a
fix serde attributes
tarkah May 19, 2021
554c628
ensure git release matching logic is for classic era
tarkah May 19, 2021
97abde8
fix tukui backend
tarkah May 19, 2021
88923af
update cli
tarkah May 19, 2021
9fb6b52
use alias for Classic -> ClassicEra
tarkah May 19, 2021
d79c347
use Classic Tbc as gui display
tarkah May 19, 2021
cbf6b9d
use all caps
tarkah May 19, 2021
b7fb745
actually rename variant to ClassicTbc
tarkah May 19, 2021
438f9a6
fix clippy
tarkah May 19, 2021
06531e1
bumped catalog.
casperstorm May 19, 2021
6c8c916
Merge branch 'feat/burning-crusade-flavor' of https://github.com/ajou…
casperstorm May 19, 2021
14941be
add folder migration logic
tarkah May 19, 2021
aeceb63
Merge remote-tracking branch 'origin/feat/burning-crusade-flavor' int…
tarkah May 19, 2021
345c7a6
bumped to 1.2.0-rc.1
casperstorm May 19, 2021
7a5a95d
Merge branch 'development' into feat/burning-crusade-flavor
casperstorm May 19, 2021
8c0b961
chore: updated localizations
casperstorm May 19, 2021
6b46737
Merge pull request #641 from ajour/chore/update-localization-19-05-20…
casperstorm May 19, 2021
b5ae100
add multi toc support
tarkah May 19, 2021
9aa71c1
Merge remote-tracking branch 'origin/feat/burning-crusade-flavor' int…
tarkah May 19, 2021
2ef1a68
Update CHANGELOG.md
casperstorm May 19, 2021
27c2592
Merge branch 'feat/burning-crusade-flavor' of https://github.com/ajou…
casperstorm May 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .github/pull-translations.sh
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ and `Removed`.

## [Unreleased]

## [1.2.0] - 2021-05-18

### Added

- Support for TBC.
- If you are planning on playing **Classic Tbc**, you should check if any addon
has `-` in Source column, if thats the case, delete and re-download the addon
from Catalog.
- If you are planning on playing **Classic Era**, you can either copy your addon
from `_classic_` to `_classic_era_` or re-download them from Catalog. Ajour doesn't
migrate it for you.
- Ability to select Ajour data folder when backing up.

### Fixed
Expand Down
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.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ajour"
description = "A World of Warcraft addon manager"
version = "1.1.0"
version = "1.2.0-rc.1"
authors = ["Casper Rogild Storm"]
license = "MIT"
homepage = "https://github.com/ajour/ajour"
Expand All @@ -17,9 +17,9 @@ wgpu = ["ajour-widgets/wgpu", "iced/wgpu", "iced/default_system_font"]
opengl = ["ajour-widgets/opengl", "iced/glow", "iced/glow_default_system_font"]

[dependencies]
ajour-core = { version = "1.1.0", path = "crates/core", features=['gui'] }
ajour-weak-auras = { version = "1.1.0", path = "crates/weak_auras" }
ajour-widgets = { version = "1.1.0", path = "crates/widgets" }
ajour-core = { version = "1.2.0-rc.1", path = "crates/core", features=['gui'] }
ajour-weak-auras = { version = "1.2.0-rc.1", path = "crates/weak_auras" }
ajour-widgets = { version = "1.2.0-rc.1", path = "crates/widgets" }

iced = { version = "0.3.0", default-features = false, features = ["debug"] }
iced_futures = { version = "0.3.0", features = ["async-std"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ajour-core"
description = "Core library for Ajour"
version = "1.1.0"
version = "1.2.0-rc.1"
authors = ["Casper Rogild Storm"]
license = "MIT"
homepage = "https://github.com/ajour/ajour"
Expand Down
4 changes: 1 addition & 3 deletions crates/core/src/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,8 @@ impl Addon {
Some(stable_package)
} else if let Some(beta_package) = remote_packages.remove(&ReleaseChannel::Beta) {
Some(beta_package)
} else if let Some(alpha_package) = remote_packages.remove(&ReleaseChannel::Alpha) {
Some(alpha_package)
} else {
None
remote_packages.remove(&ReleaseChannel::Alpha)
}
}

Expand Down
9 changes: 4 additions & 5 deletions crates/core/src/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ pub async fn latest_backup(backup_dir: PathBuf) -> Option<NaiveDateTime> {

let mut backups = vec![];

for entry in glob::glob(&zip_pattern)
for path in glob::glob(&zip_pattern)
.unwrap()
.chain(glob::glob(&zstd_pattern).unwrap())
.flatten()
{
if let Ok(path) = entry {
if let Ok(archive) = Archive::try_from(path) {
backups.push(archive.as_of);
}
if let Ok(archive) = Archive::try_from(path) {
backups.push(archive.as_of);
}
}

Expand Down
7 changes: 4 additions & 3 deletions crates/core/src/bin/parse_addon_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ fn main() {
task::block_on(async move {
let addon_cache = Some(Arc::new(Mutex::new(load_addon_cache().await.unwrap())));

let addons = read_addon_directory(addon_cache, fingerprint_cache, &path, Flavor::Classic)
.await
.unwrap();
let addons =
read_addon_directory(addon_cache, fingerprint_cache, &path, Flavor::ClassicTbc)
.await
.unwrap();

print!("{} addons parsed", addons.len());
});
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use chrono::prelude::*;
use isahc::AsyncReadResponseExt;
use serde::{Deserialize, Serialize};

const CATALOG_URL: &str = "https://github.com/ajour/ajour-catalog/raw/master/catalog-2.0.json";
const CATALOG_URL: &str = "https://github.com/ajour/ajour-catalog/raw/master/catalog-3.0.json";

type Etag = Option<String>;

Expand Down Expand Up @@ -85,22 +85,22 @@ impl std::fmt::Display for Source {
}
}

#[serde(transparent)]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Catalog {
pub addons: Vec<CatalogAddon>,
}

#[serde(rename_all = "camelCase")]
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Ord, PartialOrd)]
#[serde(rename_all = "camelCase")]
pub struct GameVersion {
#[serde(deserialize_with = "null_to_default::deserialize")]
pub game_version: String,
pub flavor: Flavor,
}

#[serde(rename_all = "camelCase")]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CatalogAddon {
#[serde(deserialize_with = "null_to_default::deserialize")]
pub id: i32,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/config/addons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mod de {
}

map.insert(Flavor::Retail, ignored.clone());
map.insert(Flavor::Classic, ignored);
map.insert(Flavor::ClassicTbc, ignored);

Ok(map)
}
Expand Down
21 changes: 8 additions & 13 deletions crates/core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ impl Config {

/// Returns a `Option<PathBuf>` to the root directory of the Flavor.
pub fn get_root_directory_for_flavor(&self, flavor: &Flavor) -> Option<PathBuf> {
if let Some(flavor_dir) = self.wow.directories.get(flavor) {
Some(flavor_dir.parent().unwrap().to_path_buf())
} else {
None
}
self.wow
.directories
.get(flavor)
.map(|p| p.parent().unwrap().to_path_buf())
}

/// Returns a `Option<PathBuf>` to the directory containing the addons.
Expand All @@ -137,10 +136,8 @@ impl Config {
// unless we add an actual pattern symbol, hence the `?`.
let pattern = format!("{}/?nterface/?ddons", dir.display());

for entry in glob::glob_with(&pattern, options).unwrap() {
if let Ok(path) = entry {
addon_dir = path;
}
for path in glob::glob_with(&pattern, options).unwrap().flatten() {
addon_dir = path;
}
}

Expand Down Expand Up @@ -185,10 +182,8 @@ impl Config {
// unless we add an actual pattern symbol, hence the `?`.
let pattern = format!("{}/?tf", dir.display());

for entry in glob::glob_with(&pattern, options).unwrap() {
if let Ok(path) = entry {
addon_dir = path;
}
for path in glob::glob_with(&pattern, options).unwrap().flatten() {
addon_dir = path;
}
}

Expand Down
41 changes: 31 additions & 10 deletions crates/core/src/config/wow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::collections::HashMap;
use std::path::PathBuf;

/// Struct for settings related to World of Warcraft.
#[serde(default)]
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
#[serde(default)]
pub struct Wow {
#[serde(default)]
#[allow(deprecated)]
Expand Down Expand Up @@ -34,19 +34,31 @@ pub enum Flavor {
#[serde(alias = "RetailPTR")]
RetailPtr,
RetailBeta,
#[serde(alias = "classic", alias = "wow_classic")]
Classic,
#[serde(
alias = "Classic",
alias = "classic",
alias = "wow_classic",
alias = "classic_era"
)]
ClassicEra,
#[serde(
alias = "wow_burning_crusade",
alias = "burningCrusade",
alias = "burning_crusade"
)]
ClassicTbc,
#[serde(alias = "ClassicPTR")]
ClassicPtr,
ClassicBeta,
}

impl Flavor {
pub const ALL: [Flavor; 6] = [
pub const ALL: [Flavor; 7] = [
Flavor::Retail,
Flavor::RetailPtr,
Flavor::RetailBeta,
Flavor::Classic,
Flavor::ClassicEra,
Flavor::ClassicTbc,
Flavor::ClassicPtr,
Flavor::ClassicBeta,
];
Expand All @@ -55,23 +67,30 @@ impl Flavor {
pub(crate) fn curse_format(self) -> String {
match self {
Flavor::Retail | Flavor::RetailPtr | Flavor::RetailBeta => "wow_retail".to_owned(),
Flavor::Classic | Flavor::ClassicPtr | Flavor::ClassicBeta => "wow_classic".to_owned(),
Flavor::ClassicTbc | Flavor::ClassicPtr | Flavor::ClassicBeta => {
"wow_burning_crusade".to_owned()
}
Flavor::ClassicEra => "wow_classic".to_owned(),
}
}

/// Returns flavor `String` in WowUp.Hub format
pub(crate) fn hub_format(self) -> String {
match self {
Flavor::Retail | Flavor::RetailPtr | Flavor::RetailBeta => "retail".to_owned(),
Flavor::Classic | Flavor::ClassicPtr | Flavor::ClassicBeta => "classic".to_owned(),
Flavor::ClassicTbc | Flavor::ClassicPtr | Flavor::ClassicBeta => {
"burningCrusade".to_owned()
}
Flavor::ClassicEra => "classic".to_owned(),
}
}

/// Returns `Flavor` which self relates to.
pub fn base_flavor(self) -> Flavor {
match self {
Flavor::Retail | Flavor::RetailPtr | Flavor::RetailBeta => Flavor::Retail,
Flavor::Classic | Flavor::ClassicPtr | Flavor::ClassicBeta => Flavor::Classic,
Flavor::ClassicTbc | Flavor::ClassicPtr | Flavor::ClassicBeta => Flavor::ClassicTbc,
Flavor::ClassicEra => Flavor::ClassicEra,
}
}

Expand All @@ -81,7 +100,8 @@ impl Flavor {
Flavor::Retail => "_retail_".to_owned(),
Flavor::RetailPtr => "_ptr_".to_owned(),
Flavor::RetailBeta => "_beta_".to_owned(),
Flavor::Classic => "_classic_".to_owned(),
Flavor::ClassicEra => "_classic_era_".to_owned(),
Flavor::ClassicTbc => "_classic_".to_owned(),
Flavor::ClassicPtr => "_classic_ptr_".to_owned(),
Flavor::ClassicBeta => "_classic_beta_".to_owned(),
}
Expand All @@ -103,7 +123,8 @@ impl std::fmt::Display for Flavor {
Flavor::Retail => "Retail",
Flavor::RetailPtr => "Retail PTR",
Flavor::RetailBeta => "Retail Beta",
Flavor::Classic => "Classic",
Flavor::ClassicEra => "Classic Era",
Flavor::ClassicTbc => "Classic TBC",
Flavor::ClassicBeta => "Classic Beta",
Flavor::ClassicPtr => "Classic PTR",
}
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/fs/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ pub async fn install_addon(
.filter_map(|p| parse_toc_path(&p))
.collect();
addon_folders.sort();
// Needed since multi-toc can now insert folder name more than once
addon_folders.dedup();

Ok(addon_folders)
}
4 changes: 1 addition & 3 deletions crates/core/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ pub async fn download_addon(
let package =
if let Some(relevant_package) = addon.relevant_release_package(global_release_channel) {
Some(relevant_package)
} else if let Some(fallback_package) = addon.fallback_release_package() {
Some(fallback_package)
} else {
None
addon.fallback_release_package()
};

if let Some(package) = package {
Expand Down
22 changes: 20 additions & 2 deletions crates/core/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,26 @@ async fn parse_addon_folders(
let mut addon_folders: Vec<_> = all_dirs
.par_iter()
.filter_map(|id| {
// Generate .toc path.
let toc_path = root_dir.join(&id).join(format!("{}.toc", id));
// Generate .toc path. If `-BCC` or `-Mainline` exists for Tbc and Era,
// respectively, use that over the standard toc.
let toc_path = {
let multi_part = match flavor.base_flavor() {
Flavor::Retail => "-Mainline",
Flavor::ClassicEra => "-Classic",
Flavor::ClassicTbc => "-BCC",
_ => "",
};

let standard_path = root_dir.join(&id).join(format!("{}.toc", id));
let multi_path = root_dir.join(&id).join(format!("{}{}.toc", id, multi_part));

if multi_path.exists() {
multi_path
} else {
standard_path
}
};

if !toc_path.exists() {
return None;
}
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/repository/backend/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ mod github {
.count();

if flavor.base_flavor() == Flavor::Retail && num_non_classic > 1
|| flavor.base_flavor() == Flavor::Classic && num_classic == 0 && num_non_classic > 1
|| flavor.base_flavor() == Flavor::ClassicEra && num_classic == 0 && num_non_classic > 1
{
return Err(RepositoryError::GitIndeterminableZip {
count: num_non_classic,
url: url.to_string(),
});
} else if flavor.base_flavor() == Flavor::Classic && num_classic > 1 {
} else if flavor.base_flavor() == Flavor::ClassicEra && num_classic > 1 {
return Err(RepositoryError::GitIndeterminableZipClassic {
count: num_classic,
url: url.to_string(),
Expand Down Expand Up @@ -345,15 +345,15 @@ mod gitlab {
.count();

if self.flavor.base_flavor() == Flavor::Retail && num_non_classic > 1
|| self.flavor.base_flavor() == Flavor::Classic
|| self.flavor.base_flavor() == Flavor::ClassicEra
&& num_classic == 0
&& num_non_classic > 1
{
return Err(RepositoryError::GitIndeterminableZip {
count: num_non_classic,
url: url.clone(),
});
} else if self.flavor.base_flavor() == Flavor::Classic && num_classic > 1 {
} else if self.flavor.base_flavor() == Flavor::ClassicEra && num_classic > 1 {
return Err(RepositoryError::GitIndeterminableZipClassic {
count: num_classic,
url,
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载