OSDN Git Service

艦隊晒しページ用のデータを生成できるようにする
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / TextGenerator.cs
index 49ae518..dc38815 100644 (file)
@@ -28,6 +28,22 @@ namespace KancolleSniffer
                    orderby ship.Spec.ShipType, -ship.Level, ship.ExpToNext\r
                    select $"{ship.Id},{ship.Spec.ShipTypeName},{ship.Name},{ship.Level},{ship.Cond}");\r
 \r
+        public static string GenerateKantaiSarashiData(IEnumerable<ShipStatus> shipList)\r
+        {\r
+            return ".2|" +\r
+                   string.Join("|", from ship in shipList\r
+                       where ship.Locked\r
+                       group ship by ship.Spec.Remodel.Base\r
+                       into grp\r
+                       orderby grp.Key\r
+                       select grp.Key + ":" + string.Join(",", from ship in grp\r
+                           orderby -ship.Level\r
+                           select ship.Level +\r
+                                  (ship.Level >= ship.Spec.Remodel.Level && ship.Spec.Remodel.Step != 0\r
+                                      ? "." + ship.Spec.Remodel.Step\r
+                                      : "")));\r
+        }\r
+\r
         public static string GenerateItemList(IEnumerable<ItemStatus> itemList)\r
             => "区分,装備名,熟練度,改修,個数\r\n" +\r
                string.Join("\r\n",\r
@@ -113,7 +129,8 @@ namespace KancolleSniffer
                     if (s != 0)\r
                         sb.Append(",");\r
                     var st = ships[s];\r
-                    sb.Append($"\"s{s + 1}\":{{\"id\":\"{st.Spec.Id}\",\"lv\":{st.Level},\"luck\":{st.Lucky},\"items\":{{");\r
+                    sb.Append(\r
+                        $"\"s{s + 1}\":{{\"id\":\"{st.Spec.Id}\",\"lv\":{st.Level},\"luck\":{st.Lucky},\"items\":{{");\r
                     var items = st.Slot;\r
                     for (var i = 0; i < items.Length; i++)\r
                     {\r