}\r
\r
[TestMethod]\r
+ public void ResetQuestList()\r
+ {\r
+ var queue = new Queue<DateTime>(new[]\r
+ {\r
+ new DateTime(2017, 11, 1, 5, 0, 0), new DateTime(2017, 11, 6, 5, 0, 0),\r
+ new DateTime(2017, 12, 1, 5, 0, 0)\r
+ });\r
+ var questInfo = new QuestInfo(null, null, () => queue.Dequeue());\r
+ var status = new Status\r
+ {\r
+ QuestList = new[]\r
+ {\r
+ new QuestStatus {Id = 201, Category = 2}, new QuestStatus {Id = 213, Category = 2},\r
+ new QuestStatus {Id = 265, Category = 2}, new QuestStatus {Id = 822, Category = 8}\r
+ },\r
+ QuestLastReset = new DateTime(2017, 10, 31, 5, 0, 0)\r
+ };\r
+ questInfo.LoadState(status);\r
+ questInfo.InspectQuestList(CreateQuestList(new int[0]));\r
+ questInfo.SaveState(status);\r
+ PAssert.That(() => status.QuestList.Select(q => q.Id).SequenceEqual(new[] {213, 822})); // デイリーとマンスリーが消える\r
+ questInfo.InspectQuestList(CreateQuestList(new int[0]));\r
+ questInfo.SaveState(status);\r
+ PAssert.That(() => status.QuestList.Select(q => q.Id).SequenceEqual(new[] {822})); // ウィークリーが消える\r
+ questInfo.InspectQuestList(CreateQuestList(new int[0]));\r
+ questInfo.SaveState(status);\r
+ PAssert.That(() => status.QuestList.Length == 0); // クォータリーが消える\r
+ }\r
+\r
+ [TestMethod]\r
public void ResetFrom0To5OClock()\r
{\r
var queue = new Queue<DateTime>(new[]\r
}\r
\r
[TestMethod]\r
- public void ResetQuestList()\r
+ public void ResetWeeklyWithoutCount()\r
{\r
var queue = new Queue<DateTime>(new[]\r
{\r
- new DateTime(2017, 11, 1, 5, 0, 0), new DateTime(2017, 11, 6, 5, 0, 0),\r
- new DateTime(2017, 12, 1, 5, 0, 0)\r
+ new DateTime(2019, 1, 27, 10, 0, 0),\r
+ new DateTime(2019, 1, 28, 5, 0, 0)\r
});\r
var questInfo = new QuestInfo(null, null, () => queue.Dequeue());\r
var status = new Status\r
{\r
- QuestList = new[]\r
- {\r
- new QuestStatus {Id = 201, Category = 2}, new QuestStatus {Id = 213, Category = 2},\r
- new QuestStatus {Id = 265, Category = 2}, new QuestStatus {Id = 822, Category = 8}\r
- },\r
- QuestLastReset = new DateTime(2017, 10, 31, 5, 0, 0)\r
+ QuestLastReset = new DateTime(2019, 1, 27, 5, 0, 0)\r
};\r
questInfo.LoadState(status);\r
- questInfo.InspectQuestList(CreateQuestList(new int[0]));\r
- questInfo.SaveState(status);\r
- PAssert.That(() => status.QuestList.Select(q => q.Id).SequenceEqual(new[] {213, 822})); // デイリーとマンスリーが消える\r
- questInfo.InspectQuestList(CreateQuestList(new int[0]));\r
- questInfo.SaveState(status);\r
- PAssert.That(() => status.QuestList.Select(q => q.Id).SequenceEqual(new[] {822})); // ウィークリーが消える\r
- questInfo.InspectQuestList(CreateQuestList(new int[0]));\r
- questInfo.SaveState(status);\r
- PAssert.That(() => status.QuestList.Length == 0); // クォータリーが消える\r
+ questInfo.InspectQuestList( // 2019-1-27 10:00\r
+ Js(new\r
+ {\r
+ api_list = new[]\r
+ {\r
+ new\r
+ {\r
+ api_no = 237,\r
+ api_category = 2,\r
+ api_type = 2,\r
+ api_state = 2,\r
+ api_title = "【節分拡張任務】南方海域 艦隊決戦",\r
+ api_detail = "",\r
+ api_get_material = new int[0],\r
+ api_progress_flag = 0\r
+ }\r
+ }\r
+ }));\r
+ PAssert.That(() => questInfo.Quests[0].Id == 237);\r
+ questInfo.InspectQuestList(CreateQuestList(new[] {201})); // 2019-1-28 05:00\r
+ PAssert.That(() => questInfo.Quests[0].Id == 201);\r
}\r
\r
private JsonObject Js(object obj) => JsonObject.CreateJsonObject(obj);\r
{\r
api_no = id,\r
api_category = id / 100,\r
+ api_type = 1,\r
api_state = 2,\r
api_title = "",\r
api_detail = "",\r
{\r
public int Id { get; set; }\r
public int Category { get; set; }\r
+ public QuestInterval Interval { get; set; }\r
public string Name { get; set; }\r
public string Detail { get; set; }\r
public int[] Material { get; set; }\r
return "";\r
}\r
\r
- public bool Cleared => NowArray?.Zip(Spec.MaxArray, (n, m) => n >= m).All(x => x) ?? Spec.Max != 0 && Now >= Spec.Max;\r
+ public bool Cleared => NowArray?.Zip(Spec.MaxArray, (n, m) => n >= m).All(x => x) ??\r
+ Spec.Max != 0 && Now >= Spec.Max;\r
}\r
\r
public class QuestInfo : IHaveState\r
}\r
}\r
\r
+ private readonly QuestInterval[] _intervals =\r
+ {\r
+ QuestInterval.Daily, QuestInterval.Weekly, QuestInterval.Monthly,\r
+ QuestInterval.Other, QuestInterval.Quarterly\r
+ };\r
+\r
public void InspectQuestList(dynamic json)\r
{\r
ResetQuests();\r
var state = (int)entry.api_state;\r
var progress = (int)entry.api_progress_flag;\r
var cat = (int)entry.api_category;\r
+ var interval = _intervals[(int)entry.api_type - 1];\r
var name = (string)entry.api_title;\r
var detail = ((string)entry.api_detail).Replace("<br>", "\r\n");\r
var material = (int[])entry.api_get_material;\r
progress = 100;\r
goto case 2;\r
case 2:\r
- AddQuest(id, cat, name, detail, material, progress, true);\r
+ AddQuest(id, cat, interval, name, detail, material, progress, true);\r
break;\r
}\r
}\r
}\r
}\r
\r
- private void AddQuest(int id, int category, string name, string detail, int[] material, int progress,\r
+ private void AddQuest(int id, int category, QuestInterval interval, string name, string detail, int[] material,\r
+ int progress,\r
bool adjustCount)\r
{\r
var count = _countList.GetCount(id);\r
{\r
Id = id,\r
Category = category,\r
+ Interval = interval,\r
Name = name,\r
Detail = detail,\r
Material = adjustCount ? material?.Concat(count.Spec.Material).ToArray() : material,\r
private void RemoveQuest(QuestInterval interval)\r
{\r
foreach (var id in\r
- (from kv in _quests where kv.Value.Count.Spec.Interval == interval select kv.Key).ToArray())\r
+ (from kv in _quests\r
+ where kv.Value.Count.Spec.Interval == interval || // 輸送5と空母3はカウンタを見ないとデイリーにならない\r
+ kv.Value.Interval == interval\r
+ select kv.Key).ToArray())\r
_quests.Remove(id);\r
}\r
\r
{\r
_quests.Clear();\r
foreach (var q in status.QuestList)\r
- AddQuest(q.Id, q.Category, q.Name, q.Detail, q.Material, q.Progress, false);\r
+ AddQuest(q.Id, q.Category, q.Interval, q.Name, q.Detail, q.Material, q.Progress, false);\r
}\r
}\r
}\r