public int Id { get; set; }\r
public int Category { get; set; }\r
public string Name { get; set; }\r
+\r
+ [XmlIgnore]\r
public QuestCount Count { get; set; }\r
+\r
public int Progress { get; set; }\r
+\r
+ [XmlIgnore]\r
public Color Color { get; set; }\r
}\r
\r
public int Id { get; set; }\r
public int Now { get; set; }\r
public int[] NowArray { get; set; }\r
- public int Max => Spec.Max;\r
\r
[XmlIgnore]\r
public QuestSpec Spec { get; set; }\r
{\r
if (progress != 100)\r
return false;\r
- NowArray = NowArray.Zip(Spec.MaxArray, (n, m) => Max(n, m)).ToArray();\r
+ NowArray = NowArray.Zip(Spec.MaxArray, Max).ToArray();\r
return true;\r
}\r
var next = 0;\r
break;\r
}\r
var now = Now + Spec.Shift;\r
- var max = Max + Spec.Shift;\r
+ var max = Spec.Max + Spec.Shift;\r
var low = (int)Ceiling(max * progress / 100.0);\r
var high = (int)Ceiling(max * next / 100.0);\r
if (now < low)\r
}\r
return false;\r
}\r
+\r
+ public override string ToString()\r
+ {\r
+ if (Id == 854)\r
+ return $"{NowArray.Count(n => n >= 1)}/{Spec.MaxArray.Length}";\r
+ return NowArray != null\r
+ ? string.Join(" ", NowArray.Zip(Spec.MaxArray, (n, m) => $"{n}/{m}"))\r
+ : $"{Now}/{Spec.Max}";\r
+ }\r
+\r
+ public string ToToolTip()\r
+ {\r
+ return Id != 854\r
+ ? ""\r
+ : string.Join(" ",\r
+ new[] {"2-4", "6-1", "6-3", "6-4"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
+ .Where(s => !string.IsNullOrEmpty(s)));\r
+ }\r
+\r
+ public bool Cleared => NowArray?.Zip(Spec.MaxArray, (n, m) => n >= m).All(x => x) ?? Now >= Spec.Max;\r
}\r
\r
// @formatter:off\r
{229, new QuestSortie {Interval = Weekly, Max = 12, Rank = "B", Maps = new[] {41, 42, 43, 44, 45}}}, // 229: 敵東方艦隊を撃滅せよ!\r
{241, new QuestSortie {Interval = Weekly, Max = 5, Rank = "B", Maps = new[] {33, 34, 35}}}, // 241: 敵北方艦隊主力を撃滅せよ!\r
{242, new QuestSortie {Interval = Weekly, Max = 1, Rank = "B", Maps = new[] {44}}}, // 242: 敵東方中枢艦隊を撃破せよ!\r
- {243, new QuestSortie {Interval = Weekly, Max = 2, Rank = "B", Maps = new[] {52}}}, // 243: 南方海域珊瑚諸島沖の制空権を握れ!\r
+ {243, new QuestSortie {Interval = Weekly, Max = 2, Rank = "S", Maps = new[] {52}}}, // 243: 南方海域珊瑚諸島沖の制空権を握れ!\r
{256, new QuestSortie {Interval = Monthly, Max = 3, Rank = "S", Maps = new[] {61}}}, // 256: 「潜水艦隊」出撃せよ!\r
{261, new QuestSortie {Interval = Weekly, Max = 3, Rank = "A", Maps = new[] {15}}}, // 261: 海上輸送路の安全確保に努めよ!\r
{265, new QuestSortie {Interval = Monthly, Max = 10, Rank = "A", Maps = new[] {15}}}, // 265: 海上護衛強化月間\r
{674, new QuestDestroyItem {Interval = Daily, Max = 3, Items = new[] {21}, Shift = 2}}, // 674: 工廠環境の整備\r
{675, new QuestSpec {Interval = Quarterly, MaxArray = new[] {6, 4}}}, // 675: 運用装備の統合整備\r
{676, new QuestSpec {Interval = Weekly, MaxArray = new[] {3, 3, 1}}}, // 676: 装備開発力の集中整備\r
+ {677, new QuestSpec {Interval = Weekly, MaxArray = new[] {4, 2, 3}}}, // 677: 継戦支援能力の整備\r
\r
{702, new QuestPowerup {Interval = Daily, Max = 2}}, // 702: 艦の「近代化改修」を実施せよ!\r
{703, new QuestPowerup {Interval = Weekly, Max = 15}} // 703: 「近代化改修」を進め、戦備を整えよ!\r
switch (state)\r
{\r
case 1:\r
- _quests.Remove(id);\r
+ if (_quests.Remove(id))\r
+ NeedSave = true;\r
break;\r
case 3:\r
progress = 100;\r
goto case 2;\r
case 2:\r
- var count = _countList.GetCount(id);\r
- if (count.AdjustCount(progress))\r
- NeedSave = true;\r
- _quests[id] = new QuestStatus\r
- {\r
- Id = id,\r
- Category = cat,\r
- Name = name,\r
- Count = count,\r
- Progress = progress,\r
- Color = cat <= _color.Length ? _color[cat - 1] : Control.DefaultBackColor\r
- };\r
+ AddQuest(id, cat, name, progress, true);\r
break;\r
}\r
}\r
}\r
}\r
\r
+ private void AddQuest(int id, int category, string name, int progress, bool adjustCount)\r
+ {\r
+ var count = _countList.GetCount(id);\r
+ if (adjustCount)\r
+ count.AdjustCount(progress);\r
+ _quests[id] = new QuestStatus\r
+ {\r
+ Id = id,\r
+ Category = category,\r
+ Name = name,\r
+ Count = count,\r
+ Progress = progress,\r
+ Color = category <= _color.Length ? _color[category - 1] : Control.DefaultBackColor\r
+ };\r
+ NeedSave = true;\r
+ }\r
+\r
+ public void ClearQuests()\r
+ {\r
+ _quests.Clear();\r
+ }\r
+\r
private void ResetQuests()\r
{\r
var now = _nowFunc();\r
if (_lastReset < quarterly && quarterly <= now)\r
_countList.Remove(QuestInterval.Quarterly);\r
_lastReset = now;\r
+ NeedSave = true;\r
}\r
\r
private bool _boss;\r
break;\r
case QuestEnemyType enemyType:\r
var num = enemyType.CountResult(\r
- _battleInfo.EnemyResultStatus.Concat(_battleInfo.EnemyGuardResultStatus));\r
+ _battleInfo.Result.Enemy.Main.Concat(_battleInfo.Result.Enemy.Guard));\r
if (num > 0)\r
AddCount(count, num);\r
break;\r
q676.Count.NowArray[2] += items.Count(id => id == 30);\r
NeedSave = true;\r
}\r
+ if (_quests.TryGetValue(677, out var q677))\r
+ {\r
+ q677.Count.NowArray[0] += items.Count(id => id == 3);\r
+ q677.Count.NowArray[1] += items.Count(id => id == 10);\r
+ q677.Count.NowArray[2] += items.Count(id => id == 5);\r
+ NeedSave = true;\r
+ }\r
}\r
\r
public void InspectPowerup(dynamic json)\r
{\r
var values = HttpUtility.ParseQueryString(request);\r
_quests.Remove(int.Parse(values["api_quest_id"]));\r
+ NeedSave = true;\r
}\r
\r
public void InspectClearItemGet(string request)\r
public void SaveState(Status status)\r
{\r
status.QuestLastReset = _lastReset;\r
- if (_countList == null)\r
- return;\r
- status.QuestCountList = _countList.CountList.ToArray();\r
+ if (_quests != null)\r
+ status.QuestList = _quests.Values.ToArray();\r
+ if (_countList != null)\r
+ status.QuestCountList = _countList.CountList.ToArray();\r
}\r
\r
public void LoadState(Status status)\r
{\r
- _countList.CountList = status.QuestCountList;\r
_lastReset = status.QuestLastReset;\r
+ if (status.QuestCountList != null)\r
+ _countList.CountList = status.QuestCountList;\r
+ if (status.QuestList != null)\r
+ {\r
+ _quests.Clear();\r
+ foreach (var q in status.QuestList)\r
+ AddQuest(q.Id, q.Category, q.Name, q.Progress, false);\r
+ }\r
}\r
}\r
}
\ No newline at end of file