Skip to content

Commit

Permalink
add searchlight to night battle csv exports
Browse files Browse the repository at this point in the history
  • Loading branch information
myangelkamikaze committed Oct 27, 2023
1 parent 72ae56c commit e18d9cf
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,10 @@
<data name="RedTorpedoBattle" xml:space="preserve">
<value>赤仮雷撃戦</value>
</data>
<data name="PlayerSearchlight" xml:space="preserve">
<value>自探照灯</value>
</data>
<data name="EnemySearchlight" xml:space="preserve">
<value>敵探照灯</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ public async Task<List<NightBattleExportModel>> NightBattle(
Defender = MakeShip(attack.Defender, attackDisplay.DefenderIndex, attackDisplay.DefenderHpBeforeAttacks[attackIndex], defenderAfterBattle),
FleetType = Constants.GetCombinedFleet(playerFleet.FleetType),
EnemyFleetType = GetEnemyFleetType(fleets.EnemyEscortFleet is not null),
PlayerSearchlight = SearchlightIndex(initial.SearchlightIndexFriend),
EnemySearchlight = SearchlightIndex(initial.SearchlightIndexEnemy),
});
}
}
Expand Down Expand Up @@ -872,6 +874,12 @@ private static string SquareString(SortieDetailViewModel sortieDetail, SortieNod
_ => index + 1,
};

private static int? SearchlightIndex(int index) => index switch
{
-1 => null,
_ => index + 1,
};

private static string GetPlayerFleet(BattleFleets fleets, BattleIndex attackerIndex, BattleIndex defenderIndex)
{
BattleIndex index = attackerIndex.FleetFlag switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ public NightBattleExportMap()
References<ShipExportMap>(s => s.Defender, CsvExportResources.PrefixDefender).Prefix(CsvExportResources.PrefixDefender);
Map(m => m.FleetType).Name(CsvExportResources.FleetType);
Map(m => m.EnemyFleetType).Name(CsvExportResources.EnemyFleetType);
Map(m => m.PlayerSearchlight).Name(CsvExportResources.PlayerSearchlight);
Map(m => m.EnemySearchlight).Name(CsvExportResources.EnemySearchlight);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ public record NightBattleExportModel
public ShipExportModel Defender { get; init; }
public string FleetType { get; init; }
public string EnemyFleetType { get; init; }
public int? PlayerSearchlight { get; init; }
public int? EnemySearchlight { get; init; }
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ public RedNightBattleExportMap()
References<RedShipExportMap>(s => s.Defender, CsvExportResources.PrefixDefender).Prefix(CsvExportResources.PrefixDefender);
Map(m => m.FleetType).Name(CsvExportResources.FleetType);
Map(m => m.EnemyFleetType).Name(CsvExportResources.EnemyFleetType);
Map(m => m.PlayerSearchlight).Name(CsvExportResources.PlayerSearchlight);
Map(m => m.EnemySearchlight).Name(CsvExportResources.EnemySearchlight);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class PhaseNightInitial : PhaseBase
private IShipData? FlareFriend { get; }
private IShipData? FlareEnemy { get; }

private int SearchlightIndexFriend { get; }
private int SearchlightIndexEnemy { get; }
public int SearchlightIndexFriend { get; }
public int SearchlightIndexEnemy { get; }
private IShipData? SearchlightFriend { get; }
private IShipData? SearchlightEnemy { get; }

Expand Down

0 comments on commit e18d9cf

Please sign in to comment.