Skip to content

Commit

Permalink
Merge pull request #260 from WoWs-Builder-Team/development
Browse files Browse the repository at this point in the history
Update 2.2 (Desktop)
  • Loading branch information
floribe2000 authored Sep 17, 2023
2 parents 8ff2e7d + 29f4eb5 commit b565ff6
Show file tree
Hide file tree
Showing 120 changed files with 3,774 additions and 3,188 deletions.
51 changes: 24 additions & 27 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
# noinspection EditorConfigKeyCorrectness
[*]
indent_style = space
charset = utf-8-bom
charset = utf-8
end_of_line = crlf
trim_trailing_whitespace = false
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 4
tab_width = 4

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
csharp_style_var_for_built_in_types = false:suggestion
dotnet_naming_rule.private_constants_rule.import_to_resharper = as_predefined
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
Expand All @@ -30,12 +27,6 @@ dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = as_predefi
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
dotnet_naming_rule.unity_serialized_field_rule.severity = warning
dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
Expand All @@ -49,13 +40,15 @@ dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none

csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
csharp_style_var_elsewhere = false:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
Expand All @@ -80,8 +73,10 @@ resharper_csharp_wrap_after_declaration_lpar = true
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_for_built_in_types = use_var_when_evident
resharper_for_other_types = use_var_when_evident
resharper_for_simple_types = use_var
resharper_object_creation_when_type_not_evident = target_typed
resharper_parentheses_non_obvious_operations = none, bitwise, bitwise_inclusive_or, bitwise_exclusive_or, shift, arithmetic, additive, multiplicative, bitwise_and
resharper_parentheses_redundancy_style = remove_if_not_clarifies_precedence
resharper_parentheses_non_obvious_operations = bitwise, shift, arithmetic
resharper_place_accessorholder_attribute_on_same_line = false
resharper_place_field_attribute_on_same_line = false
resharper_trailing_comma_in_multiline_lists = true
Expand All @@ -102,18 +97,15 @@ resharper_web_config_module_not_resolved_highlighting = warning
resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning

[*.csproj]
indent_size = 4

[*.pubxml]
indent_size = 2

[*.csproj]
ij_xml_space_inside_empty_tag = true

# noinspection EditorConfigKeyCorrectness
[*.cs]
max_line_length = 160
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
resharper_wrap_lines = false

dotnet_diagnostic.rs2008.severity = none # Ignore analyzer release tracking
Expand Down Expand Up @@ -152,10 +144,15 @@ dotnet_diagnostic.sa1642.severity = none # Constructor summary can have any text
dotnet_diagnostic.sa1643.severity = none # Destructor summary can have any text
dotnet_diagnostic.sa1648.severity = none # Inherit doc can be used wherever you want

dotnet_diagnostic.CA1848.severity = none # Ignore logger message performance
dotnet_diagnostic.CA1304.severity = suggestion # Specify cultureInfo
dotnet_diagnostic.CA1309.severity = suggestion # Use ordinal StringComparison
dotnet_diagnostic.CA1311.severity = suggestion # Specify a culture or use an invariant version
dotnet_diagnostic.CA1822.severity = suggestion # Mark member as static

[*.axaml]
max_line_length = 160

[*.{yaml,yml,json}]
indent_style = space
[*.{yaml,yml,json,props,targets,xml,resx}]
indent_size = 2
tab_width = 2
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup>
</Project>
2 changes: 0 additions & 2 deletions Tools/SquirrelBuildAndRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ dotnet build dirs.proj -c $buildConfig
Write-Output "Publishing build"
dotnet publish WoWsShipBuilder.Desktop -c $buildConfig -p:PublishProfile=PublishWindows
$publishDir = "WoWsShipBuilder.Desktop\bin\$buildConfig\publish"
Copy-Item -Path WoWsShipBuilder.Desktop\bin\$buildConfig\$frameworkVersion\runtimes\win7-x64\native\av_libGLESv2.dll -Destination $publishDir
Copy-Item -Path WoWsShipBuilder.Desktop\bin\$buildConfig\$frameworkVersion\Third-Party-Licenses.txt -Destination $publishDir

Write-Output "Creating Squirrel.Windows release"
$version = Get-Content -Path WoWsShipBuilder.Desktop\buildInfo.txt
Expand Down
3 changes: 3 additions & 0 deletions WoWsShipBuilder.Common.Test/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.cs]
dotnet_diagnostic.CA1707.severity = none # Allow underscores
dotnet_diagnostic.CA1822.severity = none # Member does not access instance data
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using WoWsShipBuilder.DataElements.DataElementAttributes;
using WoWsShipBuilder.DataElements.DataElements;
using WoWsShipBuilder.DataStructures;
Expand Down Expand Up @@ -299,7 +300,7 @@ private static CvAircraftDataContainer ProcessCvPlane(Aircraft plane, int shipTi
List<ConsumableDataContainer> consumables = new();
foreach (var consumable in plane.AircraftConsumable)
{
var consumableDataContainer = ConsumableDataContainer.FromTypeAndVariant(consumable, modifiers, true, finalPlaneHp, 0, ShipClass.AirCarrier);
var consumableDataContainer = ConsumableDataContainer.FromTypeAndVariant(consumable, modifiers, true, 0, ShipClass.AirCarrier);
consumables.Add(consumableDataContainer);
}

Expand Down Expand Up @@ -341,8 +342,8 @@ private static CvAircraftDataContainer ProcessCvPlane(Aircraft plane, int shipTi
PreparationTime = plane.PreparationTime,
PostAttackInvulnerabilityDuration = plane.PostAttackInvulnerabilityDuration,
DamageTakenDuringAttack = (int)Math.Round(plane.DamageTakenMultiplier * 100),
AimingRateMoving = (aimingRateMoving * 100).ToString(stringFormat),
AimingPreparationRateMoving = (preparationAimingRateMoving * 100).ToString(stringFormat),
AimingRateMoving = (aimingRateMoving * 100).ToString(stringFormat, CultureInfo.InvariantCulture),
AimingPreparationRateMoving = (preparationAimingRateMoving * 100).ToString(stringFormat, CultureInfo.InvariantCulture),
TimeToFullyAimed = Math.Round(fullAimTime, 1),
ConcealmentFromShips = (decimal)planesConcealmentFromShips,
ConcealmentFromPlanes = (decimal)planesConcealmentFromPlanes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public partial record MainBatteryDataContainer : DataContainerBase
{
var current = arrangementList[i];
turretNames.Add(current.GunName);
arrangementString.AppendLine($"{current.TurretCount}x{current.BarrelCount} {{{i}}}");
arrangementString.AppendLine(CultureInfo.InvariantCulture, $"{current.TurretCount}x{current.BarrelCount} {{{i}}}");
barrelLayout[i] = $"{current.TurretCount}x{current.BarrelCount}";
barrelCount += current.TurretCount * current.BarrelCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public partial record TorpedoArmamentDataContainer : DataContainerBase
{
var current = arrangementList[i];
launcherNames.Add(current.LauncherName);
arrangementString.AppendLine($"{current.LauncherCount}x{current.BarrelCount} {{{i}}}");
arrangementString.AppendLine(CultureInfo.InvariantCulture, $"{current.LauncherCount}x{current.BarrelCount} {{{i}}}");
torpLayout[i] = $"{current.LauncherCount}x{current.BarrelCount}";
torpCount += current.LauncherCount * current.BarrelCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public static DepthChargeDataContainer FromChargesName(string name, IEnumerable<
decimal maxSpeed = (decimal)(depthCharge.SinkingSpeed * (1 + depthCharge.SinkingSpeedRng)) * Constants.KnotsToMps;
decimal minTimer = (decimal)(depthCharge.DetonationTimer - depthCharge.DetonationTimerRng);
decimal maxTimer = (decimal)(depthCharge.DetonationTimer + depthCharge.DetonationTimerRng);
decimal minDetDepth = minSpeed * minTimer;
decimal maxDetDepth = maxSpeed * maxTimer;
decimal minDetDepth = minSpeed * minTimer / 2;
decimal maxDetDepth = maxSpeed * maxTimer / 2;

var depthChargeDataContainer = new DepthChargeDataContainer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using Microsoft.Extensions.Logging;
using WoWsShipBuilder.DataElements.DataElementAttributes;
using WoWsShipBuilder.DataElements.DataElements;
Expand Down Expand Up @@ -34,17 +35,17 @@ public partial record ConsumableDataContainer : DataContainerBase

public Dictionary<string, float> Modifiers { get; set; } = null!;

public static ConsumableDataContainer FromTypeAndVariant(ShipConsumable consumable, List<(string name, float value)> modifiers, bool isCvPlanes, int planesHp, int shipHp, ShipClass shipClass)
public static ConsumableDataContainer FromTypeAndVariant(ShipConsumable consumable, List<(string name, float value)> modifiers, bool isCvPlanes, int shipHp, ShipClass shipClass)
{
return FromTypeAndVariant(consumable.ConsumableName, consumable.ConsumableVariantName, consumable.Slot, modifiers, isCvPlanes, planesHp, shipHp, shipClass);
return FromTypeAndVariant(consumable.ConsumableName, consumable.ConsumableVariantName, consumable.Slot, modifiers, isCvPlanes, shipHp, shipClass);
}

public static ConsumableDataContainer FromTypeAndVariant(AircraftConsumable consumable, List<(string name, float value)> modifiers, bool isCvPlanes, int planesHp, int shipHp, ShipClass shipClass)
public static ConsumableDataContainer FromTypeAndVariant(AircraftConsumable consumable, List<(string name, float value)> modifiers, bool isCvPlanes, int shipHp, ShipClass shipClass)
{
return FromTypeAndVariant(consumable.ConsumableName, consumable.ConsumableVariantName, consumable.Slot, modifiers, isCvPlanes, planesHp, shipHp, shipClass);
return FromTypeAndVariant(consumable.ConsumableName, consumable.ConsumableVariantName, consumable.Slot, modifiers, isCvPlanes, shipHp, shipClass);
}

private static ConsumableDataContainer FromTypeAndVariant(string name, string variant, int slot, List<(string name, float value)> modifiers, bool isCvPlanes, int planesHp, int shipHp, ShipClass shipClass)
private static ConsumableDataContainer FromTypeAndVariant(string name, string variant, int slot, List<(string name, float value)> modifiers, bool isCvPlanes, int shipHp, ShipClass shipClass)
{
var consumableIdentifier = $"{name} {variant}";
var usingFallback = false;
Expand Down Expand Up @@ -109,12 +110,12 @@ private static ConsumableDataContainer FromTypeAndVariant(string name, string va

var plane = AppData.FindAircraft(consumable.PlaneName.Substring(0, consumable.PlaneName.IndexOf("_", StringComparison.Ordinal)));
consumableModifiers.Add("cruisingSpeed", plane.Speed);
consumableModifiers.Add("maxViewDistance", (float)plane.SpottingOnShips);
consumableModifiers.Add("concealment", (float)plane.ConcealmentFromShips);
consumableModifiers.Add("maxKills", consumableModifiers["fightersNum"]);

var maxViewDistanceModifiers = modifiers.FindModifiers("interceptorSelected").ToList();
var maxViewDistance = maxViewDistanceModifiers.Aggregate(consumableModifiers["maxViewDistance"], (current, modifier) => current * modifier);
var baseMaxViewDistance = (float)plane.SpottingOnShips;
var maxViewDistance = maxViewDistanceModifiers.Aggregate(baseMaxViewDistance, (current, modifier) => current * modifier);
consumableModifiers["maxViewDistance"] = maxViewDistance;
if (maxViewDistanceModifiers.Count > 0)
{
Expand All @@ -140,11 +141,14 @@ private static ConsumableDataContainer FromTypeAndVariant(string name, string va
var talentUsesModifiers = modifiers.FindModifiers("numConsumables", true);
uses = talentUsesModifiers.Aggregate(uses, (current, modifier) => (int)(current + modifier));

var allCooldownModifiers = modifiers.FindModifiers($"ConsumableReloadTime_{shipClass.ShipClassToString()}");
cooldown = allCooldownModifiers.Aggregate(cooldown, (current, modifier) => (current * modifier));
var allCooldownModifiers = modifiers.FindModifiers($"ConsumableReloadTime_{shipClass.ShipClassToString()}", true);
cooldown = allCooldownModifiers.Aggregate(cooldown, (current, modifier) => current * modifier);

allCooldownModifiers = modifiers.FindModifiers("ConsumableReloadTime", true);
cooldown = allCooldownModifiers.Aggregate(cooldown, (current, modifier) => current * modifier);

var allWorkModifiers = modifiers.FindModifiers("ConsumablesWorkTime");
workTime = allWorkModifiers.Aggregate(workTime, (current, modifier) => (current * modifier));
workTime = allWorkModifiers.Aggregate(workTime, (current, modifier) => current * modifier);

if (name.Contains("PCY011", StringComparison.InvariantCultureIgnoreCase))
{
Expand Down Expand Up @@ -178,8 +182,6 @@ private static ConsumableDataContainer FromTypeAndVariant(string name, string va

var regenerationSpeedModifiers = modifiers.FindModifiers("regenerationHPSpeed", true);
var regenerationSpeed = regenerationSpeedModifiers.Aggregate(consumableModifiers["regenerationHPSpeed"], (current, modifier) => current * modifier);
var regenerationEfficiencyModifiers = modifiers.FindModifiers("regeneratedHPPartCoef", true);
regenerationSpeed = regenerationEfficiencyModifiers.Aggregate(regenerationSpeed, (current, modifier) => current * (1 + modifier));
consumableModifiers["regenerationHPSpeed"] = regenerationSpeed;

var hpPerHeal = (float)Math.Round(workTime * (regenerationSpeed * shipHp));
Expand Down Expand Up @@ -247,11 +249,11 @@ private static ConsumableDataContainer FromTypeAndVariant(string name, string va
var plane = AppData.FindAircraft(consumable.PlaneName[..consumable.PlaneName.IndexOf("_", StringComparison.Ordinal)]);
consumableModifiers.Add("cruisingSpeed", plane.Speed);
consumableModifiers.Add("maxViewDistance", (float)plane.SpottingOnShips);
consumableModifiers.Add("concealment", (float)plane.ConcealmentFromShips);
consumableModifiers.Add("maxKills", consumableModifiers["fightersNum"]);

var concealment = (float)plane.ConcealmentFromShips;
var planesConcealmentModifiers = modifiers.FindModifiers("planeVisibilityFactor");
var planesConcealment = planesConcealmentModifiers.Aggregate(consumableModifiers["concealment"], (current, modifier) => current * modifier);
var planesConcealment = planesConcealmentModifiers.Aggregate(concealment, (current, modifier) => current * modifier);
consumableModifiers["concealment"] = planesConcealment;
}
else if (name.Contains("PCY018", StringComparison.InvariantCultureIgnoreCase))
Expand Down Expand Up @@ -279,7 +281,7 @@ private static ConsumableDataContainer FromTypeAndVariant(string name, string va
var consumableDataContainer = new ConsumableDataContainer
{
Name = localizationKey,
NumberOfUses = consumable.NumConsumables != -1 ? uses.ToString() : "",
NumberOfUses = consumable.NumConsumables != -1 ? uses.ToString(CultureInfo.InvariantCulture) : "",
IconName = iconName,
Slot = slot,
Desc = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public partial record SpecialAbilityDataContainer : DataContainerBase
specialDataContainer = new()
{
Name = $"DOCK_RAGE_MODE_TITLE_{specialAbility.Name}",
Description = $"RAGE_MODE_DESCRIPTION_{specialAbility.ActivatorName}",
Description = specialAbility.ActivatorName.Equals("RibbonActivator") ? $"RAGE_MODE_TRIGGER_DESCRIPTION_{specialAbility.ActivatorName}" : $"RAGE_MODE_DESCRIPTION_{specialAbility.ActivatorName}",
Duration = Math.Round((decimal)specialAbility.Duration, 1),
TargetAreaRadius = Math.Round((decimal)(specialAbility.ActivatorRadius / 1000), 1),
ProgressPerAction = (decimal)specialAbility.ProgressPerAction,
Expand Down
Loading

0 comments on commit b565ff6

Please sign in to comment.