OSDN Git Service

/kcsapi/api_get_member/slotitemに対応
authormasakih <masakih@users.sourceforge.jp>
Thu, 27 Feb 2014 13:13:37 +0000 (22:13 +0900)
committermasakih <masakih@users.sourceforge.jp>
Thu, 27 Feb 2014 13:13:37 +0000 (22:13 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMKCManagedObject.m
KCD/HMMemberSlotItemCommand.h [new file with mode: 0644]
KCD/HMMemberSlotItemCommand.m [new file with mode: 0644]
KCD/KCD.xcdatamodeld/KCD.xcdatamodel/contents

index 38c7f90..e2c6258 100644 (file)
@@ -60,6 +60,7 @@
                F4D2CBC518AE2AE2000EBC59 /* HMCompositCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D2CBC418AE2AE2000EBC59 /* HMCompositCommand.m */; };
                F4D2CBC818B0555A000EBC59 /* HMKCManagedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D2CBC718B0555A000EBC59 /* HMKCManagedObject.m */; };
                F4D2CBCB18B05E58000EBC59 /* HMMaserShipCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D2CBCA18B05E58000EBC59 /* HMMaserShipCommand.m */; };
+               F4E33B5818BF5F67005B8C07 /* HMMemberSlotItemCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E33B5718BF5F67005B8C07 /* HMMemberSlotItemCommand.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
                F4D2CBC718B0555A000EBC59 /* HMKCManagedObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKCManagedObject.m; sourceTree = "<group>"; };
                F4D2CBC918B05E58000EBC59 /* HMMaserShipCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMaserShipCommand.h; sourceTree = "<group>"; };
                F4D2CBCA18B05E58000EBC59 /* HMMaserShipCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMaserShipCommand.m; sourceTree = "<group>"; };
+               F4E33B5618BF5F67005B8C07 /* HMMemberSlotItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberSlotItemCommand.h; sourceTree = "<group>"; };
+               F4E33B5718BF5F67005B8C07 /* HMMemberSlotItemCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMemberSlotItemCommand.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
                                F4513EF218B991F800073552 /* HMMemberBasicCommand.m */,
                                F4513EF418B9F29800073552 /* HMMemberShipCommand.h */,
                                F4513EF518B9F29800073552 /* HMMemberShipCommand.m */,
+                               F4E33B5618BF5F67005B8C07 /* HMMemberSlotItemCommand.h */,
+                               F4E33B5718BF5F67005B8C07 /* HMMemberSlotItemCommand.m */,
                        );
                        name = Command;
                        sourceTree = "<group>";
                                F4C118FA18A67B1C005D5B25 /* CacheStoragePolicy.m in Sources */,
                                F4C1190518A71AEA005D5B25 /* HMJSONReciever.m in Sources */,
                                F4B414F818B1D35800468DAF /* HMMasterMissionCommand.m in Sources */,
+                               F4E33B5818BF5F67005B8C07 /* HMMemberSlotItemCommand.m in Sources */,
                                F4C1190B18A74DF0005D5B25 /* HMJSONCommand.m in Sources */,
                                F4B414F518B1888800468DAF /* HMMasterFurnitureCommand.m in Sources */,
                                F4513EEE18B8E2F600073552 /* HMMemberMaterialCommand.m in Sources */,
index 51e8d58..e0d4772 100644 (file)
@@ -24,7 +24,9 @@
                                   @"api_next_rate_req_0", @"api_next_rate_req_1", @"api_next_rate_req_2",
                                   @"api_link_no_0", @"api_link_no_1",
                                   @"api_flagship", @"api_name_id",
