Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/InterfaceModel.pm  view on Meta::CPAN

            category                    => 'alias',     # Shortcut to $self->_objClass

            # Alias attributes
            # ----------------

            stimulusName                => 'pattern',
            responseName                => 'substitution',

            # Default values for each alias attribute
            optionalAttribHash          => {
                'ignore_case'           => TRUE,
                'keep_checking'         => FALSE,
                'temporary'             => FALSE,
            },

            # Acceptable values for all attributes (standard interface and alias)
            attribTypeHash              => {
                # Standard
                'name'                  => 'string',
                'stimulus'              => 'pattern',
                'response'              => 'substitution',
                'enabled'               => 'boolean',
                # Alias
                'ignore_case'           => 'boolean',
                'keep_checking'         => 'boolean',
                'temporary'             => 'boolean',
                'cooldown'              => 'number',
            },

            # Switches used in client commands
            compulsorySwitchHash        => {
                'stimulus'              => 's',
                'response'              => 'p',
            },

            optionalSwitchHash          => {
                'name'                  => 'n',
                'enabled'               => 'e',
                'ignore_case'           => 'o',
                'keep_checking'         => 'k',
                'temporary'             => 't',
                'cooldown'              => 'cd',
            },
        };

        # Bless the object into existence
        bless $self, $class;
        return $self;
    }

    ##################
    # Methods

    ##################
    # Accessors - set

    ##################
    # Accessors - get
}

{ package Games::Axmud::InterfaceModel::Macro;

    use strict;
    use warnings;
#   use diagnostics;

    use Glib qw(TRUE FALSE);

    our @ISA = qw(Games::Axmud::Generic::InterfaceModel Games::Axmud);

    ##################
    # Constructors

    sub new {

        # Creates a new instance of the interface model object for macros
        #
        # Axmud interfaces are triggers, aliases, macros, timers and hooks. Interface models contain
        #   default value for each type of interface. The GA::Client object stores one model
        #   interface object for every type of interface
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   Blessed reference to the newly-created object on success

        my ($class, $check) = @_;

        # Check for improper arguments
        if (! defined $class || defined $check) {

            return $axmud::CLIENT->writeImproper($class . '->new', @_);
        }

        # Setup
        my $self = {
            _objName                    => 'macro',
            _objClass                   => $class,
            _parentFile                 => undef,       # No parent file object
            _parentWorld                => undef,       # No parent file object
            _privFlag                   => TRUE,        # All IVs are private

            # Interface category
            # ------------------

            category                    => 'macro',     # Shortcut to $self->_objClass

            # Macro attributes
            # ----------------

            stimulusName                => 'keycode',
            responseName                => 'instruction',

            # Default values for each macro attribute
            optionalAttribHash          => {
                'temporary'             => FALSE,
            },

            # Acceptable values for all attributes (standard interface and macro)
            attribTypeHash              => {
                # Standard
                'name'                  => 'string',
                'stimulus'              => 'keycode',
                'response'              => 'instruction',
                'enabled'               => 'boolean',
                # Macro
                'temporary'             => 'boolean',
                'cooldown'              => 'number',
            },

            # Switches used in client commands
            compulsorySwitchHash        => {
                'stimulus'              => 's',
                'response'              => 'p',
            },

            optionalSwitchHash          => {
                'name'                  => 'n',
                'enabled'               => 'e',
                'temporary'             => 't',
                'cooldown'              => 'cd',
            },
        };

        # Bless the object into existence
        bless $self, $class;
        return $self;
    }

    ##################
    # Methods

    ##################
    # Accessors - set

    ##################
    # Accessors - get
}

{ package Games::Axmud::InterfaceModel::Timer;

    use strict;
    use warnings;
#   use diagnostics;

    use Glib qw(TRUE FALSE);

    our @ISA = qw(Games::Axmud::Generic::InterfaceModel Games::Axmud);

    ##################
    # Constructors

    sub new {

        # Creates a new instance of the interface model object for timers
        #
        # Axmud interfaces are triggers, aliases, macros, timers and hooks. Interface models contain
        #   default value for each type of interface. The GA::Client object stores one model
        #   interface object for every type of interface
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   Blessed reference to the newly-created object on success



( run in 0.679 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )