From 05a7a06c65d59c33ed7679ed17b8ee87af41c781 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Wed, 7 Aug 2024 20:37:33 +0200 Subject: [PATCH 01/17] =?UTF-8?q?=F0=9F=91=B7=20Replace=20the=20different?= =?UTF-8?q?=20workflows=20with=20a=20single=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-default.yaml | 21 ------------- .github/workflows/test-no-default.yaml | 21 ------------- .github/workflows/test-strict.yaml | 21 ------------- .github/workflows/tests.yaml | 41 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/test-default.yaml delete mode 100644 .github/workflows/test-no-default.yaml delete mode 100644 .github/workflows/test-strict.yaml create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/test-default.yaml b/.github/workflows/test-default.yaml deleted file mode 100644 index 5a9d1a7f..00000000 --- a/.github/workflows/test-default.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Tests default - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.github/workflows/test-no-default.yaml b/.github/workflows/test-no-default.yaml deleted file mode 100644 index 178c080f..00000000 --- a/.github/workflows/test-no-default.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Tests no-default - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --no-default-features --verbose diff --git a/.github/workflows/test-strict.yaml b/.github/workflows/test-strict.yaml deleted file mode 100644 index feca7f68..00000000 --- a/.github/workflows/test-strict.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Tests strict - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --features strict --verbose diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000..672f523b --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,41 @@ +name: Run tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + default: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + no-defaults-tests: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --no-default-features --verbose + + strict-tests: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --features strict --verbose From 5b959d9f5519b7595fe75e31da9ead7eb25c4971 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Wed, 7 Aug 2024 20:38:31 +0200 Subject: [PATCH 02/17] =?UTF-8?q?Revert=20"=F0=9F=91=B7=20Replace=20the=20?= =?UTF-8?q?different=20workflows=20with=20a=20single=20workflow"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 05a7a06c65d59c33ed7679ed17b8ee87af41c781. --- .github/workflows/test-default.yaml | 21 +++++++++++++ .github/workflows/test-no-default.yaml | 21 +++++++++++++ .github/workflows/test-strict.yaml | 21 +++++++++++++ .github/workflows/tests.yaml | 41 -------------------------- 4 files changed, 63 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/test-default.yaml create mode 100644 .github/workflows/test-no-default.yaml create mode 100644 .github/workflows/test-strict.yaml delete mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/test-default.yaml b/.github/workflows/test-default.yaml new file mode 100644 index 00000000..5a9d1a7f --- /dev/null +++ b/.github/workflows/test-default.yaml @@ -0,0 +1,21 @@ +name: Tests default + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/.github/workflows/test-no-default.yaml b/.github/workflows/test-no-default.yaml new file mode 100644 index 00000000..178c080f --- /dev/null +++ b/.github/workflows/test-no-default.yaml @@ -0,0 +1,21 @@ +name: Tests no-default + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --no-default-features --verbose diff --git a/.github/workflows/test-strict.yaml b/.github/workflows/test-strict.yaml new file mode 100644 index 00000000..feca7f68 --- /dev/null +++ b/.github/workflows/test-strict.yaml @@ -0,0 +1,21 @@ +name: Tests strict + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --features strict --verbose diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index 672f523b..00000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Run tests - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - default: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - no-defaults-tests: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --no-default-features --verbose - - strict-tests: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --features strict --verbose From 6d318f89bc0a268949aa35b708265cd051bf43c5 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Wed, 7 Aug 2024 20:39:35 +0200 Subject: [PATCH 03/17] =?UTF-8?q?=F0=9F=91=B7=20Adds=20formatting=20flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/formatting.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/formatting.yaml diff --git a/.github/workflows/formatting.yaml b/.github/workflows/formatting.yaml new file mode 100644 index 00000000..43d73350 --- /dev/null +++ b/.github/workflows/formatting.yaml @@ -0,0 +1,19 @@ +name: "Formatting" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + formatting: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 From 973fcd45c77da670b9bec8d3e66200203fec10dd Mon Sep 17 00:00:00 2001 From: rster2002 Date: Wed, 7 Aug 2024 20:42:17 +0200 Subject: [PATCH 04/17] =?UTF-8?q?=F0=9F=91=B7=20Adds=20clippy=20flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/clippy.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/clippy.yaml diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml new file mode 100644 index 00000000..f8278b5c --- /dev/null +++ b/.github/workflows/clippy.yaml @@ -0,0 +1,19 @@ +name: "Clippy check" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +# Make sure CI fails on all warnings, including Clippy lints +env: + RUSTFLAGS: "-Dwarnings" + +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Clippy + run: cargo clippy --all-targets --all-features From 97e2e0bbf9554fd830bff57071cde783e68cfa87 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 22:31:43 +0200 Subject: [PATCH 05/17] =?UTF-8?q?=F0=9F=8E=A8=20Run=20cargo=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib.rs | 4 +- src/modules/civilization/mod.rs | 7 +- src/modules/civilization/models.rs | 4 +- src/modules/civilization/models/crime.rs | 2 +- src/modules/civilization/models/engineer.rs | 4 +- src/modules/exobiology/models/spawn_source.rs | 2 +- .../models/spawn_source/target_planet.rs | 2 +- src/modules/exobiology/models/species.rs | 2 +- .../exobiology/models/variant_color.rs | 161 ++++-- src/modules/galaxy/mod.rs | 6 +- src/modules/galaxy/models.rs | 6 +- .../galaxy/models/galactic_distance.rs | 2 +- src/modules/galaxy/models/gravity.rs | 2 +- src/modules/galaxy/models/local_distance.rs | 2 +- src/modules/galaxy/models/nebula.rs | 7 +- src/modules/galaxy/models/star_class.rs | 120 ++--- src/modules/galaxy/models/star_luminosity.rs | 62 +-- .../asynchronous/live_journal_dir_reader.rs | 2 +- .../blocking/live_journal_dir_reader.rs | 2 +- src/modules/journal/shared/journal_buffer.rs | 4 +- .../log_event_content/commit_crime_event.rs | 2 +- .../log_event_content/crime_victim_event.rs | 2 +- .../log_event_content/engineer_craft_event.rs | 2 +- .../engineer_progress_event.rs | 2 +- .../material_collected_event.rs | 2 +- .../content/log_event_content/scan_event.rs | 4 +- src/modules/modules_info/mod.rs | 1 - src/modules/ship/models/blueprint.rs | 138 ++--- src/modules/ship/models/ship_module.rs | 27 +- .../ship_module/ship_hardpoint_module.rs | 471 ++++++++++++++---- .../ship_hardpoint_module/hardpoint_size.rs | 2 +- .../ship_module/ship_internal_module.rs | 12 +- .../ship_internal_module/armor_module.rs | 11 +- src/modules/state/macros.rs | 16 +- src/modules/state/mod.rs | 11 +- src/modules/state/models.rs | 6 +- src/modules/state/models/carrier_state.rs | 27 +- src/modules/state/models/commander_state.rs | 76 +-- src/modules/state/models/game_state.rs | 4 +- src/modules/state/models/materials_state.rs | 8 +- src/modules/state/models/mission_state.rs | 6 +- src/modules/state/models/planet_state.rs | 102 ++-- .../planet_state/planet_species_entry.rs | 2 +- src/modules/status/blocking.rs | 38 +- src/modules/status/mod.rs | 4 +- 45 files changed, 866 insertions(+), 513 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cca5852e..91ecea67 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,10 +47,10 @@ mod modules; #[cfg(test)] mod tests { - use std::env::current_dir; - use std::path::PathBuf; use crate::logs::LogDir; use crate::logs::LogEventContent; + use std::env::current_dir; + use std::path::PathBuf; pub fn test_root() -> PathBuf { PathBuf::from("./test-files") diff --git a/src/modules/civilization/mod.rs b/src/modules/civilization/mod.rs index 92812757..a1408cfd 100644 --- a/src/modules/civilization/mod.rs +++ b/src/modules/civilization/mod.rs @@ -1,7 +1,10 @@ pub use models::conflict::Conflict; pub use models::conflict::ConflictFaction; pub use models::conflict::ConflictWarType; +pub use models::crime::Crime; pub use models::economy::Economy; +pub use models::engineer::Engineer; +pub use models::engineer::EngineerError; pub use models::faction::Faction; pub use models::faction::FactionActiveState; pub use models::faction_happiness::FactionHappiness; @@ -12,9 +15,5 @@ pub use models::superpower::Superpower; pub use models::system_security::SystemSecurity; pub use models::thargoid_war::ThargoidWar; pub use models::thargoid_war::ThargoidWarState; -pub use models::crime::Crime; -pub use models::engineer::Engineer; -pub use models::engineer::EngineerError; mod models; - diff --git a/src/modules/civilization/models.rs b/src/modules/civilization/models.rs index c4bae01b..09c6e171 100644 --- a/src/modules/civilization/models.rs +++ b/src/modules/civilization/models.rs @@ -1,5 +1,7 @@ pub mod conflict; +pub mod crime; pub mod economy; +pub mod engineer; pub mod faction; pub mod faction_happiness; pub mod faction_state; @@ -8,5 +10,3 @@ pub mod location_info; pub mod superpower; pub mod system_security; pub mod thargoid_war; -pub mod crime; -pub mod engineer; diff --git a/src/modules/civilization/models/crime.rs b/src/modules/civilization/models/crime.rs index ce1db1a4..1c1c8a9b 100644 --- a/src/modules/civilization/models/crime.rs +++ b/src/modules/civilization/models/crime.rs @@ -99,8 +99,8 @@ pub enum Crime { #[cfg(test)] mod tests { - use serde_json::Value; use crate::civilization::Crime; + use serde_json::Value; #[test] fn all_crimes_are_parsed_correctly() { diff --git a/src/modules/civilization/models/engineer.rs b/src/modules/civilization/models/engineer.rs index d96f7576..97e2b214 100644 --- a/src/modules/civilization/models/engineer.rs +++ b/src/modules/civilization/models/engineer.rs @@ -1,7 +1,7 @@ -use std::fmt::{Display, Formatter}; +use crate::{from_str_deserialize_impl, try_from_deserialize_impl}; use serde::Serialize; +use std::fmt::{Display, Formatter}; use thiserror::Error; -use crate::{from_str_deserialize_impl, try_from_deserialize_impl}; #[derive(Debug, Serialize, Clone, PartialEq)] pub enum Engineer { diff --git a/src/modules/exobiology/models/spawn_source.rs b/src/modules/exobiology/models/spawn_source.rs index f38df1be..a15014da 100644 --- a/src/modules/exobiology/models/spawn_source.rs +++ b/src/modules/exobiology/models/spawn_source.rs @@ -16,7 +16,7 @@ use crate::galaxy::{ Atmosphere, AtmosphereDensity, AtmosphereType, Nebula, PlanetClass, PlanetComposition, StarClass, StarLuminosity, Volcanism, VolcanismType, }; -use crate::logs::scan_event::{ScanEventParent}; +use crate::logs::scan_event::ScanEventParent; #[derive(Debug)] pub struct SpawnSource<'a> { diff --git a/src/modules/exobiology/models/spawn_source/target_planet.rs b/src/modules/exobiology/models/spawn_source/target_planet.rs index 4971acd7..6d68b607 100644 --- a/src/modules/exobiology/models/spawn_source/target_planet.rs +++ b/src/modules/exobiology/models/spawn_source/target_planet.rs @@ -1,8 +1,8 @@ use crate::galaxy::{Atmosphere, Gravity, PlanetClass, PlanetComposition, Volcanism}; +use crate::logs::scan_event::ScanEventParent; use crate::materials::Material; use serde::Serialize; use std::collections::HashSet; -use crate::logs::scan_event::ScanEventParent; #[derive(Debug, Serialize)] pub struct TargetPlanet { diff --git a/src/modules/exobiology/models/species.rs b/src/modules/exobiology/models/species.rs index 02b9caa4..33de23e6 100644 --- a/src/modules/exobiology/models/species.rs +++ b/src/modules/exobiology/models/species.rs @@ -1,10 +1,10 @@ use std::fmt::{Display, Formatter}; use std::str::FromStr; +use crate::exobiology::Genus; use serde::{Deserialize, Serialize}; use serde_json::Value; use strum::EnumIter; -use crate::exobiology::Genus; use crate::modules::exobiology::models::spawn_condition::SpawnCondition; use crate::modules::exobiology::r#static::species_spawn_conditions::SPECIES_SPAWN_CONDITIONS; diff --git a/src/modules/exobiology/models/variant_color.rs b/src/modules/exobiology/models/variant_color.rs index e15ddd97..c591c065 100644 --- a/src/modules/exobiology/models/variant_color.rs +++ b/src/modules/exobiology/models/variant_color.rs @@ -537,15 +537,9 @@ impl TryFrom<(&Species, &VariantSource)> for VariantColor { VariantColor::Turquoise } (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::N)) => VariantColor::Sage, - (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::Ae)) => { - VariantColor::Maroon - }, - (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::O)) => { - VariantColor::Grey - }, - (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::W)) => { - VariantColor::Indigo - }, + (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Maroon, + (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::O)) => VariantColor::Grey, + (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::W)) => VariantColor::Indigo, (Genus::Frutexa, _, VariantSource::StarClass(StarClass::Y)) => VariantColor::Amethyst, (Genus::Frutexa, _, VariantSource::StarClass(StarClass::G)) => VariantColor::Emerald, @@ -729,46 +723,117 @@ impl TryFrom<(&Species, &VariantSource)> for VariantColor { VariantColor::Peach } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, // This is a guess - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::O)) => VariantColor::Emerald, // This is a guess - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, - - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, // This is a guess - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, // This is a guess - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, - - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, // This is a guess - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, // This is a guess - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, - - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::A)) => { + VariantColor::Lime + } + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Ae)) => { + VariantColor::Orange + } // This is a guess + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::F)) => { + VariantColor::Turquoise + } + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::G)) => { + VariantColor::Grey + } + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::K)) => { + VariantColor::Indigo + } + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::T)) => { + VariantColor::Emerald + } + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::O)) => { + VariantColor::Emerald + } // This is a guess + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::TTS)) => { + VariantColor::Green + } + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Y)) => { + VariantColor::Maroon + } + + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::A)) => { + VariantColor::Lime + } + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Ae)) => { + VariantColor::Orange + } // This is a guess + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::F)) => { + VariantColor::Turquoise + } + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::G)) => { + VariantColor::Grey + } + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::K)) => { + VariantColor::Indigo + } + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::T)) => { + VariantColor::Emerald + } + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::O)) => { + VariantColor::Yellow + } // This is a guess + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::TTS)) => { + VariantColor::Green + } + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Y)) => { + VariantColor::Maroon + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::A)) => { + VariantColor::Lime + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Ae)) => { + VariantColor::Orange + } // This is a guess + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::F)) => { + VariantColor::Turquoise + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::G)) => { + VariantColor::Grey + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::K)) => { + VariantColor::Indigo + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::T)) => { + VariantColor::Emerald + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::O)) => { + VariantColor::Yellow + } // This is a guess + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::TTS)) => { + VariantColor::Green + } + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Y)) => { + VariantColor::Maroon + } + + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::A)) => { + VariantColor::Lime + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Ae)) => { + VariantColor::Orange + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::F)) => { + VariantColor::Turquoise + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::G)) => { + VariantColor::Grey + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::K)) => { + VariantColor::Indigo + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::T)) => { + VariantColor::Emerald + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::TTS)) => { + VariantColor::Green + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::O)) => { + VariantColor::Yellow + } + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Y)) => { + VariantColor::Maroon + } (_, Species::OsseusDiscus, VariantSource::Material(Material::Boron)) => { VariantColor::White diff --git a/src/modules/galaxy/mod.rs b/src/modules/galaxy/mod.rs index 62faf3b5..e398698f 100644 --- a/src/modules/galaxy/mod.rs +++ b/src/modules/galaxy/mod.rs @@ -6,6 +6,9 @@ pub use models::atmosphere::AtmosphereError; pub use models::atmosphere_element::AtmosphereElement; pub use models::atmosphere_type::AtmosphereType; pub use models::body_type::BodyType; +pub use models::galactic_distance::GalacticDistance; +pub use models::gravity::Gravity; +pub use models::local_distance::LocalDistance; pub use models::nebula::Nebula; pub use models::orbit_info::OrbitInfo; pub use models::planet_class::PlanetClass; @@ -20,9 +23,6 @@ pub use models::volcanism::Volcanism; pub use models::volcanism::VolcanismClassification; pub use models::volcanism::VolcanismError; pub use models::volcanism_type::VolcanismType; -pub use models::gravity::Gravity; -pub use models::local_distance::LocalDistance; -pub use models::galactic_distance::GalacticDistance; mod functions; mod models; diff --git a/src/modules/galaxy/models.rs b/src/modules/galaxy/models.rs index e418f9cc..96cd60cf 100644 --- a/src/modules/galaxy/models.rs +++ b/src/modules/galaxy/models.rs @@ -2,6 +2,9 @@ pub mod atmosphere; pub mod atmosphere_element; pub mod atmosphere_type; pub mod body_type; +pub mod galactic_distance; +pub mod gravity; +pub mod local_distance; pub mod nebula; pub mod orbit_info; pub mod planet_class; @@ -13,6 +16,3 @@ pub mod star_luminosity; pub mod terraform_state; pub mod volcanism; pub mod volcanism_type; -pub mod gravity; -pub mod local_distance; -pub mod galactic_distance; diff --git a/src/modules/galaxy/models/galactic_distance.rs b/src/modules/galaxy/models/galactic_distance.rs index a910f57c..6010212a 100644 --- a/src/modules/galaxy/models/galactic_distance.rs +++ b/src/modules/galaxy/models/galactic_distance.rs @@ -1,5 +1,5 @@ -use std::cmp::Ordering; use serde::{Deserialize, Serialize}; +use std::cmp::Ordering; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct GalacticDistance(f32); diff --git a/src/modules/galaxy/models/gravity.rs b/src/modules/galaxy/models/gravity.rs index 50c0e234..a683071a 100644 --- a/src/modules/galaxy/models/gravity.rs +++ b/src/modules/galaxy/models/gravity.rs @@ -1,5 +1,5 @@ -use std::fmt::Debug; use serde::{Deserialize, Serialize}; +use std::fmt::Debug; /// Gravity in m/s². #[derive(Serialize, Deserialize, Clone, PartialEq)] diff --git a/src/modules/galaxy/models/local_distance.rs b/src/modules/galaxy/models/local_distance.rs index 586e7410..00f5ad34 100644 --- a/src/modules/galaxy/models/local_distance.rs +++ b/src/modules/galaxy/models/local_distance.rs @@ -1,5 +1,5 @@ -use std::fmt::Debug; use serde::{Deserialize, Serialize}; +use std::fmt::Debug; /// Model for working with local (system) distances. Expects the value to be in LS. #[derive(Serialize, Deserialize, Clone, PartialEq)] diff --git a/src/modules/galaxy/models/nebula.rs b/src/modules/galaxy/models/nebula.rs index f470c221..102a214b 100644 --- a/src/modules/galaxy/models/nebula.rs +++ b/src/modules/galaxy/models/nebula.rs @@ -1,7 +1,7 @@ use std::fmt::{Display, Formatter}; -use strum::{EnumIter, IntoEnumIterator}; use crate::galaxy::GalacticDistance; +use strum::{EnumIter, IntoEnumIterator}; #[derive(Debug, EnumIter)] pub enum Nebula { @@ -398,7 +398,10 @@ impl Nebula { /// Calculates the closest nebula to the given coordinates. pub fn closest_to(pos: [f32; 3]) -> Nebula { - let mut closest = (Nebula::AquilaDarkRegion, GalacticDistance::from_ly(f32::MAX)); + let mut closest = ( + Nebula::AquilaDarkRegion, + GalacticDistance::from_ly(f32::MAX), + ); for nebula in Nebula::iter() { let distance = nebula.distance_to(pos); diff --git a/src/modules/galaxy/models/star_class.rs b/src/modules/galaxy/models/star_class.rs index a65c1f9d..d5a0b9c6 100644 --- a/src/modules/galaxy/models/star_class.rs +++ b/src/modules/galaxy/models/star_class.rs @@ -196,63 +196,67 @@ impl StarClass { impl Display for StarClass { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", match self { - StarClass::O => "O", - StarClass::B => "B", - StarClass::A => "A", - StarClass::F => "F", - StarClass::G => "G", - StarClass::K => "K", - StarClass::M => "M", - StarClass::L => "L", - StarClass::T => "T", - StarClass::Y => "Y", - StarClass::TTS => "TTS", - StarClass::Ae => "Ae", - StarClass::Be => "Be", - StarClass::AeBe => "AeBe", - StarClass::W => "W", - StarClass::WN => "WN", - StarClass::WNC => "WNC", - StarClass::WC => "WC", - StarClass::WO => "WO", - StarClass::CS => "CS", - StarClass::C => "C", - StarClass::CN => "CN", - StarClass::CJ => "CJ", - StarClass::CH => "CH", - StarClass::CHd => "CHd", - StarClass::D => "D", - StarClass::DA => "DA", - StarClass::DAB => "DAB", - StarClass::DAO => "DAO", - StarClass::DAZ => "DAZ", - StarClass::DAV => "DAV", - StarClass::DB => "DB", - StarClass::DBZ => "DBZ", - StarClass::DBV => "DBV", - StarClass::DO => "DO", - StarClass::DOV => "DOV", - StarClass::DQ => "DQ", - StarClass::DC => "DC", - StarClass::DCV => "DCV", - StarClass::DX => "DX", - StarClass::N => "N", - StarClass::H => "H", - StarClass::X => "X", - StarClass::SupermassiveBlackHole => "SupermassiveBlackHole", - StarClass::ABlueWhiteSuperGiant => "ABlueWhiteSuperGiant", - StarClass::BBlueWhiteSuperGiant => "BBlueWhiteSuperGiant", - StarClass::FWhiteSuperGiant => "FWhiteSuperGiant", - StarClass::GWhiteSuperGiant => "GWhiteSuperGiant", - StarClass::MRedSuperGiant => "MRedSuperGiant", - StarClass::MRedGiant => "MRedGiant", - StarClass::KOrangeGiant => "KOrangeGiant", - StarClass::RoguePlanet => "RoguePlanet", - StarClass::Nebula => "Nebula", - StarClass::StellarRemnantNebula => "StellarRemnantNebula", - StarClass::MS => "MS", - StarClass::S => "S", - }) + write!( + f, + "{}", + match self { + StarClass::O => "O", + StarClass::B => "B", + StarClass::A => "A", + StarClass::F => "F", + StarClass::G => "G", + StarClass::K => "K", + StarClass::M => "M", + StarClass::L => "L", + StarClass::T => "T", + StarClass::Y => "Y", + StarClass::TTS => "TTS", + StarClass::Ae => "Ae", + StarClass::Be => "Be", + StarClass::AeBe => "AeBe", + StarClass::W => "W", + StarClass::WN => "WN", + StarClass::WNC => "WNC", + StarClass::WC => "WC", + StarClass::WO => "WO", + StarClass::CS => "CS", + StarClass::C => "C", + StarClass::CN => "CN", + StarClass::CJ => "CJ", + StarClass::CH => "CH", + StarClass::CHd => "CHd", + StarClass::D => "D", + StarClass::DA => "DA", + StarClass::DAB => "DAB", + StarClass::DAO => "DAO", + StarClass::DAZ => "DAZ", + StarClass::DAV => "DAV", + StarClass::DB => "DB", + StarClass::DBZ => "DBZ", + StarClass::DBV => "DBV", + StarClass::DO => "DO", + StarClass::DOV => "DOV", + StarClass::DQ => "DQ", + StarClass::DC => "DC", + StarClass::DCV => "DCV", + StarClass::DX => "DX", + StarClass::N => "N", + StarClass::H => "H", + StarClass::X => "X", + StarClass::SupermassiveBlackHole => "SupermassiveBlackHole", + StarClass::ABlueWhiteSuperGiant => "ABlueWhiteSuperGiant", + StarClass::BBlueWhiteSuperGiant => "BBlueWhiteSuperGiant", + StarClass::FWhiteSuperGiant => "FWhiteSuperGiant", + StarClass::GWhiteSuperGiant => "GWhiteSuperGiant", + StarClass::MRedSuperGiant => "MRedSuperGiant", + StarClass::MRedGiant => "MRedGiant", + StarClass::KOrangeGiant => "KOrangeGiant", + StarClass::RoguePlanet => "RoguePlanet", + StarClass::Nebula => "Nebula", + StarClass::StellarRemnantNebula => "StellarRemnantNebula", + StarClass::MS => "MS", + StarClass::S => "S", + } + ) } } diff --git a/src/modules/galaxy/models/star_luminosity.rs b/src/modules/galaxy/models/star_luminosity.rs index e0ac262a..d167afcd 100644 --- a/src/modules/galaxy/models/star_luminosity.rs +++ b/src/modules/galaxy/models/star_luminosity.rs @@ -1,5 +1,5 @@ -use std::fmt::{Display, Formatter}; use serde::{Deserialize, Serialize}; +use std::fmt::{Display, Formatter}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Ord, Hash, PartialOrd, Eq)] pub enum StarLuminosity { @@ -34,34 +34,38 @@ pub enum StarLuminosity { impl Display for StarLuminosity { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", match self { - StarLuminosity::O => "O", - StarLuminosity::I => "I", - StarLuminosity::Ia0 => "Ia0", - StarLuminosity::Ia => "Ia", - StarLuminosity::Ib => "Ib", - StarLuminosity::Iab => "Iab", - StarLuminosity::II => "II", - StarLuminosity::IIa => "IIa", - StarLuminosity::IIab => "IIab", - StarLuminosity::IIb => "IIb", - StarLuminosity::III => "III", - StarLuminosity::IIIa => "IIIa", - StarLuminosity::IIIab => "IIIab", - StarLuminosity::IIIb => "IIIb", - StarLuminosity::IV => "IV", - StarLuminosity::IVa => "IVa", - StarLuminosity::IVab => "IVab", - StarLuminosity::IVb => "IVb", - StarLuminosity::V => "V", - StarLuminosity::Va => "Va", - StarLuminosity::Vab => "Vab", - StarLuminosity::Vb => "Vb", - StarLuminosity::Vz => "Vz", - StarLuminosity::VI => "VI", - StarLuminosity::VII => "VII", - StarLuminosity::Zero => "Zero", - }) + write!( + f, + "{}", + match self { + StarLuminosity::O => "O", + StarLuminosity::I => "I", + StarLuminosity::Ia0 => "Ia0", + StarLuminosity::Ia => "Ia", + StarLuminosity::Ib => "Ib", + StarLuminosity::Iab => "Iab", + StarLuminosity::II => "II", + StarLuminosity::IIa => "IIa", + StarLuminosity::IIab => "IIab", + StarLuminosity::IIb => "IIb", + StarLuminosity::III => "III", + StarLuminosity::IIIa => "IIIa", + StarLuminosity::IIIab => "IIIab", + StarLuminosity::IIIb => "IIIb", + StarLuminosity::IV => "IV", + StarLuminosity::IVa => "IVa", + StarLuminosity::IVab => "IVab", + StarLuminosity::IVb => "IVb", + StarLuminosity::V => "V", + StarLuminosity::Va => "Va", + StarLuminosity::Vab => "Vab", + StarLuminosity::Vb => "Vb", + StarLuminosity::Vz => "Vz", + StarLuminosity::VI => "VI", + StarLuminosity::VII => "VII", + StarLuminosity::Zero => "Zero", + } + ) } } diff --git a/src/modules/journal/asynchronous/live_journal_dir_reader.rs b/src/modules/journal/asynchronous/live_journal_dir_reader.rs index a1008a22..3d926b8f 100644 --- a/src/modules/journal/asynchronous/live_journal_dir_reader.rs +++ b/src/modules/journal/asynchronous/live_journal_dir_reader.rs @@ -3,9 +3,9 @@ use std::path::Path; use notify::{Event, RecommendedWatcher, RecursiveMode, Watcher}; use thiserror::Error; -use crate::journal::LiveJournalBufferError; use crate::journal::models::journal_event::JournalEvent; use crate::journal::shared::journal_buffer::LiveJournalBuffer; +use crate::journal::LiveJournalBufferError; use crate::logs::asynchronous::{LogDirReader, LogDirReaderError}; use crate::modules::journal::models::journal_event_kind::JournalEventKind; use crate::modules::shared::asynchronous::async_blocker::AsyncBlocker; diff --git a/src/modules/journal/blocking/live_journal_dir_reader.rs b/src/modules/journal/blocking/live_journal_dir_reader.rs index aecde2aa..cc3de5d1 100644 --- a/src/modules/journal/blocking/live_journal_dir_reader.rs +++ b/src/modules/journal/blocking/live_journal_dir_reader.rs @@ -3,9 +3,9 @@ use std::path::Path; use notify::{Event, RecommendedWatcher, RecursiveMode, Watcher}; use thiserror::Error; -use crate::journal::LiveJournalBufferError; use crate::journal::models::journal_event::JournalEvent; use crate::journal::shared::journal_buffer::LiveJournalBuffer; +use crate::journal::LiveJournalBufferError; use crate::logs::blocking::{LogDirReader, LogDirReaderError}; use crate::modules::journal::models::journal_event_kind::JournalEventKind; use crate::modules::shared::blocking::sync_blocker::SyncBlocker; diff --git a/src/modules/journal/shared/journal_buffer.rs b/src/modules/journal/shared/journal_buffer.rs index ec7dab05..1fb40443 100644 --- a/src/modules/journal/shared/journal_buffer.rs +++ b/src/modules/journal/shared/journal_buffer.rs @@ -2,14 +2,14 @@ use std::collections::VecDeque; use std::path::PathBuf; use std::sync::{Arc, Mutex}; -use notify::{Event, EventKind}; use notify::event::{CreateKind, DataChange, ModifyKind}; +use notify::{Event, EventKind}; use thiserror::Error; use crate::backpack::blocking::{read_backpack_file, ReadBackpackFileError}; use crate::cargo::blocking::{read_cargo_file, ReadCargoFileError}; -use crate::journal::JournalEventKind; use crate::journal::models::journal_event::JournalEvent; +use crate::journal::JournalEventKind; use crate::market::blocking::{read_market_file, ReadMarketFileError}; use crate::modules_info::blocking::{read_modules_info_file, ReadModulesInfoFileError}; use crate::nav_route::blocking::{read_nav_route_file, ReadNavRouteFileError}; diff --git a/src/modules/logs/content/log_event_content/commit_crime_event.rs b/src/modules/logs/content/log_event_content/commit_crime_event.rs index b085255c..44d12d0d 100644 --- a/src/modules/logs/content/log_event_content/commit_crime_event.rs +++ b/src/modules/logs/content/log_event_content/commit_crime_event.rs @@ -1,5 +1,5 @@ -use serde::{Deserialize, Serialize}; use crate::civilization::Crime; +use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[serde(rename_all = "PascalCase")] diff --git a/src/modules/logs/content/log_event_content/crime_victim_event.rs b/src/modules/logs/content/log_event_content/crime_victim_event.rs index 74828d69..2ede6517 100644 --- a/src/modules/logs/content/log_event_content/crime_victim_event.rs +++ b/src/modules/logs/content/log_event_content/crime_victim_event.rs @@ -1,5 +1,5 @@ -use serde::{Deserialize, Serialize}; use crate::civilization::Crime; +use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[serde(rename_all = "PascalCase")] diff --git a/src/modules/logs/content/log_event_content/engineer_craft_event.rs b/src/modules/logs/content/log_event_content/engineer_craft_event.rs index eb8c9a1d..3cb4ac84 100644 --- a/src/modules/logs/content/log_event_content/engineer_craft_event.rs +++ b/src/modules/logs/content/log_event_content/engineer_craft_event.rs @@ -1,5 +1,5 @@ -use serde::{Deserialize, Serialize}; use crate::civilization::Engineer; +use serde::{Deserialize, Serialize}; use crate::modules::materials::Material; use crate::modules::ship::{Blueprint, BlueprintModifier, ShipModule, ShipSlot}; diff --git a/src/modules/logs/content/log_event_content/engineer_progress_event.rs b/src/modules/logs/content/log_event_content/engineer_progress_event.rs index dcb4773d..d20a0ca4 100644 --- a/src/modules/logs/content/log_event_content/engineer_progress_event.rs +++ b/src/modules/logs/content/log_event_content/engineer_progress_event.rs @@ -1,5 +1,5 @@ -use serde::{Deserialize, Serialize}; use crate::civilization::{Engineer, EngineerError}; +use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[serde(rename_all = "PascalCase", untagged)] diff --git a/src/modules/logs/content/log_event_content/material_collected_event.rs b/src/modules/logs/content/log_event_content/material_collected_event.rs index 424ef482..e7c7181b 100644 --- a/src/modules/logs/content/log_event_content/material_collected_event.rs +++ b/src/modules/logs/content/log_event_content/material_collected_event.rs @@ -1,5 +1,5 @@ -use serde::{Deserialize, Serialize}; use crate::materials::{Material, MaterialCategory}; +use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[serde(rename_all = "PascalCase")] diff --git a/src/modules/logs/content/log_event_content/scan_event.rs b/src/modules/logs/content/log_event_content/scan_event.rs index 93e39557..200e18c3 100644 --- a/src/modules/logs/content/log_event_content/scan_event.rs +++ b/src/modules/logs/content/log_event_content/scan_event.rs @@ -188,10 +188,8 @@ pub struct ScanEventBeltCluster {} #[cfg(test)] mod tests { - use crate::{ - modules::logs::content::log_event_content::scan_event::ScanEvent, - }; use crate::galaxy::LocalDistance; + use crate::modules::logs::content::log_event_content::scan_event::ScanEvent; #[test] fn scan_event_is_parsed_correctly() { diff --git a/src/modules/modules_info/mod.rs b/src/modules/modules_info/mod.rs index 92dbec7d..4fd3643f 100644 --- a/src/modules/modules_info/mod.rs +++ b/src/modules/modules_info/mod.rs @@ -6,4 +6,3 @@ mod models; #[cfg(feature = "asynchronous")] pub mod asynchronous; - diff --git a/src/modules/ship/models/blueprint.rs b/src/modules/ship/models/blueprint.rs index 1c00a225..0594bc98 100644 --- a/src/modules/ship/models/blueprint.rs +++ b/src/modules/ship/models/blueprint.rs @@ -1,5 +1,5 @@ -use std::fmt::{Display, Formatter}; use serde::{Deserialize, Serialize}; +use std::fmt::{Display, Formatter}; /// Engineering blueprint that can be applied to certain ship modules. #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] @@ -205,78 +205,82 @@ pub enum Blueprint { impl Display for Blueprint { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", match self { - Blueprint::ArmorBlastResistant => "Blast Resistant", - Blueprint::ArmorHeavyDuty => "Heavy Duty", - Blueprint::ArmorKineticResistant => "Kinetic Resistant", - Blueprint::ArmorLightweight => "Lightweight", - Blueprint::ArmorThermalResistant => "Thermal Resistant", - Blueprint::ChaffCapacity => "Ammo capacity", - Blueprint::FSDInterdictorExpandedCaptureArc => "Expanded Capture Arc", - Blueprint::FSDInterdictorLongRange => "Long Range", - Blueprint::FrameShiftDriveFasterBootSequence => "Faster Boot Sequence", - Blueprint::FrameShiftDriveLongRange => "Long Range", - Blueprint::FrameShiftDriveShielded => "Shielded", - Blueprint::HeatSinkCapacity => "Ammo capacity", - Blueprint::HullReinforcementBlastResistant => "Blast Resistant", - Blueprint::HullReinforcementHeavyDuty => "Heavy Duty", - Blueprint::HullReinforcementKineticResistant => "Kinetic Resistant", - Blueprint::HullReinforcementLightweight => "Lightweight", - Blueprint::HullReinforcementThermalResistant => "Thermal Resistant", - Blueprint::MiscLightweight => "Lightweight", - Blueprint::MiscReinforced => "Reinforced", - Blueprint::MiscShielded => "Shielded", - Blueprint::PointDefenceCapacity => "Ammo capacity", - Blueprint::PowerDistributorChargeEnhanced => "Charge Enhanced", - Blueprint::PowerDistributorEngineFocussed => "Engine Focussed", - Blueprint::PowerDistributorHighCapacity => "High Capacity", - Blueprint::PowerDistributorPrioritizeEngines => "Prioritize Engines", - Blueprint::PowerDistributorPrioritizeSystems => "Prioritize Systems", - Blueprint::PowerDistributorPrioritizeWeapons => "Prioritize Weapons", - Blueprint::PowerDistributorShielded => "Shielded", - Blueprint::PowerPlantArmored => "Armored", - Blueprint::PowerPlantLowEmissions => "Low Emissions", - Blueprint::PowerPlantOvercharged => "Overcharged", - Blueprint::SensorsFastScan => "Fast Scan", - Blueprint::SensorsLightweight => "Lightweight", - Blueprint::SensorsLongRange => "Long Range", - Blueprint::SensorsWideAngle => "Wide Angle", - Blueprint::SensorsExpandedRadius => "Wide Angle", - Blueprint::ShieldBoosterBlastResistant => "Expanded Radius", - Blueprint::ShieldBoosterHeavyDuty => "Heavy Duty", - Blueprint::ShieldBoosterKineticResistant => "Kinetic Resistant", - Blueprint::ShieldBoosterResistanceAugmented => "Resistance Augmented", - Blueprint::ShieldBoosterThermalResistant => "Thermal Resistant", - Blueprint::ShieldCellBankRapidCharge => "Rapid Charge", - Blueprint::ShieldCellBankSpecialized => "Specialized", - Blueprint::ShieldGeneratorEnhancedLowPower => "Enhanced, Low Power", - Blueprint::ShieldGeneratorKineticResistant => "Kinetic Resistant", - Blueprint::ShieldGeneratorReinforced => "Reinforced", - Blueprint::ShieldGeneratorThermalResistant => "Thermal Resistant", - Blueprint::ThrustersCleanTuning => "Clean Tuning", - Blueprint::ThrustersDirtyTuning => "Dirty Tuning", - Blueprint::ThrustersStrengthened => "Strengthened", - Blueprint::WeaponDoubleShot => "Double Shot", - Blueprint::WeaponEfficient => "Efficient", - Blueprint::WeaponFocussed => "Focussed", - Blueprint::WeaponHighCapacity => "High Capacity", - Blueprint::WeaponLightweight => "Lightweight", - Blueprint::WeaponLongRange => "Long Range", - Blueprint::WeaponOvercharged => "Overcharge", - Blueprint::WeaponRapidFire => "Rapid Fire", - Blueprint::WeaponShortRange => "Short Range", - Blueprint::WeaponSturdy => "Sturdy", - - #[cfg(not(feature = "strict"))] - Blueprint::Unknown(unknown) => return write!(f, "Unknown blueprint: {}", unknown), - }) + write!( + f, + "{}", + match self { + Blueprint::ArmorBlastResistant => "Blast Resistant", + Blueprint::ArmorHeavyDuty => "Heavy Duty", + Blueprint::ArmorKineticResistant => "Kinetic Resistant", + Blueprint::ArmorLightweight => "Lightweight", + Blueprint::ArmorThermalResistant => "Thermal Resistant", + Blueprint::ChaffCapacity => "Ammo capacity", + Blueprint::FSDInterdictorExpandedCaptureArc => "Expanded Capture Arc", + Blueprint::FSDInterdictorLongRange => "Long Range", + Blueprint::FrameShiftDriveFasterBootSequence => "Faster Boot Sequence", + Blueprint::FrameShiftDriveLongRange => "Long Range", + Blueprint::FrameShiftDriveShielded => "Shielded", + Blueprint::HeatSinkCapacity => "Ammo capacity", + Blueprint::HullReinforcementBlastResistant => "Blast Resistant", + Blueprint::HullReinforcementHeavyDuty => "Heavy Duty", + Blueprint::HullReinforcementKineticResistant => "Kinetic Resistant", + Blueprint::HullReinforcementLightweight => "Lightweight", + Blueprint::HullReinforcementThermalResistant => "Thermal Resistant", + Blueprint::MiscLightweight => "Lightweight", + Blueprint::MiscReinforced => "Reinforced", + Blueprint::MiscShielded => "Shielded", + Blueprint::PointDefenceCapacity => "Ammo capacity", + Blueprint::PowerDistributorChargeEnhanced => "Charge Enhanced", + Blueprint::PowerDistributorEngineFocussed => "Engine Focussed", + Blueprint::PowerDistributorHighCapacity => "High Capacity", + Blueprint::PowerDistributorPrioritizeEngines => "Prioritize Engines", + Blueprint::PowerDistributorPrioritizeSystems => "Prioritize Systems", + Blueprint::PowerDistributorPrioritizeWeapons => "Prioritize Weapons", + Blueprint::PowerDistributorShielded => "Shielded", + Blueprint::PowerPlantArmored => "Armored", + Blueprint::PowerPlantLowEmissions => "Low Emissions", + Blueprint::PowerPlantOvercharged => "Overcharged", + Blueprint::SensorsFastScan => "Fast Scan", + Blueprint::SensorsLightweight => "Lightweight", + Blueprint::SensorsLongRange => "Long Range", + Blueprint::SensorsWideAngle => "Wide Angle", + Blueprint::SensorsExpandedRadius => "Wide Angle", + Blueprint::ShieldBoosterBlastResistant => "Expanded Radius", + Blueprint::ShieldBoosterHeavyDuty => "Heavy Duty", + Blueprint::ShieldBoosterKineticResistant => "Kinetic Resistant", + Blueprint::ShieldBoosterResistanceAugmented => "Resistance Augmented", + Blueprint::ShieldBoosterThermalResistant => "Thermal Resistant", + Blueprint::ShieldCellBankRapidCharge => "Rapid Charge", + Blueprint::ShieldCellBankSpecialized => "Specialized", + Blueprint::ShieldGeneratorEnhancedLowPower => "Enhanced, Low Power", + Blueprint::ShieldGeneratorKineticResistant => "Kinetic Resistant", + Blueprint::ShieldGeneratorReinforced => "Reinforced", + Blueprint::ShieldGeneratorThermalResistant => "Thermal Resistant", + Blueprint::ThrustersCleanTuning => "Clean Tuning", + Blueprint::ThrustersDirtyTuning => "Dirty Tuning", + Blueprint::ThrustersStrengthened => "Strengthened", + Blueprint::WeaponDoubleShot => "Double Shot", + Blueprint::WeaponEfficient => "Efficient", + Blueprint::WeaponFocussed => "Focussed", + Blueprint::WeaponHighCapacity => "High Capacity", + Blueprint::WeaponLightweight => "Lightweight", + Blueprint::WeaponLongRange => "Long Range", + Blueprint::WeaponOvercharged => "Overcharge", + Blueprint::WeaponRapidFire => "Rapid Fire", + Blueprint::WeaponShortRange => "Short Range", + Blueprint::WeaponSturdy => "Sturdy", + + #[cfg(not(feature = "strict"))] + Blueprint::Unknown(unknown) => return write!(f, "Unknown blueprint: {}", unknown), + } + ) } } #[cfg(test)] mod tests { - use serde_json::Value; use crate::ship::Blueprint; + use serde_json::Value; #[test] fn all_blueprint_test_cases_are_parsed_correctly() { diff --git a/src/modules/ship/models/ship_module.rs b/src/modules/ship/models/ship_module.rs index 3c9342a5..240bb86b 100644 --- a/src/modules/ship/models/ship_module.rs +++ b/src/modules/ship/models/ship_module.rs @@ -229,7 +229,7 @@ mod tests { let content = include_str!("zz_ship_modules.txt"); let mut lines = content.lines(); - for line in lines { + for line in lines { if line.starts_with('#') { continue; } @@ -241,11 +241,14 @@ mod tests { parts.next().unwrap(); parts.next().unwrap(); - let mounting: Option = parts.next() - .and_then(|string| if string.is_empty() { - None - } else { - Some(string) + let mounting: Option = parts + .next() + .and_then(|string| { + if string.is_empty() { + None + } else { + Some(string) + } }) .map(|mounting| mounting.parse()) .transpose() @@ -254,15 +257,9 @@ mod tests { parts.next().unwrap(); parts.next().unwrap(); - let size = parts.next() - .unwrap() - .parse::() - .unwrap(); + let size = parts.next().unwrap().parse::().unwrap(); - let class = parts.next() - .unwrap() - .parse::() - .unwrap(); + let class = parts.next().unwrap().parse::().unwrap(); let parsed = serde_json::from_value::(Value::String(input.to_string())); @@ -291,7 +288,7 @@ mod tests { assert_eq!(hardpoint.class, class); assert_eq!(hardpoint.size, hardpoint_size); } - _ => {}, + _ => {} // ShipModule::Cockpit(_) => {} // ShipModule::PaintJob(_) => {} // ShipModule::Decal(_) => {} diff --git a/src/modules/ship/models/ship_module/ship_hardpoint_module.rs b/src/modules/ship/models/ship_module/ship_hardpoint_module.rs index 4d406394..4482bdb5 100644 --- a/src/modules/ship/models/ship_module/ship_hardpoint_module.rs +++ b/src/modules/ship/models/ship_module/ship_hardpoint_module.rs @@ -174,112 +174,310 @@ impl ShipHardpointModule { }) } - fn get_module_class(module: &HardpointModule, mounting: &HardpointMounting, size: &HardpointSize) -> ModuleClass { + fn get_module_class( + module: &HardpointModule, + mounting: &HardpointMounting, + size: &HardpointSize, + ) -> ModuleClass { match (&module, &mounting, &size) { // Pulse lasers - (HardpointModule::PulseLaser, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::PulseLaser, HardpointMounting::Gimballed, HardpointSize::Small) => ModuleClass::G, - (HardpointModule::PulseLaser, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::G, - (HardpointModule::PulseLaser, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::PulseLaser, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::F, - (HardpointModule::PulseLaser, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::F, + (HardpointModule::PulseLaser, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::F + } + (HardpointModule::PulseLaser, HardpointMounting::Gimballed, HardpointSize::Small) => { + ModuleClass::G + } + (HardpointModule::PulseLaser, HardpointMounting::Turreted, HardpointSize::Small) => { + ModuleClass::G + } + (HardpointModule::PulseLaser, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::E + } + (HardpointModule::PulseLaser, HardpointMounting::Gimballed, HardpointSize::Medium) => { + ModuleClass::F + } + (HardpointModule::PulseLaser, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::F + } (HardpointModule::PulseDisruptorLaser, _, _) => ModuleClass::E, - (HardpointModule::PulseLaser, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::D, - (HardpointModule::PulseLaser, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::E, - (HardpointModule::PulseLaser, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::F, + (HardpointModule::PulseLaser, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::D + } + (HardpointModule::PulseLaser, HardpointMounting::Gimballed, HardpointSize::Large) => { + ModuleClass::E + } + (HardpointModule::PulseLaser, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::F + } (HardpointModule::PulseLaser, _, HardpointSize::Huge) => ModuleClass::A, // Burst lasers - (HardpointModule::BurstLaser, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::BurstLaser, HardpointMounting::Gimballed | HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::G, + (HardpointModule::BurstLaser, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::F + } + ( + HardpointModule::BurstLaser, + HardpointMounting::Gimballed | HardpointMounting::Turreted, + HardpointSize::Small, + ) => ModuleClass::G, (HardpointModule::CytoscramblerBurstLaser, _, _) => ModuleClass::F, - (HardpointModule::BurstLaser, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::BurstLaser, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::F, - (HardpointModule::BurstLaser, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::F, - (HardpointModule::BurstLaser, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::D, - (HardpointModule::BurstLaser, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::E, - (HardpointModule::BurstLaser, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::E, + (HardpointModule::BurstLaser, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::E + } + (HardpointModule::BurstLaser, HardpointMounting::Gimballed, HardpointSize::Medium) => { + ModuleClass::F + } + (HardpointModule::BurstLaser, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::F + } + (HardpointModule::BurstLaser, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::D + } + (HardpointModule::BurstLaser, HardpointMounting::Gimballed, HardpointSize::Large) => { + ModuleClass::E + } + (HardpointModule::BurstLaser, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::E + } (HardpointModule::BurstLaser, _, HardpointSize::Huge) => ModuleClass::E, // Cannons - (HardpointModule::Cannon, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::Cannon, HardpointMounting::Gimballed, HardpointSize::Small) => ModuleClass::E, - (HardpointModule::Cannon, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::Cannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::Cannon, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::Cannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::Cannon, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::Cannon, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::Cannon, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + (HardpointModule::Cannon, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::D + } + (HardpointModule::Cannon, HardpointMounting::Gimballed, HardpointSize::Small) => { + ModuleClass::E + } + (HardpointModule::Cannon, HardpointMounting::Turreted, HardpointSize::Small) => { + ModuleClass::F + } + (HardpointModule::Cannon, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::Cannon, HardpointMounting::Gimballed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::Cannon, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::E + } + (HardpointModule::Cannon, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::Cannon, HardpointMounting::Gimballed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::Cannon, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::D + } (HardpointModule::Cannon, _, HardpointSize::Huge) => ModuleClass::B, // Experimental - (HardpointModule::RemoteReleaseFlakLauncher, _, HardpointSize::Medium) => ModuleClass::B, - (HardpointModule::RemoteReleaseFlechetteLauncher, _, HardpointSize::Medium) => ModuleClass::B, + (HardpointModule::RemoteReleaseFlakLauncher, _, HardpointSize::Medium) => { + ModuleClass::B + } + (HardpointModule::RemoteReleaseFlechetteLauncher, _, HardpointSize::Medium) => { + ModuleClass::B + } (HardpointModule::EnzymeMissileRack, _, HardpointSize::Medium) => ModuleClass::B, // AX missile racks - (HardpointModule::AXMissileRack, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::AXMissileRack, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::F, - (HardpointModule::EnhancedAXMissileRack, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::EnhancedAXMissileRack, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::AXMissileRack, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::AXMissileRack, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::E, - (HardpointModule::EnhancedAXMissileRack, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::B, - (HardpointModule::EnhancedAXMissileRack, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + (HardpointModule::AXMissileRack, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::E + } + ( + HardpointModule::AXMissileRack, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::F, + ( + HardpointModule::EnhancedAXMissileRack, + HardpointMounting::Fixed, + HardpointSize::Medium, + ) => ModuleClass::D, + ( + HardpointModule::EnhancedAXMissileRack, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::E, + (HardpointModule::AXMissileRack, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::AXMissileRack, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::E + } + ( + HardpointModule::EnhancedAXMissileRack, + HardpointMounting::Fixed, + HardpointSize::Large, + ) => ModuleClass::B, + ( + HardpointModule::EnhancedAXMissileRack, + HardpointMounting::Turreted, + HardpointSize::Large, + ) => ModuleClass::D, // AX multi-cannons - (HardpointModule::AXMultiCannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::AXMultiCannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::F, - (HardpointModule::EnhancedAXMultiCannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::EnhancedAXMultiCannon, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::EnhancedAXMultiCannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::AXMultiCannon, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::AXMultiCannon, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::E, - (HardpointModule::EnhancedAXMultiCannon, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::B, - (HardpointModule::EnhancedAXMultiCannon, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::EnhancedAXMultiCannon, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + (HardpointModule::AXMultiCannon, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::E + } + ( + HardpointModule::AXMultiCannon, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::F, + ( + HardpointModule::EnhancedAXMultiCannon, + HardpointMounting::Fixed, + HardpointSize::Medium, + ) => ModuleClass::D, + ( + HardpointModule::EnhancedAXMultiCannon, + HardpointMounting::Gimballed, + HardpointSize::Medium, + ) => ModuleClass::E, + ( + HardpointModule::EnhancedAXMultiCannon, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::E, + (HardpointModule::AXMultiCannon, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::AXMultiCannon, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::E + } + ( + HardpointModule::EnhancedAXMultiCannon, + HardpointMounting::Fixed, + HardpointSize::Large, + ) => ModuleClass::B, + ( + HardpointModule::EnhancedAXMultiCannon, + HardpointMounting::Gimballed, + HardpointSize::Large, + ) => ModuleClass::C, + ( + HardpointModule::EnhancedAXMultiCannon, + HardpointMounting::Turreted, + HardpointSize::Large, + ) => ModuleClass::D, // Guardian gauss cannons (HardpointModule::GuardianGaussCannon, _, HardpointSize::Small) => ModuleClass::D, (HardpointModule::GuardianGaussCannon, _, HardpointSize::Medium) => ModuleClass::B, // Guardian plasma chargers - (HardpointModule::GuardianPlasmaCharger, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::GuardianPlasmaCharger, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::GuardianPlasmaCharger, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::B, - (HardpointModule::GuardianPlasmaCharger, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::GuardianPlasmaCharger, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::GuardianPlasmaCharger, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + ( + HardpointModule::GuardianPlasmaCharger, + HardpointMounting::Fixed, + HardpointSize::Small, + ) => ModuleClass::D, + ( + HardpointModule::GuardianPlasmaCharger, + HardpointMounting::Turreted, + HardpointSize::Small, + ) => ModuleClass::F, + ( + HardpointModule::GuardianPlasmaCharger, + HardpointMounting::Fixed, + HardpointSize::Medium, + ) => ModuleClass::B, + ( + HardpointModule::GuardianPlasmaCharger, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::E, + ( + HardpointModule::GuardianPlasmaCharger, + HardpointMounting::Fixed, + HardpointSize::Large, + ) => ModuleClass::C, + ( + HardpointModule::GuardianPlasmaCharger, + HardpointMounting::Turreted, + HardpointSize::Large, + ) => ModuleClass::D, // Guardian shard cannons - (HardpointModule::GuardianShardCannon, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::GuardianShardCannon, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::GuardianShardCannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::A, - (HardpointModule::GuardianShardCannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::A, - (HardpointModule::GuardianShardCannon, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::GuardianShardCannon, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + ( + HardpointModule::GuardianShardCannon, + HardpointMounting::Fixed, + HardpointSize::Small, + ) => ModuleClass::D, + ( + HardpointModule::GuardianShardCannon, + HardpointMounting::Turreted, + HardpointSize::Small, + ) => ModuleClass::F, + ( + HardpointModule::GuardianShardCannon, + HardpointMounting::Fixed, + HardpointSize::Medium, + ) => ModuleClass::A, + ( + HardpointModule::GuardianShardCannon, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::A, + ( + HardpointModule::GuardianShardCannon, + HardpointMounting::Fixed, + HardpointSize::Large, + ) => ModuleClass::C, + ( + HardpointModule::GuardianShardCannon, + HardpointMounting::Turreted, + HardpointSize::Large, + ) => ModuleClass::D, // Nanite torpedoes (HardpointModule::NaniteTorpedoPylon, _, HardpointSize::Medium) => ModuleClass::I, (HardpointModule::NaniteTorpedoPylon, _, HardpointSize::Large) => ModuleClass::I, // Shock cannons - (HardpointModule::ShockCannon, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::ShockCannon, HardpointMounting::Gimballed, HardpointSize::Small) => ModuleClass::E, - (HardpointModule::ShockCannon, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::ShockCannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::ShockCannon, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::ShockCannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::ShockCannon, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::ShockCannon, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::ShockCannon, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + (HardpointModule::ShockCannon, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::D + } + (HardpointModule::ShockCannon, HardpointMounting::Gimballed, HardpointSize::Small) => { + ModuleClass::E + } + (HardpointModule::ShockCannon, HardpointMounting::Turreted, HardpointSize::Small) => { + ModuleClass::F + } + (HardpointModule::ShockCannon, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::ShockCannon, HardpointMounting::Gimballed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::ShockCannon, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::E + } + (HardpointModule::ShockCannon, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::ShockCannon, HardpointMounting::Gimballed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::ShockCannon, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::D + } // Fragment cannons (HardpointModule::FragmentCannon, _, HardpointSize::Small) => ModuleClass::E, - (HardpointModule::FragmentCannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::A, - (HardpointModule::FragmentCannon, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::FragmentCannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::D, + (HardpointModule::FragmentCannon, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::A + } + ( + HardpointModule::FragmentCannon, + HardpointMounting::Gimballed, + HardpointSize::Medium, + ) => ModuleClass::D, + ( + HardpointModule::FragmentCannon, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::D, (HardpointModule::FragmentCannon, _, HardpointSize::Large) => ModuleClass::C, (HardpointModule::PacifierFragCannon, _, _) => ModuleClass::C, @@ -289,21 +487,57 @@ impl ShipHardpointModule { (HardpointModule::MineLauncher, _, HardpointSize::Medium) => ModuleClass::I, // Mining lasers - (HardpointModule::MiningLaser, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::MiningLaser, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::AbrasionBlaster, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::D, - (HardpointModule::AbrasionBlaster, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::D, + (HardpointModule::MiningLaser, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::D + } + (HardpointModule::MiningLaser, HardpointMounting::Turreted, HardpointSize::Small) => { + ModuleClass::D + } + (HardpointModule::AbrasionBlaster, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::D + } + ( + HardpointModule::AbrasionBlaster, + HardpointMounting::Turreted, + HardpointSize::Small, + ) => ModuleClass::D, (HardpointModule::MiningLanceBeamLaser, _, _) => ModuleClass::D, - (HardpointModule::MiningLaser, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::MiningLaser, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::D, + (HardpointModule::MiningLaser, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::MiningLaser, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::D + } // Mining launchers - (HardpointModule::DisplacementMissile, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::B, - (HardpointModule::DisplacementMissile, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::B, - (HardpointModule::DisplacementMissile, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::B, - (HardpointModule::DisplacementMissile, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::B, - (HardpointModule::SeismicCharge, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::B, - (HardpointModule::SeismicCharge, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::B, + ( + HardpointModule::DisplacementMissile, + HardpointMounting::Fixed, + HardpointSize::Small, + ) => ModuleClass::B, + ( + HardpointModule::DisplacementMissile, + HardpointMounting::Turreted, + HardpointSize::Small, + ) => ModuleClass::B, + ( + HardpointModule::DisplacementMissile, + HardpointMounting::Fixed, + HardpointSize::Medium, + ) => ModuleClass::B, + ( + HardpointModule::DisplacementMissile, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::B, + (HardpointModule::SeismicCharge, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::B + } + ( + HardpointModule::SeismicCharge, + HardpointMounting::Turreted, + HardpointSize::Medium, + ) => ModuleClass::B, (HardpointModule::SubSurfaceExtractionMissile, _, _) => ModuleClass::B, // Missiles @@ -319,18 +553,36 @@ impl ShipHardpointModule { (HardpointModule::SeekerMissileRack, _, HardpointSize::Large) => ModuleClass::A, // Multi-cannons - (HardpointModule::MultiCannon, HardpointMounting::Fixed, HardpointSize::Small) => ModuleClass::F, - (HardpointModule::MultiCannon, HardpointMounting::Gimballed, HardpointSize::Small) => ModuleClass::G, - (HardpointModule::MultiCannon, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::G, + (HardpointModule::MultiCannon, HardpointMounting::Fixed, HardpointSize::Small) => { + ModuleClass::F + } + (HardpointModule::MultiCannon, HardpointMounting::Gimballed, HardpointSize::Small) => { + ModuleClass::G + } + (HardpointModule::MultiCannon, HardpointMounting::Turreted, HardpointSize::Small) => { + ModuleClass::G + } (HardpointModule::AdvancedMultiCannon, _, HardpointSize::Small) => ModuleClass::F, (HardpointModule::EnforcerCannon, _, _) => ModuleClass::F, - (HardpointModule::MultiCannon, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::MultiCannon, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::F, - (HardpointModule::MultiCannon, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::F, + (HardpointModule::MultiCannon, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::E + } + (HardpointModule::MultiCannon, HardpointMounting::Gimballed, HardpointSize::Medium) => { + ModuleClass::F + } + (HardpointModule::MultiCannon, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::F + } (HardpointModule::AdvancedMultiCannon, _, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::MultiCannon, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::MultiCannon, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::MultiCannon, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::E, + (HardpointModule::MultiCannon, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::MultiCannon, HardpointMounting::Gimballed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::MultiCannon, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::E + } (HardpointModule::MultiCannon, _, _) => ModuleClass::A, // Plasma accelerators @@ -340,15 +592,33 @@ impl ShipHardpointModule { (HardpointModule::PlasmaAccelerator, _, HardpointSize::Huge) => ModuleClass::A, // Beam lasers - (HardpointModule::BeamLaser, HardpointMounting::Fixed | HardpointMounting::Gimballed, HardpointSize::Small) => ModuleClass::E, - (HardpointModule::BeamLaser, HardpointMounting::Turreted, HardpointSize::Small) => ModuleClass::F, + ( + HardpointModule::BeamLaser, + HardpointMounting::Fixed | HardpointMounting::Gimballed, + HardpointSize::Small, + ) => ModuleClass::E, + (HardpointModule::BeamLaser, HardpointMounting::Turreted, HardpointSize::Small) => { + ModuleClass::F + } (HardpointModule::RetributorBeamLaser, _, _) => ModuleClass::E, - (HardpointModule::BeamLaser, HardpointMounting::Fixed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::BeamLaser, HardpointMounting::Gimballed, HardpointSize::Medium) => ModuleClass::D, - (HardpointModule::BeamLaser, HardpointMounting::Turreted, HardpointSize::Medium) => ModuleClass::E, - (HardpointModule::BeamLaser, HardpointMounting::Fixed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::BeamLaser, HardpointMounting::Gimballed, HardpointSize::Large) => ModuleClass::C, - (HardpointModule::BeamLaser, HardpointMounting::Turreted, HardpointSize::Large) => ModuleClass::D, + (HardpointModule::BeamLaser, HardpointMounting::Fixed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::BeamLaser, HardpointMounting::Gimballed, HardpointSize::Medium) => { + ModuleClass::D + } + (HardpointModule::BeamLaser, HardpointMounting::Turreted, HardpointSize::Medium) => { + ModuleClass::E + } + (HardpointModule::BeamLaser, HardpointMounting::Fixed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::BeamLaser, HardpointMounting::Gimballed, HardpointSize::Large) => { + ModuleClass::C + } + (HardpointModule::BeamLaser, HardpointMounting::Turreted, HardpointSize::Large) => { + ModuleClass::D + } (HardpointModule::BeamLaser, _, HardpointSize::Huge) => ModuleClass::A, // Rail guns @@ -381,7 +651,6 @@ impl ShipHardpointModule { // Point defence (HardpointModule::PointDefenceTurret, _, _) => ModuleClass::I, - _ => ModuleClass::E, } } diff --git a/src/modules/ship/models/ship_module/ship_hardpoint_module/hardpoint_size.rs b/src/modules/ship/models/ship_module/ship_hardpoint_module/hardpoint_size.rs index e95dd712..0d7d5241 100644 --- a/src/modules/ship/models/ship_module/ship_hardpoint_module/hardpoint_size.rs +++ b/src/modules/ship/models/ship_module/ship_hardpoint_module/hardpoint_size.rs @@ -89,7 +89,7 @@ impl TryFrom for HardpointSize { 2 => HardpointSize::Medium, 3 => HardpointSize::Large, 4 => HardpointSize::Huge, - _ => return Err(HardpointSizeError::UnknownHardpointSizeNumber(value)), + _ => return Err(HardpointSizeError::UnknownHardpointSizeNumber(value)), }) } } diff --git a/src/modules/ship/models/ship_module/ship_internal_module.rs b/src/modules/ship/models/ship_module/ship_internal_module.rs index 9853cafc..2bc42973 100644 --- a/src/modules/ship/models/ship_module/ship_internal_module.rs +++ b/src/modules/ship/models/ship_module/ship_internal_module.rs @@ -139,10 +139,14 @@ impl FromStr for ShipInternalModule { // if there is no match, then it will still check `special_grades` but without providing // a ModuleGrade input. If none of these things return a Some value, then the class will // default to `ModuleClass::E`. - let class = captures.get(5) - .map(|capture| capture.as_str() - .parse::() - .map_err(ShipInternalModuleError::FailedToParseClassNumber)) + let class = captures + .get(5) + .map(|capture| { + capture + .as_str() + .parse::() + .map_err(ShipInternalModuleError::FailedToParseClassNumber) + }) .transpose()? .map(|grade_nr| grade_nr.try_into()) .transpose()? diff --git a/src/modules/ship/models/ship_module/ship_internal_module/armor_module.rs b/src/modules/ship/models/ship_module/ship_internal_module/armor_module.rs index 57beac52..509ab300 100644 --- a/src/modules/ship/models/ship_module/ship_internal_module/armor_module.rs +++ b/src/modules/ship/models/ship_module/ship_internal_module/armor_module.rs @@ -137,10 +137,13 @@ mod tests { grade: ArmorGrade::LightweightAlloy, }, ), - ("SideWinder_Armour_Mirrored", ArmorModule { - ship: ShipType::SideWinder, - grade: ArmorGrade::MirroredSurfaceComposite, - }) + ( + "SideWinder_Armour_Mirrored", + ArmorModule { + ship: ShipType::SideWinder, + grade: ArmorGrade::MirroredSurfaceComposite, + }, + ), ]; for (case, expected) in test_cases { diff --git a/src/modules/state/macros.rs b/src/modules/state/macros.rs index eccd2c60..43ce6a01 100644 --- a/src/modules/state/macros.rs +++ b/src/modules/state/macros.rs @@ -1,14 +1,12 @@ #[macro_export] macro_rules! try_feed { - ($i:expr) => { - { - let result = $i; + ($i:expr) => {{ + let result = $i; - if let FeedResult::Later = result { - return result; - } - - result + if let FeedResult::Later = result { + return result; } - }; + + result + }}; } diff --git a/src/modules/state/mod.rs b/src/modules/state/mod.rs index 1d144784..968654c4 100644 --- a/src/modules/state/mod.rs +++ b/src/modules/state/mod.rs @@ -21,15 +21,14 @@ //! } //! ``` -pub use models::commander_state::CommanderState; +pub use models::carrier_state::CarrierState; pub use models::commander_state::current_organic::CurrentOrganic; +pub use models::commander_state::CommanderState; pub use models::game_state::GameState; -pub use models::system_state::SystemState; -pub use models::planet_state::PlanetState; pub use models::materials_state::MaterialsState; -pub use models::carrier_state::CarrierState; pub use models::planet_state::planet_species_entry::PlanetSpeciesEntry; +pub use models::planet_state::PlanetState; +pub use models::system_state::SystemState; -mod models; mod macros; - +mod models; diff --git a/src/modules/state/models.rs b/src/modules/state/models.rs index 04ec6e90..fc23cfa6 100644 --- a/src/modules/state/models.rs +++ b/src/modules/state/models.rs @@ -1,8 +1,8 @@ +pub mod carrier_state; pub mod commander_state; pub mod feed_result; pub mod game_state; -pub mod planet_state; -pub mod system_state; pub mod materials_state; -pub mod carrier_state; pub mod mission_state; +pub mod planet_state; +pub mod system_state; diff --git a/src/modules/state/models/carrier_state.rs b/src/modules/state/models/carrier_state.rs index 97e7e83e..87f5ee2e 100644 --- a/src/modules/state/models/carrier_state.rs +++ b/src/modules/state/models/carrier_state.rs @@ -1,10 +1,10 @@ -use chrono::{DateTime, Utc}; -use serde::Serialize; +use crate::logs::carrier_jump_request_event::CarrierJumpRequestEvent; use crate::logs::carrier_stats_event::CarrierStatsEvent; use crate::logs::{LogEvent, LogEventContent}; -use crate::logs::carrier_jump_request_event::CarrierJumpRequestEvent; use crate::small::SmallSystemInfo; use crate::state::models::feed_result::FeedResult; +use chrono::{DateTime, Utc}; +use serde::Serialize; #[derive(Serialize)] pub struct CarrierState { @@ -20,23 +20,23 @@ impl CarrierState { match &log_event.content { LogEventContent::CarrierStats(stats) => { self.stats = stats.clone(); - }, + } LogEventContent::CarrierDecommission(decommission) => { self.scrap_time = Some(decommission.scrap_time.clone()); - }, + } LogEventContent::CarrierCancelDecommission(_) => { self.scrap_time = None; - }, + } LogEventContent::CarrierJumpRequest(request) => { self.scheduled_jump = Some(request.clone()); - }, + } LogEventContent::CarrierBuy(_) => { self.update_location(&log_event); - }, + } LogEventContent::CarrierJump(_) => { self.update_location(&log_event); - }, - _ => {}, + } + _ => {} } FeedResult::Accepted @@ -45,8 +45,11 @@ impl CarrierState { /// Returns the scheduled jump. This is a bit more reliable than just checking if /// `scheduled_jump` is Some value as this also checks the departure time. There could be /// instances where the scheduled jump might not be unset for example when not logged in. - pub fn get_scheduled_jump(&self, target_time: &DateTime) -> Option { - let Some(request) = &self.scheduled_jump else { + pub fn get_scheduled_jump( + &self, + target_time: &DateTime, + ) -> Option { + let Some(request) = &self.scheduled_jump else { return None; }; diff --git a/src/modules/state/models/commander_state.rs b/src/modules/state/models/commander_state.rs index d0c07153..961e9630 100644 --- a/src/modules/state/models/commander_state.rs +++ b/src/modules/state/models/commander_state.rs @@ -1,23 +1,23 @@ use std::collections::HashMap; -use serde::Serialize; use crate::exploration::calculate_estimated_worth; +use serde::Serialize; -use crate::logs::{LogEvent, LogEventContent}; use crate::logs::commander_event::CommanderEvent; -use crate::logs::scan_organic_event::ScanOrganicEventScanType; -use crate::modules::civilization::LocationInfo; -use current_organic::CurrentOrganic; use crate::logs::rank_event::RankEvent; use crate::logs::reputation_event::ReputationEvent; -use crate::logs::statistics_event::StatisticsEvent; use crate::logs::scan_event::ScanEvent; +use crate::logs::scan_organic_event::ScanOrganicEventScanType; +use crate::logs::statistics_event::StatisticsEvent; +use crate::logs::{LogEvent, LogEventContent}; +use crate::modules::civilization::LocationInfo; use crate::state::models::carrier_state::CarrierState; use crate::state::models::feed_result::FeedResult; use crate::state::models::materials_state::MaterialsState; use crate::state::models::mission_state::MissionState; use crate::state::SystemState; use crate::try_feed; +use current_organic::CurrentOrganic; pub mod current_organic; @@ -43,35 +43,31 @@ impl CommanderState { match &log_event.content { LogEventContent::Scan(event) => { self.current_exploration_data.push(event.clone()); - }, + } LogEventContent::Died(event) => { self.current_exploration_data.clear(); - }, + } LogEventContent::Rank(ranks) => { self.rank = Some(ranks.clone()); } LogEventContent::Reputation(reputation) => { self.reputation = Some(reputation.clone()); - }, + } LogEventContent::Statistics(statistics) => { self.statistics = Some(statistics.clone()); } LogEventContent::MultiSellExplorationData(event) => { for system in &event.discovered { self.current_exploration_data - .retain(|item| { - item.star_system != system.system_name - }); + .retain(|item| item.star_system != system.system_name); } - }, + } LogEventContent::SellExplorationData(event) => { for system in &event.systems { self.current_exploration_data - .retain(|item| { - &item.star_system != system - }); + .retain(|item| &item.star_system != system); } - }, + } LogEventContent::Location(location) => { self.current_system = Some(location.location_info.system_address); @@ -96,38 +92,45 @@ impl CommanderState { body_id: scan_organic.body, species: scan_organic.species.clone(), }); - }, + } ScanOrganicEventScanType::Analyse => { self.current_organic_process = Some(ScanOrganicEventScanType::Analyse); - }, + } ScanOrganicEventScanType::Log => { self.current_organic = None; - }, + } }, LogEventContent::Materials(event) => { for material in &event.raw { - self.material_state.set_material_count(material.name.clone(), material.count); + self.material_state + .set_material_count(material.name.clone(), material.count); } for material in &event.encoded { - self.material_state.set_material_count(material.name.clone(), material.count); + self.material_state + .set_material_count(material.name.clone(), material.count); } for material in &event.manufactured { - self.material_state.set_material_count(material.name.clone(), material.count); + self.material_state + .set_material_count(material.name.clone(), material.count); } } LogEventContent::MaterialCollected(event) => { - self.material_state.add_material_count(event.name.clone(), event.count); - }, + self.material_state + .add_material_count(event.name.clone(), event.count); + } LogEventContent::MaterialDiscarded(event) => { - self.material_state.remove_material_count(event.name.clone(), event.count); - }, + self.material_state + .remove_material_count(event.name.clone(), event.count); + } LogEventContent::MaterialTrade(event) => { - self.material_state.remove_material_count(event.paid.material.clone(), event.paid.quantity); - self.material_state.add_material_count(event.received.material.clone(), event.received.quantity); - }, + self.material_state + .remove_material_count(event.paid.material.clone(), event.paid.quantity); + self.material_state + .add_material_count(event.received.material.clone(), event.received.quantity); + } LogEventContent::CarrierStats(stats) => { if self.carrier_state.is_none() { @@ -136,7 +139,7 @@ impl CommanderState { self.carrier_state = Some(state); } - }, + } LogEventContent::CarrierJump(_) | LogEventContent::CarrierBuy(_) @@ -152,17 +155,18 @@ impl CommanderState { | LogEventContent::CarrierTradeOrder(_) | LogEventContent::CarrierDockingPermission(_) | LogEventContent::CarrierNameChange(_) - | LogEventContent::CarrierJumpCancelled(_) => { - match &mut self.carrier_state { - Some(state) => { try_feed!(state.feed_log_event(&log_event)); }, - None => return FeedResult::Later, + | LogEventContent::CarrierJumpCancelled(_) => match &mut self.carrier_state { + Some(state) => { + try_feed!(state.feed_log_event(&log_event)); } + None => return FeedResult::Later, }, _ => {} } - let carrier_has_been_scrapped = self.carrier_state + let carrier_has_been_scrapped = self + .carrier_state .as_ref() .is_some_and(|state| state.has_been_scrapped(&log_event.timestamp)); diff --git a/src/modules/state/models/game_state.rs b/src/modules/state/models/game_state.rs index 18fc58ee..4acc1b5d 100644 --- a/src/modules/state/models/game_state.rs +++ b/src/modules/state/models/game_state.rs @@ -3,8 +3,8 @@ use std::mem; use serde::Serialize; -use crate::logs::{LogEvent, LogEventContent}; use crate::logs::file_header_event::FileHeaderEvent; +use crate::logs::{LogEvent, LogEventContent}; use crate::state::models::commander_state::CommanderState; use crate::state::models::feed_result::FeedResult; @@ -118,9 +118,9 @@ impl Default for GameState { #[cfg(test)] mod tests { - use std::collections::HashSet; use crate::logs::blocking::LogDirReader; use crate::state::GameState; + use std::collections::HashSet; use std::env::current_dir; use std::time::Instant; diff --git a/src/modules/state/models/materials_state.rs b/src/modules/state/models/materials_state.rs index 2be24a4e..c96eacdf 100644 --- a/src/modules/state/models/materials_state.rs +++ b/src/modules/state/models/materials_state.rs @@ -1,6 +1,6 @@ -use std::collections::HashMap; -use serde::Serialize; use crate::materials::Material; +use serde::Serialize; +use std::collections::HashMap; #[derive(Serialize, Default)] pub struct MaterialsState { @@ -20,7 +20,9 @@ impl MaterialsState { pub fn add_material_count(&mut self, material: Material, count: u16) { self.materials .entry(material.clone()) - .and_modify(|current| *current = (*current + count).min(material.grade().grade_storage_limit())) + .and_modify(|current| { + *current = (*current + count).min(material.grade().grade_storage_limit()) + }) .or_insert(count.min(material.grade().grade_storage_limit())); } diff --git a/src/modules/state/models/mission_state.rs b/src/modules/state/models/mission_state.rs index bbc99b9d..da1a8049 100644 --- a/src/modules/state/models/mission_state.rs +++ b/src/modules/state/models/mission_state.rs @@ -1,5 +1,5 @@ -use std::collections::HashMap; use serde::Serialize; +use std::collections::HashMap; #[derive(Serialize)] pub struct MissionState { @@ -7,9 +7,7 @@ pub struct MissionState { } #[derive(Serialize)] -pub struct Mission { - -} +pub struct Mission {} impl Default for MissionState { fn default() -> Self { diff --git a/src/modules/state/models/planet_state.rs b/src/modules/state/models/planet_state.rs index df03e72f..549e768d 100644 --- a/src/modules/state/models/planet_state.rs +++ b/src/modules/state/models/planet_state.rs @@ -10,12 +10,10 @@ use thiserror::Error; use crate::logs::saa_scan_complete_event::SAAScanCompleteEvent; use crate::logs::saa_signals_found_event::SAASignalsFoundEventSignal; -use crate::logs::scan_event::{ - ScanEvent, ScanEventKind, ScanEventPlanet, -}; +use crate::logs::scan_event::{ScanEvent, ScanEventKind, ScanEventPlanet}; +use crate::logs::scan_organic_event::ScanOrganicEventScanType; use crate::logs::touchdown_event::TouchdownEvent; use crate::logs::{LogEvent, LogEventContent}; -use crate::logs::scan_organic_event::ScanOrganicEventScanType; use crate::modules::exobiology::{Genus, Species}; use crate::state::models::feed_result::FeedResult; use crate::state::models::planet_state::planet_species_entry::{PlanetSpeciesEntry, WillSpawn}; @@ -69,11 +67,13 @@ impl PlanetState { LogEventContent::SAASignalsFound(signals) => { self.saa_signals.clone_from(&signals.signals); - self.saa_genuses = Some(signals - .genuses - .iter() - .map(|signal| signal.genus.clone()) - .collect()); + self.saa_genuses = Some( + signals + .genuses + .iter() + .map(|signal| signal.genus.clone()) + .collect(), + ); } LogEventContent::FSSBodySignals(body_signals) => { let mut signal_counts = SignalCounts { @@ -87,14 +87,28 @@ impl PlanetState { for signal in &body_signals.signals { match &signal.kind { - PlanetarySignalType::Human => { signal_counts.human_signal_count += 1; } - PlanetarySignalType::Biological => { signal_counts.biological_signal_count += 1; } - PlanetarySignalType::Geological => { signal_counts.geological_signal_count += 1; } - PlanetarySignalType::Thargoid => { signal_counts.thargoid_signal_count += 1; } - PlanetarySignalType::Guardian => { signal_counts.guardian_signal_count += 1; } - PlanetarySignalType::Other => { signal_counts.other_signal_count += 1; } - PlanetarySignalType::Commodity(commodity) => { self.commodity_signals.push(commodity.clone()); } - _ => {}, + PlanetarySignalType::Human => { + signal_counts.human_signal_count += 1; + } + PlanetarySignalType::Biological => { + signal_counts.biological_signal_count += 1; + } + PlanetarySignalType::Geological => { + signal_counts.geological_signal_count += 1; + } + PlanetarySignalType::Thargoid => { + signal_counts.thargoid_signal_count += 1; + } + PlanetarySignalType::Guardian => { + signal_counts.guardian_signal_count += 1; + } + PlanetarySignalType::Other => { + signal_counts.other_signal_count += 1; + } + PlanetarySignalType::Commodity(commodity) => { + self.commodity_signals.push(commodity.clone()); + } + _ => {} } } @@ -104,24 +118,22 @@ impl PlanetState { if touchdown.on_planet { self.touchdowns.push(touchdown.clone()); } - }, + } LogEventContent::ScanOrganic(scanned_organic) => { self.scanned_species.insert(scanned_organic.species.clone()); if let ScanOrganicEventScanType::Log = scanned_organic.scan_type { self.logged_species.insert(scanned_organic.species.clone()); } - }, - LogEventContent::CodexEntry(codex_entry) => { - match &codex_entry.name { - CodexEntry::Species(species) => { - self.scanned_species.insert(species.clone()); - }, - CodexEntry::Variant(variant) => { - self.scanned_species.insert(variant.species.clone()); - }, - _ => {}, + } + LogEventContent::CodexEntry(codex_entry) => match &codex_entry.name { + CodexEntry::Species(species) => { + self.scanned_species.insert(species.clone()); + } + CodexEntry::Variant(variant) => { + self.scanned_species.insert(variant.species.clone()); } + _ => {} }, _ => {} } @@ -190,17 +202,24 @@ impl PlanetState { // If the possible number of species is the same as the number of biological // signals it counts all of them as yes. - _ if self.signal_counts - .as_ref() - .is_some_and(|signals| signals.biological_signal_count == number_of_species) => WillSpawn::Yes, + _ if self.signal_counts.as_ref().is_some_and(|signals| { + signals.biological_signal_count == number_of_species + }) => + { + WillSpawn::Yes + } // If the current species has not been scanned yet (checked by the first if // statement), but there already is another species of the same genus, then // this species does not have a chance to spawn. - _ if self.scanned_species + _ if self + .scanned_species .iter() .find(|scanned| scanned.genus() == species.genus()) - .is_some() => WillSpawn::No, + .is_some() => + { + WillSpawn::No + } // If the planet has not been scanned yet and the genuses are still unknown, it // will count any species that hasn't already been flagged as a maybe. @@ -209,9 +228,13 @@ impl PlanetState { // If the planet has been scanned, but the species' genus does not appear in the // list of scanned genuses that can spawn, then the current species will not // spawn. - _ if self.saa_genuses + _ if self + .saa_genuses .as_ref() - .is_some_and(|genuses| !genuses.contains(&species.genus())) => WillSpawn::No, + .is_some_and(|genuses| !genuses.contains(&species.genus())) => + { + WillSpawn::No + } // If the species is not handled by any of the special cases above, then the // species is still under consideration. @@ -249,14 +272,9 @@ impl PlanetState { maybe_values.sort(); - let known_total: u64 = maybe_values - .iter() - .sum(); + let known_total: u64 = maybe_values.iter().sum(); - let maybe_total: u64 = maybe_values - .iter() - .take(remaining_unknowns) - .sum(); + let maybe_total: u64 = maybe_values.iter().take(remaining_unknowns).sum(); known_total + maybe_total } diff --git a/src/modules/state/models/planet_state/planet_species_entry.rs b/src/modules/state/models/planet_state/planet_species_entry.rs index 79871a48..09748c97 100644 --- a/src/modules/state/models/planet_state/planet_species_entry.rs +++ b/src/modules/state/models/planet_state/planet_species_entry.rs @@ -1,5 +1,5 @@ -use serde::Serialize; use crate::exobiology::Species; +use serde::Serialize; #[derive(Debug, Serialize)] pub struct PlanetSpeciesEntry { diff --git a/src/modules/status/blocking.rs b/src/modules/status/blocking.rs index 44257d8d..98df36f3 100644 --- a/src/modules/status/blocking.rs +++ b/src/modules/status/blocking.rs @@ -24,15 +24,13 @@ pub enum ReadStatusFileError { #[cfg(test)] mod tests { - use std::fs::read_to_string; use crate::status::Status; use crate::tests::test_root; + use std::fs::read_to_string; #[test] fn none_status_file_is_parsed_correctly() { - let file = test_root() - .join("json") - .join("StatusNone.json"); + let file = test_root().join("json").join("StatusNone.json"); let string_contents = read_to_string(&file).unwrap(); @@ -45,9 +43,7 @@ mod tests { #[test] fn supercruise_status_file_is_parsed_correctly() { - let file = test_root() - .join("json") - .join("StatusSupercruise.json"); + let file = test_root().join("json").join("StatusSupercruise.json"); let string_contents = read_to_string(&file).unwrap(); @@ -55,9 +51,7 @@ mod tests { dbg!(&status); - let status = status.unwrap() - .contents - .unwrap(); + let status = status.unwrap().contents.unwrap(); assert!(!status.flags.landed()); assert!(!status.flags.landing_gear_down()); @@ -66,18 +60,14 @@ mod tests { #[test] fn landed_status_file_is_parsed_correctly() { - let file = test_root() - .join("json") - .join("StatusLanded.json"); + let file = test_root().join("json").join("StatusLanded.json"); let string_contents = read_to_string(&file).unwrap(); let status = serde_json::from_str::(&string_contents); dbg!(&status); - let status = status.unwrap() - .contents - .unwrap(); + let status = status.unwrap().contents.unwrap(); assert!(!status.flags.in_srv()); assert!(status.flags.landed()); @@ -88,18 +78,14 @@ mod tests { #[test] fn srv_status_file_is_parsed_correctly() { - let file = test_root() - .join("json") - .join("StatusSRV.json"); + let file = test_root().join("json").join("StatusSRV.json"); let string_contents = read_to_string(&file).unwrap(); let status = serde_json::from_str::(&string_contents); dbg!(&status); - let status = status.unwrap() - .contents - .unwrap(); + let status = status.unwrap().contents.unwrap(); assert!(status.flags.in_srv()); assert!(status.planet_status.is_some()); @@ -108,18 +94,14 @@ mod tests { #[test] fn on_foot_status_file_is_parsed_correctly() { - let file = test_root() - .join("json") - .join("StatusOnFoot.json"); + let file = test_root().join("json").join("StatusOnFoot.json"); let string_contents = read_to_string(&file).unwrap(); let status = serde_json::from_str::(&string_contents); dbg!(&status); - let status = status.unwrap() - .contents - .unwrap(); + let status = status.unwrap().contents.unwrap(); assert!(status.flags2.on_foot()); assert!(status.planet_status.is_some()); diff --git a/src/modules/status/mod.rs b/src/modules/status/mod.rs index 80a0c1bd..bb9e81d1 100644 --- a/src/modules/status/mod.rs +++ b/src/modules/status/mod.rs @@ -5,11 +5,11 @@ pub use models::fuel_status::FuelStatus; pub use models::gui_focus::GuiFocus; pub use models::legal_status::LegalStatus; pub use models::planet_status::PlanetStatus; +pub use models::status::OnFootStatus; +pub use models::status::ShipStatus; pub use models::status::Status; pub use models::status::StatusContents; pub use models::status::StatusKind; -pub use models::status::ShipStatus; -pub use models::status::OnFootStatus; mod models; From 2708fa20b6157c0ced6a8ea585f0fd89371ee844 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 22:36:45 +0200 Subject: [PATCH 06/17] =?UTF-8?q?=F0=9F=8E=A8=20Run=20cargo=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib.rs | 2 +- src/modules/ship/models/ship_module.rs | 23 +++++++++++------------ src/modules/state/models/carrier_state.rs | 1 - 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dabf4765..5b576fa2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,10 +33,10 @@ pub use modules::modules_info; pub use modules::nav_route; pub use modules::odyssey; pub use modules::outfitting; +pub use modules::partials; pub use modules::ship; pub use modules::ship_locker; pub use modules::shipyard; -pub use modules::partials; pub use modules::state; pub use modules::station; pub use modules::status; diff --git a/src/modules/ship/models/ship_module.rs b/src/modules/ship/models/ship_module.rs index 240bb86b..48772e4e 100644 --- a/src/modules/ship/models/ship_module.rs +++ b/src/modules/ship/models/ship_module.rs @@ -288,18 +288,17 @@ mod tests { assert_eq!(hardpoint.class, class); assert_eq!(hardpoint.size, hardpoint_size); } - _ => {} - // ShipModule::Cockpit(_) => {} - // ShipModule::PaintJob(_) => {} - // ShipModule::Decal(_) => {} - // ShipModule::VoicePack(_) => {} - // ShipModule::Nameplate(_) => {} - // ShipModule::EngineColor(_) => {} - // ShipModule::WeaponColor(_) => {} - // ShipModule::ShipKitModule(_) => {} - // ShipModule::Bobble(_) => {} - // ShipModule::StringLights(_) => {} - // ShipModule::Unknown(_) => {} + _ => {} // ShipModule::Cockpit(_) => {} + // ShipModule::PaintJob(_) => {} + // ShipModule::Decal(_) => {} + // ShipModule::VoicePack(_) => {} + // ShipModule::Nameplate(_) => {} + // ShipModule::EngineColor(_) => {} + // ShipModule::WeaponColor(_) => {} + // ShipModule::ShipKitModule(_) => {} + // ShipModule::Bobble(_) => {} + // ShipModule::StringLights(_) => {} + // ShipModule::Unknown(_) => {} } } } diff --git a/src/modules/state/models/carrier_state.rs b/src/modules/state/models/carrier_state.rs index 6435fbd3..5d998526 100644 --- a/src/modules/state/models/carrier_state.rs +++ b/src/modules/state/models/carrier_state.rs @@ -1,7 +1,6 @@ use crate::logs::carrier_jump_request_event::CarrierJumpRequestEvent; use crate::logs::carrier_stats_event::CarrierStatsEvent; use crate::logs::{LogEvent, LogEventContent}; -use crate::logs::carrier_jump_request_event::CarrierJumpRequestEvent; use crate::partials::PartialSystemInfo; use crate::state::models::feed_result::FeedResult; use chrono::{DateTime, Utc}; From 215ec278ad3847f1738bb03ebef417dc7cf16a58 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 22:42:27 +0200 Subject: [PATCH 07/17] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Run=20clippy=20--fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/civilization/models/crime.rs | 2 +- src/modules/civilization/models/engineer.rs | 2 +- src/modules/exobiology/models/spawn_source.rs | 8 ++------ src/modules/exobiology/models/species.rs | 6 +++--- src/modules/exobiology/models/variant.rs | 4 ++-- .../content/log_event_content/engineer_progress_event.rs | 2 +- src/modules/ship/models/blueprint.rs | 2 +- src/modules/ship/models/ship_module.rs | 4 ++-- .../ship/models/ship_module/ship_internal_module.rs | 7 +++---- src/modules/state/models/carrier_state.rs | 6 +++--- src/modules/state/models/commander_state.rs | 6 +++--- src/modules/state/models/mission_state.rs | 8 +------- src/modules/state/models/planet_state.rs | 5 ++--- src/modules/state/models/system_state.rs | 6 +++--- 14 files changed, 28 insertions(+), 40 deletions(-) diff --git a/src/modules/civilization/models/crime.rs b/src/modules/civilization/models/crime.rs index 1c1c8a9b..6d9315d9 100644 --- a/src/modules/civilization/models/crime.rs +++ b/src/modules/civilization/models/crime.rs @@ -105,7 +105,7 @@ mod tests { #[test] fn all_crimes_are_parsed_correctly() { let content = include_str!("zz_crimes.txt"); - let mut lines = content.lines(); + let lines = content.lines(); for line in lines { if line.starts_with('#') { diff --git a/src/modules/civilization/models/engineer.rs b/src/modules/civilization/models/engineer.rs index 97e2b214..5b76ac89 100644 --- a/src/modules/civilization/models/engineer.rs +++ b/src/modules/civilization/models/engineer.rs @@ -1,4 +1,4 @@ -use crate::{from_str_deserialize_impl, try_from_deserialize_impl}; +use crate::try_from_deserialize_impl; use serde::Serialize; use std::fmt::{Display, Formatter}; use thiserror::Error; diff --git a/src/modules/exobiology/models/spawn_source.rs b/src/modules/exobiology/models/spawn_source.rs index a15014da..07547cb4 100644 --- a/src/modules/exobiology/models/spawn_source.rs +++ b/src/modules/exobiology/models/spawn_source.rs @@ -2,10 +2,7 @@ pub mod spawn_source_star; pub mod target_planet; pub mod target_system; -use std::cmp::min; -use std::collections::HashSet; -use serde::Serialize; use strum::IntoEnumIterator; use crate::exobiology::models::spawn_source::spawn_source_star::SpawnSourceStar; @@ -13,8 +10,7 @@ use crate::exobiology::models::spawn_source::target_planet::TargetPlanet; use crate::exobiology::models::spawn_source::target_system::TargetSystem; use crate::exobiology::{SpawnCondition, Species}; use crate::galaxy::{ - Atmosphere, AtmosphereDensity, AtmosphereType, Nebula, PlanetClass, PlanetComposition, - StarClass, StarLuminosity, Volcanism, VolcanismType, + AtmosphereDensity, AtmosphereType, Nebula, VolcanismType, }; use crate::logs::scan_event::ScanEventParent; @@ -47,7 +43,7 @@ impl<'a> SpawnSource<'a> { &self.target_planet.surface_temperature >= min_temp } SpawnCondition::MaxMeanTemperature(max_temp) => { - &self.target_planet.surface_temperature <= &max_temp + &self.target_planet.surface_temperature <= max_temp } SpawnCondition::NoAtmosphere => { self.target_planet.atmosphere.kind == AtmosphereType::None diff --git a/src/modules/exobiology/models/species.rs b/src/modules/exobiology/models/species.rs index 33de23e6..1d5f5b56 100644 --- a/src/modules/exobiology/models/species.rs +++ b/src/modules/exobiology/models/species.rs @@ -634,7 +634,7 @@ impl Species { Species::BacteriumVesicula => 1_000_000, Species::BacteriumAlcyoneum => 1_658_500, Species::BacteriumTela => 1_949_000, - Species::BacteriumInformem => 8_418_00, + Species::BacteriumInformem => 841_800, Species::BacteriumVolu => 7_774_700, Species::BacteriumBullaris => 1_152_500, Species::BacteriumOmentum => 4_689_800, @@ -697,10 +697,10 @@ impl Species { Species::ReceptaUmbrux => 12_934_900, Species::ReceptaDeltahedronix => 16_202_800, - Species::ReceptaConditivus => 14_3133_700, + Species::ReceptaConditivus => 143_133_700, Species::StratumExcutitus => 2_448_900, - Species::StratumPaleas => 1_362_00, + Species::StratumPaleas => 136_200, Species::StratumLaminamus => 2_788_300, Species::StratumAraneamus => 2_448_900, Species::StratumLimaxus => 1_362_000, diff --git a/src/modules/exobiology/models/variant.rs b/src/modules/exobiology/models/variant.rs index 8962f944..855ead55 100644 --- a/src/modules/exobiology/models/variant.rs +++ b/src/modules/exobiology/models/variant.rs @@ -142,7 +142,7 @@ mod tests { #[test] fn variants_test_file_entries_all_parse() { let content = include_str!("zz_variants.txt"); - let mut lines = content.lines(); + let lines = content.lines(); for line in lines { if line.starts_with('#') { @@ -160,7 +160,7 @@ mod tests { #[test] fn variants_datadump_test_file_entries_all_parse() { let content = include_str!("zz_datamined_variants.txt"); - let mut lines = content.lines(); + let lines = content.lines(); for line in lines { if line.starts_with('#') { diff --git a/src/modules/logs/content/log_event_content/engineer_progress_event.rs b/src/modules/logs/content/log_event_content/engineer_progress_event.rs index d20a0ca4..17c743aa 100644 --- a/src/modules/logs/content/log_event_content/engineer_progress_event.rs +++ b/src/modules/logs/content/log_event_content/engineer_progress_event.rs @@ -1,4 +1,4 @@ -use crate::civilization::{Engineer, EngineerError}; +use crate::civilization::Engineer; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] diff --git a/src/modules/ship/models/blueprint.rs b/src/modules/ship/models/blueprint.rs index 0594bc98..f2651fb0 100644 --- a/src/modules/ship/models/blueprint.rs +++ b/src/modules/ship/models/blueprint.rs @@ -285,7 +285,7 @@ mod tests { #[test] fn all_blueprint_test_cases_are_parsed_correctly() { let contents = include_str!("zz_blueprint_test_cases.txt"); - let mut lines = contents.lines(); + let lines = contents.lines(); for line in lines { dbg!(&line); diff --git a/src/modules/ship/models/ship_module.rs b/src/modules/ship/models/ship_module.rs index 48772e4e..9f122f40 100644 --- a/src/modules/ship/models/ship_module.rs +++ b/src/modules/ship/models/ship_module.rs @@ -201,7 +201,7 @@ mod tests { use serde_json::Value; use crate::modules::ship::ShipModule; - use crate::ship::{HardpointMounting, HardpointSize, ModuleClass, ShipInternalModule}; + use crate::ship::{HardpointMounting, HardpointSize, ModuleClass}; #[test] fn modules_are_parsed_correctly() { @@ -227,7 +227,7 @@ mod tests { #[test] fn all_eddn_test_cases_are_parsed_correctly() { let content = include_str!("zz_ship_modules.txt"); - let mut lines = content.lines(); + let lines = content.lines(); for line in lines { if line.starts_with('#') { diff --git a/src/modules/ship/models/ship_module/ship_internal_module.rs b/src/modules/ship/models/ship_module/ship_internal_module.rs index 2bc42973..774a8b54 100644 --- a/src/modules/ship/models/ship_module/ship_internal_module.rs +++ b/src/modules/ship/models/ship_module/ship_internal_module.rs @@ -8,7 +8,6 @@ use serde::Serialize; use thiserror::Error; use crate::from_str_deserialize_impl; -use crate::galaxy::StarClass::Y; use crate::modules::ship::{ ArmorModule, ArmorModuleError, InternalModule, InternalType, ModuleClass, ModuleClassError, }; @@ -150,9 +149,9 @@ impl FromStr for ShipInternalModule { .transpose()? .map(|grade_nr| grade_nr.try_into()) .transpose()? - .and_then(|class| match module.special_grades(size, Some(&class)) { - Some(replacement) => Some(replacement), - None => Some(class), + .map(|class| match module.special_grades(size, Some(&class)) { + Some(replacement) => replacement, + None => class, }) .or_else(|| module.special_grades(size, None)) .unwrap_or(ModuleClass::E); diff --git a/src/modules/state/models/carrier_state.rs b/src/modules/state/models/carrier_state.rs index 5d998526..cb15245f 100644 --- a/src/modules/state/models/carrier_state.rs +++ b/src/modules/state/models/carrier_state.rs @@ -22,7 +22,7 @@ impl CarrierState { self.stats = stats.clone(); } LogEventContent::CarrierDecommission(decommission) => { - self.scrap_time = Some(decommission.scrap_time.clone()); + self.scrap_time = Some(decommission.scrap_time); } LogEventContent::CarrierCancelDecommission(_) => { self.scrap_time = None; @@ -31,10 +31,10 @@ impl CarrierState { self.scheduled_jump = Some(request.clone()); } LogEventContent::CarrierBuy(_) => { - self.update_location(&log_event); + self.update_location(log_event); } LogEventContent::CarrierJump(_) => { - self.update_location(&log_event); + self.update_location(log_event); } _ => {} } diff --git a/src/modules/state/models/commander_state.rs b/src/modules/state/models/commander_state.rs index 961e9630..499ddafa 100644 --- a/src/modules/state/models/commander_state.rs +++ b/src/modules/state/models/commander_state.rs @@ -135,7 +135,7 @@ impl CommanderState { LogEventContent::CarrierStats(stats) => { if self.carrier_state.is_none() { let mut state: CarrierState = stats.clone().into(); - state.feed_log_event(&log_event); + state.feed_log_event(log_event); self.carrier_state = Some(state); } @@ -157,7 +157,7 @@ impl CommanderState { | LogEventContent::CarrierNameChange(_) | LogEventContent::CarrierJumpCancelled(_) => match &mut self.carrier_state { Some(state) => { - try_feed!(state.feed_log_event(&log_event)); + try_feed!(state.feed_log_event(log_event)); } None => return FeedResult::Later, }, @@ -206,7 +206,7 @@ impl CommanderState { pub fn current_exploration_worth(&self) -> u64 { self.current_exploration_data .iter() - .map(|item| calculate_estimated_worth(item)) + .map(calculate_estimated_worth) .sum() } } diff --git a/src/modules/state/models/mission_state.rs b/src/modules/state/models/mission_state.rs index da1a8049..61b89e95 100644 --- a/src/modules/state/models/mission_state.rs +++ b/src/modules/state/models/mission_state.rs @@ -2,6 +2,7 @@ use serde::Serialize; use std::collections::HashMap; #[derive(Serialize)] +#[derive(Default)] pub struct MissionState { pub missions: HashMap, } @@ -9,10 +10,3 @@ pub struct MissionState { #[derive(Serialize)] pub struct Mission {} -impl Default for MissionState { - fn default() -> Self { - MissionState { - missions: HashMap::new(), - } - } -} diff --git a/src/modules/state/models/planet_state.rs b/src/modules/state/models/planet_state.rs index 549e768d..896d2921 100644 --- a/src/modules/state/models/planet_state.rs +++ b/src/modules/state/models/planet_state.rs @@ -1,7 +1,7 @@ pub mod planet_species_entry; mod signal_counts; -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; use crate::exobiology::{SpawnSource, TargetPlanet, TargetSystem}; use crate::exploration::{CodexEntry, PlanetarySignalType}; @@ -215,8 +215,7 @@ impl PlanetState { _ if self .scanned_species .iter() - .find(|scanned| scanned.genus() == species.genus()) - .is_some() => + .any(|scanned| scanned.genus() == species.genus()) => { WillSpawn::No } diff --git a/src/modules/state/models/system_state.rs b/src/modules/state/models/system_state.rs index 7c98f2ee..c341c43f 100644 --- a/src/modules/state/models/system_state.rs +++ b/src/modules/state/models/system_state.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use crate::exobiology::{SpawnSourceStar, Species, TargetSystem}; +use crate::exobiology::{SpawnSourceStar, TargetSystem}; use chrono::{DateTime, Utc}; use serde::Serialize; @@ -124,10 +124,10 @@ impl From<&LocationInfo> for SystemState { #[cfg(test)] mod tests { - use std::collections::{HashMap, HashSet}; + use std::env::current_dir; - use crate::exobiology::{SpawnSource, Species}; + use crate::exobiology::SpawnSource; use crate::logs::blocking::LogDirReader; use crate::state::GameState; From ccf983188eda8ad48df84ffa2d1c0006457567f2 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 22:49:20 +0200 Subject: [PATCH 08/17] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Fix=20manual=20clipp?= =?UTF-8?q?y=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../asynchronous/live_journal_dir_reader.rs | 8 +++---- .../blocking/live_journal_dir_reader.rs | 8 +++---- .../journal/models/journal_event_kind.rs | 2 +- src/modules/logs/content/log_event_content.rs | 3 --- src/modules/state/models/commander_state.rs | 21 +++++++++++-------- src/modules/state/models/game_state.rs | 18 ++++------------ 6 files changed, 25 insertions(+), 35 deletions(-) diff --git a/src/modules/journal/asynchronous/live_journal_dir_reader.rs b/src/modules/journal/asynchronous/live_journal_dir_reader.rs index 3d926b8f..da3e8368 100644 --- a/src/modules/journal/asynchronous/live_journal_dir_reader.rs +++ b/src/modules/journal/asynchronous/live_journal_dir_reader.rs @@ -45,13 +45,13 @@ pub struct LiveJournalDirReader { #[derive(Debug, Error)] pub enum JournalDirWatcherError { #[error(transparent)] - LogDirReaderError(#[from] LogDirReaderError), + LogDirReader(#[from] LogDirReaderError), #[error(transparent)] - LiveJournalBufferError(#[from] LiveJournalBufferError), + LiveJournalBuffer(#[from] LiveJournalBufferError), #[error(transparent)] - NotifyError(#[from] notify::Error), + Notify(#[from] notify::Error), } impl LiveJournalDirReader { @@ -89,7 +89,7 @@ impl LiveJournalDirReader { return Some(match log_event { Ok(event) => Ok(JournalEvent { is_live: self.log_dir_reader.is_reading_latest(), - kind: JournalEventKind::LogEvent(event), + kind: JournalEventKind::LogEvent(Box::new(event)), }), Err(error) => Err(error.into()), }); diff --git a/src/modules/journal/blocking/live_journal_dir_reader.rs b/src/modules/journal/blocking/live_journal_dir_reader.rs index cc3de5d1..baf6ef78 100644 --- a/src/modules/journal/blocking/live_journal_dir_reader.rs +++ b/src/modules/journal/blocking/live_journal_dir_reader.rs @@ -44,13 +44,13 @@ pub struct LiveJournalDirReader { #[derive(Debug, Error)] pub enum JournalDirWatcherError { #[error(transparent)] - LogDirReaderError(#[from] LogDirReaderError), + LogDirReader(#[from] LogDirReaderError), #[error(transparent)] - LiveJournalBufferError(#[from] LiveJournalBufferError), + LiveJournalBuffer(#[from] LiveJournalBufferError), #[error(transparent)] - NotifyError(#[from] notify::Error), + Notify(#[from] notify::Error), } impl LiveJournalDirReader { @@ -94,7 +94,7 @@ impl Iterator for LiveJournalDirReader { return Some(match log_event { Ok(event) => Ok(JournalEvent { is_live: self.log_dir_reader.is_reading_latest(), - kind: JournalEventKind::LogEvent(event), + kind: JournalEventKind::LogEvent(Box::new(event)), }), Err(error) => Err(error.into()), }); diff --git a/src/modules/journal/models/journal_event_kind.rs b/src/modules/journal/models/journal_event_kind.rs index f5c231e2..a5ab2f92 100644 --- a/src/modules/journal/models/journal_event_kind.rs +++ b/src/modules/journal/models/journal_event_kind.rs @@ -13,7 +13,7 @@ use crate::status::Status; /// directory and includes all the possible models that could have been updated. #[derive(Debug, PartialEq)] pub enum JournalEventKind { - LogEvent(LogEvent), + LogEvent(Box), StatusEvent(Status), OutfittingEvent(Outfitting), ShipyardEvent(Shipyard), diff --git a/src/modules/logs/content/log_event_content.rs b/src/modules/logs/content/log_event_content.rs index c8e31724..783586bb 100644 --- a/src/modules/logs/content/log_event_content.rs +++ b/src/modules/logs/content/log_event_content.rs @@ -875,7 +875,6 @@ impl LogEventContent { LogEventContent::Location(event) => event.location_info.body_id, LogEventContent::FSDJump(event) => event.system_info.body_id, LogEventContent::CarrierJump(event) => event.system_info.body_id, - LogEventContent::CarrierJump(event) => event.system_info.body_id, LogEventContent::ApproachSettlement(event) => event.body_id, LogEventContent::CarrierJumpRequest(event) => event.body_id, LogEventContent::CodexEntry(event) => event.body_id, @@ -888,7 +887,6 @@ impl LogEventContent { LogEventContent::Scan(event) => event.body_id, LogEventContent::Touchdown(event) => event.body_id, LogEventContent::ScanOrganic(event) => event.body, - LogEventContent::Touchdown(event) => event.body_id, _ => return None, }) } @@ -898,7 +896,6 @@ impl LogEventContent { LogEventContent::Location(event) => &event.location_info.body, LogEventContent::FSDJump(event) => &event.system_info.body, LogEventContent::CarrierJump(event) => &event.system_info.body, - LogEventContent::CarrierJump(event) => &event.system_info.body, LogEventContent::ApproachSettlement(event) => &event.body_name, LogEventContent::CarrierJumpRequest(event) => match &event.body { Some(name) => name, diff --git a/src/modules/state/models/commander_state.rs b/src/modules/state/models/commander_state.rs index 499ddafa..4fb5cf8a 100644 --- a/src/modules/state/models/commander_state.rs +++ b/src/modules/state/models/commander_state.rs @@ -44,7 +44,7 @@ impl CommanderState { LogEventContent::Scan(event) => { self.current_exploration_data.push(event.clone()); } - LogEventContent::Died(event) => { + LogEventContent::Died(_) => { self.current_exploration_data.clear(); } LogEventContent::Rank(ranks) => { @@ -74,10 +74,6 @@ impl CommanderState { let system = self.upset_system(&location.location_info); system.visit(&log_event.timestamp); } - LogEventContent::CarrierJump(carrier_jump) => { - let system = self.upset_system(&carrier_jump.system_info); - system.carrier_visit(&log_event.timestamp); - } LogEventContent::FSDJump(fsd_jump) => { self.current_system = Some(fsd_jump.system_info.system_address); @@ -155,11 +151,18 @@ impl CommanderState { | LogEventContent::CarrierTradeOrder(_) | LogEventContent::CarrierDockingPermission(_) | LogEventContent::CarrierNameChange(_) - | LogEventContent::CarrierJumpCancelled(_) => match &mut self.carrier_state { - Some(state) => { - try_feed!(state.feed_log_event(log_event)); + | LogEventContent::CarrierJumpCancelled(_) => { + if let LogEventContent::CarrierJump(carrier_jump) = &log_event.content { + let system = self.upset_system(&carrier_jump.system_info); + system.carrier_visit(&log_event.timestamp); + } + + match &mut self.carrier_state { + Some(state) => { + try_feed!(state.feed_log_event(log_event)); + } + None => return FeedResult::Later, } - None => return FeedResult::Later, }, _ => {} diff --git a/src/modules/state/models/game_state.rs b/src/modules/state/models/game_state.rs index 4acc1b5d..d3d304d7 100644 --- a/src/modules/state/models/game_state.rs +++ b/src/modules/state/models/game_state.rs @@ -32,25 +32,15 @@ impl GameState { } pub fn current_commander(&self) -> Option<&CommanderState> { - let Some(commander_id) = &self.current_commander else { - return None; - }; - - let Some(commander_entry) = self.commanders.get(commander_id) else { - return None; - }; + let commander_id = self.current_commander.as_ref()?; + let commander_entry = self.commanders.get(commander_id)?; Some(commander_entry) } pub fn current_commander_mut(&mut self) -> Option<&mut CommanderState> { - let Some(commander_id) = &self.current_commander else { - return None; - }; - - let Some(commander_entry) = self.commanders.get_mut(commander_id) else { - return None; - }; + let commander_id = self.current_commander.as_ref()?; + let commander_entry = self.commanders.get_mut(commander_id)?; Some(commander_entry) } From 6150e644c8d9e940e3fcc125f339e55f7877724d Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:00:18 +0200 Subject: [PATCH 09/17] =?UTF-8?q?=E2=8F=AA=EF=B8=8F=20Revert=20change=20bo?= =?UTF-8?q?xing=20log=20event?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/journal/asynchronous/live_journal_dir_reader.rs | 2 +- src/modules/journal/blocking/live_journal_dir_reader.rs | 2 +- src/modules/journal/models/journal_event_kind.rs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/journal/asynchronous/live_journal_dir_reader.rs b/src/modules/journal/asynchronous/live_journal_dir_reader.rs index da3e8368..d297db5b 100644 --- a/src/modules/journal/asynchronous/live_journal_dir_reader.rs +++ b/src/modules/journal/asynchronous/live_journal_dir_reader.rs @@ -89,7 +89,7 @@ impl LiveJournalDirReader { return Some(match log_event { Ok(event) => Ok(JournalEvent { is_live: self.log_dir_reader.is_reading_latest(), - kind: JournalEventKind::LogEvent(Box::new(event)), + kind: JournalEventKind::LogEvent(event), }), Err(error) => Err(error.into()), }); diff --git a/src/modules/journal/blocking/live_journal_dir_reader.rs b/src/modules/journal/blocking/live_journal_dir_reader.rs index baf6ef78..de85411c 100644 --- a/src/modules/journal/blocking/live_journal_dir_reader.rs +++ b/src/modules/journal/blocking/live_journal_dir_reader.rs @@ -94,7 +94,7 @@ impl Iterator for LiveJournalDirReader { return Some(match log_event { Ok(event) => Ok(JournalEvent { is_live: self.log_dir_reader.is_reading_latest(), - kind: JournalEventKind::LogEvent(Box::new(event)), + kind: JournalEventKind::LogEvent(event), }), Err(error) => Err(error.into()), }); diff --git a/src/modules/journal/models/journal_event_kind.rs b/src/modules/journal/models/journal_event_kind.rs index a5ab2f92..509a4dfd 100644 --- a/src/modules/journal/models/journal_event_kind.rs +++ b/src/modules/journal/models/journal_event_kind.rs @@ -12,8 +12,12 @@ use crate::status::Status; /// This event is fired from the [LiveJournalDirReader] when any change happens in the journal /// directory and includes all the possible models that could have been updated. #[derive(Debug, PartialEq)] + +// The large enum variant is allowed here as this is usually allocated by the reader anyway and +// adding another box here wouldn't be that useful. Also even though it's large, it's not huge. +#[allow(clippy::large_enum_variant)] pub enum JournalEventKind { - LogEvent(Box), + LogEvent(LogEvent), StatusEvent(Status), OutfittingEvent(Outfitting), ShipyardEvent(Shipyard), From 1fbedf247d28674d6e6ed34f08ceb3e4336e0ac2 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:00:44 +0200 Subject: [PATCH 10/17] =?UTF-8?q?=F0=9F=8E=A8=20Run=20cargo=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/exobiology/models/spawn_source.rs | 5 +---- src/modules/journal/models/journal_event_kind.rs | 1 - src/modules/state/models/commander_state.rs | 2 +- src/modules/state/models/mission_state.rs | 4 +--- src/modules/state/models/system_state.rs | 2 +- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/modules/exobiology/models/spawn_source.rs b/src/modules/exobiology/models/spawn_source.rs index 07547cb4..8dd34b38 100644 --- a/src/modules/exobiology/models/spawn_source.rs +++ b/src/modules/exobiology/models/spawn_source.rs @@ -2,16 +2,13 @@ pub mod spawn_source_star; pub mod target_planet; pub mod target_system; - use strum::IntoEnumIterator; use crate::exobiology::models::spawn_source::spawn_source_star::SpawnSourceStar; use crate::exobiology::models::spawn_source::target_planet::TargetPlanet; use crate::exobiology::models::spawn_source::target_system::TargetSystem; use crate::exobiology::{SpawnCondition, Species}; -use crate::galaxy::{ - AtmosphereDensity, AtmosphereType, Nebula, VolcanismType, -}; +use crate::galaxy::{AtmosphereDensity, AtmosphereType, Nebula, VolcanismType}; use crate::logs::scan_event::ScanEventParent; #[derive(Debug)] diff --git a/src/modules/journal/models/journal_event_kind.rs b/src/modules/journal/models/journal_event_kind.rs index 509a4dfd..e752561b 100644 --- a/src/modules/journal/models/journal_event_kind.rs +++ b/src/modules/journal/models/journal_event_kind.rs @@ -12,7 +12,6 @@ use crate::status::Status; /// This event is fired from the [LiveJournalDirReader] when any change happens in the journal /// directory and includes all the possible models that could have been updated. #[derive(Debug, PartialEq)] - // The large enum variant is allowed here as this is usually allocated by the reader anyway and // adding another box here wouldn't be that useful. Also even though it's large, it's not huge. #[allow(clippy::large_enum_variant)] diff --git a/src/modules/state/models/commander_state.rs b/src/modules/state/models/commander_state.rs index 4fb5cf8a..a4cd4c68 100644 --- a/src/modules/state/models/commander_state.rs +++ b/src/modules/state/models/commander_state.rs @@ -163,7 +163,7 @@ impl CommanderState { } None => return FeedResult::Later, } - }, + } _ => {} } diff --git a/src/modules/state/models/mission_state.rs b/src/modules/state/models/mission_state.rs index 61b89e95..abb98563 100644 --- a/src/modules/state/models/mission_state.rs +++ b/src/modules/state/models/mission_state.rs @@ -1,12 +1,10 @@ use serde::Serialize; use std::collections::HashMap; -#[derive(Serialize)] -#[derive(Default)] +#[derive(Serialize, Default)] pub struct MissionState { pub missions: HashMap, } #[derive(Serialize)] pub struct Mission {} - diff --git a/src/modules/state/models/system_state.rs b/src/modules/state/models/system_state.rs index c341c43f..2ac25e1e 100644 --- a/src/modules/state/models/system_state.rs +++ b/src/modules/state/models/system_state.rs @@ -124,7 +124,7 @@ impl From<&LocationInfo> for SystemState { #[cfg(test)] mod tests { - + use std::env::current_dir; use crate::exobiology::SpawnSource; From 497b49ff2d90cbafbb52144811e6a4533a48423d Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:03:46 +0200 Subject: [PATCH 11/17] =?UTF-8?q?=F0=9F=90=9B=20Fix=20incorrect=20species?= =?UTF-8?q?=20credit=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/exobiology/models/species.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/exobiology/models/species.rs b/src/modules/exobiology/models/species.rs index 1d5f5b56..bbff44b5 100644 --- a/src/modules/exobiology/models/species.rs +++ b/src/modules/exobiology/models/species.rs @@ -634,7 +634,7 @@ impl Species { Species::BacteriumVesicula => 1_000_000, Species::BacteriumAlcyoneum => 1_658_500, Species::BacteriumTela => 1_949_000, - Species::BacteriumInformem => 841_800, + Species::BacteriumInformem => 8_418_000, Species::BacteriumVolu => 7_774_700, Species::BacteriumBullaris => 1_152_500, Species::BacteriumOmentum => 4_689_800, @@ -700,7 +700,7 @@ impl Species { Species::ReceptaConditivus => 143_133_700, Species::StratumExcutitus => 2_448_900, - Species::StratumPaleas => 136_200, + Species::StratumPaleas => 1_362_000, Species::StratumLaminamus => 2_788_300, Species::StratumAraneamus => 2_448_900, Species::StratumLimaxus => 1_362_000, From cf1d3fc0cb450e6ad8ca774faf2ec03ea8a0c5e3 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:04:52 +0200 Subject: [PATCH 12/17] =?UTF-8?q?=F0=9F=90=9B=20Fix=20another=20incorrect?= =?UTF-8?q?=20specie=20credit=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/exobiology/models/species.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/exobiology/models/species.rs b/src/modules/exobiology/models/species.rs index bbff44b5..b78604ab 100644 --- a/src/modules/exobiology/models/species.rs +++ b/src/modules/exobiology/models/species.rs @@ -697,7 +697,7 @@ impl Species { Species::ReceptaUmbrux => 12_934_900, Species::ReceptaDeltahedronix => 16_202_800, - Species::ReceptaConditivus => 143_133_700, + Species::ReceptaConditivus => 14_313_370, Species::StratumExcutitus => 2_448_900, Species::StratumPaleas => 1_362_000, From 07e869ea5373ecce5e9a58a875459c023a758c96 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:05:31 +0200 Subject: [PATCH 13/17] =?UTF-8?q?=F0=9F=90=9B=20Fix=20incorrect=20specie?= =?UTF-8?q?=20credit=20value=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/exobiology/models/species.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/exobiology/models/species.rs b/src/modules/exobiology/models/species.rs index b78604ab..69e14ce0 100644 --- a/src/modules/exobiology/models/species.rs +++ b/src/modules/exobiology/models/species.rs @@ -697,7 +697,7 @@ impl Species { Species::ReceptaUmbrux => 12_934_900, Species::ReceptaDeltahedronix => 16_202_800, - Species::ReceptaConditivus => 14_313_370, + Species::ReceptaConditivus => 14_313_700, Species::StratumExcutitus => 2_448_900, Species::StratumPaleas => 1_362_000, From d621d71488b92f3654ac2fcde341d7d539e3222c Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:18:31 +0200 Subject: [PATCH 14/17] =?UTF-8?q?=F0=9F=8E=A8=20Perform=20custom=20formatt?= =?UTF-8?q?ing=20on=20variant=20color=20mappings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is way more readable... --- .../exobiology/models/variant_color.rs | 1128 +++++------------ 1 file changed, 316 insertions(+), 812 deletions(-) diff --git a/src/modules/exobiology/models/variant_color.rs b/src/modules/exobiology/models/variant_color.rs index c591c065..16cf7186 100644 --- a/src/modules/exobiology/models/variant_color.rs +++ b/src/modules/exobiology/models/variant_color.rs @@ -48,6 +48,7 @@ pub enum VariantColorError { UnknownVariant, } +#[rustfmt::skip] impl TryFrom<(&Species, &VariantSource)> for VariantColor { type Error = VariantColorError; @@ -77,283 +78,127 @@ impl TryFrom<(&Species, &VariantSource)> for VariantColor { (Genus::BarkMound, _, _) => VariantColor::None, // Bacterium - (_, Species::BacteriumAcies, VariantSource::Material(Material::Antimony)) => { - VariantColor::Cyan - } - (_, Species::BacteriumAcies, VariantSource::Material(Material::Polonium)) => { - VariantColor::Cyan - } - (_, Species::BacteriumAcies, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Cobalt - } - (_, Species::BacteriumAcies, VariantSource::Material(Material::Technetium)) => { - VariantColor::Lime - } - (_, Species::BacteriumAcies, VariantSource::Material(Material::Tellurium)) => { - VariantColor::White - } - (_, Species::BacteriumAcies, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Aquamarine - } - - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::O), - ) => VariantColor::Turquoise, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::B), - ) => VariantColor::Grey, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::A), - ) => VariantColor::Yellow, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::F), - ) => VariantColor::Lime, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::G), - ) => VariantColor::Emerald, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::K), - ) => VariantColor::Green, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::M), - ) => VariantColor::Teal, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::L), - ) => VariantColor::Sage, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::T), - ) => VariantColor::Red, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::TTS), - ) => VariantColor::Maroon, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::W), - ) => VariantColor::Amethyst, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::D), - ) => VariantColor::Ocher, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::N), - ) => VariantColor::Indigo, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::Y), - ) => VariantColor::Mauve, - ( - _, - Species::BacteriumAlcyoneum | Species::BacteriumAurasus | Species::BacteriumCerbrus, - VariantSource::StarClass(StarClass::Ae), - ) => VariantColor::Orange, - - (_, Species::BacteriumBullaris, VariantSource::Material(Material::Antimony)) => { - VariantColor::Cobalt - } - (_, Species::BacteriumBullaris, VariantSource::Material(Material::Polonium)) => { - VariantColor::Yellow - } - (_, Species::BacteriumBullaris, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Aquamarine - } - (_, Species::BacteriumBullaris, VariantSource::Material(Material::Technetium)) => { - VariantColor::Gold - } - (_, Species::BacteriumBullaris, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Lime - } - (_, Species::BacteriumBullaris, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Red - } - - (_, Species::BacteriumInformem, VariantSource::Material(Material::Antimony)) => { - VariantColor::Red - } - (_, Species::BacteriumInformem, VariantSource::Material(Material::Polonium)) => { - VariantColor::Lime - } - (_, Species::BacteriumInformem, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Gold - } - (_, Species::BacteriumInformem, VariantSource::Material(Material::Technetium)) => { - VariantColor::Aquamarine - } - (_, Species::BacteriumInformem, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Yellow - } - (_, Species::BacteriumInformem, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Cobalt - } - - (_, Species::BacteriumNebulus, VariantSource::Material(Material::Antimony)) => { - VariantColor::Magenta - } - (_, Species::BacteriumNebulus, VariantSource::Material(Material::Polonium)) => { - VariantColor::Gold - } - (_, Species::BacteriumNebulus, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Orange - } - (_, Species::BacteriumNebulus, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Green - } - (_, Species::BacteriumNebulus, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Cobalt - } - (_, Species::BacteriumNebulus, VariantSource::Material(Material::Technetium)) => { - VariantColor::Cyan - } - - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Boron)) => { - VariantColor::Lime - } - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Lime - } - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Mercury)) => { - VariantColor::White - } - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Aquamarine - } - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Niobium)) => { - VariantColor::Peach - } - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Tin)) => { - VariantColor::Red - } - (_, Species::BacteriumOmentum, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Blue - } - - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Boron)) => { - VariantColor::White - } - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Cadmium)) => { - VariantColor::White - } - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Mercury)) => { - VariantColor::Peach - } - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Lime - } - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Niobium)) => { - VariantColor::Red - } - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Tin)) => { - VariantColor::Mulberry - } - (_, Species::BacteriumScopulum, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Aquamarine - } - - (_, Species::BacteriumTela, VariantSource::Material(Material::Boron)) => { - VariantColor::Gold - } - (_, Species::BacteriumTela, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Gold - } - (_, Species::BacteriumTela, VariantSource::Material(Material::Mercury)) => { - VariantColor::Orange - } - (_, Species::BacteriumTela, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Yellow - } - (_, Species::BacteriumTela, VariantSource::Material(Material::Niobium)) => { - VariantColor::Magenta - } - (_, Species::BacteriumTela, VariantSource::Material(Material::Tin)) => { - VariantColor::Cobalt - } - (_, Species::BacteriumTela, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Green - } - - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Boron)) => { - VariantColor::Peach - } - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Peach - } - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Mercury)) => { - VariantColor::Red - } - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::White - } - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Niobium)) => { - VariantColor::Mulberry - } - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Tin)) => { - VariantColor::Blue - } - (_, Species::BacteriumVerrata, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Lime - } - - (_, Species::BacteriumVesicula, VariantSource::Material(Material::Antimony)) => { - VariantColor::Cyan - } - (_, Species::BacteriumVesicula, VariantSource::Material(Material::Polonium)) => { - VariantColor::Orange - } - (_, Species::BacteriumVesicula, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Mulberry - } - (_, Species::BacteriumVesicula, VariantSource::Material(Material::Technetium)) => { - VariantColor::Gold - } - (_, Species::BacteriumVesicula, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Red - } - (_, Species::BacteriumVesicula, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Lime - } - - (_, Species::BacteriumVolu, VariantSource::Material(Material::Antimony)) => { - VariantColor::Red - } - (_, Species::BacteriumVolu, VariantSource::Material(Material::Polonium)) => { - VariantColor::Aquamarine - } - (_, Species::BacteriumVolu, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Cobalt - } - (_, Species::BacteriumVolu, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Cyan - } - (_, Species::BacteriumVolu, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Gold - } - (_, Species::BacteriumVolu, VariantSource::Material(Material::Technetium)) => { - VariantColor::Lime - } + (_, Species::BacteriumAcies, VariantSource::Material(Material::Antimony)) => VariantColor::Cyan, + (_, Species::BacteriumAcies, VariantSource::Material(Material::Polonium)) => VariantColor::Cyan, + (_, Species::BacteriumAcies, VariantSource::Material(Material::Ruthenium)) => VariantColor::Cobalt, + (_, Species::BacteriumAcies, VariantSource::Material(Material::Technetium)) => VariantColor::Lime, + (_, Species::BacteriumAcies, VariantSource::Material(Material::Tellurium)) => VariantColor::White, + (_, Species::BacteriumAcies, VariantSource::Material(Material::Yttrium)) => VariantColor::Aquamarine, + + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::O)) => VariantColor::Turquoise, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::B)) => VariantColor::Grey, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::A)) => VariantColor::Yellow, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::F)) => VariantColor::Lime, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::G)) => VariantColor::Emerald, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::K)) => VariantColor::Green, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::M)) => VariantColor::Teal, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::L)) => VariantColor::Sage, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::T)) => VariantColor::Red, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Maroon, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::W)) => VariantColor::Amethyst, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::D)) => VariantColor::Ocher, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::N)) => VariantColor::Indigo, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::Y)) => VariantColor::Mauve, + (_, Species::BacteriumAlcyoneum, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, + + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::O)) => VariantColor::Turquoise, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::B)) => VariantColor::Grey, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::A)) => VariantColor::Yellow, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::F)) => VariantColor::Lime, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::G)) => VariantColor::Emerald, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::K)) => VariantColor::Green, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::M)) => VariantColor::Teal, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::L)) => VariantColor::Sage, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::T)) => VariantColor::Red, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Maroon, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::W)) => VariantColor::Amethyst, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::D)) => VariantColor::Ocher, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::N)) => VariantColor::Indigo, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Mauve, + (_, Species::BacteriumAurasus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, + + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::O)) => VariantColor::Turquoise, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::B)) => VariantColor::Grey, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::A)) => VariantColor::Yellow, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::F)) => VariantColor::Lime, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::G)) => VariantColor::Emerald, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::K)) => VariantColor::Green, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::M)) => VariantColor::Teal, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::L)) => VariantColor::Sage, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::T)) => VariantColor::Red, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Maroon, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::W)) => VariantColor::Amethyst, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::D)) => VariantColor::Ocher, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::N)) => VariantColor::Indigo, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Mauve, + (_, Species::BacteriumCerbrus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, + + (_, Species::BacteriumBullaris, VariantSource::Material(Material::Antimony)) => VariantColor::Cobalt, + (_, Species::BacteriumBullaris, VariantSource::Material(Material::Polonium)) => VariantColor::Yellow, + (_, Species::BacteriumBullaris, VariantSource::Material(Material::Ruthenium)) => VariantColor::Aquamarine, + (_, Species::BacteriumBullaris, VariantSource::Material(Material::Technetium)) => VariantColor::Gold, + (_, Species::BacteriumBullaris, VariantSource::Material(Material::Tellurium)) => VariantColor::Lime, + (_, Species::BacteriumBullaris, VariantSource::Material(Material::Yttrium)) => VariantColor::Red, + + (_, Species::BacteriumInformem, VariantSource::Material(Material::Antimony)) => VariantColor::Red, + (_, Species::BacteriumInformem, VariantSource::Material(Material::Polonium)) => VariantColor::Lime, + (_, Species::BacteriumInformem, VariantSource::Material(Material::Ruthenium)) => VariantColor::Gold, + (_, Species::BacteriumInformem, VariantSource::Material(Material::Technetium)) => VariantColor::Aquamarine, + (_, Species::BacteriumInformem, VariantSource::Material(Material::Tellurium)) => VariantColor::Yellow, + (_, Species::BacteriumInformem, VariantSource::Material(Material::Yttrium)) => VariantColor::Cobalt, + + (_, Species::BacteriumNebulus, VariantSource::Material(Material::Antimony)) => VariantColor::Magenta, + (_, Species::BacteriumNebulus, VariantSource::Material(Material::Polonium)) => VariantColor::Gold, + (_, Species::BacteriumNebulus, VariantSource::Material(Material::Ruthenium)) => VariantColor::Orange, + (_, Species::BacteriumNebulus, VariantSource::Material(Material::Tellurium)) => VariantColor::Green, + (_, Species::BacteriumNebulus, VariantSource::Material(Material::Yttrium)) => VariantColor::Cobalt, + (_, Species::BacteriumNebulus, VariantSource::Material(Material::Technetium)) => VariantColor::Cyan, + + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Boron)) => VariantColor::Lime, + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Cadmium)) => VariantColor::Lime, + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Mercury)) => VariantColor::White, + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Molybdenum)) => VariantColor::Aquamarine, + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Niobium)) => VariantColor::Peach, + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Tin)) => VariantColor::Red, + (_, Species::BacteriumOmentum, VariantSource::Material(Material::Tungsten)) => VariantColor::Blue, + + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Boron)) => VariantColor::White, + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Cadmium)) => VariantColor::White, + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Mercury)) => VariantColor::Peach, + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Molybdenum)) => VariantColor::Lime, + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Niobium)) => VariantColor::Red, + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Tin)) => VariantColor::Mulberry, + (_, Species::BacteriumScopulum, VariantSource::Material(Material::Tungsten)) => VariantColor::Aquamarine, + + (_, Species::BacteriumTela, VariantSource::Material(Material::Boron)) => VariantColor::Gold, + (_, Species::BacteriumTela, VariantSource::Material(Material::Cadmium)) => VariantColor::Gold, + (_, Species::BacteriumTela, VariantSource::Material(Material::Mercury)) => VariantColor::Orange, + (_, Species::BacteriumTela, VariantSource::Material(Material::Molybdenum)) => VariantColor::Yellow, + (_, Species::BacteriumTela, VariantSource::Material(Material::Niobium)) => VariantColor::Magenta, + (_, Species::BacteriumTela, VariantSource::Material(Material::Tin)) => VariantColor::Cobalt, + (_, Species::BacteriumTela, VariantSource::Material(Material::Tungsten)) => VariantColor::Green, + + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Boron)) => VariantColor::Peach, + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Cadmium)) => VariantColor::Peach, + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Mercury)) => VariantColor::Red, + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Molybdenum)) => VariantColor::White, + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Niobium)) => VariantColor::Mulberry, + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Tin)) => VariantColor::Blue, + (_, Species::BacteriumVerrata, VariantSource::Material(Material::Tungsten)) => VariantColor::Lime, + + (_, Species::BacteriumVesicula, VariantSource::Material(Material::Antimony)) => VariantColor::Cyan, + (_, Species::BacteriumVesicula, VariantSource::Material(Material::Polonium)) => VariantColor::Orange, + (_, Species::BacteriumVesicula, VariantSource::Material(Material::Ruthenium)) => VariantColor::Mulberry, + (_, Species::BacteriumVesicula, VariantSource::Material(Material::Technetium)) => VariantColor::Gold, + (_, Species::BacteriumVesicula, VariantSource::Material(Material::Tellurium)) => VariantColor::Red, + (_, Species::BacteriumVesicula, VariantSource::Material(Material::Yttrium)) => VariantColor::Lime, + + (_, Species::BacteriumVolu, VariantSource::Material(Material::Antimony)) => VariantColor::Red, + (_, Species::BacteriumVolu, VariantSource::Material(Material::Polonium)) => VariantColor::Aquamarine, + (_, Species::BacteriumVolu, VariantSource::Material(Material::Ruthenium)) => VariantColor::Cobalt, + (_, Species::BacteriumVolu, VariantSource::Material(Material::Tellurium)) => VariantColor::Cyan, + (_, Species::BacteriumVolu, VariantSource::Material(Material::Yttrium)) => VariantColor::Gold, + (_, Species::BacteriumVolu, VariantSource::Material(Material::Technetium)) => VariantColor::Lime, (Genus::BrainTree, _, _) => VariantColor::None, @@ -389,153 +234,70 @@ impl TryFrom<(&Species, &VariantSource)> for VariantColor { // W (Genus::Clypeus, _, VariantSource::StarClass(StarClass::Y)) => VariantColor::Green, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::A), - ) => VariantColor::Teal, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::F), - ) => VariantColor::Grey, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::G), - ) => VariantColor::Turquoise, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::K), - ) => VariantColor::Red, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::L), - ) => VariantColor::Orange, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::N), - ) => VariantColor::Emerald, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::B), - ) => VariantColor::Indigo, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::Y), - ) => VariantColor::Yellow, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::D), - ) => VariantColor::Green, - ( - _, - Species::ConchaAureolas | Species::ConchaLabiata, - VariantSource::StarClass(StarClass::W), - ) => VariantColor::Lime, - - (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Antimony)) => { - VariantColor::Peach - } - (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Orange - } - (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Yellow - } - (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Polonium)) => { - VariantColor::Red - } - (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Gold - } - (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Technetium)) => { - VariantColor::White - } - - (_, Species::ConchaRenibus, VariantSource::Material(Material::Boron)) => { - VariantColor::Red - } - (_, Species::ConchaRenibus, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Red - } - (_, Species::ConchaRenibus, VariantSource::Material(Material::Mercury)) => { - VariantColor::Mulberry - } - (_, Species::ConchaRenibus, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Peach - } - (_, Species::ConchaRenibus, VariantSource::Material(Material::Niobium)) => { - VariantColor::Blue - } - (_, Species::ConchaRenibus, VariantSource::Material(Material::Tin)) => { - VariantColor::Aquamarine - } - (_, Species::ConchaRenibus, VariantSource::Material(Material::Tungsten)) => { - VariantColor::White - } + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::A)) => VariantColor::Teal, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::F)) => VariantColor::Grey, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::G)) => VariantColor::Turquoise, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::K)) => VariantColor::Red, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::L)) => VariantColor::Orange, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::N)) => VariantColor::Emerald, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::B)) => VariantColor::Indigo, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::Y)) => VariantColor::Yellow, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::D)) => VariantColor::Green, + (_, Species::ConchaAureolas, VariantSource::StarClass(StarClass::W)) => VariantColor::Lime, + + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::A)) => VariantColor::Teal, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::F)) => VariantColor::Grey, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::G)) => VariantColor::Turquoise, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::K)) => VariantColor::Red, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::L)) => VariantColor::Orange, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::N)) => VariantColor::Emerald, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::B)) => VariantColor::Indigo, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::Y)) => VariantColor::Yellow, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::D)) => VariantColor::Green, + (_, Species::ConchaLabiata, VariantSource::StarClass(StarClass::W)) => VariantColor::Lime, + + (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Antimony)) => VariantColor::Peach, + (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Ruthenium)) => VariantColor::Orange, + (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Tellurium)) => VariantColor::Yellow, + (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Polonium)) => VariantColor::Red, + (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Yttrium)) => VariantColor::Gold, + (_, Species::ConchaBiconcavis, VariantSource::Material(Material::Technetium)) => VariantColor::White, + + (_, Species::ConchaRenibus, VariantSource::Material(Material::Boron)) => VariantColor::Red, + (_, Species::ConchaRenibus, VariantSource::Material(Material::Cadmium)) => VariantColor::Red, + (_, Species::ConchaRenibus, VariantSource::Material(Material::Mercury)) => VariantColor::Mulberry, + (_, Species::ConchaRenibus, VariantSource::Material(Material::Molybdenum)) => VariantColor::Peach, + (_, Species::ConchaRenibus, VariantSource::Material(Material::Niobium)) => VariantColor::Blue, + (_, Species::ConchaRenibus, VariantSource::Material(Material::Tin)) => VariantColor::Aquamarine, + (_, Species::ConchaRenibus, VariantSource::Material(Material::Tungsten)) => VariantColor::White, (Genus::CrystallineShards, _, _) => VariantColor::None, - (_, Species::ElectricaePluma, VariantSource::Material(Material::Antimony)) => { - VariantColor::Cobalt - } - (_, Species::ElectricaePluma, VariantSource::Material(Material::Polonium)) => { - VariantColor::Cyan - } - (_, Species::ElectricaePluma, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Blue - } - (_, Species::ElectricaePluma, VariantSource::Material(Material::Technetium)) => { - VariantColor::Magenta - } - (_, Species::ElectricaePluma, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Red - } - (_, Species::ElectricaePluma, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Mulberry - } + (_, Species::ElectricaePluma, VariantSource::Material(Material::Antimony)) => VariantColor::Cobalt, + (_, Species::ElectricaePluma, VariantSource::Material(Material::Polonium)) => VariantColor::Cyan, + (_, Species::ElectricaePluma, VariantSource::Material(Material::Ruthenium)) => VariantColor::Blue, + (_, Species::ElectricaePluma, VariantSource::Material(Material::Technetium)) => VariantColor::Magenta, + (_, Species::ElectricaePluma, VariantSource::Material(Material::Tellurium)) => VariantColor::Red, + (_, Species::ElectricaePluma, VariantSource::Material(Material::Yttrium)) => VariantColor::Mulberry, - (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Antimony)) => { - VariantColor::Cyan - } - (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Polonium)) => { - VariantColor::Cobalt - } - (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Blue - } - (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Technetium)) => { - VariantColor::Aquamarine - } - (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Magenta - } - (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Green - } + (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Antimony)) => VariantColor::Cyan, + (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Polonium)) => VariantColor::Cobalt, + (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Ruthenium)) => VariantColor::Blue, + (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Technetium)) => VariantColor::Aquamarine, + (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Tellurium)) => VariantColor::Magenta, + (_, Species::ElectricaeRadialem, VariantSource::Material(Material::Yttrium)) => VariantColor::Green, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::B)) => VariantColor::Lime, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::A)) => VariantColor::Green, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::F)) => VariantColor::Yellow, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::G)) => VariantColor::Teal, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::K)) => VariantColor::Emerald, - (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::M)) => { - VariantColor::Amethyst - } + (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::M)) => VariantColor::Amethyst, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::L)) => VariantColor::Mauve, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::T)) => VariantColor::Orange, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Red, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::Y)) => VariantColor::Ocher, - (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::D)) => { - VariantColor::Turquoise - } + (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::D)) => VariantColor::Turquoise, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::N)) => VariantColor::Sage, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Maroon, (Genus::Fonticulua, _, VariantSource::StarClass(StarClass::O)) => VariantColor::Grey, @@ -553,412 +315,154 @@ impl TryFrom<(&Species, &VariantSource)> for VariantColor { (Genus::Frutexa, _, VariantSource::StarClass(StarClass::L)) => VariantColor::Teal, (Genus::Frutexa, _, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Boron)) => { - VariantColor::Green - } - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Green - } - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Mercury)) => { - VariantColor::Yellow - } - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Cyan - } - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Niobium)) => { - VariantColor::Gold - } - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Tin)) => { - VariantColor::Orange - } - (_, Species::FumerolaAquatis, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Cobalt - } - - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Boron)) => { - VariantColor::Orange - } - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Orange - } - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Mercury)) => { - VariantColor::Magenta - } - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Gold - } - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Niobium)) => { - VariantColor::Cobalt - } - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Tin)) => { - VariantColor::Cyan - } - (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Yellow - } - - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Boron)) => { - VariantColor::Aquamarine - } - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Aquamarine - } - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Mercury)) => { - VariantColor::Lime - } - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Blue - } - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Niobium)) => { - VariantColor::White - } - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Tin)) => { - VariantColor::Peach - } - (_, Species::FumerolaExtremus, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Mulberry - } - - (_, Species::FumerolaNitris, VariantSource::Material(Material::Boron)) => { - VariantColor::White - } - (_, Species::FumerolaNitris, VariantSource::Material(Material::Cadmium)) => { - VariantColor::White - } - (_, Species::FumerolaNitris, VariantSource::Material(Material::Mercury)) => { - VariantColor::Peach - } - (_, Species::FumerolaNitris, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Lime - } - (_, Species::FumerolaNitris, VariantSource::Material(Material::Niobium)) => { - VariantColor::Red - } - (_, Species::FumerolaNitris, VariantSource::Material(Material::Tin)) => { - VariantColor::Mulberry - } - (_, Species::FumerolaNitris, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Aquamarine - } - - (_, Species::FungoidaBullarum, VariantSource::Material(Material::Antimony)) => { - VariantColor::Red - } - (_, Species::FungoidaBullarum, VariantSource::Material(Material::Polonium)) => { - VariantColor::Mulberry - } - (_, Species::FungoidaBullarum, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Magenta - } - (_, Species::FungoidaBullarum, VariantSource::Material(Material::Technetium)) => { - VariantColor::Peach - } - (_, Species::FungoidaBullarum, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Gold - } - (_, Species::FungoidaBullarum, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Orange - } - - (_, Species::FungoidaGelata, VariantSource::Material(Material::Boron)) => { - VariantColor::Cyan - } - (_, Species::FungoidaGelata, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Cyan - } - (_, Species::FungoidaGelata, VariantSource::Material(Material::Mercury)) => { - VariantColor::Lime - } - (_, Species::FungoidaGelata, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Mulberry - } - (_, Species::FungoidaGelata, VariantSource::Material(Material::Niobium)) => { - VariantColor::Green - } - (_, Species::FungoidaGelata, VariantSource::Material(Material::Tin)) => { - VariantColor::Red - } - (_, Species::FungoidaGelata, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Orange - } - - (_, Species::FungoidaSetisis, VariantSource::Material(Material::Antimony)) => { - VariantColor::Peach - } - (_, Species::FungoidaSetisis, VariantSource::Material(Material::Polonium)) => { - VariantColor::White - } - (_, Species::FungoidaSetisis, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Gold - } - (_, Species::FungoidaSetisis, VariantSource::Material(Material::Technetium)) => { - VariantColor::Lime - } - (_, Species::FungoidaSetisis, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Yellow - } - (_, Species::FungoidaSetisis, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Orange - } - - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Boron)) => { - VariantColor::Blue - } - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Blue - } - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Mercury)) => { - VariantColor::Green - } - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Magenta - } - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Niobium)) => { - VariantColor::White - } - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Tin)) => { - VariantColor::Orange - } - (_, Species::FungoidaStabitis, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Peach - } - - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::A)) => { - VariantColor::Lime - } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Ae)) => { - VariantColor::Orange - } // This is a guess - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::F)) => { - VariantColor::Turquoise - } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::G)) => { - VariantColor::Grey - } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::K)) => { - VariantColor::Indigo - } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::T)) => { - VariantColor::Emerald - } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::O)) => { - VariantColor::Emerald - } // This is a guess - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::TTS)) => { - VariantColor::Green - } - (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Y)) => { - VariantColor::Maroon - } - - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::A)) => { - VariantColor::Lime - } - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Ae)) => { - VariantColor::Orange - } // This is a guess - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::F)) => { - VariantColor::Turquoise - } - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::G)) => { - VariantColor::Grey - } - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::K)) => { - VariantColor::Indigo - } - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::T)) => { - VariantColor::Emerald - } - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::O)) => { - VariantColor::Yellow - } // This is a guess - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::TTS)) => { - VariantColor::Green - } - (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Y)) => { - VariantColor::Maroon - } - - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::A)) => { - VariantColor::Lime - } - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Ae)) => { - VariantColor::Orange - } // This is a guess - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::F)) => { - VariantColor::Turquoise - } - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::G)) => { - VariantColor::Grey - } - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::K)) => { - VariantColor::Indigo - } - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::T)) => { - VariantColor::Emerald - } - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::O)) => { - VariantColor::Yellow - } // This is a guess - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::TTS)) => { - VariantColor::Green - } - (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Y)) => { - VariantColor::Maroon - } - - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::A)) => { - VariantColor::Lime - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Ae)) => { - VariantColor::Orange - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::F)) => { - VariantColor::Turquoise - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::G)) => { - VariantColor::Grey - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::K)) => { - VariantColor::Indigo - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::T)) => { - VariantColor::Emerald - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::TTS)) => { - VariantColor::Green - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::O)) => { - VariantColor::Yellow - } - (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Y)) => { - VariantColor::Maroon - } - - (_, Species::OsseusDiscus, VariantSource::Material(Material::Boron)) => { - VariantColor::White - } - (_, Species::OsseusDiscus, VariantSource::Material(Material::Cadmium)) => { - VariantColor::White - } - (_, Species::OsseusDiscus, VariantSource::Material(Material::Mercury)) => { - VariantColor::Lime - } - (_, Species::OsseusDiscus, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Peach - } - (_, Species::OsseusDiscus, VariantSource::Material(Material::Niobium)) => { - VariantColor::Aquamarine - } - (_, Species::OsseusDiscus, VariantSource::Material(Material::Tin)) => { - VariantColor::Blue - } - (_, Species::OsseusDiscus, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Red - } - - (_, Species::OsseusPumice, VariantSource::Material(Material::Antimony)) => { - VariantColor::White - } - (_, Species::OsseusPumice, VariantSource::Material(Material::Polonium)) => { - VariantColor::Peach - } - (_, Species::OsseusPumice, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Gold - } - (_, Species::OsseusPumice, VariantSource::Material(Material::Technetium)) => { - VariantColor::Lime - } - (_, Species::OsseusPumice, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Green - } - (_, Species::OsseusPumice, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Yellow - } - - (_, Species::ReceptaConditivus, VariantSource::Material(Material::Yttrium)) => { - VariantColor::Green - } - (_, Species::ReceptaConditivus, VariantSource::Material(Material::Antimony)) => { - VariantColor::Lime - } - (_, Species::ReceptaConditivus, VariantSource::Material(Material::Polonium)) => { - VariantColor::White - } - (_, Species::ReceptaConditivus, VariantSource::Material(Material::Ruthenium)) => { - VariantColor::Yellow - } - (_, Species::ReceptaConditivus, VariantSource::Material(Material::Tellurium)) => { - VariantColor::Cyan - } - (_, Species::ReceptaConditivus, VariantSource::Material(Material::Technetium)) => { - VariantColor::Aquamarine - } - - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Boron)) => { - VariantColor::Lime - } - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Cadmium)) => { - VariantColor::Lime - } - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Mercury)) => { - VariantColor::Cyan - } - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Molybdenum)) => { - VariantColor::Gold - } - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Niobium)) => { - VariantColor::Mulberry - } - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Tin)) => { - VariantColor::Orange - } - (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Tungsten)) => { - VariantColor::Red - } + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Boron)) => VariantColor::Green, + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Cadmium)) => VariantColor::Green, + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Mercury)) => VariantColor::Yellow, + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Molybdenum)) => VariantColor::Cyan, + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Niobium)) => VariantColor::Gold, + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Tin)) => VariantColor::Orange, + (_, Species::FumerolaAquatis, VariantSource::Material(Material::Tungsten)) => VariantColor::Cobalt, + + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Boron)) => VariantColor::Orange, + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Cadmium)) => VariantColor::Orange, + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Mercury)) => VariantColor::Magenta, + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Molybdenum)) => VariantColor::Gold, + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Niobium)) => VariantColor::Cobalt, + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Tin)) => VariantColor::Cyan, + (_, Species::FumerolaCarbosis, VariantSource::Material(Material::Tungsten)) => VariantColor::Yellow, + + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Boron)) => VariantColor::Aquamarine, + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Cadmium)) => VariantColor::Aquamarine, + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Mercury)) => VariantColor::Lime, + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Molybdenum)) => VariantColor::Blue, + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Niobium)) => VariantColor::White, + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Tin)) => VariantColor::Peach, + (_, Species::FumerolaExtremus, VariantSource::Material(Material::Tungsten)) => VariantColor::Mulberry, + + (_, Species::FumerolaNitris, VariantSource::Material(Material::Boron)) => VariantColor::White, + (_, Species::FumerolaNitris, VariantSource::Material(Material::Cadmium)) => VariantColor::White, + (_, Species::FumerolaNitris, VariantSource::Material(Material::Mercury)) => VariantColor::Peach, + (_, Species::FumerolaNitris, VariantSource::Material(Material::Molybdenum)) => VariantColor::Lime, + (_, Species::FumerolaNitris, VariantSource::Material(Material::Niobium)) => VariantColor::Red, + (_, Species::FumerolaNitris, VariantSource::Material(Material::Tin)) => VariantColor::Mulberry, + (_, Species::FumerolaNitris, VariantSource::Material(Material::Tungsten)) => VariantColor::Aquamarine, + + (_, Species::FungoidaBullarum, VariantSource::Material(Material::Antimony)) => VariantColor::Red, + (_, Species::FungoidaBullarum, VariantSource::Material(Material::Polonium)) => VariantColor::Mulberry, + (_, Species::FungoidaBullarum, VariantSource::Material(Material::Ruthenium)) => VariantColor::Magenta, + (_, Species::FungoidaBullarum, VariantSource::Material(Material::Technetium)) => VariantColor::Peach, + (_, Species::FungoidaBullarum, VariantSource::Material(Material::Tellurium)) => VariantColor::Gold, + (_, Species::FungoidaBullarum, VariantSource::Material(Material::Yttrium)) => VariantColor::Orange, + + (_, Species::FungoidaGelata, VariantSource::Material(Material::Boron)) => VariantColor::Cyan, + (_, Species::FungoidaGelata, VariantSource::Material(Material::Cadmium)) => VariantColor::Cyan, + (_, Species::FungoidaGelata, VariantSource::Material(Material::Mercury)) => VariantColor::Lime, + (_, Species::FungoidaGelata, VariantSource::Material(Material::Molybdenum)) => VariantColor::Mulberry, + (_, Species::FungoidaGelata, VariantSource::Material(Material::Niobium)) => VariantColor::Green, + (_, Species::FungoidaGelata, VariantSource::Material(Material::Tin)) => VariantColor::Red, + (_, Species::FungoidaGelata, VariantSource::Material(Material::Tungsten)) => VariantColor::Orange, + + (_, Species::FungoidaSetisis, VariantSource::Material(Material::Antimony)) => VariantColor::Peach, + (_, Species::FungoidaSetisis, VariantSource::Material(Material::Polonium)) => VariantColor::White, + (_, Species::FungoidaSetisis, VariantSource::Material(Material::Ruthenium)) => VariantColor::Gold, + (_, Species::FungoidaSetisis, VariantSource::Material(Material::Technetium)) => VariantColor::Lime, + (_, Species::FungoidaSetisis, VariantSource::Material(Material::Tellurium)) => VariantColor::Yellow, + (_, Species::FungoidaSetisis, VariantSource::Material(Material::Yttrium)) => VariantColor::Orange, + + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Boron)) => VariantColor::Blue, + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Cadmium)) => VariantColor::Blue, + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Mercury)) => VariantColor::Green, + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Molybdenum)) => VariantColor::Magenta, + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Niobium)) => VariantColor::White, + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Tin)) => VariantColor::Orange, + (_, Species::FungoidaStabitis, VariantSource::Material(Material::Tungsten)) => VariantColor::Peach, + + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, // This is a guess + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::O)) => VariantColor::Emerald, // This is a guess + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, + (_, Species::OsseusCornibus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, + + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, // This is a guess + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, // This is a guess + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, + (_, Species::OsseusFractus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, + + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, // This is a guess + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, // This is a guess + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, + (_, Species::OsseusPellebantus, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, + + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::A)) => VariantColor::Lime, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Orange, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::F)) => VariantColor::Turquoise, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::G)) => VariantColor::Grey, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::K)) => VariantColor::Indigo, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::T)) => VariantColor::Emerald, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Green, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::O)) => VariantColor::Yellow, + (_, Species::OsseusSpiralis, VariantSource::StarClass(StarClass::Y)) => VariantColor::Maroon, + + (_, Species::OsseusDiscus, VariantSource::Material(Material::Boron)) => VariantColor::White, + (_, Species::OsseusDiscus, VariantSource::Material(Material::Cadmium)) => VariantColor::White, + (_, Species::OsseusDiscus, VariantSource::Material(Material::Mercury)) => VariantColor::Lime, + (_, Species::OsseusDiscus, VariantSource::Material(Material::Molybdenum)) => VariantColor::Peach, + (_, Species::OsseusDiscus, VariantSource::Material(Material::Niobium)) => VariantColor::Aquamarine, + (_, Species::OsseusDiscus, VariantSource::Material(Material::Tin)) => VariantColor::Blue, + (_, Species::OsseusDiscus, VariantSource::Material(Material::Tungsten)) => VariantColor::Red, + + (_, Species::OsseusPumice, VariantSource::Material(Material::Antimony)) => VariantColor::White, + (_, Species::OsseusPumice, VariantSource::Material(Material::Polonium)) => VariantColor::Peach, + (_, Species::OsseusPumice, VariantSource::Material(Material::Ruthenium)) => VariantColor::Gold, + (_, Species::OsseusPumice, VariantSource::Material(Material::Technetium)) => VariantColor::Lime, + (_, Species::OsseusPumice, VariantSource::Material(Material::Tellurium)) => VariantColor::Green, + (_, Species::OsseusPumice, VariantSource::Material(Material::Yttrium)) => VariantColor::Yellow, + + (_, Species::ReceptaConditivus, VariantSource::Material(Material::Yttrium)) => VariantColor::Green, + (_, Species::ReceptaConditivus, VariantSource::Material(Material::Antimony)) => VariantColor::Lime, + (_, Species::ReceptaConditivus, VariantSource::Material(Material::Polonium)) => VariantColor::White, + (_, Species::ReceptaConditivus, VariantSource::Material(Material::Ruthenium)) => VariantColor::Yellow, + (_, Species::ReceptaConditivus, VariantSource::Material(Material::Tellurium)) => VariantColor::Cyan, + (_, Species::ReceptaConditivus, VariantSource::Material(Material::Technetium)) => VariantColor::Aquamarine, + + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Boron)) => VariantColor::Lime, + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Cadmium)) => VariantColor::Lime, + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Mercury)) => VariantColor::Cyan, + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Molybdenum)) => VariantColor::Gold, + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Niobium)) => VariantColor::Mulberry, + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Tin)) => VariantColor::Orange, + (_, Species::ReceptaDeltahedronix, VariantSource::Material(Material::Tungsten)) => VariantColor::Red, // TODO figure out O and W. Possible remaining colors: Green and Indigo // O // W - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::L)) => { - VariantColor::Ocher - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::TTS)) => { - VariantColor::Sage - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::T)) => { - VariantColor::Teal - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::B)) => { - VariantColor::Turquoise - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::M)) => { - VariantColor::Maroon - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::A)) => { - VariantColor::Amethyst - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::F)) => { - VariantColor::Mauve - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::G)) => { - VariantColor::Orange - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::K)) => { - VariantColor::Red - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::D)) => { - VariantColor::Yellow - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::Y)) => { - VariantColor::Lime - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::N)) => { - VariantColor::Emerald - } - (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::Ae)) => { - VariantColor::Grey - } + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::L)) => VariantColor::Ocher, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::TTS)) => VariantColor::Sage, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::T)) => VariantColor::Teal, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::B)) => VariantColor::Turquoise, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::M)) => VariantColor::Maroon, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::A)) => VariantColor::Amethyst, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::F)) => VariantColor::Mauve, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::G)) => VariantColor::Orange, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::K)) => VariantColor::Red, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::D)) => VariantColor::Yellow, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::Y)) => VariantColor::Lime, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::N)) => VariantColor::Emerald, + (_, Species::ReceptaUmbrux, VariantSource::StarClass(StarClass::Ae)) => VariantColor::Grey, (Genus::Stratum, _, VariantSource::StarClass(StarClass::F)) => VariantColor::Emerald, (Genus::Stratum, _, VariantSource::StarClass(StarClass::K)) => VariantColor::Lime, From 88db7af0b4219f993f4c7098e2bb1cfa27147df9 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:21:24 +0200 Subject: [PATCH 15/17] =?UTF-8?q?=F0=9F=91=B7=20Update=20Clippy=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/clippy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml index f8278b5c..e7ef06ff 100644 --- a/.github/workflows/clippy.yaml +++ b/.github/workflows/clippy.yaml @@ -16,4 +16,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run Clippy - run: cargo clippy --all-targets --all-features + run: cargo clippy --all-targets From c473153e60ebce3ca3424001634352a30c3429a3 Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:24:06 +0200 Subject: [PATCH 16/17] =?UTF-8?q?=F0=9F=91=B7=20Update=20Clippy=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/clippy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml index e7ef06ff..60676f2d 100644 --- a/.github/workflows/clippy.yaml +++ b/.github/workflows/clippy.yaml @@ -16,4 +16,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run Clippy - run: cargo clippy --all-targets + run: cargo clippy From 4b1032ec35dc05504e312b2aebb0821fa7d2649c Mon Sep 17 00:00:00 2001 From: rster2002 Date: Sat, 10 Aug 2024 23:24:31 +0200 Subject: [PATCH 17/17] =?UTF-8?q?=F0=9F=91=B7=20Update=20Clippy=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/clippy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml index 60676f2d..c18aed8c 100644 --- a/.github/workflows/clippy.yaml +++ b/.github/workflows/clippy.yaml @@ -16,4 +16,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run Clippy - run: cargo clippy + run: cargo clippy --all-features