From dd7a2358c03032e5ceaee0a50ba5c09e6806f154 Mon Sep 17 00:00:00 2001 From: Nick Loose Date: Sun, 14 Nov 2010 20:51:06 +0100 Subject: [PATCH] Added the ability to make Items Indestructible --- Classes/IJInventoryItem.h | 4 +- Classes/IJInventoryWindowController.m | 8 + Classes/IJItemPropertiesViewController.h | 4 +- Classes/IJItemPropertiesViewController.m | 13 ++ English.lproj/ItemPropertiesView.xib | 269 ++++++++++++++++++----- 5 files changed, 237 insertions(+), 61 deletions(-) diff --git a/Classes/IJInventoryItem.h b/Classes/IJInventoryItem.h index 835a33a..ce9e7b7 100644 --- a/Classes/IJInventoryItem.h +++ b/Classes/IJInventoryItem.h @@ -19,12 +19,12 @@ @interface IJInventoryItem : NSObject { uint16_t itemId; - uint16_t damage; + int16_t damage; uint8_t count; uint8_t slot; } @property (nonatomic, assign) uint16_t itemId; -@property (nonatomic, assign) uint16_t damage; +@property (nonatomic, assign) int16_t damage; @property (nonatomic, assign) uint8_t count; @property (nonatomic, assign) uint8_t slot; diff --git a/Classes/IJInventoryWindowController.m b/Classes/IJInventoryWindowController.m index 2d22499..61ed9dc 100644 --- a/Classes/IJInventoryWindowController.m +++ b/Classes/IJInventoryWindowController.m @@ -420,6 +420,14 @@ [propertiesWindow setAlphaValue:0.0]; }]; propertiesViewController.item = item; + + if (propertiesViewController.item.damage == -1000){ + [propertiesViewController setState:YES]; + }else { + [propertiesViewController setState:NO]; + } + + [propertiesWindow setPoint:point side:MAPositionRight]; [propertiesWindow makeKeyAndOrderFront:nil]; [propertiesWindow setAlphaValue:1.0]; diff --git a/Classes/IJItemPropertiesViewController.h b/Classes/IJItemPropertiesViewController.h index 9a9638e..a9f82cc 100644 --- a/Classes/IJItemPropertiesViewController.h +++ b/Classes/IJItemPropertiesViewController.h @@ -12,9 +12,11 @@ @interface IJItemPropertiesViewController : NSViewController { IJInventoryItem *item; + IBOutlet NSButton *checkIndestructible; } @property (nonatomic, retain) IJInventoryItem *item; +- (void)setState:(bool)enabel; - (IBAction)closeButton:(id)sender; - +- (IBAction)makeIndestructible:(id)sender; @end diff --git a/Classes/IJItemPropertiesViewController.m b/Classes/IJItemPropertiesViewController.m index 49b9403..39cccf8 100644 --- a/Classes/IJItemPropertiesViewController.m +++ b/Classes/IJItemPropertiesViewController.m @@ -20,4 +20,17 @@ self.item = nil; // Hack to prevent this item as coming up as 'lastItem' if they click again. } +- (IBAction)makeIndestructible:(id)sender +{ + if ([checkIndestructible state] == NSOnState) { + self.item.damage = -1000; + + }else { + self.item.damage = 0; + } +} + +- (void)setState:(bool)enabel{ + [checkIndestructible setState:enabel]; +} @end diff --git a/English.lproj/ItemPropertiesView.xib b/English.lproj/ItemPropertiesView.xib index c642369..6d48742 100644 --- a/English.lproj/ItemPropertiesView.xib +++ b/English.lproj/ItemPropertiesView.xib @@ -2,13 +2,13 @@ 1060 - 10F569 - 804 - 1038.29 + 10H574 + 823 + 1038.35 461.00 com.apple.InterfaceBuilder.CocoaPlugin - 804 + 823 YES @@ -43,21 +43,80 @@ 268 YES + + + 268 + {{106, 11}, {21, 21}} + + YES + + 67239424 + 0 + checkIndestructible + + LucidaGrande + 13 + 1044 + + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + + 268 + {{8, 13}, {95, 17}} + + YES + + 68288064 + 71304192 + Indestructible: + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + 268 - {{127, 54}, {12, 30}} + {{156, 88}, {13, 20}} YES 67239424 268435456 Button - - LucidaGrande - 13 - 1044 - + -2042347265 129 @@ -74,11 +133,11 @@ 268 - {{74, 9}, {51, 22}} + {{108, 36}, {51, 22}} YES - -1804468671 + 343014977 272630848 @@ -88,6 +147,7 @@ YES allowsFloats formatterBehavior + lenient locale negativeInfinitySymbol nilSymbol @@ -98,17 +158,18 @@ YES + -∞ - + +∞ - #,##0.### - #,##0.### + # + # @@ -142,7 +203,7 @@ . , - YES + NO NO YES @@ -161,17 +222,14 @@ 6 System textColor - - 3 - MAA - + 268 - {{74, 36}, {51, 22}} + {{108, 62}, {51, 22}} YES @@ -237,7 +295,7 @@ 268 - {{3, 11}, {66, 17}} + {{37, 38}, {66, 17}} YES @@ -246,27 +304,14 @@ Damage: - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - + + 268 - {{8, 63}, {120, 14}} + {{8, 92}, {120, 14}} YES @@ -286,7 +331,7 @@ 268 - {{3, 38}, {66, 17}} + {{37, 65}, {66, 17}} YES @@ -300,7 +345,7 @@ - {140, 80} + {174, 109} NSView @@ -372,6 +417,22 @@ 25 + + + makeIndestructible: + + + + 34 + + + + checkIndestructible + + + + 35 + @@ -405,12 +466,14 @@ YES + + + - @@ -516,6 +579,35 @@ + + 26 + + + YES + + + + + + 27 + + + + + 28 + + + YES + + + + checkIndestructible + + + 29 + + + @@ -524,6 +616,7 @@ YES 1.IBEditorWindowLastContentRect 1.IBPluginDependency + 1.IBViewBoundsToFrameTransform 1.WindowOrigin 1.editorWindowContentRectSynchronizationRect 10.IBPluginDependency @@ -531,6 +624,7 @@ 11.IBPluginDependency 12.IBNumberFormatterBehaviorMetadataKey 12.IBNumberFormatterLocalizesFormatMetadataKey + 12.IBNumberFormatterSampleNumberKey 12.IBPluginDependency 17.IBPluginDependency 17.IBViewBoundsToFrameTransform @@ -538,6 +632,12 @@ 22.IBPluginDependency 22.IBViewBoundsToFrameTransform 23.IBPluginDependency + 26.IBPluginDependency + 26.IBViewBoundsToFrameTransform + 27.IBPluginDependency + 28.IBPluginDependency + 28.IBViewBoundsToFrameTransform + 29.IBPluginDependency 3.IBPluginDependency 3.IBViewBoundsToFrameTransform 4.IBPluginDependency @@ -553,21 +653,23 @@ YES - {{550, 448}, {140, 80}} + {{1100, 300}, {174, 109}} com.apple.InterfaceBuilder.CocoaPlugin + {628, 654} {{217, 442}, {480, 272}} com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABClAAAwjwAAA + P4AAAL+AAABC2AAAwmAAAA com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABCogAAwo4AAA + P4AAAL+AAABDHAAAwtQAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -577,17 +679,27 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABAQAAAwmQAAA + P4AAAL+AAADAAAAAwfAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABAQAAAwjAAAA + P4AAAL+AAABC1AAAwfAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABClAAAwpQAAA + P4AAAL+AAABB2AAAwqQAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABB2AAAwlwAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABCxAAAwqgAAA com.apple.InterfaceBuilder.CocoaPlugin @@ -611,7 +723,7 @@ - 25 + 35 @@ -620,19 +732,51 @@ IJItemPropertiesViewController NSViewController - closeButton: - id + YES + + YES + closeButton: + makeIndestructible: + + + YES + id + id + - closeButton: - - closeButton: - id + YES + + YES + closeButton: + makeIndestructible: + + + YES + + closeButton: + id + + + makeIndestructible: + id + + + + + checkIndestructible + NSButton + + + checkIndestructible + + checkIndestructible + NSButton IBProjectSource - IJItemPropertiesViewController.h + Classes/IJItemPropertiesViewController.h @@ -1099,11 +1243,20 @@ YES - InsideJob.xcodeproj + ../InsideJob.xcodeproj 3 - NSStopProgressFreestandingTemplate - {83, 83} + YES + + YES + NSStopProgressFreestandingTemplate + NSSwitch + + + YES + {83, 83} + {15, 15} +