2 // HMApplySuppliesCommand.m
5 // Created by Hori,Masaki on 2014/09/24.
6 // Copyright (c) 2014年 Hori,Masaki. All rights reserved.
9 #import "HMApplySuppliesCommand.h"
11 #import "HMKCShipObject+Extensions.h"
12 #import "HMServerDataStore.h"
15 @implementation HMApplySuppliesCommand
18 HMServerDataStore *store = [HMServerDataStore oneTimeEditor];
20 NSDictionary *data = self.json[@"api_data"];
21 NSArray *shipInfos = data[@"api_ship"];
23 for(NSDictionary *updataInfo in shipInfos) {
25 NSArray<HMKCShipObject *> *ships = [store objectsWithEntityName:@"Ship"
27 predicateFormat:@"id = %@", @([updataInfo[@"api_id"] integerValue])];
28 if(ships.count == 0) {
30 NSLog(@"Error: at %@ : %@", NSStringFromClass([self class]), error);
35 ships[0].bull = updataInfo[@"api_bull"];
36 ships[0].fuel = updataInfo[@"api_fuel"];
37 NSArray *onslots = updataInfo[@"api_onslot"];
38 ships[0].onslot_0 = onslots[0];
39 ships[0].onslot_1 = onslots[1];
40 ships[0].onslot_2 = onslots[2];
41 ships[0].onslot_3 = onslots[3];
42 ships[0].onslot_4 = onslots[4];