-                                  @"api_comment_id", @"api_nickname_id", @"api_member_id"];
+                                  @"api_comment_id", @"api_nickname_id", @"api_member_id",
+                                  @"api_flag_0", @"api_flag_1", @"api_flag_2", @"api_flag_3", @"api_flag_4",
+                                  @"api_flag_5", @"api_flag_6", @"api_flag_7"];
        if([t containsObject:inKey]) {
                if(![*ioValue isKindOfClass:[NSNumber class]]) {
                        id newValue = @([*ioValue integerValue]);
diff --git a/KCD/HMMemberSlotItemCommand.h b/KCD/HMMemberSlotItemCommand.h
new file mode 100644 (file)
index 0000000..33fe28f
--- /dev/null
@@ -0,0 +1,13 @@
+//
+//  HMMemberSlotItemCommand.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/02/27.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMJSONCommand.h"
+
+@interface HMMemberSlotItemCommand : HMJSONCommand
+
+@end
diff --git a/KCD/HMMemberSlotItemCommand.m b/KCD/HMMemberSlotItemCommand.m
new file mode 100644 (file)
index 0000000..be44f0d
--- /dev/null
@@ -0,0 +1,76 @@
+//
+//  HMMemberSlotItemCommand.m
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/02/27.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMMemberSlotItemCommand.h"
+
+@implementation HMMemberSlotItemCommand
++ (void)load
+{
+       static dispatch_once_t onceToken;
+       dispatch_once(&onceToken, ^{
+               [HMJSONCommand registerClass:self];
+       });
+}
+
++ (BOOL)canExcuteAPI:(NSString *)api
+{
+       return [api isEqualToString:@"/kcsapi/api_get_member/slotitem"];
+}
+
+- (NSArray *)ignoreKeys
+{
+       static NSArray *ignoreKeys = nil;
+       if(ignoreKeys) return ignoreKeys;
+       
+       ignoreKeys = @[@"api_tyku", @"api_raig", @"api_houk", @"api_luck",
+                                  @"api_souk", @"api_baku", @"api_raik", @"api_leng",
+                                  @"api_rare", @"api_soku", @"api_taik", @"api_type", @"api_tais",
+                                  @"api_bakk", @"api_info", @"api_houm", @"api_raim", @"api_broken",
+                                  @"api_saku", @"api_member_id", @"api_houg", @"api_atap",
+                                  @"api_name"];
+       return ignoreKeys;
+}
+
+- (void)execute
+{
+       [self commitJSONToEntityNamed:@"SlotItem"];
+}
+
+- (void)setMasterSlotItem:(id)value toObject:(NSManagedObject *)object
+{
+       id currentValue = [object valueForKeyPath:@"master_slotItem.name"];
+       if(currentValue && ![currentValue isEqual:[NSNull null]]) return;
+       
+       NSManagedObjectContext *managedObjectContext = [object managedObjectContext];
+       
+       NSFetchRequest *req = [NSFetchRequest fetchRequestWithEntityName:@"MasterSlotItem"];
+       NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id = %@", value];
+       [req setPredicate:predicate];
+       NSError *error = nil;
+       id result = [managedObjectContext executeFetchRequest:req
+                                                                                                       error:&error];
+       if(error) {
+               [self log:@"Fetch error: %@", error];
+               return;
+       }
+       if(!result || [result count] == 0) {
+               [self log:@"Could not find slotItem of id (%@)", value];
+               return;
+       }
+       
+       [object setValue:result[0] forKey:@"master_SlotItem"];
+}
+- (BOOL)handleExtraValue:(id)value forKey:(NSString *)key toObject:(NSManagedObject *)object
+{
+       if([key isEqualToString:@"api_slotitem_id"]) {
+               [self setMasterSlotItem:value toObject:object];
+               return YES;
+       }
+       return NO;
+}
+@end
index 99f6424..be0c93e 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="3401" systemVersion="13B42" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
+<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="3401" systemVersion="13C64" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
     <entity name="Basic" representedClassName="HMKCManagedObject" syncable="YES">
         <attribute name="active_flag" optional="YES" attributeType="Boolean" syncable="YES"/>
         <attribute name="comment" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="type_2" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
         <attribute name="type_3" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
         <attribute name="usebull" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
+        <relationship name="slotItems" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="SlotItem" inverseName="master_slotItem" inverseEntity="SlotItem" syncable="YES"/>
     </entity>
     <entity name="MasterSType" representedClassName="HMKCManagedObject" syncable="YES">
         <attribute name="id" attributeType="Integer 32" indexed="YES" syncable="YES"/>
         <attribute name="use_fuel" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
         <relationship name="master_ship" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="MasterShip" inverseName="ships" inverseEntity="MasterShip" syncable="YES"/>
     </entity>
+    <entity name="SlotItem" representedClassName="HMKCManagedObject" syncable="YES">
+        <attribute name="flag_0" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_1" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_2" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_3" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_4" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_5" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_6" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="flag_7" optional="YES" attributeType="Boolean" syncable="YES"/>
+        <attribute name="id" optional="YES" attributeType="Integer 64" defaultValueString="0" syncable="YES"/>
+        <attribute name="kaih" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
+        <attribute name="sakb" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
+        <relationship name="master_slotItem" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="MasterSlotItem" inverseName="slotItems" inverseEntity="MasterSlotItem" syncable="YES"/>
+    </entity>
     <elements>
         <element name="Basic" positionX="0" positionY="0" width="0" height="0"/>
         <element name="Deck" positionX="0" positionY="0" width="0" height="0"/>
         <element name="Material" positionX="0" positionY="0" width="0" height="0"/>
         <element name="NyukyoDock" positionX="0" positionY="0" width="0" height="0"/>
         <element name="Ship" positionX="0" positionY="0" width="0" height="0"/>
+        <element name="SlotItem" positionX="0" positionY="0" width="0" height="0"/>
     </elements>
 </model>
\ No newline at end of file