Skip to content

Commit

Permalink
fix poi route submission types
Browse files Browse the repository at this point in the history
  • Loading branch information
myangelkamikaze committed Dec 16, 2024
1 parent 966f653 commit 4f96bd3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions ElectronicObserver/Data/PoiDbSubmission/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public static JsonNode MakeShip(this IShipData ship)
null => null,
_ => new()
{
ApiId = equipment.MasterID,
ApiSlotitemId = equipment.EquipmentID,
ApiId = equipment.MasterID.ToString(),
ApiSlotitemId = equipment.EquipmentID.ToString(),
ApiLocked = equipment.IsLocked switch
{
true => 1,
false => 0,
true => "1",
false => "0",
},
ApiLevel = equipment.Level,
ApiAlv = equipment.AircraftLevel,
ApiLevel = equipment.Level.ToString(),
ApiAlv = equipment.AircraftLevel.ToString(),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ namespace ElectronicObserver.Data.PoiDbSubmission.PoiDbRouteSubmission;
public class PoiDbRouteEquipment
{
[JsonPropertyName("api_id")]
public required int ApiId { get; init; }
public required string ApiId { get; init; }

[JsonPropertyName("api_slotitem_id")]
public required int ApiSlotitemId { get; init; }
public required string ApiSlotitemId { get; init; }

[JsonPropertyName("api_locked")]
public required int ApiLocked { get; init; }
public required string ApiLocked { get; init; }

[JsonPropertyName("api_level")]
public required int ApiLevel { get; init; }
public required string ApiLevel { get; init; }

[JsonPropertyName("api_alv")]
public required int ApiAlv { get; init; }
public required string ApiAlv { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ namespace ElectronicObserver.Data.PoiDbSubmission.PoiDbRouteSubmission;
public class PoiDbRouteShip
{
[JsonPropertyName("api_ship_id")]
public required int ApiShipId { get; init; }
public required string ApiShipId { get; init; }

[JsonPropertyName("api_lv")]
public required int ApiLv { get; init; }
public required string ApiLv { get; init; }

[JsonPropertyName("api_sally_area")]
public required int? ApiSallyArea { get; init; }
public required string? ApiSallyArea { get; init; }

[JsonPropertyName("api_soku")]
public required int ApiSoku { get; init; }
public required string ApiSoku { get; init; }

[JsonPropertyName("api_slotitem_ex")]
public required int ApiSlotitemEx { get; init; }
public required string ApiSlotitemEx { get; init; }

[JsonPropertyName("api_slotitem_level")]
public required int ApiSlotitemLevel { get; init; }
public required string ApiSlotitemLevel { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private void SubmitData()
List<List<object>> slot1 = Fleet1.MembersInstance!
.OfType<ShipData>()
.Select(s => s.SlotInstance
.Select(e => e.MakePoiEquipment() ?? (object)-1)
.Select(e => e.MakePoiEquipment() ?? (object)"-1")
.ToList())
.ToList();

Expand Down Expand Up @@ -209,16 +209,16 @@ private void SubmitData()

private static PoiDbRouteShip MakeShip(IShipData ship) => new()
{
ApiShipId = ship.ShipID,
ApiLv = ship.Level,
ApiShipId = ship.ShipID.ToString(),
ApiLv = ship.Level.ToString(),
ApiSallyArea = ship.SallyArea switch
{
> 0 => ship.SallyArea,
> 0 => ship.SallyArea.ToString(),
_ => null,
},
ApiSoku = ship.Speed,
ApiSlotitemEx = ship.ExpansionSlotInstance?.EquipmentID ?? -1,
ApiSlotitemLevel = ship.ExpansionSlotInstance?.Level ?? -1,
ApiSoku = ship.Speed.ToString(),
ApiSlotitemEx = ship.ExpansionSlotInstance?.EquipmentID.ToString() ?? "-1",
ApiSlotitemLevel = ship.ExpansionSlotInstance?.Level.ToString() ?? "-1",
};

[return: NotNullIfNotNull(nameof(fleet))]
Expand Down

0 comments on commit 4f96bd3

Please sign in to comment.