forked from ambethia/Pocket-Gnome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.0 Commit - Let the code rapage begin
- Loading branch information
Josh
authored and
Josh
committed
Oct 18, 2010
0 parents
commit d163bfa
Showing
1,923 changed files
with
353,057 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// Action.h | ||
// Pocket Gnome | ||
// | ||
// Created by Jon Drummond on 9/6/08. | ||
// Copyright 2008 Jon Drummond. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
typedef enum ActionType { | ||
ActionType_None = 0, | ||
ActionType_Spell = 1, | ||
ActionType_Item = 2, | ||
ActionType_Macro = 3, | ||
ActionType_Delay = 4, | ||
ActionType_InteractNPC = 5, | ||
ActionType_Jump = 6, | ||
ActionType_SwitchRoute = 7, | ||
ActionType_QuestTurnIn = 8, | ||
ActionType_QuestGrab = 9, | ||
ActionType_Vendor = 10, | ||
ActionType_Mail = 11, | ||
ActionType_Repair = 12, | ||
ActionType_ReverseRoute = 13, | ||
ActionType_CombatProfile = 14, | ||
ActionType_InteractObject = 15, | ||
ActionType_JumpToWaypoint = 16, | ||
ActionType_Max, | ||
} ActionType; | ||
|
||
@class RouteSet; | ||
|
||
@interface Action : NSObject <NSCoding, NSCopying> { | ||
ActionType _type; | ||
id _value; | ||
BOOL _enabled; | ||
} | ||
|
||
- (id)initWithType: (ActionType)type value: (id)value; | ||
+ (id)actionWithType: (ActionType)type value: (id)value; | ||
+ (id)action; | ||
|
||
@property (readwrite, assign) ActionType type; | ||
@property (readwrite, copy) id value; | ||
|
||
@property BOOL enabled; | ||
|
||
// in order to play nice with old code | ||
@property (readonly) float delay; | ||
@property (readonly) UInt32 actionID; | ||
|
||
- (RouteSet*)route; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// | ||
// Action.m | ||
// Pocket Gnome | ||
// | ||
// Created by Jon Drummond on 9/6/08. | ||
// Copyright 2008 Jon Drummond. All rights reserved. | ||
// | ||
|
||
#import "Action.h" | ||
#import "RouteSet.h" | ||
#import "Route.h" | ||
#import "Spell.h" | ||
#import "SpellController.h" | ||
|
||
@implementation Action | ||
|
||
- (id) init { | ||
return [self initWithType: ActionType_None value: nil]; | ||
} | ||
|
||
- (id)initWithType: (ActionType)type value: (id)value { | ||
self = [super init]; | ||
if (self != nil) { | ||
self.type = type; | ||
self.value = value; | ||
self.enabled = YES; | ||
//self.delay = delay; | ||
//self.actionID = actionID; | ||
} | ||
return self; | ||
} | ||
|
||
+ (id)actionWithType: (ActionType)type value: (id)value { | ||
return [[[[self class] alloc] initWithType: type value: value] autorelease]; | ||
} | ||
|
||
+ (id)action { | ||
return [[self class] actionWithType: ActionType_None value: nil]; | ||
} | ||
|
||
- (id)initWithCoder:(NSCoder *)decoder { | ||
self = [super init]; | ||
if(self) { | ||
self.type = [[decoder decodeObjectForKey: @"Type"] unsignedIntValue]; | ||
self.value = ([decoder decodeObjectForKey: @"Value"] ? [decoder decodeObjectForKey: @"Value"] : nil); | ||
self.enabled = [decoder decodeObjectForKey: @"Enabled"] ? [[decoder decodeObjectForKey: @"Enabled"] boolValue] : YES; | ||
} | ||
return self; | ||
} | ||
|
||
-(void)encodeWithCoder:(NSCoder *)coder { | ||
[coder encodeObject: [NSNumber numberWithUnsignedInt: self.type] forKey: @"Type"]; | ||
|
||
if(self.type > ActionType_None){ | ||
[coder encodeObject: self.value forKey: @"Value"]; | ||
[coder encodeObject: [NSNumber numberWithBool: self.enabled] forKey: @"Enabled"]; | ||
} | ||
} | ||
|
||
- (id)copyWithZone:(NSZone *)zone { | ||
Action *copy = [[[self class] allocWithZone: zone] initWithType: self.type value: self.value]; | ||
return copy; | ||
} | ||
|
||
- (void) dealloc { | ||
self.value = nil; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@synthesize type = _type; | ||
@synthesize value = _value; | ||
@synthesize enabled = _enabled; | ||
|
||
- (void)setType: (ActionType)type { | ||
if(type < ActionType_None || (type >= ActionType_Max)) { | ||
type = ActionType_None; | ||
} | ||
|
||
_type = type; | ||
} | ||
|
||
- (float)delay { | ||
if(self.type == ActionType_Delay) { | ||
return [self.value floatValue]; | ||
} | ||
return 0.0f; | ||
} | ||
|
||
- (UInt32)actionID { | ||
|
||
if(self.type == ActionType_Spell || self.type == ActionType_Item || self.type == ActionType_Macro) { | ||
return [self.value unsignedIntValue]; | ||
} | ||
return 0; | ||
} | ||
|
||
- (RouteSet*)route{ | ||
|
||
if ( self.type == ActionType_SwitchRoute ){ | ||
return (RouteSet*)self.value; | ||
} | ||
|
||
return nil; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// ActionController.h | ||
// Pocket Gnome | ||
// | ||
// Created by Josh on 1/14/10. | ||
// Copyright 2010 Savory Software, LLC. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "Action.h" | ||
|
||
@interface ActionController : NSObject { | ||
IBOutlet NSView *view; | ||
IBOutlet id _delegate; | ||
IBOutlet NSButton *disableButton; | ||
BOOL _enabled; | ||
} | ||
|
||
+ (id)actionControllerWithAction: (Action*)action; | ||
|
||
- (NSView*)view; | ||
- (IBAction)validateState: (id)sender; | ||
- (IBAction)disableAction: (id)sender; | ||
|
||
@property (readwrite, assign) id delegate; | ||
@property BOOL enabled; | ||
|
||
- (Action*)action; | ||
- (void)setStateFromAction: (Action*)action; | ||
- (void)removeBindings; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
// | ||
// ActionController.m | ||
// Pocket Gnome | ||
// | ||
// Created by Josh on 1/14/10. | ||
// Copyright 2010 Savory Software, LLC. All rights reserved. | ||
// | ||
|
||
#import "ActionController.h" | ||
#import "Action.h" | ||
|
||
#import "RepairActionController.h" | ||
#import "SwitchRouteActionController.h" | ||
#import "SpellActionController.h" | ||
#import "ItemActionController.h" | ||
#import "MacroActionController.h" | ||
#import "DelayActionController.h" | ||
#import "JumpActionController.h" | ||
#import "QuestTurnInActionController.h" | ||
#import "QuestGrabActionController.h" | ||
#import "InteractObjectActionController.h" | ||
#import "InteractNPCActionController.h" | ||
#import "CombatProfileActionController.h" | ||
#import "VendorActionController.h" | ||
#import "MailActionController.h" | ||
#import "ReverseRouteActionController.h" | ||
#import "JumpToWaypointActionController.h" | ||
|
||
@implementation ActionController | ||
|
||
- (id) init | ||
{ | ||
self = [super init]; | ||
if (self != nil) { | ||
self.enabled = YES; | ||
} | ||
return self; | ||
} | ||
|
||
- (void) dealloc | ||
{ | ||
[view removeFromSuperview]; | ||
[super dealloc]; | ||
} | ||
|
||
+ (id)actionControllerWithAction: (Action*)action { | ||
ActionController *newController = nil; | ||
|
||
if ( [action type] == ActionType_Repair ) | ||
newController = [[RepairActionController alloc] init]; | ||
else if ( [action type] == ActionType_SwitchRoute ) | ||
newController = [[SwitchRouteActionController alloc] init]; | ||
else if ( [action type] == ActionType_Spell ) | ||
newController = [[SpellActionController alloc] init]; | ||
else if ( [action type] == ActionType_Item ) | ||
newController = [[ItemActionController alloc] init]; | ||
else if ( [action type] == ActionType_Macro ) | ||
newController = [[MacroActionController alloc] init]; | ||
else if ( [action type] == ActionType_Delay ) | ||
newController = [[DelayActionController alloc] init]; | ||
else if ( [action type] == ActionType_Jump ) | ||
newController = [[JumpActionController alloc] init]; | ||
else if ( [action type] == ActionType_QuestTurnIn ) | ||
newController = [[QuestTurnInActionController alloc] init]; | ||
else if ( [action type] == ActionType_QuestGrab ) | ||
newController = [[QuestGrabActionController alloc] init]; | ||
else if ( [action type] == ActionType_InteractNPC ) | ||
newController = [[InteractNPCActionController alloc] init]; | ||
else if ( [action type] == ActionType_InteractObject ) | ||
newController = [[InteractObjectActionController alloc] init]; | ||
else if ( [action type] == ActionType_CombatProfile ) | ||
newController = [[CombatProfileActionController alloc] init]; | ||
else if ( [action type] == ActionType_Vendor ) | ||
newController = [[VendorActionController alloc] init]; | ||
else if ( [action type] == ActionType_Mail ) | ||
newController = [[MailActionController alloc] init]; | ||
else if ( [action type] == ActionType_ReverseRoute ) | ||
newController = [[ReverseRouteActionController alloc] init]; | ||
else if ( [action type] == ActionType_JumpToWaypoint ) | ||
newController = [[JumpToWaypointActionController alloc] init]; | ||
|
||
if(newController) { | ||
[newController setStateFromAction: action]; | ||
return [newController autorelease]; | ||
} | ||
|
||
return [[[ActionController alloc] init] autorelease]; | ||
} | ||
|
||
@synthesize enabled = _enabled; | ||
@synthesize delegate = _delegate; | ||
|
||
- (NSView*)view { | ||
return view; | ||
} | ||
|
||
- (IBAction)validateState: (id)sender { | ||
return; | ||
} | ||
|
||
- (IBAction)disableAction: (id)sender { | ||
for(NSView *aView in [[self view] subviews]) { | ||
if( (aView != sender) && [aView respondsToSelector: @selector(setEnabled:)] ) { | ||
[(NSControl*)aView setEnabled: ![sender state]]; | ||
} | ||
} | ||
|
||
self.enabled = ![sender state]; | ||
} | ||
|
||
- (Action*)action { | ||
return nil; | ||
return [[[Action alloc] init] autorelease]; | ||
} | ||
|
||
- (void)setStateFromAction: (Action*)action { | ||
self.enabled = [action enabled]; | ||
|
||
if(self.enabled) [disableButton setState: NSOffState]; | ||
else [disableButton setState: NSOnState]; | ||
|
||
[self disableAction: disableButton]; | ||
} | ||
|
||
- (void)removeBindings{ | ||
|
||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// ActionMenusController.h | ||
// Pocket Gnome | ||
// | ||
// Created by Jon Drummond on 9/6/08. | ||
// Copyright 2008 Jon Drummond. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@class Controller; | ||
@class SpellController; | ||
@class InventoryController; | ||
@class MobController; | ||
@class NodeController; | ||
@class MacroController; | ||
|
||
typedef enum ActionMenuTypes { | ||
MenuType_Spell = 1, | ||
MenuType_Inventory = 2, | ||
MenuType_Macro = 3, | ||
MenuType_Interact = 5, | ||
|
||
} ActionMenuType; | ||
|
||
@interface ActionMenusController : NSObject { | ||
|
||
IBOutlet Controller *controller; | ||
IBOutlet SpellController *spellController; | ||
IBOutlet InventoryController *inventoryController; | ||
IBOutlet MobController *mobController; | ||
IBOutlet NodeController *nodeController; | ||
IBOutlet MacroController *macroController; | ||
} | ||
|
||
+ (ActionMenusController *)sharedMenus; | ||
|
||
- (NSMenu*)menuType: (ActionMenuType)type actionID: (UInt32)actionID; | ||
|
||
@end |
Oops, something went wrong.