1 // Copyright (C) 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>
\r
3 // Licensed under the Apache License, Version 2.0 (the "License");
\r
4 // you may not use this file except in compliance with the License.
\r
5 // You may obtain a copy of the License at
\r
7 // http://www.apache.org/licenses/LICENSE-2.0
\r
9 // Unless required by applicable law or agreed to in writing, software
\r
10 // distributed under the License is distributed on an "AS IS" BASIS,
\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 // See the License for the specific language governing permissions and
\r
13 // limitations under the License.
\r
15 using System.Collections.Generic;
\r
16 using static System.Math;
\r
18 namespace KancolleSniffer
\r
20 public class MiscTextInfo
\r
22 private const string GuideText = "[海域ゲージ情報]\r\n 海域選択画面に進むと表示します。\r\n[演習情報]\r\n 演習相手を選ぶと表示します。";
\r
23 public string Text { get; private set; } = GuideText;
\r
24 public bool ClearFlag { private get; set; }
\r
26 public void ClearIfNeeded()
\r
34 private readonly Dictionary<int, int> _required = new Dictionary<int, int>
\r
52 public void InspectMapInfo(dynamic json)
\r
54 Text = "[海域ゲージ]\r\n";
\r
55 foreach (var entry in json.api_map_info() ? json.api_map_info : json)
\r
57 var map = (int)entry.api_id;
\r
58 if (entry.api_eventmap())
\r
60 var evmap = entry.api_eventmap;
\r
61 Text += $"{map / 10}-{map % 10} : HP {(int)evmap.api_now_maphp}/{(int)evmap.api_max_maphp}\r\n";
\r
64 if (!entry.api_defeat_count())
\r
66 var reqStr = _required.TryGetValue(map, out var req) ? req.ToString() : "?";
\r
67 Text += $"{map / 10}-{map % 10} : 撃破 {(int)entry.api_defeat_count}/{reqStr}\r\n";
\r
71 private readonly int[] _expTable =
\r
73 0, 100, 300, 600, 1000, 1500, 2100, 2800, 3600, 4500,
\r
74 5500, 6600, 7800, 9100, 10500, 12000, 13600, 15300, 17100, 19000,
\r
75 21000, 23100, 25300, 27600, 30000, 32500, 35100, 37800, 40600, 43500,
\r
76 46500, 49600, 52800, 56100, 59500, 63000, 66600, 70300, 74100, 78000,
\r
77 82000, 86100, 90300, 94600, 99000, 103500, 108100, 112800, 117600, 122500,
\r
78 127500, 132700, 138100, 143700, 149500, 155500, 161700, 168100, 174700, 181500,
\r
79 188500, 195800, 203400, 211300, 219500, 228000, 236800, 245900, 255300, 265000,
\r
80 275000, 285400, 296200, 307400, 319000, 331000, 343400, 356200, 369400, 383000,
\r
81 397000, 411500, 426500, 442000, 458000, 474500, 491500, 509000, 527000, 545500,
\r
82 564500, 584500, 606500, 631500, 661500, 701500, 761500, 851500, 1000000, 1000000,
\r
83 1010000, 1011000, 1013000, 1016000, 1020000, 1025000, 1031000, 1038000, 1046000, 1055000,
\r
84 1065000, 1077000, 1091000, 1107000, 1125000, 1145000, 1168000, 1194000, 1223000, 1255000,
\r
85 1290000, 1329000, 1372000, 1419000, 1470000, 1525000, 1584000, 1647000, 1714000, 1785000,
\r
86 1860000, 1940000, 2025000, 2115000, 2210000, 2310000, 2415000, 2525000, 2640000, 2760000,
\r
87 2887000, 3021000, 3162000, 3310000, 3465000, 3628000, 3799000, 3978000, 4165000, 4360000,
\r
88 4564000, 4777000, 4999000, 5230000, 5470000, 5720000, 5780000, 5860000, 5970000, 6120000,
\r
89 6320000, 6580000, 6910000, 7320000, 7820000
\r
92 public void InspectPracticeEnemyInfo(dynamic json)
\r
94 Text = $"[演習情報]\r\n敵艦隊名 : {json.api_deckname}\r\n";
\r
95 var ships = json.api_deck.api_ships;
\r
96 var s1 = (int)ships[0].api_id != -1 ? (int)ships[0].api_level : 1;
\r
97 var s2 = (int)ships[1].api_id != -1 ? (int)ships[1].api_level : 1;
\r
98 var raw = _expTable[Min(s1, _expTable.Length) - 1] / 100.0 + _expTable[Min(s2, _expTable.Length) - 1] / 300.0;
\r
99 var exp = raw >= 500 ? 500 + (int)Sqrt(raw - 500) : (int)raw;
\r
100 Text += $"獲得経験値 : {exp}\r\nS勝利 : {(int)(exp * 1.2)}";
\r