From: masakih Date: Sun, 23 Mar 2014 06:29:30 +0000 (+0900) Subject: 開発履歴に旗艦名とレベルおよび司令部レベルを残すようにした X-Git-Tag: 1.0beta5~53 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8b581cc4cfd6338ff668646005cb9d1f7109ba64;p=kcd%2FKCD.git 開発履歴に旗艦名とレベルおよび司令部レベルを残すようにした --- diff --git a/KCD.xcodeproj/project.pbxproj b/KCD.xcodeproj/project.pbxproj index 95d8c3e9..1d7d69d2 100644 --- a/KCD.xcodeproj/project.pbxproj +++ b/KCD.xcodeproj/project.pbxproj @@ -35,7 +35,7 @@ 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 */; }; @@ -136,8 +136,8 @@ F494DC6C18CC054800AE97E4 /* HMNyukyoDockStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMNyukyoDockStatus.m; sourceTree = ""; }; F4B3DBC818DDB9170011B4FC /* HMCreateSlotItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMCreateSlotItemCommand.h; sourceTree = ""; }; F4B3DBC918DDB9170011B4FC /* HMCreateSlotItemCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMCreateSlotItemCommand.m; sourceTree = ""; }; - F4B3DBCB18DDBA200011B4FC /* HMKaihatuHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKaihatuHistory.h; sourceTree = ""; }; - F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKaihatuHistory.m; sourceTree = ""; }; + F4B3DC1918DEAB5E0011B4FC /* HMKaihatuHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKaihatuHistory.h; sourceTree = ""; }; + F4B3DC1A18DEAB5E0011B4FC /* HMKaihatuHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKaihatuHistory.m; sourceTree = ""; }; F4B414E718B09A4B00468DAF /* HMMasterMapAreaCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterMapAreaCommand.h; sourceTree = ""; }; F4B414E818B09A4B00468DAF /* HMMasterMapAreaCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMasterMapAreaCommand.m; sourceTree = ""; }; F4B414EA18B0A7D600468DAF /* HMMasterUseItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterUseItemCommand.h; sourceTree = ""; }; @@ -354,9 +354,9 @@ 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 = ""; @@ -579,7 +579,7 @@ 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 */, diff --git a/KCD/HMCreateSlotItemCommand.m b/KCD/HMCreateSlotItemCommand.m index eb538fc9..0dbda5e6 100644 --- a/KCD/HMCreateSlotItemCommand.m +++ b/KCD/HMCreateSlotItemCommand.m @@ -35,9 +35,9 @@ 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]; @@ -45,7 +45,7 @@ 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"]; @@ -55,6 +55,40 @@ 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" @@ -65,6 +99,9 @@ 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]; } diff --git a/KCD/HMKaihatuHistory.h b/KCD/HMKaihatuHistory.h index 708ade56..78c27bed 100644 --- a/KCD/HMKaihatuHistory.h +++ b/KCD/HMKaihatuHistory.h @@ -2,7 +2,7 @@ // 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. // @@ -12,12 +12,15 @@ @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 diff --git a/KCD/HMKaihatuHistory.m b/KCD/HMKaihatuHistory.m index a54e7aa1..ce85776d 100644 --- a/KCD/HMKaihatuHistory.m +++ b/KCD/HMKaihatuHistory.m @@ -2,7 +2,7 @@ // 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. // @@ -18,5 +18,8 @@ @dynamic name; @dynamic steel; @dynamic kaihatusizai; +@dynamic flagShipName; +@dynamic flagShipLv; +@dynamic commanderLv; @end diff --git a/KCD/LocalData.xcdatamodeld/LocalData.xcdatamodel/contents b/KCD/LocalData.xcdatamodeld/LocalData.xcdatamodel/contents index 3ece2317..696b1e66 100644 --- a/KCD/LocalData.xcdatamodeld/LocalData.xcdatamodel/contents +++ b/KCD/LocalData.xcdatamodeld/LocalData.xcdatamodel/contents @@ -3,7 +3,10 @@ + + + @@ -21,6 +24,6 @@ - + \ No newline at end of file