Games-Axmud

 view release on metacpan or  search on metacpan

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

                    'ok',
                );

                return undef;
            }

            # Open the file in the external text editor
            $cmd =~ s/%s/$file/;

            system $cmd;
        });

        # This IV only available to rooms
        if ($self->editObj->category eq 'room') {

            $self->addLabel($grid, '<i>For rooms in virtual areas, the virtual area\'s file</i>',
                1, 12, 10, 11);
            my $entry2 = $self->addEntry($grid, 'virtualAreaPath', TRUE,
                1, 12, 11, 12);
            # 2nd entry box starts insensitive if the 1st entry box doesn't contain text
            if (! $entry->get_text()) {

                $entry2->set_sensitive(FALSE);
            }

            my $button3 = $self->addButton($grid,
                'Copy to virtual path',
                'Copy the file path above into the entry box below',
                undef,
                7, 9, 9, 10);
            $button3->signal_connect('clicked' => sub {

                # Copy the contents of the first entry into the second when the button is clicked
                $entry2->set_text($entry->get_text());
            });

            # The second entry can only be edited when the first contains text
            $entry->signal_connect('changed' => sub {

                # Update the IV
                my $text = $entry->get_text();
                $self->ivAdd('editHash', 'sourceCodePath', $text);

                if (! $entry->get_text()) {

                    # First entry is now empty, so empty the second entry too
                    $entry2->set_text('');
                    $entry2->set_sensitive(FALSE);

                } else {

                    # Sensitise the second entry
                    $entry2->set_sensitive(TRUE);
                }
            });
        }

        # Right column
        $self->addCheckButton($grid, 'Concrete (not abstract) object', 'concreteFlag', FALSE,
            7, 12, 1, 2);
        $self->addCheckButton($grid, 'Alive', 'aliveFlag', FALSE,
            7, 12, 2, 3);
        $self->addCheckButton($grid, 'Sentient', 'sentientFlag', FALSE,
            7, 12, 3, 4);
        $self->addCheckButton($grid, 'Portable (can be carried)', 'portableFlag', FALSE,
            7, 12, 4, 5);
        $self->addCheckButton($grid, 'Saleable (can be sold)', 'saleableFlag', FALSE,
            7, 12, 5, 6);

        # Tab complete
        return 1;
    }

    sub familyTab {

        # Family tab
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

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

            return $axmud::CLIENT->writeImproper($self->_objClass . '->familyTab', @_);
        }

        # Tab setup
        # Create a notebook within the main one, so that we have two rows of tabs
        my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Family');

        # Add tabs to the inner notebook
        $self->family1Tab($innerNotebook);
        $self->family2Tab($innerNotebook);

        return 1;
    }

    sub family1Tab {

        # Family1 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @columnList;

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

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

            $innerNotebook,
            'Page _1',
            ['Character settings', 'Character nickname'],
        );

        # Prepare lists of guilds and races
        foreach my $profObj ($self->session->ivValues('profHash')) {

            if ($profObj->category eq 'guild') {
                push (@guildList, $profObj->name);
            } elsif ($profObj->category eq 'race') {
                push (@raceList, $profObj->name);
            }
        }

        # Left column
        $self->addLabel($grid, '<b>Character settings</b>',
            0, 6, 0, 1);
        $self->addLabel($grid, 'Guild',
            1, 3, 1, 2);
        $self->addComboBox($grid, 'guild', \@guildList, '',
            FALSE,              # 'undef' value allowed
            3, 6, 1, 2);
        $self->addLabel($grid, 'Race',
            1, 3, 2, 3);
        $self->addComboBox($grid, 'race', \@raceList, '',
            FALSE,              # 'undef' value allowed
            3, 6, 2, 3);
        $self->addLabel($grid, 'Age',
            1, 3, 3, 4);
        $self->addEntryWithIcon($grid, 'age', 'int', 0, undef,
            3, 6, 3, 4);
        $self->addLabel($grid, 'Level',
            1, 3, 4, 5);
        $self->addEntryWithIcon($grid, 'level', 'int', 0, undef,
            3, 6, 4, 5);
        $self->addLabel($grid, 'Bank balance',
            1, 3, 5, 6);
        $self->addEntryWithIcon($grid, 'bankBalance', 'float', 0, undef,
            3, 6, 5, 6);
        $self->addLabel($grid, 'Purse contents',
            1, 3, 6, 7);
        $self->addEntryWithIcon($grid, 'purseContents', 'float', 0, undef,
            3, 6, 6, 7);

        # Right column
        $self->addLabel($grid, 'Lives left',
            7, 9, 1, 2);
        $self->addEntryWithIcon($grid, 'lifeCount', 'int', 0, undef,
            9, 12, 1, 2);
        $self->addLabel($grid, 'Times killed',
            7, 9, 2, 3);
        $self->addEntryWithIcon($grid, 'deathCount', 'int', 0, undef,
            9, 12, 2, 3);
        $self->addLabel($grid, 'Max lives',
            7, 9, 3, 4);
        $self->addEntryWithIcon($grid, 'lifeMax', 'int', 0, undef,
            9, 12, 3, 4);
        $self->addLabel($grid, 'Life status',
            7, 9, 4, 5);
        @comboList = ('alive', 'sleep', 'passout', 'dead');
        $self->addComboBox($grid, 'lifeStatus', \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 12, 4, 5);
        $self->addLabel($grid, 'Alignment',
            7, 9, 5, 6);
        $self->addEntryWithButton($grid, 'alignment', TRUE,
            9, 12, 5, 6);

        # Bottom section
        $self->addLabel($grid, '<b>Character nickname</b>',
            0, 12, 7, 8);
        $self->addLabel(
            $grid,
            '<i>Used in automatic logins. Can include any text, e.g. \'Gandalf the Great\'</i>',
            0, 12, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, 'nickname', 'string', 1, undef,
            0, 10, 9, 10);
        my $button = $self->addButton(
            $grid,
            'Reset',
            'Reset the character\'s nickname',
            undef,
            10, 12, 9, 10,
        );
        $button->signal_connect('clicked' => sub {

            $self->ivAdd('editHash', 'nickname', $self->editObj->name);
            $entry->set_text($self->editObj->name);
        });

        # Tab complete
        return 1;
    }

    sub settings2Tab {

        # Settings2 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

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

            return $axmud::CLIENT->writeImproper($self->_objClass . '->settings2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Points - health, magic, energy, guild and social points'],
        );

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

            'Page _1',
            ['Task window'],
        );

        # Task window
        $self->addLabel($grid, '<b>Task window</b>',
            0, 12, 0, 1);

        # Left column
        $self->addCheckButton($grid, 'Split lines, with one line per token', 'splitLineFlag', TRUE,
            1, 6, 1, 2);
        $self->addCheckButton($grid, 'Show token types', 'showTypeFlag', TRUE,
            1, 6, 2, 3);

        # Right column
        $self->addCheckButton($grid, 'Show packet numbers', 'countPacketFlag', TRUE,
            7, 12, 1, 2);

        # Tab complete
        return 1;
    }

    sub parametersStatus1Tab {

        # Parameters Status1 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @comboList;

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

            return $axmud::CLIENT->writeImproper($self->_objClass . '->parametersStatus1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Background colour parameters', 'Data display'],
        );

        # (Import a list of standard colour tags, putting bold colours first)
        @comboList = ($axmud::CLIENT->constColourTagList, $axmud::CLIENT->constBoldColourTagList);

        # Background colour parameters
        $self->addLabel($grid, '<b>Background colour parameters</b>',
            0, 12, 0, 1);

        $self->addCheckButton($grid, 'Allow background colour changes', 'allowColourFlag', TRUE,
            1, 6, 1, 2);
        $self->addLabel($grid, 'Character alive',
            1, 3, 2, 3);
        $self->addComboBox($grid, 'aliveColour', \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 6, 2, 3);
        $self->addLabel($grid, 'Alive, health below 50%',
            1, 3, 3, 4);
        $self->addComboBox($grid, 'alive50Colour', \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 6, 3, 4);
        $self->addLabel($grid, 'Alive, health below 30%',
            1, 3, 4, 5);
        $self->addComboBox($grid, 'alive30Colour', \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 6, 4, 5);
        $self->addLabel($grid, 'Alive, health below 10%',
            1, 3, 5, 6);
        $self->addComboBox($grid, 'alive10Colour', \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 6, 5, 6);

        # (right column)
        $self->addLabel($grid, 'Character asleep',
            7, 9, 2, 3);
        $self->addComboBox($grid, 'asleepColour', \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 12, 2, 3);
        $self->addLabel($grid, 'Character passed out',
            7, 9, 3, 4);
        $self->addComboBox($grid, 'passedOutColour', \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 12, 3, 4);
        $self->addLabel($grid, 'Character dead',
            7, 9, 4, 5);
        $self->addComboBox($grid, 'deadColour', \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 12, 4, 5);

        # Data display
        $self->addLabel($grid, '<b>Data display</b>',
            0, 12, 6, 7);
        $self->addCheckButton(
            $grid, 'Show information in \'main\' window gauges', 'gaugeFlag', TRUE,
            1, 6, 7, 8);
        $self->addCheckButton($grid, 'Also show explicit gauge labels', 'gaugeValueFlag', TRUE,
            1, 6, 8, 9);

        # Tab complete
        return 1;
    }

    sub parametersStatus2Tab {

        # Parameters Status2 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @columnList;

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

            return $axmud::CLIENT->writeImproper($self->_objClass . '->parametersStatus2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Status task commands'],



( run in 3.886 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )