1 // Copyright (C) 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>
\r
3 // This program is part of KancolleSniffer.
\r
5 // KancolleSniffer is free software: you can redistribute it and/or modify
\r
6 // it under the terms of the GNU General Public License as published by
\r
7 // the Free Software Foundation, either version 3 of the License, or
\r
8 // (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, see <http://www.gnu.org/licenses/>.
\r
18 using System.Collections.Generic;
\r
22 namespace KancolleSniffer
\r
24 public static class TextGenerator
\r
26 public static string GenerateShipList(IEnumerable<ShipStatus> shipList)
\r
27 => "ID,艦種,艦名,レベル\r\n" +
\r
29 from ship in shipList
\r
30 orderby ship.Spec.ShipType, -ship.Level, ship.ExpToNext
\r
31 select $"{ship.Id},{ship.Spec.ShipTypeName},{ship.Name},{ship.Level}");
\r
33 public static string GenerateItemList(IEnumerable<ItemStatus> itemList)
\r
34 => "区分,装備名,改修・熟練度,個数\r\n" +
\r
36 (from item in itemList
\r
37 where item.Spec.Id != -1
\r
38 orderby item.Spec.Type, item.Spec.Id, item.Alv, item.Level
\r
40 $"{item.Spec.TypeName},{item.Spec.Name},{(item.Level == 0 ? item.Alv == 0 ? 0 : item.Alv : item.Level)}"
\r
42 select grp.Key + $",{grp.Count()}"));
\r
44 public static string GenerateFleetInfo(Sniffer sniffer)
\r
46 var sb = new StringBuilder();
\r
47 var fn = new[] { "第一艦隊", "第二艦隊", "第三艦隊", "第四艦隊" };
\r
48 for (var f = 0; f < fn.Length; f++)
\r
50 sb.Append(fn[f] + "\r\n");
\r
51 foreach (var s in sniffer.GetShipStatuses(f))
\r
53 sb.Append($"{s.Name} Lv{s.Level}");
\r
54 foreach (var item in s.Slot.Where(item => item.Id != -1))
\r
56 sb.Append(" " + item.Spec.Name +
\r
57 (item.Alv == 0 ? "" : "+" + item.Alv) +
\r
58 (item.Level == 0 ? "" : "★" + item.Level));
\r
60 if (s.SlotEx.Id > 0)
\r
62 var item = s.SlotEx;
\r
63 sb.Append(" " + item.Spec.Name);
\r
67 sb.Append($"制空: {sniffer.GetFighterPower(f)} 索敵: {sniffer.GetFleetLineOfSights(f):F1}\r\n");
\r
69 return sb.ToString();
\r