2 // ApplySuppliesCommand.swift
5 // Created by Hori,Masaki on 2017/01/08.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
11 final class ApplySuppliesCommand: JSONCommand {
13 override func execute() {
15 let store = ServerDataStore.oneTimeEditor()
20 guard let i = json["api_id"].int else {
24 guard let ship = store.sync(execute: { store.ship(by: i) }) else {
28 guard let bull = json["api_bull"].int else {
32 guard let fuel = json["api_fuel"].int else {
36 guard let slots = json["api_onslot"].arrayObject as? [Int] else {
40 guard slots.count > 4 else {
49 ship.onslot_0 = slots[0]
50 ship.onslot_1 = slots[1]
51 ship.onslot_2 = slots[2]
52 ship.onslot_3 = slots[3]
53 ship.onslot_4 = slots[4]