private IEnumerable<IEnumerable<ShipData>> GetEnemiesFromId(string enemyId)
{
var shipInfos = KanColleClient.Current.Master.Ships;
var slotInfos = KanColleClient.Current.Master.SlotItems;
int[] ids;
int[][] shipParam;
int[][] shipSlots;
int[] lvs;
int[] hps;
if (this.EnemyData.EnemyDictionary.TryGetValue(enemyId, out ids) &&
this.EnemyData.EnemyParams.TryGetValue(enemyId, out shipParam) &&
this.EnemyData.EnemySlotItems.TryGetValue(enemyId, out shipSlots) &&
this.EnemyData.EnemyLevels.TryGetValue(enemyId, out lvs) &&
this.EnemyData.EnemyHPs.TryGetValue(enemyId, out hps))
{
var shipIds = SplitData(ids);
var shipLvs = SplitData(lvs);
var shipHps = SplitData(hps);
int[][] upgrades;
this.EnemyData.EnemyUpgraded.TryGetValue(enemyId, out upgrades);
if (upgrades != null)
{
for (var i = 0; i < shipParam.Length; i++)
{
for (var j = 0; j < shipParam[i].Length; j++)
{
shipParam[i][j] += upgrades[i][j];
}
}
}
var baseIndex = 0;
return shipIds.Select((x, i) =>
{
var index = baseIndex;
baseIndex += x.Length;
return x.Select((id, j) =>
{
var param = shipParam[index + j];
return new MastersShipData(shipInfos[id])
{
Level = shipLvs[i][j],
NowHP = shipHps[i][j],
MaxHP = shipHps[i][j],
Firepower = param[0],
Torpedo = param[1],
AA = param[2],
Armer = param[3],
Slots = shipSlots[index + j]
.Where(s => s != -1)
.Select(s => slotInfos[s])
.Select((s, si) => new ShipSlotData(s))
.ToArray()
};
});
})
.ToArray();
}
else
{
return new ShipData[0][];
}
}