Skip to content

Commit

Permalink
poi submission fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
myangelkamikaze committed Dec 8, 2024
1 parent e48a485 commit 44e916c
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 278 deletions.
96 changes: 0 additions & 96 deletions ElectronicObserver/Data/PoiDbSubmission/FormDataExtensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ private void SubmitData(JsonNode apiDestructionBattle)

foreach ((string key, JsonNode? value) in apiDestructionBattle.AsObject())
{
if (key is "api_air_base_attack")
{
dictionarySubmission.Add(key, value?.ToJsonString());
continue;
}

dictionarySubmission.Add(key, value);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,44 @@
using System.Text.Json.Serialization;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;

namespace ElectronicObserver.Data.PoiDbSubmission.PoiDbFriendFleetSubmission;

public class PoiDbFriendFleetSubmissionData
{
[JsonPropertyName("body")]
public required Body Body { get; init; }
[JsonPropertyName("maparea_id")]
public required int World { get; init; }

[JsonPropertyName("mapinfo_no")]
public required int Map { get; init; }

[JsonPropertyName("curCellId")]
public required int Cell { get; init; }

[JsonPropertyName("mapLevel")]
public required int MapLevel { get; init; }

[JsonPropertyName("friendly_status")]
public required FriendlyStatus FriendlyStatus { get; init; }

[JsonPropertyName("api_friendly_battle")]
public required JsonNode ApiFriendlyBattle { get; init; }

[JsonPropertyName("escapeList")]
public required List<int> EscapeList { get; init; }

[JsonPropertyName("formation")]
public required int Formation { get; init; }

[JsonPropertyName("enemy")]
public required Dictionary<string, JsonNode?> Enemy { get; init; }

[JsonPropertyName("deck1")]
public required List<JsonNode> Deck1 { get; init; }

[JsonPropertyName("deck2")]
public required List<JsonNode>? Deck2 { get; init; }

[JsonPropertyName("version")]
public required string Version { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,38 +193,35 @@ private void SubmitData()
{
PoiDbFriendFleetSubmissionData submissionData = new()
{
Body = new()
World = world,
Map = map,
Cell = cell,
MapLevel = eventDifficulty,
FriendlyStatus = new()
{
World = world,
Map = map,
Cell = cell,
MapLevel = eventDifficulty,
FriendlyStatus = new()
{
FirenumBefore = TorchesBefore,
Firenum = TorchesAfter,
Flag = friendFleetRequestFlag,
Type = friendFleetRequestType,
NowMaphp = mapInfo.ApiEventmap?.ApiNowMaphp ?? 0,
MaxMaphp = mapInfo.ApiEventmap?.ApiNowMaphp ?? 0,
Version = Version,
},
ApiFriendlyBattle = ApiFriendlyBattle,
EscapeList = EscapeList,
Formation = playerFormation,
Enemy = Enemy,
Deck1 = Deck1,
Deck2 = Deck2,
FirenumBefore = TorchesBefore,
Firenum = TorchesAfter,
Flag = friendFleetRequestFlag,
Type = friendFleetRequestType,
NowMaphp = mapInfo.ApiEventmap?.ApiNowMaphp ?? 0,
MaxMaphp = mapInfo.ApiEventmap?.ApiNowMaphp ?? 0,
Version = Version,
},
ApiFriendlyBattle = ApiFriendlyBattle,
EscapeList = EscapeList,
Formation = playerFormation,
Enemy = Enemy,
Deck1 = Deck1,
Deck2 = Deck2,
Version = Version,
};

Dictionary<string, Dictionary<string, JsonNode?>> dictionarySubmission = JsonSerializer
.Deserialize<Dictionary<string, Dictionary<string, JsonNode?>>>(JsonSerializer.Serialize(submissionData))!;
Dictionary<string, JsonNode?> dictionarySubmission = JsonSerializer
.Deserialize<Dictionary<string, JsonNode?>>(JsonSerializer.Serialize(submissionData))!;

foreach ((string key, JsonNode? value) in ApiFriendlyInfo.AsObject())
{
dictionarySubmission["body"].Add(key, value);
dictionarySubmission.Add(key, value);
}

Task.Run(async () =>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
using System.Text.Json.Serialization;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using ElectronicObserver.KancolleApi.Types.Models;

namespace ElectronicObserver.Data.PoiDbSubmission.PoiDbQuestSubmission;

public class PoiDbQuestSubmissionData
{
[JsonPropertyName("form")]
public required Form Form { get; init; }
[JsonPropertyName("current")]
public required int CompletedQuestId { get; init; }

[JsonPropertyName("after")]
public required List<int> NewQuestIds { get; init; }

/// <summary>
/// Should be <see cref="ApiListClass" /> but we're skipping deserialization to avoid data loss.
/// </summary>
[JsonPropertyName("detail")]
public required List<JsonNode> NewQuestData { get; init; }

[JsonPropertyName("version")]
public required string Version { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,10 @@ private void SubmitData()

PoiDbQuestSubmissionData submissionData = new()
{
Form = new()
{
CompletedQuestId = completedQuestId,
NewQuestIds = newlyUnlockedQuestIds,
NewQuestData = newQuestData,
Version = Version,
}
CompletedQuestId = completedQuestId,
NewQuestIds = newlyUnlockedQuestIds,
NewQuestData = newQuestData,
Version = Version,
};

Task.Run(async () =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Text.Json.Serialization;

namespace ElectronicObserver.Data.PoiDbSubmission.PoiDbRouteSubmission;

public class PoiDbRouteEquipment
{
[JsonPropertyName("api_id")]
public required int ApiId { get; init; }

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

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

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

[JsonPropertyName("api_alv")]
public required int ApiAlv { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Text.Json.Serialization;

namespace ElectronicObserver.Data.PoiDbSubmission.PoiDbRouteSubmission;

public class PoiDbRouteShip
{
[JsonPropertyName("api_ship_id")]
public required int ApiShipId { get; init; }

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

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

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

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

[JsonPropertyName("api_slotitem_level")]
public required int ApiSlotitemLevel { get; init; }
}
Loading

0 comments on commit 44e916c

Please sign in to comment.