public void Damecon()\r
{\r
var logs = ReadAllLines("damecon_001");\r
- var items = _itemInfo.InjectItems(new[]{43});\r
+ var items = JsonParser.Parse("[[[],[],[],[],[43]]]");\r
dynamic battle = JsonParser.Parse(logs[2]);\r
- _shipInfo.InjectShips(battle);\r
- _shipInfo.GetStatus(5).Slot = new []{items[0]};\r
+ _shipInfo.InjectShips(battle, items);\r
_battleInfo.InspectBattle(battle, logs[0]);\r
dynamic result = JsonParser.Parse(logs[5]);\r
_battleInfo.InspectBattleResult(result);\r
- PAssert.That(() => _shipInfo.GetStatus(5).NowHp == 31);\r
+ PAssert.That(() => _shipInfo.GetShipStatuses(2)[4].NowHp == 31);\r
}\r
}\r
}
\ No newline at end of file
foreach (var logs in _battleApiLog)\r
RemoveUnwantedInformation(ref logs[1], ref logs[2]);\r
var version = string.Join(".", Application.ProductVersion.Split('.').Take(2));\r
- var api = CompressApi(string.Join("\r\n", _battleApiLog.Select(logs => string.Join("\r\n", logs))));\r
+ var api = CompressApi(string.Join("\r\n",\r
+ new[] {BattleStartSlots()}.Concat(_battleApiLog.SelectMany(logs => logs))));\r
var rank = _sniffer.Battle.DisplayedResultRank;\r
var status = string.Join("\r\n", new[]\r
{\r
return result;\r
}\r
\r
+ private string BattleStartSlots()\r
+ {\r
+ return JsonObject.CreateJsonObject((from ship in _sniffer.BattleStartStatus\r
+ group ship by ship.Fleet\r
+ into fleet\r
+ select\r
+ (from s in fleet\r
+ select (from item in s.AllSlot select item.Spec.Id).ToArray()\r
+ ).ToArray()\r
+ ).ToArray()).ToString();\r
+ }\r
+\r
private string HpDiffLog() => string.Join(" ",\r
from pair in _sniffer.BattleResultStatusDiff\r
let assumed = pair.Assumed\r
private ShipStatus[] _battleResult = new ShipStatus[0];\r
public ShipStatusPair[] BattleResultDiff { get; private set; } = new ShipStatusPair[0];\r
public bool IsBattleResultError => BattleResultDiff.Length > 0;\r
+ public ShipStatus[] BattleStartStatus { get; private set; } = new ShipStatus[0];\r
\r
public class ShipStatusPair\r
{\r
_battleResult = new ShipStatus[0];\r
}\r
\r
+ public void SaveBattleStartStatus()\r
+ {\r
+ BattleStartStatus = _decks.Where((deck, i) => _inSortie[i])\r
+ .SelectMany(deck => deck.Select(id => (ShipStatus)GetStatus(id).Clone())).ToArray();\r
+ }\r
+\r
private void ClearShipInfo()\r
{\r
_shipInfo.Clear();\r
set => _shipMaster.UseOldEnemyId = value;\r
}\r
\r
- public void InjectShips(dynamic battle)\r
+ public void InjectShips(dynamic battle, dynamic item)\r
{\r
- var deck = (int)battle.api_deck_id;\r
- var id = 1;\r
- var ships = ((int[])battle.api_f_nowhps).Zip((int[])battle.api_f_maxhps,\r
- (now, max) => new ShipStatus {Id = id++, NowHp = now, MaxHp = max}).ToArray();\r
- _decks[deck - 1] = (from ship in ships select ship.Id).ToArray();\r
- foreach (var ship in ships)\r
- _shipInfo[ship.Id] = ship;\r
+ var deck = (int)battle.api_deck_id - 1;\r
+ InjectShips(deck, (int[])battle.api_f_nowhps, (int[])battle.api_f_maxhps, (int[][])item[0]);\r
if (battle.api_f_nowhps_combined())\r
- {\r
- var guards = ((int[])battle.api_f_nowhps_combined).Zip((int[])battle.api_f_maxhps_combined,\r
- (now, max) => new ShipStatus {Id = id++, NowHp = now, MaxHp = max}).ToArray();\r
- _decks[1] = (from ship in guards select ship.Id).ToArray();\r
- foreach (var ship in guards)\r
- _shipInfo[ship.Id] = ship;\r
- }\r
+ InjectShips(1, (int[])battle.api_f_nowhps_combined, (int[])battle.api_f_maxhps_combined, (int[][])item[1]);\r
foreach (var enemy in (int[])battle.api_ship_ke)\r
_shipMaster[enemy] = new ShipSpec {Id = enemy};\r
if (battle.api_ship_ke_combined())\r
_shipMaster[enemy] = new ShipSpec {Id = enemy};\r
}\r
}\r
+\r
+ private void InjectShips(int deck, int[] nowhps, int[] maxhps, int[][] slots)\r
+ {\r
+ var id = _shipInfo.Keys.Count + 1;\r
+ var ships = nowhps.Zip(maxhps,\r
+ (now, max) => new ShipStatus {Id = id++, NowHp = now, MaxHp = max}).ToArray();\r
+ _decks[deck] = (from ship in ships select ship.Id).ToArray();\r
+ foreach (var ship in ships)\r
+ _shipInfo[ship.Id] = ship;\r
+ foreach (var entry in ships.Zip(slots, (ship, slot) =>new {ship, slot}))\r
+ {\r
+ entry.ship.Slot = _itemInfo.InjectItems(entry.slot.Take(5)).ToArray();\r
+ if (entry.slot.Length >= 6)\r
+ entry.ship.SlotEx = _itemInfo.InjectItems(entry.slot.Skip(5)).First();\r
+ }\r
+ }\r
}\r
}
\ No newline at end of file