From ad219762b16ef16dff5bb659e7b3e50200a50d36 Mon Sep 17 00:00:00 2001 From: floribe2000 Date: Tue, 3 Oct 2023 01:03:32 +0200 Subject: [PATCH 1/4] fix auto coloring in charts --- WoWsShipBuilder.Common/wwwroot/scripts/ChartsHelper.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WoWsShipBuilder.Common/wwwroot/scripts/ChartsHelper.js b/WoWsShipBuilder.Common/wwwroot/scripts/ChartsHelper.js index b4dee8e4e..540ad5419 100644 --- a/WoWsShipBuilder.Common/wwwroot/scripts/ChartsHelper.js +++ b/WoWsShipBuilder.Common/wwwroot/scripts/ChartsHelper.js @@ -219,6 +219,7 @@ export function ChangeSuggestedMax(chartId, newSuggestedMax) export function CreateChart(chartId, title, xLabel, yLabel, xUnit, yUnit) { const ctx = document.getElementById(chartId); + const fixColor = (color, value) => Chart.helpers.color(color).opaquer(1).rgbString(); const chart = new Chart(ctx, { type: 'line', @@ -338,10 +339,10 @@ export function CreateChart(chartId, title, xLabel, yLabel, xUnit, yUnit) { mode: 'dataset', customize(context) { - const index = context.datasetIndex; + const colors = context.colors; return { - background: GetColor(index), - border: GetColor(index) + background: fixColor(colors.background, 0.5), + border: fixColor(colors.border, 0.5), }; } } From a62fbc42a3e2a3182266ae005464af0130fa6fd3 Mon Sep 17 00:00:00 2001 From: floribe2000 Date: Tue, 3 Oct 2023 17:32:37 +0200 Subject: [PATCH 2/4] fix plane HP calculation when air groups mod 2 is selected WG changed modifier names again, from planeHealth to planeHealthCoeff --- .../DataContainers/Aircraft/CvAircraftDataContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WoWsShipBuilder.Common/DataContainers/Aircraft/CvAircraftDataContainer.cs b/WoWsShipBuilder.Common/DataContainers/Aircraft/CvAircraftDataContainer.cs index 148db097e..28b957236 100644 --- a/WoWsShipBuilder.Common/DataContainers/Aircraft/CvAircraftDataContainer.cs +++ b/WoWsShipBuilder.Common/DataContainers/Aircraft/CvAircraftDataContainer.cs @@ -240,7 +240,7 @@ private static CvAircraftDataContainer ProcessCvPlane(Aircraft plane, int shipTi break; } - var allPlaneHpModifiers = modifiers.FindModifiers("planeHealth", true); + var allPlaneHpModifiers = modifiers.FindModifiers("planeHealthCoeff", true); var finalPlaneHp = (int)Math.Round(allPlaneHpModifiers.Aggregate(planeHp, (current, modifier) => current * modifier), 0); int planeHpPerTierIndex = modifiers.FindModifierIndex("planeHealthPerLevel"); From 14db6a00d1d7cdfe43ad808c8906c42203f64e65 Mon Sep 17 00:00:00 2001 From: floribe2000 Date: Sat, 14 Oct 2023 13:12:01 +0200 Subject: [PATCH 3/4] fix speed boost bonus calculation The speed boost consumable bonus is additive, not multiplicative. --- .../DataContainers/Ship/ManeuverabilityDataContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs b/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs index 9e1ad3d8d..de97c1355 100644 --- a/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs +++ b/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs @@ -67,10 +67,10 @@ public static ManeuverabilityDataContainer FromShip(Ship ship, List decimal maxSpeedModifier = modifiers.FindModifiers("speedCoef", true).Aggregate(1m, (current, modifier) => current * (decimal)modifier); maxSpeedModifier = modifiers.FindModifiers("shipSpeedCoeff", true).Aggregate(maxSpeedModifier, (current, modifier) => current * (decimal)modifier); - var speedBoostModifier = modifiers.FindModifiers("speedBoost_boostCoeff", true).Sum(); // Speed boost is additive + var speedBoostModifier = modifiers.FindModifiers("speedBoost_boostCoeff", true).Sum(); if (speedBoostModifier != 0) { - maxSpeedModifier *= (decimal)(1 + speedBoostModifier + modifiers.FindModifiers("boostCoeffForsage").Sum()); // needed for Halland UU + maxSpeedModifier += (decimal)(1 + speedBoostModifier + modifiers.FindModifiers("boostCoeffForsage").Sum()); // Speed boost is additive, Halland UU bonus only applies if regular speed boost is active } decimal maxDiveSpeedModifier = modifiers.FindModifiers("maxBuoyancySpeedCoeff", true).Aggregate(1m, (current, modifier) => current * (decimal)modifier); From 9b842972514241353b0debe799314a24e70e63e8 Mon Sep 17 00:00:00 2001 From: floribe2000 Date: Sat, 14 Oct 2023 13:13:22 +0200 Subject: [PATCH 4/4] correction for previous speed boost fix when using additive calculation, no +1 must be applied to the modifier --- .../DataContainers/Ship/ManeuverabilityDataContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs b/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs index de97c1355..45420638e 100644 --- a/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs +++ b/WoWsShipBuilder.Common/DataContainers/Ship/ManeuverabilityDataContainer.cs @@ -70,7 +70,7 @@ public static ManeuverabilityDataContainer FromShip(Ship ship, List var speedBoostModifier = modifiers.FindModifiers("speedBoost_boostCoeff", true).Sum(); if (speedBoostModifier != 0) { - maxSpeedModifier += (decimal)(1 + speedBoostModifier + modifiers.FindModifiers("boostCoeffForsage").Sum()); // Speed boost is additive, Halland UU bonus only applies if regular speed boost is active + maxSpeedModifier += (decimal)(speedBoostModifier + modifiers.FindModifiers("boostCoeffForsage").Sum()); // Speed boost is additive, Halland UU bonus only applies if regular speed boost is active } decimal maxDiveSpeedModifier = modifiers.FindModifiers("maxBuoyancySpeedCoeff", true).Aggregate(1m, (current, modifier) => current * (decimal)modifier);