F494DC6A18C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F494DC6818C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib */; };
F494DC6D18CC054800AE97E4 /* HMNyukyoDockStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = F494DC6C18CC054800AE97E4 /* HMNyukyoDockStatus.m */; };
F4B3DBCA18DDB9170011B4FC /* HMCreateSlotItemCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B3DBC918DDB9170011B4FC /* HMCreateSlotItemCommand.m */; };
- F4B3DBCD18DDBA200011B4FC /* HMKaihatuHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */; };
+ F4B3DC1B18DEAB5E0011B4FC /* HMKaihatuHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B3DC1A18DEAB5E0011B4FC /* HMKaihatuHistory.m */; };
F4B414E918B09A4B00468DAF /* HMMasterMapAreaCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B414E818B09A4B00468DAF /* HMMasterMapAreaCommand.m */; };
F4B414EC18B0A7D600468DAF /* HMMasterUseItemCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B414EB18B0A7D600468DAF /* HMMasterUseItemCommand.m */; };
F4B414EF18B0BF1A00468DAF /* HMMasterMapInfoCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B414EE18B0BF1A00468DAF /* HMMasterMapInfoCommand.m */; };
F494DC6C18CC054800AE97E4 /* HMNyukyoDockStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMNyukyoDockStatus.m; sourceTree = "<group>"; };
F4B3DBC818DDB9170011B4FC /* HMCreateSlotItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMCreateSlotItemCommand.h; sourceTree = "<group>"; };
F4B3DBC918DDB9170011B4FC /* HMCreateSlotItemCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMCreateSlotItemCommand.m; sourceTree = "<group>"; };
- F4B3DBCB18DDBA200011B4FC /* HMKaihatuHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKaihatuHistory.h; sourceTree = "<group>"; };
- F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKaihatuHistory.m; sourceTree = "<group>"; };
+ F4B3DC1918DEAB5E0011B4FC /* HMKaihatuHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKaihatuHistory.h; sourceTree = "<group>"; };
+ F4B3DC1A18DEAB5E0011B4FC /* HMKaihatuHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKaihatuHistory.m; sourceTree = "<group>"; };
F4B414E718B09A4B00468DAF /* HMMasterMapAreaCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterMapAreaCommand.h; sourceTree = "<group>"; };
F4B414E818B09A4B00468DAF /* HMMasterMapAreaCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMasterMapAreaCommand.m; sourceTree = "<group>"; };
F4B414EA18B0A7D600468DAF /* HMMasterUseItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterUseItemCommand.h; sourceTree = "<group>"; };
F46F104718ABAC910063E503 /* KCD.xcdatamodeld */,
F4E7802F18DC42680011BC4C /* HMKenzoHistory.h */,
F4E7803018DC42680011BC4C /* HMKenzoHistory.m */,
- F4B3DBCB18DDBA200011B4FC /* HMKaihatuHistory.h */,
- F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */,
F4E7802C18DC3AF00011BC4C /* LocalData.xcdatamodeld */,
+ F4B3DC1918DEAB5E0011B4FC /* HMKaihatuHistory.h */,
+ F4B3DC1A18DEAB5E0011B4FC /* HMKaihatuHistory.m */,
);
name = CoreData;
sourceTree = "<group>";
F47B78B218A7B42B0011386E /* HMJSONViewWindowController.m in Sources */,
F4B414EF18B0BF1A00468DAF /* HMMasterMapInfoCommand.m in Sources */,
F4C118FC18A67B1C005D5B25 /* CustomHTTPProtocol.m in Sources */,
- F4B3DBCD18DDBA200011B4FC /* HMKaihatuHistory.m in Sources */,
+ F4B3DC1B18DEAB5E0011B4FC /* HMKaihatuHistory.m in Sources */,
F4D2CBCB18B05E58000EBC59 /* HMMaserShipCommand.m in Sources */,
F4513EFA18BB699700073552 /* HMShipWindowController.m in Sources */,
F46F104118A9B85E0063E503 /* HMJSONNode.m in Sources */,
NSString *name = nil;
NSNumber *numberOfUsedKaihatuSizai = nil;
+ NSManagedObjectContext *context = [[HMCoreDataManager defaultManager] managedObjectContext];
+
if(created) {
- NSManagedObjectContext *context = [[HMCoreDataManager defaultManager] managedObjectContext];
-
NSNumber *slotItemID = [data valueForKey:@"api_slotitem_id"];
NSFetchRequest *req = [NSFetchRequest fetchRequestWithEntityName:@"MasterSlotItem"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id = %@", slotItemID];
NSArray *array = [context executeFetchRequest:req error:NULL];
if([array count] == 0) {
- NSLog(@"MasterSlotItem data is invalid or ship_id is invalid.");
+ NSLog(@"MasterSlotItem data is invalid or api_slotitem_id is invalid.");
return;
}
name = [array[0] valueForKey:@"name"];
numberOfUsedKaihatuSizai = @0;
}
+ // Deck -> FlagShip
+ NSFetchRequest *req = [NSFetchRequest fetchRequestWithEntityName:@"Deck"];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id = 1"];
+ [req setPredicate:predicate];
+
+ NSArray *array = [context executeFetchRequest:req error:NULL];
+ if([array count] == 0) {
+ NSLog(@"Deck data is invalid.");
+ return;
+ }
+ id deck = array[0];
+ id flagShipID = [deck valueForKey:@"ship_0"];
+ req = [NSFetchRequest fetchRequestWithEntityName:@"Ship"];
+ predicate = [NSPredicate predicateWithFormat:@"id = %@", flagShipID];
+ [req setPredicate:predicate];
+ array = [context executeFetchRequest:req error:NULL];
+ if([array count] == 0) {
+ NSLog(@"Ship data is invalid or ship_0 is invalid.");
+ return;
+ }
+ id flagShip = array[0];
+ NSNumber *flagShipLv = [flagShip valueForKey:@"lv"];
+ NSString *flagShipName = [flagShip valueForKeyPath:@"master_ship.name"];
+
+ // Basic -> level
+ req = [NSFetchRequest fetchRequestWithEntityName:@"Basic"];
+
+ array = [context executeFetchRequest:req error:NULL];
+ if([array count] == 0) {
+ NSLog(@"Basic data is invalid.");
+ return;
+ }
+ id basic = array[0];
+
HMLocalDataStore *lds = [HMLocalDataStore oneTimeEditor];
NSManagedObjectContext *localStoreContext = [lds managedObjectContext];
HMKaihatuHistory *newObejct = [NSEntityDescription insertNewObjectForEntityForName:@"KaihatuHistory"
newObejct.steel = @([[self.arguments valueForKey:@"api_item3"] integerValue]);
newObejct.bauxite = @([[self.arguments valueForKey:@"api_item4"] integerValue]);
newObejct.kaihatusizai = numberOfUsedKaihatuSizai;
+ newObejct.flagShipLv = flagShipLv;
+ newObejct.flagShipName = flagShipName;
+ newObejct.commanderLv = [basic valueForKey:@"level"];
newObejct.date = [NSDate date];
}
// HMKaihatuHistory.h
// KCD
//
-// Created by Hori,Masaki on 2014/03/22.
+// Created by Hori,Masaki on 2014/03/23.
// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
//
@interface HMKaihatuHistory : NSManagedObject
-@property (nonatomic, retain) NSNumber *bull;
-@property (nonatomic, retain) NSNumber *bauxite;
-@property (nonatomic, retain) NSDate *date;
-@property (nonatomic, retain) NSNumber *fuel;
-@property (nonatomic, retain) NSString *name;
-@property (nonatomic, retain) NSNumber *steel;
-@property (nonatomic, retain) NSNumber *kaihatusizai;
+@property (nonatomic, retain) NSNumber * bull;
+@property (nonatomic, retain) NSNumber * bauxite;
+@property (nonatomic, retain) NSDate * date;
+@property (nonatomic, retain) NSNumber * fuel;
+@property (nonatomic, retain) NSString * name;
+@property (nonatomic, retain) NSNumber * steel;
+@property (nonatomic, retain) NSNumber * kaihatusizai;
+@property (nonatomic, retain) NSString * flagShipName;
+@property (nonatomic, retain) NSNumber * flagShipLv;
+@property (nonatomic, retain) NSNumber * commanderLv;
@end
// HMKaihatuHistory.m
// KCD
//
-// Created by Hori,Masaki on 2014/03/22.
+// Created by Hori,Masaki on 2014/03/23.
// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
//
@dynamic name;
@dynamic steel;
@dynamic kaihatusizai;
+@dynamic flagShipName;
+@dynamic flagShipLv;
+@dynamic commanderLv;
@end
<entity name="KaihatuHistory" representedClassName="HMKaihatuHistory" syncable="YES">
<attribute name="bauxite" attributeType="Integer 32" minValueString="10" syncable="YES"/>
<attribute name="bull" attributeType="Integer 32" minValueString="10" syncable="YES"/>
+ <attribute name="commanderLv" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="date" attributeType="Date" indexed="YES" syncable="YES"/>
+ <attribute name="flagShipLv" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
+ <attribute name="flagShipName" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="fuel" attributeType="Integer 32" minValueString="10" syncable="YES"/>
<attribute name="kaihatusizai" attributeType="Integer 32" minValueString="0" syncable="YES"/>
<attribute name="name" attributeType="String" minValueString="1" indexed="YES" syncable="YES"/>
</entity>
<elements>
<element name="KenzoHistory" positionX="0" positionY="0" width="128" height="163"/>
- <element name="KaihatuHistory" positionX="0" positionY="63" width="128" height="148"/>
+ <element name="KaihatuHistory" positionX="0" positionY="63" width="128" height="193"/>
</elements>
</model>
\ No newline at end of file