OSDN Git Service

AppDelegateからウインドウに関する部分を分離した
[kcd/KCD.git] / KCD / QuestListCommand.swift
index 2d2649f..45f99bb 100644 (file)
@@ -15,7 +15,7 @@ class QuestListCommand: JSONCommand {
     }
     override func execute() {
         // 左のタブがAllじゃない時は無視する
-        guard let tab = arguments["api_tab_id"].flatMap({ Int($0) }),
+        guard let tab = parameter["api_tab_id"].int,
             tab == 0
             else { return }
         
@@ -36,11 +36,11 @@ class QuestListCommand: JSONCommand {
         let quests = store.sortedQuestByNo()
         data["api_list"].forEach { (_, quest) in
             guard let no = quest["api_no"].int
-            else { return }
+                else { return }
             let t = quests.binarySearch { $0.no ==? no }
             guard let new = t ?? store.createQuest()
                 else { return print("Can not create Quest") }
-            new.bonus_flag = quest["api_bonus_flag"].bool ?? false
+            new.bonus_flag = quest["api_bonus_flag"].int.map { $0 != 0} ?? false
             new.category = quest["api_category"].int ?? 0
             new.detail = quest["api_detail"].string ?? ""
 //            new.get_material_0 = questData["api_get_material_0"] as? Int ?? 0