Games-Axmud

 view release on metacpan or  search on metacpan

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

        }

        # Get a sorted list of route keys from the cage
        @sortedList = sort {lc($a) cmp lc($b)} ($self->editObj->ivKeys('routeHash'));
        # Get a list of columns in the simple list, which depends on how many cages there are
        @cageList = $self->compileCages();

        # Compile the simple list data
        OUTER: foreach my $routeKey (@sortedList) {

            INNER: foreach my $cageObj (@cageList) {

                if ($cageObj->ivExists('routeHash', $routeKey)) {

                    # Don't display the route object's blessed reference - just display the route in
                    #   the form used by keys in the cage's ->routeHash
                    push (@dataList, $routeKey);

                } else {

                    # An route called $routeKey isn't stored in $cageObj
                    push (@dataList, undef);
                }
            }
        }

        # Reset the simple list
        $self->resetListData($self->slWidget1, [@dataList], scalar @cageList);

        return 1;
    }

    sub routesTab_addEditButtons {

        # Called by $self->routes1Tab and $self->routes2Tab to create the editing buttons beneath
        #   the GA::Obj::SimpleList
        #
        # Expected arguments
        #   $grid       - The current Gtk3::Grid displayed in the notebook
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $grid, $slWidget, $columns, $check) = @_;

        # Local variables
        my @typeList;

        # Check for improper arguments
        if (! defined $grid || ! defined $slWidget || ! defined $columns || defined $check) {

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

        # Add comboboxes, check buttons and entries
        $self->addLabel($grid, 'Route type',
            1, 4, 8, 9);
        @typeList = ('road', 'quick', 'circuit');
        my $combo = $self->addComboBox($grid, undef, \@typeList, '',
            TRUE,               # No 'undef' value used
            4, 5, 8, 9);

        my $checkButton = $self->addCheckButton($grid, 'Hoppable', undef, TRUE,
            5, 7, 8, 9);
        # New routes should be hoppable by default
        $checkButton->set_active(TRUE);

        $self->addLabel($grid, 'Start room tag',
            7, 10, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
            10, 13, 8, 9);

        $self->addLabel($grid, 'Stop room tag',
            1, 4, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
            4, 7, 9, 10);

        $self->addLabel($grid, 'Circuit name',
            7, 10, 9, 10);
        my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
            10, 13, 9, 10);

        $self->addLabel($grid, 'Route',
            1, 4, 10, 11);
        my $entry4 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 13, 10, 11);

        # Add editing buttons
        my $button = $self->addButton(
            $grid,
            'Add route',
            'Add a new pre-defined route',
            undef,
            3, 5, 11, 12,
            TRUE,           # Irreversible
        );
        $button->signal_connect('clicked' => sub {

            my ($routeType, $hopFlag, $startTag, $stopTag, $circuitName, $route, $cmd);

            $routeType = $combo->get_active_text();
            $hopFlag = $checkButton->get_active();
            $startTag = $entry->get_text();
            $stopTag = $entry2->get_text();
            $circuitName = $entry3->get_text();
            $route = $entry4->get_text();

            # Prepare the client command
            if ($routeType eq 'road') {

                if ($self->checkEntryIcon($entry, $entry2, $entry4)) {

                    $cmd = 'addroute ' . $startTag . ' ' . $stopTag . ' <' . $route . '> -o';
                }

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

            . ' component</i>',
            1, 13, 1, 2);

        $self->addCheckButton(
            $grid,
            'Locator doesn\'t use normal/bold colour tags interchangeably',
            'boldSensitiveFlag',
            TRUE,
            1, 13, 2, 3);

        my $checkButton = $self->addCheckButton(
            $grid,
            'Locator only considers colours/styles that applied at the beginning of the line',
            'useInitialTagsFlag',
            TRUE,
            1, 13, 3, 4);

        my $checkButton2 = $self->addCheckButton(
            $grid,
            'Locator only considers colours/styles that were explicity specified on this line',
            'useExplicitTagsFlag',
            TRUE,
            1, 13, 4, 5);

        $self->addCheckButton(
            $grid,
            'Locator treats this component as if it were a single line',
            'combineLinesFlag',
            TRUE,
            1, 13, 5, 6);

        # Locator task ignore options
        $self->addLabel($grid, '<b>Locator task ignore options</b>',
            0, 13, 6, 7);
        $self->addLabel(
            $grid,
            '<i>Options which allow the Locator task to ignore some parts of a line (if you'
            . ' modify several options, only one is used)</i>',
            1, 13, 7, 8);

        $self->addLabel($grid, 'Locator ignores text that doesn\'t use this standard colour tag',
            1, 9, 8, 9);

        $allTextMsg = '(Use all colours)';
        @comboList = (
            $allTextMsg,
            $axmud::CLIENT->constColourTagList,
            $axmud::CLIENT->constBoldColourTagList,
        );

        foreach my $item ($axmud::CLIENT->constColourTagList) {

            push (@comboList, 'ul_' . $item);
        }

        foreach my $item ($axmud::CLIENT->constBoldColourTagList) {

            push (@comboList, 'UL_' . $item);
        }

        # (Don't use the generic combobox code so that the tags are always displayed in the same
        #   order)
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 13, 8, 9);

        $current = $self->getEditHash_scalarIV('useTextColour');
        if ($current) {

            # Display the current value of the IV in the combobox
            OUTER: for (my $count = 0; $count < scalar @comboList; $count++) {

                if ($comboList[$count] eq $current) {

                    $comboBox->set_active($count);
                    $matchFlag = TRUE;
                    last OUTER;
                }
            }

            if (! $matchFlag) {

                $comboBox->set_active(0);
            }
        }

       $comboBox->signal_connect('changed' => sub {

            my $text = $comboBox->get_active_text();

            # If the user has selected the title, ignore it
            if ($text eq $allTextMsg) {
                $self->ivAdd('editHash', 'useTextColour', undef);
            } else {
                $self->ivAdd('editHash', 'useTextColour', $text);
            }
        });

        $self->addLabel(
            $grid,
            'Locator ignores the first <i>n</i> characters (0 - use whole line)',
            1, 9, 9, 10);
        $self->addEntryWithIcon($grid, 'ignoreFirstChars', 'int', 0, undef,
            9, 13, 9, 10);
        $self->addLabel(
            $grid,
            'Locator uses only the first <i>n</i> characters (0 - use whole line)',
            1, 9, 10, 11);
        $self->addEntryWithIcon($grid, 'useFirstChars', 'int', 0, undef,
            9, 13, 10, 11);
        $self->addLabel(
            $grid,
            'Locator uses only the contents of any group substring(s), if this pattern matches',
            1, 9, 11, 12);
        $self->addEntryWithIconButton($grid, 'usePatternGroups', 'regex', 0, undef,
            1, 13, 12, 13);

        # Tab complete
        return 1;
    }

    sub otherOptionsTab {

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

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

            1, 10, 2, 6,
            TRUE, TRUE, FALSE, FALSE,  # Treat as list, remove empty lines, don't remove whitespace
        );
        $self->addRegexButton($grid,
            [
                'list', $patternListIV,
            ],
            10, 12, 2, 3);
        $self->addLabel($grid, '',    # Empty labels for spacing
            10, 12, 3, 4);
        $self->addLabel($grid, '',    # Empty labels for spacing
            10, 12, 4, 5);
        $self->addLabel($grid, '',    # Empty labels for spacing
            10, 12, 5, 6);

        # Second label and textview, e.g. 'Tags found at the start of the component'
        my $label2 = $self->addLabel($grid, '',
            1, 4, 6, 7);
        my $textView2 = $self->addTextView($grid, $tagListIV, TRUE,
            1, 4, 7, 12,
            TRUE, TRUE, TRUE, FALSE);  # Treat as list, remove empty lines, do remove whitespace
        my $buffer = $textView2->get_buffer();

        # (Set text for these two labels)
        if (! $self->getEditHash_scalarIV($flagIV)) {

            $label->set_markup('<i>' . $stringList[1] . '</i>');
            $label2->set_markup('<i>' . $stringList[2] . '</i>');

        } else {

            $label->set_markup('<i>' . $stringList[3] . '</i>');
            $label2->set_markup('<i>' . $stringList[4] . '</i>');
        }

        # ->signal_connects for first group of radiobuttons
        $radioButton->signal_connect('toggled' => sub {

            # Set the IV only if this radiobutton has been selected
            if ($radioButton->get_active()) {

                $self->ivAdd('editHash', $flagIV, FALSE);

                $label->set_markup('<i>' . $stringList[1] . '</i>');
                $label2->set_markup('<i>' . $stringList[2] . '</i>');
            }
        });

        $radioButton2->signal_connect('toggled' => sub {

            # Set the IV only if this radiobutton has been selected
            if ($radioButton2->get_active()) {

                $self->ivAdd('editHash', $flagIV, TRUE);

                $label->set_markup('<i>' . $stringList[3] . '</i>');
                $label2->set_markup('<i>' . $stringList[4] . '</i>');
            }
        });

        # Prepare lists for insertion into comboboxes
        @comboList = $axmud::CLIENT->constColourTagList;
        foreach my $item (@comboList) {

            push (@comboList2, 'ul_' . $item);
        }
        @comboList3 = $axmud::CLIENT->constStyleTagList;

        # Add editing combos / buttons in bottom-right corner
        # First set - standard text colour tags
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, 'Standard text colour tags:',
            TRUE,               # No 'undef' value used
            4, 10, 7, 8);
        my $button = $self->patternsTags1Tab_addButton(
            $grid,
            7,
            $tagListIV,
            $buffer,
            $comboBox,
            'Standard text colour tags:',
        );
        my $button2 = $self->patternsTags1Tab_addBoldButton(
            $grid,
            7,
            $tagListIV,
            $buffer,
            $comboBox,
            'Standard text colour tags:',
        );

        # Second set - standard underlay colour tags
        my $comboBox2 = $self->addComboBox(
            $grid,
            undef,
            \@comboList2,
            'Standard underlay colour tags:',
            TRUE,               # No 'undef' value used
            4, 10, 8, 9);
        my $button3 = $self->patternsTags1Tab_addButton(
            $grid,
            8,
            $tagListIV,
            $buffer,
            $comboBox2,
            'Standard underlay colour tags:',
        );
        my $button4 = $self->patternsTags1Tab_addBoldButton(
            $grid,
            8,
            $tagListIV,
            $buffer,
            $comboBox2,
            'Standard underlay colour tags:',
        );

        # Third set - xterm tags
        $self->addLabel($grid, 'xterm tags:',
            4, 6, 9, 10);
        my $entry = $self->addEntryWithIcon(
            $grid,
            undef,

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

            }
        });

        # Fourth set - rgb tags
        $self->addLabel($grid, 'RGB tags:',
            4, 6, 10, 11);
        my $entry2 = $self->addEntryWithIcon(
            $grid,
            undef,
            \&patternsTags1Tab_checkEntry2,
            undef,
            undef,
            6, 10, 10, 11,
            8, 8);

        # (Only one button of this type, for this tab, so it doesn't have its own function)
        my $button6 = $self->addButton(
            $grid,
            'Add',
            'Add the selected xterm tag to the list',
            undef,
            10, 11, 10, 11,
        );
        $button6->signal_connect('clicked' => sub {

            my (
                $tag, $first, $second, $num, $modTag,
                @ivList,
            );

            if ($self->checkEntryIcon($entry2)) {

                $tag = $entry2->get_text();

                # Convert $tag to use standard capitalisation: RGB colour tags in the range
                #   '#000000' to '#FFFFFF' or 'u#000000' to 'u#FFFFFF'
                $first = substr($tag, 0, 1);
                $second = substr($tag, 0, 2);
                if ($first eq '#') {

                    $modTag = uc($tag);

                } elsif ($second eq 'u#' || $second eq 'U#') {

                    $modTag = 'u#' . uc(substr($tag, 2));
                }

                # Update the IV
                @ivList = $self->getEditHash_listIV($tagListIV);

                push (@ivList, $modTag);
                $self->ivAdd('editHash', $tagListIV, \@ivList);

                # Update the textview
                $buffer->set_text(join("\n", @ivList));
            }
        });

        # Fifth set - style tags
        # NB 'Dummy' style tags can be added to the GA::Obj::Component object, although this is not
        #   recommended, so they are not included in the combobox
        my $comboBox3 = $self->addComboBox($grid, undef, \@comboList3, 'Style tags:',
            TRUE,               # No 'undef' value used
            4, 10, 11, 12);
        my $button7 = $self->patternsTags1Tab_addButton(
            $grid,
            11,
            $tagListIV,
            $buffer,
            $comboBox3,
            'Style tags:',
        );

        # Set initial sensitivity for these widgets
        $self->patternsTags1Tab_setSensitive(
            $self->getEditHash_scalarIV($modeIV),
            $textView2,
            [$comboBox, $button, $button2],
            [$comboBox2, $button3, $button4],
            [$entry, $button5],
            [$entry2, $button6],
            [$comboBox3, $button7],
        );

        # ->signal_connects for second group of radiobuttons
        $radioButton11->signal_connect('toggled' => sub {

            # Set the IV only if this radiobutton has been selected
            if ($radioButton11->get_active()) {

                $self->ivAdd('editHash', $modeIV, 'default');   # Any tags

                $self->patternsTags1Tab_setSensitive(
                    'default',
                    $textView2,
                    [$comboBox, $button, $button2],
                    [$comboBox2, $button3, $button4],
                    [$entry, $button5],
                    [$entry2, $button6],
                    [$comboBox3, $button6],
                );
            }
        });

        $radioButton12->signal_connect('toggled' => sub {

            # Set the IV only if this radiobutton has been selected
            if ($radioButton12->get_active()) {

                $self->ivAdd('editHash', $modeIV, 'no_colour');

                $self->patternsTags1Tab_setSensitive(
                    'no_colour',
                    $textView2,
                    [$comboBox, $button, $button2],
                    [$comboBox2, $button3, $button4],
                    [$entry, $button5],
                    [$entry2, $button6],
                    [$comboBox3, $button6],
                );
            }

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


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

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

        # $text can be an xterm colour tag (in the range 'x0' to 'x255', or 'ux0' to 'ux255'; xterm
        #   tags are case-insensitive
        if ($text =~ m/^u?x([0-9]+)$/i) {

            # (Don't permit 'x000005', but do permit 'x005' or 'x5')
            if ($1 >= 0 && $1 <= 255 && length ($1) <= 3) {
                return 1;
            } else {
                return undef;
            }

        } else {

            return undef;
        }
    }

    sub patternsTags1Tab_checkEntry2 {

        # Called by $self->patternsTags1Tab to check the text in the second Gtk3::Entry
        #
        # Expected arguments
        #   $text       - The contents of the Gtk3::Entry
        #
        # Return values
        #   'undef' on improper arguments or if $text is invalid
        #   1 if $text is valid

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

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

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

        # $text can be an RGB colour tag (in the range '#000000' to '#FFFFFF', or 'u#000000' to
        #   'u#FFFFFF'; RGB tags are case-insensitive
        if ($text =~ m/^u?\#[0-9A-F]{6}$/i) {
            return 1;
        } else {
            return undef;
        }
    }

    sub patternsTags1Tab_addButton {

        # Called by $self->patternsTags1Tab to add a Gtk3::Button next to a combobox
        #
        # Expected arguments
        #   $grid           - The Gtk3::Grid for this tab
        #   $row            - The position in the grid of the buttons
        #   $iv             - The IV being edited (e.g. 'startTagList')
        #   $buffer         - The buffer of the Gtk3::TextView used to display the IV
        #   $comboBox       - The Gtk3::ComboBox used alongside the Gtk3::Button
        #   $title          - The title used at the top of the combobox
        #
        # Return values
        #   'undef' on improper arguments
        #   The Gtk3::Button created, otherwise

        my ($self, $grid, $row, $iv, $buffer, $comboBox, $title, $check) = @_;

        # Check for improper arguments
        if (
            ! defined $grid || ! defined $row || ! defined $iv || ! defined $buffer
            || ! defined $comboBox || ! defined $title || defined $check
        ) {
            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->patternsTags1Tab_addButton',
                @_,
            );
        }

        my $button = $self->addButton(
            $grid,
            'Add',
            'Add the selected colour tag to the list',
            undef,
            10, 11, $row, ($row + 1),
        );
        $button->signal_connect('clicked' => sub {

            my (
                $tag,
                @ivList,
            );

            $tag = $comboBox->get_active_text();

            if ($tag && $tag ne $title) {

                # Update the IV
                @ivList = $self->getEditHash_listIV($iv);

                push (@ivList, $tag);
                $self->ivAdd('editHash', $iv, \@ivList);

                # Update the textview
                $buffer->set_text(join("\n", @ivList));
            }
        });

        return $button;
    }

    sub patternsTags1Tab_addBoldButton {

        # Called by $self->patternsTags1Tab to add another Gtk3::Button next to a combobox
        #
        # Expected arguments
        #   $grid           - The Gtk3::Grid for this tab
        #   $row            - The position in the grid of the buttons
        #   $iv             - The IV being edited (e.g. 'startTagList')
        #   $buffer         - The buffer of the Gtk3::TextView used to display the IV
        #   $comboBox       - The Gtk3::ComboBox used alongside the Gtk3::Button
        #   $title          - The title used at the top of the combobox
        #
        # Return values
        #   'undef' on improper arguments
        #   The Gtk3::Button created, otherwise

        my ($self, $grid, $row, $iv, $buffer, $comboBox, $title, $check) = @_;

        # Check for improper arguments
        if (
            ! defined $grid || ! defined $row || ! defined $iv || ! defined $buffer
            || ! defined $comboBox || ! defined $title || defined $check
        ) {
            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->patternsTags1Tab_addBoldButton',
                @_,
            );
        }

        my $button = $self->addButton(
            $grid,
            'Add bold',
            'Add the selected bold colour tag to the list',
            undef,
            11, 12, $row, ($row + 1),
        );
        $button->signal_connect('clicked' => sub {

            my (
                $tag,
                @ivList,
            );

            $tag = $comboBox->get_active_text();

            if ($tag && $tag ne $title) {

                # Update the IV
                @ivList = $self->getEditHash_listIV($iv);

                push (@ivList, uc($tag));
                $self->ivAdd('editHash', $iv, \@ivList);

                # Update the textview
                $buffer->set_text(join("\n", @ivList));
            }
        });

        return $button;
    }

    sub patternsTags1Tab_setSensitive {

        # Called by $self->patternsTags1Tab to check the text in the Gtk3::Entry
        #
        # Expected arguments
        #   $mode       - Matches a setting for $self->editObj->startTagMode, ->stopAtTagMode, etc
        #                   (set to one of 'default', 'no_colour', 'no_style', 'no_colour_style')
        #   $textView   - (Only) textview to be sensitised/desensitised
        #   $listRef, $listRef2, $listRef3, $listRef4, $listRef5
        #               - References to lists of widgets to be sensitised/desensitised

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


        $self->addLabel($grid, '<i>Words for \'or\' in the dictionary\'s language</i>',
            1, 12, 8, 10);
        $self->addTextView($grid, 'orList', TRUE,
            1, 12, 10, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub numbersTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'N_umbers',
            ['Number terms'],
        );

        # Number terms
        $self->addLabel($grid, '<b>Number terms</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of terms for ordinal numbers, fractions and indeterminate numbers</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Term', 'text',
            'Number', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'numberHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Term',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Number (indeterminate = -1):',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
            10, 12, 8, 9);

        # Add buttons that resemble those from GA::Generic::EditWin->addSimpleListButtons_hashIV
        my $button = $self->addButton($grid, 'Add term', 'Add a new number term', undef,
            1, 3, 9, 10);
        $button->signal_connect('clicked' => sub {

            my ($term, $value);

            if ($self->checkEntryIcon($entry, $entry2)) {

                $term = $entry->get_text();
                $value = $entry2->get_text();

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('numberHash', $term, $value);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'numberHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        my $button2 = $self->addButton($grid, 'Delete term', 'Delete the selected term', undef,
            6, 8, 9, 10);
        $button2->signal_connect('clicked' => sub {

            my ($term) = $self->getSimpleListData($slWidget, 0);
            if (defined $term) {

                # Delete the key-value pair from the hash
                $self->modifyEditHash_hashIV('numberHash', $term, undef, TRUE);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'numberHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        my $button3 = $self->addButton($grid,
            'Reset', 'Reset the hash which stores the terms', undef,
            8, 10, 9, 10);
        $button3->signal_connect('clicked' => sub {

            # Remove this IV from $self->editHash, so that the IV in $self->editObj takes over
            $self->ivDelete('editHash', 'numberHash');

            # Refresh the simple list and reset entry boxes
            $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'numberHash');
            $self->resetEntryBoxes($entry, $entry2);
        });

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


        # Add the entry to the grid directly
        $grid->attach(
            $entry,
            $leftAttach,
            $topAttach,
            ($rightAttach - $leftAttach),
            ($bottomAttach - $topAttach),
        );

        return $entry;
    }

    sub time2Tab {

        # Time2 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Clock patterns - time of day'],
        );

        # Clock patterns - time of day
        $self->addLabel($grid, '<b>Clock patterns - time of day</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Use a value of 0 for a.m., 1 for p.m.</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'clockDayHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Value:',
            7, 10, 8, 9);
        @comboList = (0, 1);
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            10, 12, 8, 9);

        # Add buttons that resemble those from GA::Generic::EditWin->addSimpleListButtons_hashIV
        my $button = $self->addButton($grid, 'Add pattern', 'Add a new clock pattern', undef,
            1, 3, 9, 10);
        $button->signal_connect('clicked' => sub {

            my ($pattern, $value);

            if ($self->checkEntryIcon($entry)) {

                $pattern = $entry->get_text();
                $value = $combo->get_active_text();

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('clockDayHash', $pattern, $value);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList(
                    $slWidget,
                    (scalar @columnList / 2),
                    'clockDayHash',
                );

                $self->resetEntryBoxes($entry);
            }
        });

        my $button2 = $self->addButton($grid,
            'Delete pattern', 'Delete the selected clock pattern', undef,
            6, 8, 9, 10);
        $button2->signal_connect('clicked' => sub {

            my ($term) = $self->getSimpleListData($slWidget, 0);
            if (defined $term) {

                # Delete the key-value pair from the hash
                $self->modifyEditHash_hashIV('clockDayHash', $term, undef, TRUE);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList(
                    $slWidget,
                    (scalar @columnList / 2),
                    'clockDayHash',
                );

                $self->resetEntryBoxes($entry);
            }
        });

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


            # Add an empty hash to $self->editHash
            $self->ivAdd('editHash', 'clockDayHash', {});

            # Refresh the simple list and reset entry boxes
            $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'clockDayHash');
            $self->resetEntryBoxes($entry);
        });

        # Tab complete
        return 1;
    }

    sub time3Tab {

        # Time3 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 . '->time3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Clock patterns - hours'],
        );

        # Clock patterns - hours
        $self->addLabel($grid, '<b>Clock patterns - hours</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Use a value of 1-12, but use 0 for midnight</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'clockHourHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Value',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
            10, 12, 8, 9);

        # Add buttons that resemble those from GA::Generic::EditWin->addSimpleListButtons_hashIV
        my $button = $self->addButton($grid, 'Add pattern', 'Add a new clock pattern', undef,
            1, 3, 9, 10);
        $button->signal_connect('clicked' => sub {

            my ($term, $value);

            if ($self->checkEntryIcon($entry, $entry2)) {

                $term = $entry->get_text();
                $value = $entry2->get_text();

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('clockHourHash', $term, $value);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList(
                    $slWidget,
                    (scalar @columnList / 2),
                    'clockHourHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        my $button2 = $self->addButton($grid,
            'Delete pattern', 'Delete the selected clock pattern', undef,
            6, 8, 9, 10);
        $button2->signal_connect('clicked' => sub {

            my ($term) = $self->getSimpleListData($slWidget, 0);
            if (defined $term) {

                # Delete the key-value pair from the hash
                $self->modifyEditHash_hashIV('clockHourHash', $term, undef, TRUE);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList(
                    $slWidget,
                    (scalar @columnList / 2),
                    'clockHourHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        my $button3 = $self->addButton($grid,
            'Reset', 'Reset the hash which stores the clock patterns', undef,

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

            # Add an empty hash to $self->editHash
            $self->ivAdd('editHash', 'clockHourHash', {});

            # Refresh the simple list and reset entry boxes
            $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'clockHourHash');
            $self->resetEntryBoxes($entry, $entry2);
        });

        # Tab complete
        return 1;
    }

    sub time4Tab {

        # Time4 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 . '->time4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Clock patterns - minutes'],
        );

        # Clock patterns - minutes
        $self->addLabel($grid, '<b>Clock patterns - minutes</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Use positive values for minutes past, negative for minutes to (0 for hours)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->numbersTab_refreshList($slWidget, (scalar @columnList / 2), 'clockMinuteHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Value',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
            10, 12, 8, 9);

        # Add buttons that resemble those created by
        #   GA::Generic::EditWin->addSimpleListButtons_hashIV
        my $button = $self->addButton($grid, 'Add pattern', 'Add a new clock pattern', undef,
            1, 3, 9, 10);
        $button->signal_connect('clicked' => sub {

            my ($term, $value);

            if ($self->checkEntryIcon($entry, $entry2)) {

                $term = $entry->get_text();
                $value = $entry2->get_text();

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('clockMinuteHash', $term, $value);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList(
                    $slWidget,
                    (scalar @columnList / 2),
                    'clockMinuteHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        my $button2 = $self->addButton($grid,
            'Delete pattern', 'Delete the selected clock pattern', undef,
            6, 8, 9, 10);
        $button2->signal_connect('clicked' => sub {

            my ($term) = $self->getSimpleListData($slWidget, 0);
            if (defined $term) {

                # Delete the key-value pair from the hash
                $self->modifyEditHash_hashIV('clockMinuteHash', $term, undef, TRUE);

                # Refresh the simple list and reset entry boxes
                $self->numbersTab_refreshList(
                    $slWidget,
                    (scalar @columnList / 2),
                    'clockMinuteHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        my $button3 = $self->addButton($grid,

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

        $self->nouns2Tab($innerNotebook);
        $self->nouns3Tab($innerNotebook);
        $self->nouns4Tab($innerNotebook);
        $self->nouns5Tab($innerNotebook);
        $self->nouns6Tab($innerNotebook);
        $self->nouns7Tab($innerNotebook);
        $self->nouns8Tab($innerNotebook);
        $self->nouns9Tab($innerNotebook);
        $self->nouns10Tab($innerNotebook);

        return 1;
    }

    sub nouns1Tab {

        # Nouns1 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 . '->nouns1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Sentients'],
        );

        # Sentients
        $self->addLabel($grid, '<b>Sentients</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of words for sentient beings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'sentientHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('sentient');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'sentientHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('sentientHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'sentientHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns2Tab {

        # Nouns2 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 . '->nouns2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Creatures'],
        );

        # Creatures
        $self->addLabel($grid, '<b>Creatures</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of words for non-sentient beings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'creatureHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('creature');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'creatureHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('creatureHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'creatureHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns3Tab {

        # Nouns3 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 . '->nouns3Tab', @_);
        }

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

            my @list = $self->editObj->constDecorationTypeList;

            $self->ivAdd('editHash', \@list);
            $buffer2->set_text(join("\n", $self->editObj->ivPeek('constDecorationTypeList')));
        });
        $button2->set_tooltip_text('Use the default list of Decoration types');
        $grid->attach($button2, 10, 5, 2, 2);

        # Tab complete
        return 1;
    }

    sub nouns4Tab {

        # Nouns4 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page 4',
            ['Portables'],
        );

        # Portables
        $self->addLabel($grid, '<b>Portables</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of portable words (objects which can usually be picked up)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'portableTypeHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);

        @comboList = $self->getEditHash_listIV('portableTypeList');
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'portableTypeHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $comboBox->get_active_text();

            if ($self->checkEntryIcon($entry) && $type) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('portableTypeHash', $word, $type);
                # (We have a second hash to update)
                $self->modifyEditHash_hashIV('portableHash', $word, 'portable');

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'portableTypeHash',
                );

                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns5Tab {

        # Nouns5 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Decorations'],
        );

        # Decorations
        $self->addLabel($grid, '<b>Decorations</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of decoration words (objects which can\'t usually be picked up)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'decorationTypeHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);

        @comboList = $self->getEditHash_listIV('decorationTypeList');
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'decorationTypeHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $comboBox->get_active_text();

            if ($self->checkEntryIcon($entry) && $type) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('decorationTypeHash', $word, $type);
                # (We have a second hash to update)
                $self->modifyEditHash_hashIV('decorationHash', $word, 'decoration');

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'decorationTypeHash',
                );

                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns6Tab {

        # Nouns6 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 . '->nouns6Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _6',
            ['Guilds'],
        );

        # Guilds
        $self->addLabel($grid, '<b>Guilds</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of guild words</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'guildHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('guild');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'guildHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('guildHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'guildHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns7Tab {

        # Nouns7 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 . '->nouns7Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _7',
            ['Races'],
        );

        # Races
        $self->addLabel($grid, '<b>Races</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of race words</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'raceHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('race');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'raceHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('raceHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'raceHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns8Tab {

        # Nouns8 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 . '->nouns8Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _8',
            ['Weapons'],
        );

        # Weapons
        $self->addLabel($grid, '<b>Weapons</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of weapon words</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'weaponHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('weapon');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'weaponHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('weaponHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'weaponHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns9Tab {

        # Nouns9 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 . '->nouns9Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _9',
            ['Armour'],
        );

        # Armour
        $self->addLabel($grid, '<b>Armour</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of armour words</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'armourHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('armour');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'armourHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('armourHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'armourHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub nouns10Tab {

        # Nouns10 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 . '->nouns10Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page 1_0',
            ['Garments'],
        );

        # Garments
        $self->addLabel($grid, '<b>Garments</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of garment words</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'garmentHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, 0,
            10, 12, 8, 9);
        $entry2->set_text('garment');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'garmentHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('garmentHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'garmentHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub pluralsTab {

        # Plurals 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 . '->pluralsTab', @_);
        }

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

        # Add tabs to the inner notebook
        $self->plurals1Tab($innerNotebook);
        $self->plurals2Tab($innerNotebook);
        $self->plurals3Tab($innerNotebook);

        return 1;
    }

    sub plurals1Tab {

        # Plurals1 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 . '->plurals1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Plural ending patterns'],
        );

        # Plural ending patterns
        $self->addLabel($grid, '<b>Plural ending patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Plural patterns and their equivalent singular endings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Plural pattern', 'text',
            'Singular ending', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pluralEndingHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Plural pattern',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Singular ending',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 0, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'pluralEndingHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $singular);

            $pattern = $entry->get_text();
            $singular = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('pluralEndingHash', $pattern, $singular);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pluralEndingHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub plurals2Tab {

        # Plurals2 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 . '->plurals2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Singular ending patterns'],
        );

        # Singular ending patterns
        $self->addLabel($grid, '<b>Singular ending patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Singular patterns and their equivalent plural endings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Singular pattern', 'text',
            'Plural ending', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'reversePluralEndingHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Singular pattern',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 0, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Plural ending',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'reversePluralEndingHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $singular);

            $pattern = $entry->get_text();
            $singular = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('reversePluralEndingHash', $pattern, $singular);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'reversePluralEndingHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub plurals3Tab {

        # Plurals3 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 . '->plurals3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Plural nouns'],
        );

        # Plural nouns
        $self->addLabel($grid, '<b>Plural nouns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of nouns that are exceptions to the usual rules</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Singular noun', 'text',
            'Plural noun', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pluralNounHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Singular noun',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Plural noun',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'pluralNounHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($singular, $plural);

            $singular = $entry->get_text();
            $plural = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('pluralNounHash', $singular, $plural);
                # (We have a second hash to update)
                $self->modifyEditHash_hashIV('reversePluralNounHash', $plural, $singular);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pluralNounHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub adjectivesTab {

        # Adjectives 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 . '->adjectivesTab', @_);
        }

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

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

        # Add tabs to the inner notebook
        $self->adjectives1Tab($innerNotebook);
        $self->adjectives2Tab($innerNotebook);
        $self->adjectives3Tab($innerNotebook);
        $self->adjectives4Tab($innerNotebook);

        return 1;
    }

    sub adjectives1Tab {

        # Adjectives1 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 . '->adjectives1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Adjectives'],
        );

        # Adjectives
        $self->addLabel($grid, '<b>Adjectives</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of adjective words</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Word', 'text',
            'Type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'adjHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Word',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Type',
            7, 10, 8, 9);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);
        $entry2->set_text('adj');

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'adjHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($word, $type);

            $word = $entry->get_text();
            $type = $entry2->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('adjHash', $word, $type);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'adjHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub adjectives2Tab {

        # Adjectives2 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 . '->adjectives2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Declined adjective patterns'],
        );

        # Declined adjective patterns
        $self->addLabel($grid, '<b>Declined adjective patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Declined adjective endings and their equivalent undeclined endings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Declined ending pattern', 'text',
            'Undeclined ending', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'adjEndingHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Declined ending pattern',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Undeclined ending',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'adjEndingHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($declined, $undeclined);

            $declined = $entry->get_text();
            $undeclined = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('adjEndingHash', $declined, $undeclined);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'adjEndingHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub adjectives3Tab {

        # Adjectives3 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 . '->adjectives3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Undeclined adjective patterns'],
        );

        # Undeclined adjective patterns
        $self->addLabel($grid, '<b>Undeclined adjective patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Undeclined adjective endings and their equivalent declined endings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Undeclined ending pattern', 'text',
            'Declined ending', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'reverseAdjEndingHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Undeclined ending pattern',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Declined ending',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'reverseAdjEndingHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($declined, $undeclined);

            $declined = $entry->get_text();
            $undeclined = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('reverseAdjEndingHash', $declined, $undeclined);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'reverseAdjEndingHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub adjectives4Tab {

        # Adjectives4 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 . '->adjectives4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Declined adjectives'],
        );

        # Declined adjectives
        $self->addLabel($grid, '<b>Declined adjectives</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of adjectives that are exceptions to the usual declension rules</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Undeclined form', 'text',
            'Declined form', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'declinedAdjHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Undeclined form',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Declined form',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'declinedAdjHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($declined, $undeclined);

            $declined = $entry->get_text();
            $undeclined = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('declinedAdjHash', $declined, $undeclined);
                # (We have a second hash to update)
                $self->modifyEditHash_hashIV(
                    'reverseDeclinedAdjHash',
                    $undeclined,
                    $declined,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'declinedAdjHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub pseudoTab {

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

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

        # Check for improper arguments

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


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

        # Add tabs to the inner notebook
        $self->pseudo1Tab($innerNotebook);
        $self->pseudo2Tab($innerNotebook);
        $self->pseudo3Tab($innerNotebook);

        return 1;
    }

    sub pseudo1Tab {

        # Pseudo1 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 . '->pseudo1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Pseudo nouns'],
        );

        # Pseudo nouns
        $self->addLabel($grid, '<b>Pseudo nouns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Groups of words which represent a single noun</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pseudo noun', 'text',
            'Replacement noun', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pseudoNounHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pseudo noun (pattern)',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 12, 8, 9);

        $self->addLabel($grid, 'Replacement noun',
            1, 4, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'pseudoNounHash',
            10,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pseudo, $replacement);

            $pseudo = $entry->get_text();
            $replacement = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('pseudoNounHash', $pseudo, $replacement);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pseudoNounHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub pseudo2Tab {

        # Pseudo2 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 . '->pseudo2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Pseudo objects'],
        );

        # Pseudo objects
        $self->addLabel($grid, '<b>Pseudo objects</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Groups of words which represent a single object</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pseudo object', 'text',
            'Replacement object', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pseudoObjHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pseudo object (pattern)',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 12, 8, 9);

        $self->addLabel($grid, 'Replacement object (if any)',
            1, 4, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 0, undef,
            4, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'pseudoObjHash',
            10,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pseudo, $replacement);

            $pseudo = $entry->get_text();
            $replacement = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('pseudoObjHash', $pseudo, $replacement);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pseudoObjHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub pseudo3Tab {

        # Pseudo3 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 . '->pseudo3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Pseudo adjectives'],
        );

        # Pseudo adjectives
        $self->addLabel($grid, '<b>Pseudo adjectives</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Groups of words which represent a single adjective</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pseudo adjective', 'text',
            'Replacement adjective', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pseudoAdjHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pseudo adjective (pattern)',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            4, 12, 8, 9);

        $self->addLabel($grid, 'Replacement adjective (if any)',
            1, 4, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 0, undef,
            4, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'pseudoAdjHash',
            10,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pseudo, $replacement);

            $pseudo = $entry->get_text();
            $replacement = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('pseudoAdjHash', $pseudo, $replacement);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'pseudoAdjHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub contentsTab {

        # Contents 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 . '->contentsTab', @_);
        }

        # Tab setup

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

            north northeast east southeast south southwest west northwest up down
            northnortheast eastnortheast eastsoutheast southsoutheast
            southsouthwest westsouthwest westnorthwest northnorthwest
        );

        $noAutoString = 'Don\'t auto-allocate';
        unshift(@comboList, $noAutoString);

        $self->addLabel($grid, 'Auto-allocate to',
            1, 2, 11, 12);
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            2, 6, 11, 12);

        # 'Unselect' button
        my $button = $self->addButton($grid,
            'Unselect', 'Unselect the selected direction', undef,
            1, 2, 8, 9);
        $button->signal_connect('clicked' => sub {

            $slWidget->get_selection->unselect_all();
        });

        # 'Add/Edit direction' button
        my $button2 = $self->addButton($grid,
            'Add/Edit dir', 'Add a new direction or edit the selected one', undef,
            2, 4, 8, 9);
        $button2->signal_connect('clicked' => sub {

            my ($dir, $abbrev, $opp, $oppAbbrev, $auto, $posn);

            ($dir, $abbrev, $opp, $oppAbbrev, $auto)
                = $self->getSimpleListData($slWidget, 0, 1, 2, 3, 4);

            # Sensitise the widgets
            $self->sensitiseWidgets($entry, $entry2, $entry3, $entry4, $combo);

            if (! $dir) {

                # 'Add' direction. Make sure the entry boxes are empty
                $entry->set_text('');
                $entry2->set_text('');
                $entry3->set_text('');
                $entry4->set_text('');
                # Make sure the 'Don't auto-allocate' string is visible at the top of the combo
                $combo->set_active(0);

                # If the user clicks 'Use changes', it's a completely new secondary direction
                $thisDir = undef;

            } else {

                # 'Edit' direction. Fill the entry boxes with the selected direction's data
                $entry->set_text($dir);
                if (defined $abbrev) {

                    $entry2->set_text($abbrev);
                }
                $entry3->set_text($opp);
                $entry4->set_text($oppAbbrev);
                # Make the right choice visible in the combobox
                $posn = 0;  # Default is the 'don't auto-allocate' string
                if ($auto) {

                    OUTER: for (my $index = 0; $index < 18; $index++) {

                        if ($comboList[$index] eq $auto) {

                            $posn = $index;
                            last OUTER;
                        }
                    }
                }

                $combo->set_active($posn);
                $axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->directions2Tab');

                # Store the direction that's being edited because the 'Use changes' button needs it
                $thisDir = $dir;
            }
        });

        # 'Delete direction' button
        my $button3 = $self->addButton($grid,
            'Delete dir', 'Delete the selected direction', undef,
            4, 6, 8, 9);
        $button3->signal_connect('clicked' => sub {

            my (
                $dir, $listRef, $hashRef, $count,
                @dirList,
                %dirHash, %abbrevHash, %oppHash, %oppAbbrevHash, %autoHash,
            );

            ($dir) = $self->getSimpleListData($slWidget, 0);
            if ($dir) {

                # Import data from the affected IVs
                if ($self->ivExists('editHash', 'secondaryDirList')) {

                    $listRef = $self->ivShow('editHash', 'secondaryDirList');
                    @dirList = @$listRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryDirHash');
                    %dirHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryAbbrevHash');
                    %abbrevHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryOppHash');
                    %oppHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryOppAbbrevHash');
                    %oppAbbrevHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryAutoHash');
                    %autoHash = %$hashRef;

                } else {

                    @dirList = $self->editObj->secondaryDirList;
                    %dirHash = $self->editObj->secondaryDirHash;
                    %abbrevHash = $self->editObj->secondaryAbbrevHash;
                    %oppHash = $self->editObj->secondaryOppHash;
                    %oppAbbrevHash = $self->editObj->secondaryOppAbbrevHash;
                    %autoHash = $self->editObj->secondaryAutoHash;

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

                    $self->ivAdd('editHash', 'secondaryOppAbbrevHash', \%oppAbbrevHash);
                    $self->ivAdd('editHash', 'secondaryAutoHash', \%autoHash);

                    # Refresh the simple list
                    $self->directions2Tab_refreshList($slWidget, scalar (@columnList / 2));

                    # The component should still be highlighted, after being moved down
                    $slWidget->select($rowNum + 1);
                }
            }
        });

        # 'Use changes' button
        my $button6 = $self->addButton($grid,
            'Use changes', 'Use the changes to the data', undef,
            8, 12, 11, 12);
        $button6->signal_connect('clicked' => sub {

            my (
                $dir, $abbrev, $opp, $oppAbbrev, $msg, $auto, $listRef, $hashRef, $count,
                @dirList,
                %primDirHash, %primAbbrevHash, %dirHash, %abbrevHash, %oppHash, %oppAbbrevHash,
                %autoHash, %relDirHash, %relAbbrevHash, %combDirHash,
            );

            if ($self->checkEntryIcon($entry, $entry2, $entry3, $entry4)) {

                $dir = $entry->get_text();
                $abbrev = $entry2->get_text();
                $opp = $entry3->get_text();
                $oppAbbrev = $entry4->get_text();

                # $abbrev should be 'undef', rather than an empty string; vice-versa for $oppAbbrev
                if (! $abbrev) {

                    $abbrev = undef;
                }

                if (! $oppAbbrev) {

                    $oppAbbrev = '';
                }

                # (Definitely need to remove any leading/trailing whitespace, as well as replace two
                #   or more whitespace characters in the middle with a single whitespace character
                $dir = $axmud::CLIENT->trimWhitespace($dir, TRUE);
                if ($abbrev) {

                    $abbrev = $axmud::CLIENT->trimWhitespace($abbrev, TRUE);
                }

                $opp = $axmud::CLIENT->trimWhitespace($opp, TRUE);
                if ($oppAbbrev) {

                    $oppAbbrev = $axmud::CLIENT->trimWhitespace($oppAbbrev, TRUE);
                }

                $auto = $combo->get_active_text();
                if ($auto eq $noAutoString) {

                    # User selected 'Don't auto-allocate' in the combobox; the dictionary's
                    #   ->secondaryAutoHash expects a key-value pair, with a value set to 'undef'
                    $auto = undef;
                }

                # Need to check that the user hasn't added a primary direction (standard or custom)
                #   or an existing secondary direction
                # Import data from the affected IVs. We can't use ->combDirHash because it hasn't
                #   been updated yet, if any changes have been made in this window
                if ($self->ivExists('editHash', 'primaryDirHash')) {

                    # (If any primary dir IVs have been changed, then they are ALL in ->editHash)
                    $hashRef = $self->ivShow('editHash', 'primaryDirHash');
                    %primDirHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'primaryAbbrevHash');
                    %primAbbrevHash = %$hashRef;

                } else {

                    %primDirHash = $self->editObj->primaryDirHash;
                    %primAbbrevHash = $self->editObj->primaryAbbrevHash;
                }

                %relDirHash = $self->editObj->relativeDirHash;
                %relAbbrevHash = $self->editObj->relativeAbbrevHash;

                if ($self->ivExists('editHash', 'secondaryDirList')) {

                    # (If any secondary dir IVs have been changed, then they are ALL in ->editHash)
                    $listRef = $self->ivShow('editHash', 'secondaryDirList');
                    @dirList = @$listRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryDirHash');
                    %dirHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryAbbrevHash');
                    %abbrevHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryOppHash');
                    %oppHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryOppAbbrevHash');
                    %oppAbbrevHash = %$hashRef;
                    $hashRef = $self->ivShow('editHash', 'secondaryAutoHash');
                    %autoHash = %$hashRef;

                } else {

                    @dirList = $self->editObj->secondaryDirList;
                    %dirHash = $self->editObj->secondaryDirHash;
                    %abbrevHash = $self->editObj->secondaryAbbrevHash;
                    %oppHash = $self->editObj->secondaryOppHash;
                    %oppAbbrevHash = $self->editObj->secondaryOppAbbrevHash;
                    %autoHash = $self->editObj->secondaryAutoHash;
                }

                # (Compose our own temporary %combDirHash, in the form
                #   $combDirHash{custom_primary_dir} = undef
                #   $combDirHash{recognised_secondary_dir} = undef
                foreach my $value (values %primDirHash) {

                    $combDirHash{$value} = undef;       # Hash in form $hash{$key} = $value
                }

                foreach my $value (values %primAbbrevHash) {

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


    sub assistedMovesTab {

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

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

        # Local variables
        my (@columnList, @profList, @sortedList);

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

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

        # Tab setup
        # N.B. No sub-headings
        my $grid = $self->addTab($self->notebook, '_Assisted moves');

        # Assisted moves
        $self->addLabel($grid, '<b>Assisted moves</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Command sequences used in assisted moves for this exit, e.g.'
            . ' \'push button;north\'</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Profile', 'text',
            'Command sequence', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'assistedHash');

        # Get a sorted list of all non-world profiles...
        foreach my $profObj ($self->session->ivValues('profHash')) {

            if ($profObj->category ne 'world') {

                push (@profList, $profObj->name);
            }
        }

        @sortedList = sort {lc($a) cmp lc($b)} (@profList);
        # ...and put the current world profile at the top of the list
        unshift (@sortedList, $self->session->currentWorld->name);

        # Add entries/comboboxes for adding world model objects
        $self->addLabel($grid, 'Profile',
            1, 3, 8, 9);
        my $combo = $self->addComboBox($grid, undef, \@sortedList, '',
            TRUE,               # No 'undef' value used
            3, 6, 8, 9);

        $self->addLabel($grid, 'Command sequence',
            1, 3, 9, 10);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'assistedHash',
            10,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($profName, $sequence);

            $profName = $combo->get_active_text();
            $sequence = $entry->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('assistedHash', $profName, $sequence);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'assistedHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub doorsTab {

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

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

        # Local variables
        my (@columnList, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            '_Doors',
            ['Door commands'],
        );

        # Door commands
        $self->addLabel($grid, '<b>Door commands</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Command sequences used to get through this exit\'s door (if any)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Door type', 'text',
            'Command sequence', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'doorHash');

        # Add entries/comboboxes for adding world model objects
        $self->addLabel($grid, 'Profile',
            1, 3, 8, 9);
        @comboList = qw(break pick unlock open close lock);
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 6, 8, 9);

        $self->addLabel($grid, 'Command sequence',
            1, 3, 9, 10);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'assistedHash',
            10,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($type, $sequence);

            $type = $combo->get_active_text();
            $sequence = $entry->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('doorHash', $type, $sequence);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'doorHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub randomTab {

        # Random 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 . '->randomTab', @_);
        }

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

        # Tab complete
        return 1;
    }

    sub room4Tab {

        # Room4 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Optional arguments
        #   $tabTitle       - When inherited by GA::EditWin::Painter, the tab's page number (a
        #                       string)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (@columnList, @comboList);

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

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

        # Tab setup
        if (! $tabTitle) {

            $tabTitle = 'Page _4';  # This function wasn't called by GA::EditWin::Painter
        }

        my $grid = $self->addTab(
            $innerNotebook,
            $tabTitle ,
            ['Verbose descriptions'],
        );

        # Verbose descriptions
        $self->addLabel($grid, '<b>Verbose descriptions</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of verbose descriptions for each light status</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Light status', 'text',
            'Verbose descrip', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'descripHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Light status',
            1, 3, 8, 9);
        @comboList = $self->session->worldModelObj->lightStatusList;
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 6, 8, 9);

        $self->addLabel($grid, 'Verbose description',
            1, 3, 9, 10);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'descripHash',
            10,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($status, $descrip);

            $status = $combo->get_active_text();
            $descrip = $entry->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('descripHash', $status, $descrip);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'descripHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub room5Tab {

        # Room5 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Optional arguments
        #   $tabTitle       - When inherited by painter object (a non-model GA::ModelObj::Room),
        #                       the tab's page number (a string)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Check for improper arguments

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


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

        # Local variables
        my (@columnList, @charList, @sortedList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _6',
            ['Character visits'],
        );

        # Character visits
        $self->addLabel($grid, '<b>Character visits</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Record of how many visits each character has made to this room</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Character', 'text',
            'Number of visits', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'visitHash');

        # Get a sorted list of characters, not including the current character (if any)
        foreach my $profObj ($self->session->ivValues('profHash')) {

            if (
                $profObj->category eq 'char'
                && (
                    ! $self->session->currentChar
                    || $self->session->currentChar ne $profObj
                )
            ) {
                push (@charList, $profObj->name);
            }
        }

        @sortedList = sort {lc($a) cmp lc($b)} (@charList);

        # Put the current char (if any) at the beginning of the list
        if ($self->session->currentChar) {

            unshift (@sortedList, $self->session->currentChar->name);
        }

        # Add entries/comboboxes for adding new key/value pairs
        $self->addLabel($grid, 'Character',
            1, 3, 8, 9);
        my $combo = $self->addComboBox($grid, undef, \@sortedList, '',
            TRUE,               # No 'undef' value used
            3, 6, 8, 9);

        $self->addLabel($grid, 'Number of visits',
            7, 9, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'visitHash',
            10,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($char, $visitCount);

            $char = $combo->get_active_text();
            $visitCount = $entry->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('visitHash', $char, $visitCount);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'visitHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub room7Tab {

        # Room7 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Optional arguments
        #   $tabTitle       - When inherited by GA::EditWin::Painter, the tab's page number (a
        #                       string)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (@columnList, @profList, @sortedList);

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

            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub exits2Tab {

        # Exits2 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 . '->exits2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Involuntary exit patterns'],
        );

        # Involuntary exit patterns
        $self->addLabel($grid, '<b>Involuntary exit patterns</b>',
            0, 12, 0, 2);
        $self->addLabel(
            $grid,
            '<i>Patterns which mean the character has left the room involuntarily</i>',
            1, 10, 2, 4);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Optional direction or destination room #', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV(
            $slWidget,
            scalar (@columnList / 2),
            'involuntaryExitPatternHash',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 12, 8, 9);

        $self->addLabel($grid, '(Optional) direction or destination room number',
            1, 4, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', undef, undef,
            4, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'involuntaryExitPatternHash',
            10,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $value);

            $pattern = $entry->get_text();
            $value = $entry2->get_text();
            # Use 'undef' rather than an empty string
            if ($value eq '') {

                $value = undef;
            }

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('involuntaryExitPatternHash', $pattern, $value);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'involuntaryExitPatternHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub exits3Tab {

        # Exits3 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 . '->exits3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Repulse exit patterns'],
        );

        # Repulse exit patterns
        $self->addLabel($grid, '<b>Repulse exit patterns</b>',
            0, 12, 0, 2);
        $self->addLabel(
            $grid,
            '<i>Patterns which mean the character has left the room involuntarily after a failed'
            . ' move</i>',
            1, 10, 2, 4);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Optional direction or destination room #', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV(
            $slWidget,
            scalar (@columnList / 2),
            'repulseExitPatternHash',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 12, 8, 9);

        $self->addLabel($grid, '(Optional) direction or destination room number',
            1, 4, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', undef, undef,
            4, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'repulseExitPatternHash',
            10,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $value);

            $pattern = $entry->get_text();
            $value = $entry2->get_text();
            # Use 'undef' rather than an empty string
            if ($value eq '') {

                $value = undef;
            }

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('repulseExitPatternHash', $pattern, $value);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'repulseExitPatternHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub exits4Tab {

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

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


        # List of profile-specific commands
        $self->addLabel($grid, '<b>List of profile-specific commands</b>',
            0, 12, 0, 2);
        $self->addLabel($grid, '<i>(Character-independent)</i>',
            1, 12, 2, 4);
        $self->addTextView($grid, 'cmdList', TRUE,
            1, 12, 4, 6);

        # Tab complete
        return 1;
    }

    sub fightTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            '_Fight',
            ['List of profile-specific fight patterns'],
        );

        # List of profile-specific fight patterns
        $self->addLabel($grid, '<b>List of profile-specific fight patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen during a fight</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'fightMsgList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'fightMsgList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV('fightMsgList', undef, FALSE, $pattern, $grpNum);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'fightMsgList');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub interactionTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'Int_eraction',
            ['List of profile-specific interaction patterns'],
        );

        # List of profile-specific interaction patterns
        $self->addLabel($grid, '<b>List of profile-specific interaction patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen during an interaction</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'interactionMsgList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'interactionMsgList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'interactionMsgList',
                    undef,
                    FALSE,
                    $pattern,
                    $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionMsgList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub initialTab {

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

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

#   sub redrawWidgets {}        # Inherited from GA::Generic::Win

    # ->signal_connects

    # Other functions

    sub checkEditObj {

        # Called by $self->winEnable
        # Checks that the object stored in $self->editObj is the correct class of object
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments or if the check fails
        #   1 if the check succeeds

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

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

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

        if ($self->editObj && ! $self->editObj->isa('Games::Axmud::Profile::World')) {
            return undef;
        } else {
            return 1;
        }
    }

#   sub enableButtons {}        # Inherited from GA::Generic::ConfigWin

#   sub enableSingleButton {}   # Inherited from GA::Generic::ConfigWin

#   sub setupNotebook {}        # Inherited from GA::Generic::ConfigWin

    sub expandNotebook {

        # Called by $self->setupNotebook
        # Set up additional tabs for the notebook, depending on which category of profile is being
        #   being edited
        #
        # 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 . '->expandNotebook', @_);
        }

        # The combobox in $self->rooms2Tab (used by 'Rooms' pages 2, 4 and 6) must be updated
        #   whenever the user adds/deletes a room statement component (in page 1). Use a special IV
        #   to store the comboboxes to update
        $self->{comboHash} = {};
        # The simple lists on these tabs must also be updated, when the user deletes a component on
        #   page 1. Use a special IV to store the simple lists to  update
        $self->{simpleListHash} = {};

        # If this is a current profile, set a flag
        if ($self->session->currentWorld eq $self->editObj) {

            $self->ivPoke('currentFlag', TRUE);
        }

        # Expand the notebook
        $self->settingsTab();
        $self->initialTab();            # Inherited from GA::EditWin::Generic::Profile
        $self->notesTab();              # Inherited from GA::EditWin::Generic::Profile
        $self->overrideTab();
        $self->roomsTab();
        $self->movesTab();
        $self->statusTab();
        $self->inventoryTab();
        $self->channelsTab();
        $self->attackTab();
        $self->worldFightTab();         # (Not inherited from GA::EditWin::Generic::Profile)
        $self->worldInteractionTab();   # (Not inherited from GA::EditWin::Generic::Profile)
        $self->worldCommandsTab();      # (Not inherited from GA::EditWin::Generic::Profile)
        $self->advanceTab();
        $self->currencyTab();
        $self->missionsTab();
        $self->questsTab();
        $self->statsTab();
        $self->privateDataTab(          # Inherited from GA::Generic::EditWin
            'privateHash',
            '_Private',
            'Private data hash',
            'Data created by your own plugins and scripts, but stored in this profile',
        );

        return 1;
    }

    sub saveChanges {

        # Called by $self->buttonOK and $self->buttonSave (usually for 'edit' windows only, not
        #   'pref' windows)
        # Saves any changes made to data stored by the edit object
        #
        # 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 . '->saveChanges', @_);
        }

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

                    );
                }
            }
        });

        my $button3 = $self->addButton(
            $grid, 'Refresh list', 'Refresh the list of dictionaries', undef,
            4, 6, 3, 4);
        $button3->signal_connect('clicked' => sub {

            # Refresh the combo
            $self->settings10Tab_refreshCombo($combo);
        });

        # Multiples
        $self->addLabel($grid, '<b>Multiples</b>',
            0, 12, 4, 5);
        $self->addCheckButton($grid, 'Add numbers to similar objects', 'numberedObjFlag', TRUE,
            1, 6, 5, 6);
        $self->addLabel($grid, 'Multiple object pattern',
            1, 4, 6, 7);
        $self->addEntryWithIconButton($grid, 'multiplePattern', 'regex', undef, undef,
            4, 6, 6, 7);

        # Consecutive empty line suppression
        $self->addLabel($grid, '<b>Consecutive empty line suppression</b>',
            7, 13, 0, 1);
        $self->addLabel($grid, 'Lines to suppress (0 - none, 1 - all)',
            8, 11, 1, 2);
        $self->addEntryWithIcon($grid, 'suppressEmptyLineCount', 'int', 0, undef,
            11, 13, 1, 2, 8, 8);
        $self->addCheckButton(
            $grid, 'Suppress empty lines before login', 'suppressBeforeLoginFlag', TRUE,
            8, 13, 2, 3);

        # Command separator
        $self->addLabel($grid, '<b>Command separator \'' . $axmud::CLIENT->cmdSep . '\'</b>',
            7, 12, 3, 4);
        $self->addCheckButton(
            $grid, 'Auto-separate commands in this world', 'autoSeparateCmdFlag', TRUE,
            8, 13, 4, 5);

        # Slowwalking
        $self->addLabel($grid, '<b>Slowwalking</b>',
            7, 13, 5, 6);
        $self->addLabel($grid, 'Max world commands (0 - no limit)',
            8, 11, 6, 7);
        $self->addEntryWithIcon($grid, 'excessCmdLimit', 'int', 0, undef,
            11, 13, 6, 7, 6, 4);
        $self->addLabel($grid, '...in time period (min 0.1 secs)',
            8, 11, 7, 8);
        $self->addEntryWithIcon($grid, 'excessCmdDelay', 'float', 0.1, undef,
            11, 13, 7, 8, 6, 4);

        # Tab complete
        return 1;
    }

    sub settings10Tab_refreshCombo {

        # Resets the combobox displayed by $self->settings10Tab
        #
        # Expected arguments
        #   $combo          - The Gtk3::Combo
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (
            $currentDict,
            @dictList, @comboList,
        );

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

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

        # Import the GA::Client's list of dictionaries, and sort them
        @dictList = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('dictHash'));

        # Get the profile's current dictionary (might be stored in $self->editHash, or the
        #   unmodified value stored in $self->editObj)
        $currentDict = $self->getEditHash_scalarIV('dict');

        # If $currentDict is defined (and it should be), remove it from @dictList, and insert it at
        #   the beginning, so it can appear at the top of the combo
        foreach my $dictObj (@dictList) {

            if (! $currentDict || $currentDict ne $dictObj->name) {

                push (@comboList, $dictObj->name);
            }
        }

        if ($currentDict) {

            unshift (@comboList, $currentDict);

        } else {

            # (If $currentDict was not, for some reason, defined, an empty string is inserted for
            #   setting the IV to 'undef')
            unshift (@comboList, '');
        }

        # Refill the combo
        $self->resetComboBox($combo, @comboList);

        # Operation complete
        return 1;
    }

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

        $self->addLabel($grid,
            '<i>List of terminal type override settings which must be applied when this is the'
            . ' current world, overriding global settings</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Setting', 'text',
            'Value (1 - enabled)', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 7);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');

        # Add editing widgets
        $self->addLabel($grid, 'TTYPE negotiations',
            1, 3, 7, 8);

        @initList = (
            'send_nothing'          => 'Send nothing',
            'send_client'           => 'Send client name, then usual list',
            'send_client_version'   => 'Send client/name version, then usual list',
            'send_custom_client'    => 'Send custom client/name version, then usual list',
            'send_default'          => 'Send usual terminal type list',
            'send_unknown'          => 'Send \'unknown\'',
        );

        do {

            my ($mode, $descrip);

            $mode = shift @initList;
            $descrip = shift @initList;

            push (@comboList, $descrip);
            $comboHash{$descrip} = $mode;

        } until (! @initList);

        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,                       # No 'undef' value used
            3, 8, 7, 8);

        my $button = $self->addButton($grid, 'Use', 'Use this setting in the session', undef,
            8, 10, 7, 8);
        $button->signal_connect('clicked' => sub {

            my (
                $mode,
                %hash,
            );

            $mode = $comboHash{$combo->get_active_text()};
            %hash = $self->getEditHash_hashIV('termOverrideHash');
            $hash{termTypeMode} = $mode;
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the combobox
            $combo->set_active(0);
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        my $button2 = $self->addButton(
            $grid,
            'Don\'t use',
            'Don\'t use this setting in the session',
            undef,
            10, 12, 7, 8);
        $button2->signal_connect('clicked' => sub {

            my %hash = $self->getEditHash_hashIV('termOverrideHash');
            delete $hash{'termTypeMode'};
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the combobox
            $combo->set_active(0);
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        $self->addLabel($grid, 'Custom client name',
            1, 3, 8, 9);
        my $entry = $self->addEntry($grid, undef, TRUE,
            3, 8, 8, 9);

        my $button3 = $self->addButton($grid, 'Use', 'Use this setting in the session', undef,
            8, 10, 8, 9);
        $button3->signal_connect('clicked' => sub {

            my (
                $string,
                %hash,
            );

            $string = $entry->get_text();
            if (! defined $string) {

                $string = '';
            }

            %hash = $self->getEditHash_hashIV('termOverrideHash');
            $hash{'customClientName'} = $string;
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the entry box
            $entry->set_text('');
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        my $button4 = $self->addButton(
            $grid,
            'Don\'t use',
            'Don\'t use this setting in the session',
            undef,
            10, 12, 8, 9);
        $button4->signal_connect('clicked' => sub {

            my %hash = $self->getEditHash_hashIV('termOverrideHash');
            delete $hash{'customClientName'};
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the entry box
            $entry->set_text('');
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        $self->addLabel($grid, 'Custom client version',
            1, 3, 9, 10);
        my $entry2 = $self->addEntry($grid, undef, TRUE,
            3, 8, 9, 10);

        my $button5 = $self->addButton($grid, 'Use', 'Use this setting in the session', undef,
            8, 10, 9, 10);

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

            my %hash = $self->getEditHash_hashIV('termOverrideHash');
            delete $hash{'customClientVersion'};
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the entry box
            $entry2->set_text('');
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        @initList2 = (
            'useCtrlSeqFlag'          => 'Use VT100 control sequences',
            'useVisibleCursorFlag'    => 'Show visible cursor in default textview',
            'useDirectKeysFlag'       => 'Use direct keyboard input in terminal',
        );

        do {

            my ($iv, $descrip);

            $iv = shift @initList2;
            $descrip = shift @initList2;

            push (@comboList2, $descrip);
            $comboHash2{$descrip} = $iv;

        } until (! @initList2);

        $self->addLabel($grid, 'Terminal emulation',
            1, 3, 10, 11);
        my $combo2 = $self->addComboBox($grid, undef, \@comboList2, '',
            TRUE,                       # No 'undef' value used
            3, 6, 10, 11);

        @comboList3 = ('Enabled', 'Disabled');
        my $combo3 = $self->addComboBox($grid, undef, \@comboList3, '',
            TRUE,                       # No 'undef' value used
            6, 8, 10, 11);

        my $button7 = $self->addButton($grid, 'Use', 'Use this setting in the session', undef,
            8, 10, 10, 11);
        $button7->signal_connect('clicked' => sub {

            my (
                $iv, $mode, $flag,
                %hash,
            );

            $iv = $comboHash2{$combo2->get_active_text()};
            $mode = $combo3->get_active_text();
            if ($mode eq 'Enabled') {
                $flag = TRUE;
            } else {
                $flag = FALSE;
            }

            %hash = $self->getEditHash_hashIV('termOverrideHash');
            $hash{$iv} = $flag;
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the comboboxes
            $combo2->set_active(0);
            $combo3->set_active(0);
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        my $button8 = $self->addButton(
            $grid,
            'Don\'t use',
            'Don\'t use this setting in the session',
            undef,
            10, 12, 10, 11);
        $button8->signal_connect('clicked' => sub {

            my (
                $iv,
                %hash,
            );

            $iv = $comboHash2{$combo2->get_active_text()};

            %hash = $self->getEditHash_hashIV('termOverrideHash');
            delete $hash{$iv};
            $self->ivAdd('editHash', 'termOverrideHash', \%hash);

            # Reset the comboboxes
            $combo2->set_active(0);
            $combo3->set_active(0);
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        my $button9 = $self->addButton(
            $grid,
            'Reset',
            'Reset the list of override settings',
            undef,
            8, 10, 11, 12);
        $button9->signal_connect('clicked' => sub {

            # Remove this IV from $self->editHash, so that the IV in $self->editObj takes over
            $self->ivDelete('editHash', 'termOverrideHash');

            # Reset widgets
            $combo->set_active(0);
            $entry->set_text('');
            $entry2->set_text('');
            $combo2->set_active(0);
            $combo3->set_active(0);
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        my $button10 = $self->addButton(
            $grid,
            'Clear',
            'Clear the list of override settings',
            undef,
            10, 12, 11, 12);
        $button10->signal_connect('clicked' => sub {

            # Add an empty hash to $self->editHash
            $self->ivAdd('editHash', 'termOverrideHash', {});

            # Reset widgets
            $combo->set_active(0);
            $entry->set_text('');
            $entry2->set_text('');
            $combo2->set_active(0);
            $combo3->set_active(0);
            # Refresh the simple list
            $self->refreshList_hashIV($slWidget, (scalar @columnList / 2), 'termOverrideHash');
        });

        # Tab complete
        return 1;
    }

    sub override5Tab {

        # Override5 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values

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

        $self->rooms17Tab($innerNotebook);
        $self->rooms18Tab($innerNotebook);
        $self->rooms19Tab($innerNotebook);
        $self->rooms20Tab($innerNotebook);
        $self->rooms21Tab($innerNotebook);

        return 1;
    }

    sub rooms1Tab {

        # Rooms1 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Room statement components'],
        );

        # Room statement components
        $self->addLabel($grid, '<b>Room statement components</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid, '<i>List of the components that make up room statements in this world</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Component name', 'text',
            'Type', 'text',
            'Fixed size', 'int',
            'Min. size', 'int',
            'Max. size', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->rooms1Tab_refreshList($slWidget, (scalar @columnList / 2));

        # Add entries/comboboxes for adding new components
        $self->addLabel($grid, 'Type:',
            1, 2, 8, 9);
        @comboList = $axmud::CLIENT->constComponentTypeList;
        # The first item in the list is 'anchor', which is a special kind of component which doesn't
        #   have a corresponding GA::Obj::Component; remove it from the list
        shift @comboList;
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,           # No 'undef' value used
            2, 6, 8, 9);
        # ->signal_connect appears below...

        $self->addLabel($grid, 'Name:',
            7, 8, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
            8, 12, 8, 9);

        $comboBox->signal_connect('changed' => sub {

            my (
                $type, $name,
                %compHash,
            );

            $type = $comboBox->get_active_text();

            # Suggest a name that isn't already taken, and set the $entry to display it
            # First import the hash IV
            %compHash = $self->getEditHash_hashIV('componentHash');
            if (! exists $compHash{$type}) {

                # $type is available as a name, so use the type as the name
                $name = $type;

            } else {

                # Try some alternative names, e.g. 'verb_descrip_1'
                OUTER: for (my $count = 1; $count < 100; $count++) {

                    my $suggestion = $type . '_' . $count;

                    if (! exists $compHash{$suggestion}) {

                        $name = $suggestion;
                        last OUTER;
                    }
                }
            }

            if (defined $name) {

                $entry->set_text($name);
            }
        });

        # Add standard editing buttons to the simple list
        my $button = $self->addButton($grid, 'Add...', 'Add a new room statement component', undef,
            1, 3, 9, 10);
        $button->signal_connect('clicked' => sub {

            my (

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

                $compObj->size,
                $compObj->minSize,
                $compObj->maxSize,
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub rooms1Tab_updateWorld {

        # Updates the world's list of room statement components, when one of the components is
        #   removed from ->componentHash
        #
        # Expected arguments
        #   $name   - The name of the component to remove (e.g. 'verb_descrip_1')
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my @ivList;

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

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

        # The deleted component might still be in any (or, conceivably all) of these IVs
        @ivList = ('verboseComponentList', 'shortComponentList', 'briefComponentList');
        foreach my $iv (@ivList) {

            my (@compList, @modList);

            # Import the IV...
            @compList = $self->getEditHash_listIV($iv);
            foreach my $component (@compList) {

                if ($name ne $component) {

                    push (@modList, $component);
                }
            }

            # ...and store it again
            $self->ivAdd('editHash', $iv, \@modList);
        }

        return 1;
    }

    sub rooms1Tab_refreshCombos {

        # Resets the comboboxes stored in $self->comboHash
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Optional arguments
        #   @comboList  - A list of items to store in each combobox, once it has been emptied (can
        #       be an empty list)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my @sortedList;

        # (No improper arguments to check)

        # Sort the list of components, and add the anchor line (which doesn't appear in the
        #   ->componentHash IV)
        @sortedList = sort {lc($a) cmp lc($b)} (@comboList);
        push(@sortedList, 'anchor');

        # Update each combobox in turn
        foreach my $combo ($self->ivValues('comboHash')) {

            $self->resetComboBox($combo, @sortedList);
        }

        return 1;
    }

    sub rooms2Tab {

        # Rooms2 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #   $iv             - The IV to edit - one of 'verboseComponentList', 'shortComponentList'
        #                       and 'briefComponentList'
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (@columnList, @comboList);

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

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

        # Tab setup
        my $grid;

        if ($iv eq 'verboseComponentList') {

            $grid = $self->addTab(
                $innerNotebook,
                'Page _2',
                ['Verbose components'],
            );

            # Verbose components
            $self->addLabel($grid, '<b>Verbose components</b>',
                0, 12, 0, 1);
            $self->addLabel($grid,
                '<i>List of components found in verbose room statements</i>',
                1, 12, 1, 2);

        } elsif ($iv eq 'shortComponentList') {

            $grid = $self->addTab(
                $innerNotebook,
                'Page _5',
                ['Short verbose components'],
            );

            # Short verbose components
            $self->addLabel($grid, '<b>Short verbose components</b>',

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

            );
        }

        # Import the IV
        @dataList = $self->getEditHash_listIV('exitStateStringList');
        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub rooms15Tab {

        # Rooms15 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page 15',
            ['Exit state colour tags'],
        );

        # Exit state colour tags
        $self->addLabel($grid, '<b>Exit state colour tags</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of colour tags which specify an exit state, when they occur at the beginning'
            . ' of an exit</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Colour tag', 'text',
            'Exit state', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 9);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'exitStateTagHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Colour tag',
            1, 3, 9, 10);
        my $entry = $self->addEntryWithIcon($grid, undef, \&rooms15Tab_checkEntry, undef, undef,
            3, 6, 9, 10);

        $self->addLabel($grid, 'Exit state',
            1, 3, 10, 11);
        @comboList = (
            'open',
            'closed',
            'locked',
            'secret',
            'secret_open',
            'secret_closed',
            'secret_locked',
            'impass',
            'dark',
            'danger',
            'emphasis',
            'other',
            'ignore',
            # Put 'normal' at the end, since it's the default exit state (but is probably never
            #   added to $self->ediObj->exitStateStringList)
            'normal',
        );
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,           # No 'undef' value used
            3, 6, 10, 11);

        $self->addLabel($grid, '(or) specify an assisted move',
            7, 9, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            9, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'exitStateTagHash',
            11,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($tag, $text, $text2, $state);

            $tag = $entry->get_text();

            $text = $combo->get_active_text();
            $text2 = $entry2->get_text();
            if (defined $text2 && $text2 ne '') {
                $state = $text2;
            } else {
                $state = $text;
            }

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('exitStateTagHash', $tag, $state);

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

            if (defined $result) {
                return 1;
            } else {
                return undef;
            }
        }
    }

    sub rooms16Tab {

        # Rooms16 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 . '->rooms16Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page 16',
            ['Exit aliases'],
        );

        # Exit aliases
        $self->addLabel($grid, '<b>Exit aliases</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of patterns, which appear in exit lists, but which represent one or more other'
            . ' exits</i>',
            1, 12, 1, 2);
        $self->addLabel($grid,
            '<i>e.g. \'compass\' - representing the exits \'n s e w nw ne sw se\'</i>',
            1, 12, 2, 3);

        # Add a simple list
        @columnList = (
            'Exit alias (pattern)', 'text',
            'Replacement string', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'exitAliasHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Exit alias',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Replacement string',
            6, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'exitAliasHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($alias, $string);

            $alias = $entry->get_text();
            $string = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('exitAliasHash', $alias, $string);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'exitAliasHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub rooms17Tab {

        # Rooms17 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 . '->rooms17Tab', @_);
        }

        # Tab setup

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

            ],
            10, 12, 0, 4);

        $self->addTextView($grid, 'contentPatternList', TRUE,
            1, 12, 4, 12,
            TRUE, TRUE, FALSE, FALSE,  # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub rooms20Tab {

        # Rooms20 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 . '->rooms20Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page 20',
            ['Special contents patterns'],
        );

        # Special contents patterns
        $self->addLabel($grid, '<b>Special contents patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of patterns matching any line in the \'verb_special\' component</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Replacement contents', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'specialPatternHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 6, 8, 9);

        $self->addLabel($grid, 'Replacement',
            7, 8, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            8, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'specialPatternHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $replace);

            $pattern = $entry->get_text();
            $replace = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('specialPatternHash', $pattern, $replace);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'specialPatternHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub rooms21Tab {

        # Rooms21 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) {

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

            1, 12, 8, 10);
        $self->addTextView($grid, 'unspecifiedRoomPatternList', TRUE,
            1, 12, 10, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub moves4Tab {

        # Moves4 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 . '->moves4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Transient exit patterns'],
        );

        # Transient exit patterns
        $self->addLabel($grid, '<b>Transient exit patterns</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Patterns matching exits which appear unpredictably (e.g. the entrance to a moving'
            . ' vehicle)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Transient exit pattern', 'text',
            'Destination room #', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'transientExitPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Transient exit pattern',
            1, 3, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 6, 10, 11);

        $self->addLabel($grid, '(Optional) desination room #',
            6, 9, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 0, undef,
            9, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'transientExitPatternList',
            11, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $destRoom);

            $pattern = $entry->get_text();
            $destRoom = $entry2->get_text();
            if ($destRoom eq '' || $destRoom eq '0') {

                $destRoom = undef;
            }

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV('transientExitPatternList',
                    undef, FALSE,
                    $pattern, $destRoom,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'transientExitPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub moves5Tab {

        # Moves5 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 . '->moves5Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Follow patterns'],
        );

        # Follow patterns
        $self->addLabel($grid, '<b>Follow patterns</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Patterns seen when the character moves by following someone, and a new room'
            . ' statement is then received</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Follow pattern', 'text',
            'Direction substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'followPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Follow pattern',
            1, 3, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 6, 10, 11);

        $self->addLabel($grid, 'Substring # for direction',
            6, 9, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'followPatternList',
            11, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV('followPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'followPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub moves6Tab {

        # Moves6 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 . '->moves6Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _6',
            ['Follow anchor patterns'],
        );

        # Follow anchor patterns
        $self->addLabel($grid, '<b>Follow anchor patterns</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Patterns seen when the character moves by following someone, but no new room'
            . ' statement is then received</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Follow anchor pattern', 'text',
            'Direction substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'followAnchorPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Follow anchor pattern',
            1, 3, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 6, 10, 11);

        $self->addLabel($grid, 'Substring # for direction',
            6, 9, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'followAnchorPatternList',
            11, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV('followAnchorPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'followAnchorPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub statusTab {

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

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

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

        $self->status12Tab($innerNotebook);
        $self->status13Tab($innerNotebook);
        $self->status14Tab($innerNotebook);

        return 1;
    }

    sub status1Tab {

        # 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 @columnList;

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

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

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

        # Status task commands
        $self->addLabel($grid, '<b>Status task commands</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Default list of commands sent to the world to update the Status task\'s'
            . ' variables (inherited by each</i>',
            1, 12, 1, 2);
        $self->addLabel($grid,
            '<i>new character profile - edit the current character profile to change the commands'
            . ' actually sent)</i>',
            1, 12, 2, 3);

        # Add a simple list
        @columnList = (
            'Command', 'text',
            'How often to send', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statusCmdHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Command',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Sent how often (in seconds):',
            6, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'statusCmdHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($cmd, $time);

            $cmd = $entry->get_text();
            $time = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('statusCmdHash', $cmd, $time);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statusCmdHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub status2Tab {

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

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

        # Local variables
        my @comboList;

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

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

        return 1;
    }

    sub status3Tab {

        # Status3 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #   $taskObj        - A temporary Status task object
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (@columnList, @comboList, @colourList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Status task - gauges'],
        );

        # Status task - gauges
        $self->addLabel(
            $grid,
            '<b>Status task - gauges</b>'
            . '   <i>How the Status task displays gauges in the \'main\' window</i>',
            0, 12, 0, 1);
        # Add a simple list
        @columnList = (
            'Variable', 'text',
            'Max variable', 'text',
            'Add', 'bool',
            'Label', 'text',
            'Full col', 'text',
            'Empty col', 'text',
            'Label col', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 1, 6);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'gaugeFormatList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Variable:',
            1, 2, 6, 7);

        @comboList = sort {lc($a) cmp lc($b)} (
            $taskObj->ivKeys('constCharVarHash'),
            $taskObj->ivKeys('constFixedVarHash'),
        );
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            2, 6, 6, 7);
        $self->addLabel($grid, 'or custom:',
            6, 7, 6, 7);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            7, 10, 6, 7);

        $self->addLabel($grid, 'Maximum var:',
            1, 2, 7, 8);
        my $comboBox2 = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            2, 6, 7, 8);
        $self->addLabel($grid, 'or custom:',
            6, 7, 7, 8);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            7, 10, 7, 8);

        my $checkButton = $self->addCheckButton($grid, 'Not maximum', undef, TRUE,
            10, 12, 7, 8);

        @colourList = ($axmud::CLIENT->constColourTagList, $axmud::CLIENT->constBoldColourTagList);
        $self->addLabel($grid, 'Full colour:',
            1, 2, 8, 9);
        my $comboBox3 = $self->addComboBox($grid, undef, [@colourList], '',
            TRUE,               # No 'undef' value used
            2, 6, 8, 9);
        $self->addLabel($grid, 'or xterm/RGB:',
            6, 7, 8, 9);
        my $entry3 = $self->addEntryWithIcon($grid, undef, \&status3Tab_checkEntry, undef, undef,
            7, 10, 8, 9);

        $self->addLabel($grid, 'Empty colour:',
            1, 2, 9, 10);
        my $comboBox4 = $self->addComboBox($grid, undef, [@colourList], '',
            TRUE,               # No 'undef' value used
            2, 6, 9, 10);
        $self->addLabel($grid, 'or xterm/RGB:',
            6, 7, 9, 10);
        my $entry4 = $self->addEntryWithIcon($grid, undef, \&status3Tab_checkEntry, undef, undef,
            7, 10, 9, 10);

        $self->addLabel($grid, 'Label colour:',
            1, 2, 10, 11);
        my $comboBox5 = $self->addComboBox($grid, undef, [@colourList], '',
            TRUE,               # No 'undef' value used
            2, 6, 10, 11);
        $self->addLabel($grid, 'or xterm/RGB:',
            6, 7, 10, 11);
        my $entry5 = $self->addEntryWithIcon($grid, undef, \&status3Tab_checkEntry, undef, undef,
            7, 10, 10, 11);

        $self->addLabel($grid, '<i>Optional text</i>:',

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

            }

        } elsif ($text =~ m/^\#[0-9A-Fa-f]{6}$/) {

            return 1;

        } else {

            return undef;
        }
    }

    sub status4Tab {

        # Status4 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 . '->status4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Status task MSDP variables'],
        );

        # Status task MSDP variables
        $self->addLabel($grid, '<b>Status task MSDP variables</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>MSDP variables that should be converted directly into Status task variables</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'MSDP variable', 'text',
            'Status task variable', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'msdpStatusVarHash');

        # Add entries/comboboxes for adding new variables
        $self->addLabel($grid, 'MSDP variable',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Status task variable',
            6, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'msdpStatusVarHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($msdpVar, $var);

            $msdpVar = $entry->get_text();
            $var = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('msdpStatusVarHash', $msdpVar, $var);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'msdpStatusVarHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub status5Tab {

        # Status5 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 . '->status5Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Status task MXP variables'],
        );

        # Status task MXP variables
        $self->addLabel($grid, '<b>Status task MXP variables</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>MXP entities whose values should be converted directly into Status task'
            . ' variables</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'MXP variable', 'text',
            'Status task variable', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'mxpStatusVarHash');

        # Add entries/comboboxes for adding new variables
        $self->addLabel($grid, 'MXP entity',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Status task variable',
            6, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'mxpStatusVarHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($mxpEnt, $var);

            $mxpEnt = $axmud::CLIENT->trimWhitespace($entry->get_text());
            $var = $axmud::CLIENT->trimWhitespace($entry2->get_text());

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('mxpStatusVarHash', $mxpEnt, $var);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'mxpStatusVarHash',
                );

                $self->resetEntryBoxes($entry, $entry2);

                # Update the Status task with the current value (if any) of the MXP entity
                if (
                    $self->session->statusTask
                    && $self->session->ivExists('mxpEntityHash', $mxpEnt)
                ) {
                    my $mxpObj = $self->session->ivShow('mxpEntityHash', $mxpEnt);
                    $self->session->statusTask->setValue($var, $mxpObj->value);
                }
            }
        });

        # Tab complete
        return 1;
    }

    sub status6Tab {

        # Status6 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #   $taskObj        - A temporary Status task object
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (
            $customString,
            @columnList, @comboList,
        );

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _6',
            ['Status task - general patterns'],
        );

        # Status task - general patterns
        $self->addLabel($grid, '<b>Status task - general patterns</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Patterns with group substrings, e.g. </i><b>(.*)</b> <i>and</i> <b>(\d+)</b><i>,'
            . ' one of which matches the data we need</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
            'Variable', 'text',
            'Mode', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'groupPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 12, 8, 9);

        $self->addLabel($grid, 'Substring #:',
            1, 3, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            3, 6, 9, 10, 4, 4);

        $self->addLabel($grid, 'Mode:',
            9, 10, 9, 10);
        my $comboBox = $self->addComboBox($grid, undef, ['hide', 'show', 'choose'], '',
            TRUE,               # No 'undef' value used
            10, 12, 9, 10);

        $self->addLabel($grid, 'Status task variable:',
            1, 6, 10, 11);

        $customString = 'Use a custom variable:';

        @comboList = sort {lc($a) cmp lc($b)} (
            $taskObj->ivKeys('constCharVarHash'),
            $taskObj->ivKeys('constFixedVarHash'),
            $taskObj->ivKeys('constPseudoVarHash'),
            $taskObj->ivKeys('constLocalVarHash'),
            $taskObj->ivKeys('constCounterVarHash'),
        );
        unshift (@comboList, $customString);
        my $comboBox2 = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            6, 9, 10, 11);
        # ->signal_connect appears below

        my $entry3 = $self->addEntry($grid, undef, TRUE,
            9, 12, 10, 11);
        $comboBox2->signal_connect('changed' => sub {

            my $text = $comboBox2->get_active_text();
            if ($text eq $customString ) {
                $entry3->set_sensitive(TRUE);
            } else {
                $entry3->set_sensitive(FALSE);
                $entry3->set_text('');
            }
        });

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'groupPatternList',
            11, 4,
            $entry, $entry2, $entry3,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $var, $mode);

            $pattern = $entry->get_text();

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

                );
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub status7Tab {

        # Status7 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _7',
            ['Status task - bar patterns'],
        );

        # Status task - bar patterns
        $self->addLabel($grid, '<b>Status task - bar patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns containing data represented by multiple symbols</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
            'Variable', 'text',
            'Mode', 'text',
            'Unit', 'text',
            'Max units', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'barPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 6, 8, 9);

        $self->addLabel($grid, 'Unit:',
            6, 7, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            7, 9, 8, 9, 4, 4);

        $self->addLabel($grid, 'Max units:',
            9, 10, 8, 9);
        my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            10, 12, 8, 9, 4, 4);

        $self->addLabel($grid, 'Substring #:',
            1, 2, 9, 10);
        my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            2, 4, 9, 10, 4, 4);

        $self->addLabel($grid, 'Data type:',
            4, 6, 9, 10);

        @comboList = (
            'health', 'magic', 'energy', 'guild', 'social', 'xp_current', 'xp_next_level',
            'qp_current', 'qp_next_level', 'op_current', 'op_next_level',
        );

        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            6, 8, 9, 10);

        $self->addLabel($grid, 'Mode:',
            8, 10, 9, 10);
        my $comboBox2 = $self->addComboBox($grid, undef, ['hide', 'show', 'choose'], '',
            TRUE,               # No 'undef' value used
            10, 12, 9, 10);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'barPatternList',
            10, 6,
            $entry, $entry2, $entry3, $entry4,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $var, $mode, $unit, $maxUnits);

            $pattern = $entry->get_text();
            $grpNum = $entry4->get_text();
            $var = $comboBox->get_active_text();
            $mode = $comboBox2->get_active_text();
            $unit = $entry2->get_text();
            $maxUnits = $entry3->get_text();

            if ($self->checkEntryIcon($entry, $entry2, $entry3, $entry4)) {

                # Add new values to (the end of) the list IV

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

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'barPatternList');
                $self->resetEntryBoxes($entry, $entry2, $entry3, $entry4);
            }
        });

        # Tab complete
        return 1;
    }

    sub status8Tab {

        # Status8 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _8',
            ['Status task - character affect patterns'],
        );

        # Status task - character affect patterns
        $self->addLabel($grid, '<b>Status task - character affect patterns</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Patterns containing data about spells (etc) affecting the character</i>',
            0, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
            'Display', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'affectPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 12, 8, 9);

        $self->addLabel($grid, 'Substring #:',
            1, 2, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            2, 6, 9, 10, 4, 4);

        $self->addLabel($grid, 'Mode:',
            9, 10, 9, 10);
        my $comboBox2 = $self->addComboBox($grid, undef, ['hide', 'show', 'choose'], '',
            TRUE,               # No 'undef' value used
            10, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'affectPatternList',
            10,  4,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $mode);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();
            $mode = $comboBox2->get_active_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'affectPatternList',
                    undef, FALSE,
                    $pattern, $grpNum, $mode,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'affectPatternList',
                );
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub status9Tab {

        # Status9 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _9',
            ['Status task - character stat patterns'],
        );

        # Status task - character stat patterns
        $self->addLabel($grid, '<b>Status task - character stat patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns containing data about the character\'s stats</i>',
            0, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
            'Stat', 'text',
            'Display', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'statPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 12, 8, 9);

        $self->addLabel($grid, 'Substring #:',
            1, 2, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            2, 6, 9, 10, 4, 4);

        $self->addLabel($grid, 'Stat:',
            6, 7, 9, 10);
        @comboList = $self->editObj->ivKeys('statHash');
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            7, 9, 9, 10);

        $self->addLabel($grid, 'Mode:',
            9, 10, 9, 10);
        my $comboBox2 = $self->addComboBox($grid, undef, ['hide', 'show', 'choose'], '',
            TRUE,               # No 'undef' value used
            10, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'statPatternList',
            10,  4,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $stat, $mode);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();
            $stat = $comboBox->get_active_text();
            $mode = $comboBox2->get_active_text();

            if (! $stat) {

                $self->showMsgDialogue(
                    'Character stat error',
                    'error',
                    'No stat set (if the stat list is empty, you must create some stats in the'
                    . ' \'stats\' tab)',
                    'ok',
                );

            } elsif ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'statPatternList',
                    undef, FALSE,
                    $pattern, $grpNum, $stat, $mode,
                );

                # Refresh the simple list and reset entry boxes

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

        $self->addLabel(
            $grid,
            'All lines between a line matching a \'start\' pattern and the first empty line are'
            . ' used',
            2, 12, 9, 10);

        # Tab complete
        return 1;
    }

    sub inventory2Tab {

        # Inventory2 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Inventory task patterns'],
        );

        # Inventory task patterns
        $self->addLabel($grid, '<b>Inventory task patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns containing data about the character\'s inventory</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
            'Type', 'text',
            'Mode', 'text',
            'Position', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'inventoryPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Type:',
            8, 9, 8, 9);

        @comboList = (
            'wield', 'hold', 'wear', 'carry',
            'sack',
            'purse', 'deposit', 'deposit_only', 'withdraw', 'withdraw_only', 'balance',
            'empty_purse', 'empty_bank',
            'misc',
            'ignore',
        );
        my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 12, 8, 9);

        $self->addLabel($grid, 'Substring #:',
            1, 2, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            2, 6, 9, 10, 4, 4);

        $self->addLabel($grid, 'Mode:',
            6, 7, 9, 10);
        my $comboBox2 = $self->addComboBox($grid, undef, ['hide', 'show'], '',
            TRUE,               # No 'undef' value used
            7, 9, 9, 10);

        $self->addLabel($grid, 'Position:',
            9, 10, 9, 10);
        my $comboBox3 = $self->addComboBox($grid, undef, ['start', 'stop', 'optional'], '',
            TRUE,               # No 'undef' value used
            10, 12, 9, 10);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'inventoryPatternList',
            10,  5,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $type, $mode, $posn);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();
            $type = $comboBox->get_active_text();
            $mode = $comboBox2->get_active_text();
            $posn = $comboBox3->get_active_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'inventoryPatternList',

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


                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub inventory3Tab {

        # Inventory3 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 . '->inventory3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Inventory task ignore patterns'],
        );

        # Inventory task ignore patterns
        $self->addLabel($grid, '<b>Inventory task ignore patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns which should be ignored by the Inventory task</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Mode', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'inventoryIgnorePatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 10, 11);

        $self->addLabel($grid, 'Mode:',
            8, 10, 10, 11);
        my $comboBox = $self->addComboBox($grid, undef, ['hide', 'show'], '',
            TRUE,               # No 'undef' value used
            10, 12, 10, 11);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'inventoryIgnorePatternList',
            11,  2,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $mode);

            $pattern = $entry->get_text();
            $mode = $comboBox->get_active_text();

            if ($self->checkEntryIcon($entry)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'inventoryIgnorePatternList',
                    undef, FALSE,
                    $pattern, $mode,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'inventoryIgnorePatternList',
                );

                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub inventory4Tab {

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

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


        $self->addTextView($grid, 'inventorySplitPatternList', TRUE,
            1, 12, 8, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub inventory5Tab {

        # Inventory5 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Condition task patterns'],
        );

        # Condition task patterns
        $self->addLabel($grid, '<b>Condition task patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns containing data about an inventory object\'s condition</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
            'Mode', 'text',
            'Condition', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'conditionPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 12, 8, 9);

        $self->addLabel($grid, 'Substring #:',
            1, 3, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            3, 5, 9, 10, 4, 4);

        $self->addLabel($grid, 'Condition (0-100):',
            5, 7, 9, 10);
        my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, 100,
            7, 9, 9, 10, 3, 3);

        $self->addLabel($grid, 'Mode:',
            9, 10, 9, 10);
        my $comboBox = $self->addComboBox($grid, undef, ['hide', 'show'], '',
            TRUE,               # No 'undef' value used
            10, 12, 9, 10);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'conditionPatternList',
            10,  4,
            $entry, $entry2, $entry3
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $mode, $condition);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();
            $mode = $comboBox->get_active_text();
            $condition = $entry3->get_text();

            if ($self->checkEntryIcon($entry, $entry2, $entry3)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'conditionPatternList',
                    undef, FALSE,
                    $pattern, $grpNum, $mode, $condition,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'conditionPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2, $entry3);
            }
        });

        # Tab complete
        return 1;

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

            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub inventory7Tab {

        # Inventory7 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 . '->inventory7Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _7',
            ['Inventory commands'],
        );

        # Inventory commands
        $self->addLabel($grid, '<b>Inventory commands</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Default list of commands sent to the world to update the Inventory task\'s'
            . ' variables (inherited by each</i>',
            1, 12, 1, 2);
        $self->addLabel($grid,
            '<i>new character profile - edit the current character profile to change the commands'
            . ' actually sent)</i>',
            1, 12, 2, 3);

        # Add a simple list
        @columnList = (
            'Command', 'text',
            'How often to send', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'inventoryCmdHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Command',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Sent how often (in seconds):',
            6, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'inventoryCmdHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($cmd, $time);

            $cmd = $entry->get_text();
            $time = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('inventoryCmdHash', $cmd, $time);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'inventoryCmdHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub channelsTab {

        # Channels 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 . '->channelsTab', @_);
        }

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

        # Add tabs to the inner notebook
        $self->channels1Tab($innerNotebook);
        $self->channels2Tab($innerNotebook);

        return 1;
    }

    sub channels1Tab {

        # Channels1 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 . '->channels1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Channel patterns'],
        );

        # Channel patterns
        $self->addLabel($grid, '<b>Channel patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of patterns used to divert text to the Channels and Divert tasks</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Channel', 'text',
            'Only in task window', 'bool',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 9);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'channelList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 9, 10);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 12, 9, 10);

        $self->addLabel($grid, 'Channel name (1-16 chars):',
            1, 2, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
            2, 6, 10, 11,
            16, 16);

        my $checkButton = $self->addCheckButton($grid, 'Only in task window?', undef, TRUE,
            7, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'channelList',
            11, 3,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $channel, $flag);

            $pattern = $entry->get_text();
            $channel = $entry2->get_text();
            $flag = $checkButton->get_active();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'channelList',
                    undef, FALSE,
                    $pattern, $channel, $flag,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'channelList',
                );

                $self->resetEntryBoxes($entry);
            }
        });

        # One non-standard button, sandwich in between the existing ones
        my $button2 = $self->addButton($grid,
            'Modify selected', 'Modifies the selected pattern\'s attributes', undef,
            3, 6, 11, 12);
        $button2->signal_connect('clicked' => sub {

            my (
                $index, $pattern, $channel, $flag, $choice, $choice2,
                @ivList, @comboList,
            );

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

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

        # Add tabs to the inner notebook
        $self->attack1Tab($innerNotebook);
        $self->attack2Tab($innerNotebook);
        $self->attack3Tab($innerNotebook);
        $self->attack4Tab($innerNotebook);

        return 1;
    }

    sub attack1Tab {

        # Attack1 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 . '->attack1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Target leaves patterns'],
        );

        # Target leaves patterns
        $self->addLabel($grid, '<b>Target leaves patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when a target (or a potential target) leaves</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Target #', 'int',
            'Direction #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'targetLeavesPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 12, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            1, 3, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            3, 6, 9, 10, 4, 4);

        $self->addLabel($grid, 'Direction substring # (0 if unspecified):',
            7, 9, 9, 10);
        my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 9, 10, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'targetLeavesPatternList',
            10,  3,
            $entry, $entry2, $entry3
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $grpNum2);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();
            $grpNum2 = $entry3->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'targetLeavesPatternList',
                    undef, FALSE,
                    $pattern, $grpNum, $grpNum2,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'targetLeavesPatternList',
                );
                $self->resetEntryBoxes($entry, $entry2, $entry3);
            }
        });

        # Tab complete
        return 1;
    }

    sub attack2Tab {

        # Attack2 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 . '->attack2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Target arrives patterns'],
        );

        # Target arrives patterns
        $self->addLabel($grid, '<b>Target arrives patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns seen when a target (or a potential target) arrives</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Target #', 'int',
            'Direction #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'targetArrivesPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            3, 12, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            1, 3, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            3, 6, 9, 10, 4, 4);

        $self->addLabel($grid, 'Direction substring # (0 if unspecified):',
            7, 9, 9, 10);
        my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 9, 10, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'targetArrivesPatternList',
            10,  3,
            $entry, $entry2, $entry3
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum, $grpNum2);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();
            $grpNum2 = $entry3->get_text();

            if ($self->checkEntryIcon($entry, $entry2, $entry3)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'targetArrivesPatternList',
                    undef, FALSE,
                    $pattern, $grpNum, $grpNum2,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'targetArrivesPatternList',
                );
                $self->resetEntryBoxes($entry, $entry2, $entry3);
            }
        });

        # Tab complete
        return 1;
    }

    sub attack3Tab {

        # Attack3 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook

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

        $self->worldFight1Tab($innerNotebook);
        $self->worldFight2Tab($innerNotebook);
        $self->worldFight3Tab($innerNotebook);
        $self->worldFight4Tab($innerNotebook);
        $self->worldFight5Tab($innerNotebook);
        $self->worldFight6Tab($innerNotebook);
        $self->worldFight7Tab($innerNotebook);
        $self->worldFight8Tab($innerNotebook);
        $self->worldFight9Tab($innerNotebook);

        return 1;
    }

    sub worldFight1Tab {

        # WorldFight1 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 . '->worldFight1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Fight started patterns'],
        );

        # Fight started patterns
        $self->addLabel($grid, '<b>Fight started patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when the character initiates a fight</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'fightStartedPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'fightStartedPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'fightStartedPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'fightStartedPatternList',
                );
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldFight2Tab {

        # WorldFight2 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 . '->worldFight2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Cannot find target patterns'],
        );

        # Cannot find target patterns
        $self->addLabel($grid, '<b>Cannot find target patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns seen when the character initiates a fight with a non-existent target</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'cannotFindTargetPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'cannotFindTargetPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'cannotFindTargetPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'cannotFindTargetPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldFight3Tab {

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

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

            1, 12, 10, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub worldFight4Tab {

        # WorldFight4 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 . '->worldFight4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Target already dead patterns'],
        );

        # Target already dead patterns
        $self->addLabel($grid, '<b>Target already dead patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns seen when the character initiates a fight with a dead target</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'targetAlreadyDeadPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'targetAlreadyDeadPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'targetAlreadyDeadPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'targetAlreadyDeadPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldFight5Tab {

        # WorldFight5 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Target killed patterns'],
        );

        # Target killed patterns
        $self->addLabel($grid, '<b>Target killed patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when the character wins a fight</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'targetKilledPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'targetKilledPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'targetKilledPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'targetKilledPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldFight6Tab {

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

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

            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub worldFight7Tab {

        # WorldFight7 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 . '->worldFight7Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _7',
            ['Target defeat patterns'],
        );

        # Target defeat patterns
        $self->addLabel($grid, '<b>Target defeat patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns seen when the character loses a fight (besides getting killed/knocked'
            . ' out)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'fightDefeatPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'fightDefeatPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'fightDefeatPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'fightDefeatPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldFight8Tab {

        # WorldFight8 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, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _8',
            ['Remote wimpy engaged patterns'],
        );

        # Remote wimpy engaged patterns
        $self->addLabel($grid, '<b>Remote wimpy engaged patterns</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Patterns seen when the world engages wimpy mode (presumably ending a fight)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV($slWidget, scalar (@columnList / 2), 'wimpyEngagedPatternList');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'wimpyEngagedPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'wimpyEngagedPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'wimpyEngagedPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldFight9Tab {

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

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

        $self->worldInteraction5Tab($innerNotebook);
        $self->worldInteraction6Tab($innerNotebook);
        $self->worldInteraction7Tab($innerNotebook);
        $self->worldInteraction8Tab($innerNotebook);
        $self->worldInteraction9Tab($innerNotebook);

        return 1;
    }

    sub worldInteraction1Tab {

        # WorldInteraction1 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 . '->worldInteraction1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Interaction started patterns'],
        );

        # Interaction started patterns
        $self->addLabel($grid, '<b>Interaction started patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when the character initiates an interaction</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'interactionStartedPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'interactionStartedPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'interactionStartedPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionStartedPatternList',
                );
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldInteraction2Tab {

        # WorldInteraction2 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 . '->worldInteraction2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Cannot interact patterns'],
        );

        # Cannot interact patterns
        $self->addLabel($grid, '<b>Cannot interact patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns seen when the character fails to initiate an interaction</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'cannotInteractPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'cannotInteractPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'cannotInteractPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'cannotInteractPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldInteraction3Tab {

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

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

        $self->addTextView($grid, 'noCannotInteractPatternList', TRUE,
            1, 12, 10, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub worldInteraction4Tab {

        # WorldInteraction4 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 . '->worldInteraction4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Interaction success patterns'],
        );

        # Interaction success patterns
        $self->addLabel($grid, '<b>Interaction success patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when the character wins an interaction</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'interactionSuccessPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add buttons at various positions
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'interactionSuccessPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'interactionSuccessPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionSuccessPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldInteraction5Tab {

        # WorldInteraction5 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 . '->worldInteraction5Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Interaction fail patterns'],
        );

        # Interaction fail patterns
        $self->addLabel($grid, '<b>Interaction fail patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when the character loses an interaction</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'interactionFailPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'interactionFailPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'interactionFailPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionFailPatternList',
                );
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldInteraction6Tab {

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

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

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

        $self->addTextView($grid, 'noInteractionFailPatternList', TRUE,
            1, 12, 10, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub worldInteraction7Tab {

        # WorldInteraction7 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 . '->worldInteraction7Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _7',
            ['Interaction conversion patterns'],
        );

        # Interaction conversion patterns
        $self->addLabel($grid, '<b>Interaction conversion patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Patterns seen when an interaction turns into a fight</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'interactionFightPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'interactionFightPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'interactionFightPatternList',
                    undef, FALSE,
                    $pattern, $grpNum
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionFightPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldInteraction8Tab {

        # WorldInteraction8 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 . '->worldInteraction8Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _8',
            ['Interaction disaster patterns'],
        );

        # Interaction disaster patterns
        $self->addLabel($grid, '<b>Interaction disaster patterns</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Patterns seen when an interaction requires the character to flee</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Pattern', 'text',
            'Substring #', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_listIV(
            $slWidget,
            scalar (@columnList / 2),
            'interactionDisasterPatternList',
        );

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Pattern:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'regex', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Target substring #:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9, 4, 4);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_listIV(
            $grid,
            $slWidget,
            'interactionDisasterPatternList',
            9, 2,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($pattern, $grpNum);

            $pattern = $entry->get_text();
            $grpNum = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add new values to (the end of) the list IV
                $self->addEditHash_listIV(
                    'interactionDisasterPatternList',
                    undef, FALSE,
                    $pattern, $grpNum,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_listIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionDisasterPatternList',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub worldInteraction9Tab {

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

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

        $self->addTextView($grid, 'advanceFailPatternList', TRUE,
            1, 12, 10, 12,
            TRUE, TRUE, FALSE, FALSE,   # Treat as list, remove empty lines, don't remove whitespace
        );

        # Tab complete
        return 1;
    }

    sub currencyTab {

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

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

        # Local variables
        my (@columnList, @comboList);

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'C_urrency',
            ['Currency conversion chart'],
        );

        # Currency conversion chart
        $self->addLabel($grid, '<b>Currency conversion chart</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, 'Conversion into the standard unit:',
            1, 6, 1, 2);
        @comboList = $self->editObj->ivKeys('currencyHash');
        my $comboBox = $self->addComboBox($grid, 'standardCurrencyUnit', \@comboList, '',
            FALSE,              # 'undef' value allowed
            6, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Currency unit', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'currencyHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Currency unit:',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Value (in standard units):',
            6, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
            9, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'currencyHash',
            9,
            $entry, $entry2,
        );

        $button->signal_connect('clicked' => sub {

            my ($unit, $value);

            $unit = $entry->get_text();
            $value = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('currencyHash', $unit, $value);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'currencyHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        $self->addLabel($grid,
            'Round cash values to this many decimal places (0-9, or -1 to prevent rounding)',
            1, 9, 10, 11);
        $self->addEntryWithIcon($grid, 'currencyRounding', 'int', -1, 9,
            9, 12, 10, 11);

        # Tab complete
        return 1;
    }

    sub missionsTab {

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

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

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


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

        # Add tabs to the inner notebook
        $self->stats1Tab($innerNotebook);
        $self->stats2Tab($innerNotebook);

        return 1;
    }

    sub stats1Tab {

        # Stats1 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 . '->stats1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Character stats (1/2)'],
        );

        # Character stats (1/2)
        $self->addLabel($grid, '<b>Character stats (1/2)</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of character stats for this world and their default values</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Stat', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Stat',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Default value (usually 0):',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'statHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($unit, $value);

            $unit = $entry->get_text();
            $value = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('statHash', $unit, $value);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub stats2Tab {

        # Stats2 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 . '->stats2Tab', @_);

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

        $self->skills1Tab($innerNotebook);
        $self->skills2Tab($innerNotebook);

        return 1;
    }

    sub skills1Tab {

        # Skills1 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 . '->skills1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['List of guild skills'],
        );

        # List of guild skills
        $self->addLabel($grid, '<b>List of guild skills</b>',
            0, 10, 0, 1);
        my $button = $self->addButton($grid,
            'Dump lists', 'Display these lists in the \'main\' window', undef,
            10, 12, 0, 1);
        $button->signal_connect('clicked' => sub {

            $self->session->pseudoCmd('listadvance -g', $self->pseudoCmdMode);
        });
        $self->addLabel($grid, '<i>All skills available to this guild</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Skill', 'text',
            'Maximum level', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'skillMaxLevelHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Skill:',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Max level:',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            9, 12, 8, 9);

        # Add buttons at various positions
        my $button2 = Gtk3::Button->new('Add');
        $button2->signal_connect('clicked' => sub {

            my ($skill, $maxLevel);

            $skill = $entry->get_text();
            $maxLevel = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('skillMaxLevelHash', $skill, $maxLevel);

                # All the keys in the hash 'skillMaxLevelHash' must be saved as a list in a
                #   second IV
                $self->storeListColumnInList($slWidget, 'skillList', 0);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'skillMaxLevelHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });
        $button->set_tooltip_text('Add a new pattern with the above settings');
        $grid->attach($button2, 1, 9, 2, 1);

        my $button3 = Gtk3::Button->new('Delete');
        $button3->signal_connect('clicked' => sub {

            my ($key) = $self->getSimpleListData($slWidget, 0);
            if (defined $key) {

                # Delete the key-value pair from the hash
                $self->modifyEditHash_hashIV('skillMaxLevelHash', $key, undef, TRUE);

                # All the keys in the hash 'skillMaxLevelHash' must be saved as a list in a second
                #   IV
                $self->storeListColumnInList($slWidget, 'skillList', 0);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'skillMaxLevelHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });
        $button3->set_tooltip_text('Delete the selected pattern');
        $grid->attach($button3, 6, 9, 2, 1);

        my $button4 = Gtk3::Button->new('Reset');
        $button4->signal_connect('clicked' => sub {

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

            7, 9, 4, 5);
        $self->addEntryWithIcon($grid, 'interactFightCount', 'int', 0, undef,
            9, 12, 4, 5);
        $self->addLabel($grid, 'No. disasters',
            7, 9, 5, 6);
        $self->addEntryWithIcon($grid, 'interactDisasterCount', 'int', 0, undef,
            9, 12, 5, 6);

        # Tab complete
        return 1;
    }

    sub attacks2Tab {

        # Attacks2 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 . '->attacks2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Fight history (1/2)'],
        );

        # Fight history (1/2)
        $self->addLabel($grid, '<b>Fight history (1/2)</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Record of things killed (sorted by main noun - not updated by the Attack task)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Main noun', 'text',
            'Number of kills', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'fightVictimHash');

        # Add entries/comboboxes for adding new records
        $self->addLabel($grid, 'Main noun',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Number of kills',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'fightVictimHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($noun, $count);

            $noun = $entry->get_text();
            $count = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('fightVictimHash', $noun, $count);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'fightVictimHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub attacks3Tab {

        # Attacks3 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 . '->attacks3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Fight history (2/2)'],
        );

        # Fight history (2/2)
        $self->addLabel($grid, '<b>Fight history (2/2)</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Record of things killed (sorted by base string)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Base string', 'text',
            'Number of kills', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'fightVictimStringHash');

        # Add entries/comboboxes for adding new records
        $self->addLabel($grid, 'Base string',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Number of kills',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'fightVictimStringHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($baseString, $count);

            $baseString = $entry->get_text();
            $count = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('fightVictimStringHash', lc($baseString), $count);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'fightVictimStringHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub attacks4Tab {

        # Attacks4 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 . '->attacks4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Interaction history (1/2)'],
        );

        # Interaction history (1/2)
        $self->addLabel($grid, '<b>Interaction history (1/2)</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Record of successful interactions (sorted by main noun - not updated by the Attack'
            . ' task)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Main noun', 'text',
            'Success count', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'interactionVictimHash');

        # Add entries/comboboxes for adding new records
        $self->addLabel($grid, 'Main noun',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Success count',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'interactionVictimHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($noun, $count);

            $noun = $entry->get_text();
            $count = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('interactionVictimHash', $noun, $count);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionVictimHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub attacks5Tab {

        # Attacks5 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 . '->attacks5Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _5',
            ['Interaction history (2/2)'],
        );

        # Interaction history (2/2)
        $self->addLabel($grid, '<b>Interaction history (2/2)</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>Record of successful interactions (sorted by base string)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Base string', 'text',
            'Success count', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV(
            $slWidget,
            scalar (@columnList / 2),
            'interactionVictimStringHash',
        );

        # Add entries/comboboxes for adding new records
        $self->addLabel($grid, 'Base string',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Success count',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'interactionVictimStringHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($baseString, $count);

            $baseString = $entry->get_text();
            $count = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV(
                    'interactionVictimStringHash',
                    lc($baseString),
                    $count,
                );

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'interactionVictimStringHash',
                );
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub affectsTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'A_ffects',
            ['Character affects'],
        );

        # Character affects
        $self->addLabel($grid, '<b>Character affects</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of spells (etc) that currently affect this character</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Affect', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'affectHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Affect',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Value (not in use)',
            7, 10, 8, 9);
        # (Left commented out, in case we want to assign values to the IV's key-value pairs later)
#        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
#           10, 12, 8, 9);
        $self->addEntry($grid, undef, FALSE,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'affectHash',
            9,
            $entry,
        );
        $button->signal_connect('clicked' => sub {

            my $affect = $entry->get_text();

            if ($self->checkEntryIcon($entry)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('affectHash', $affect, undef);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'affectHash');
                $self->resetEntryBoxes($entry);
            }
        });

        # Tab complete
        return 1;
    }

    sub statsTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'S_tats',
            ['Character stats'],
        );

        # Character stats
        $self->addLabel($grid, '<b>Character stats</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of stats for this character and their current values</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Stat', 'text',
            'Value', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Stat',
            1, 4, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            4, 7, 8, 9);

        $self->addLabel($grid, 'Current value',
            7, 10, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'float', 0, undef,
            10, 12, 8, 9);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'statHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($unit, $value);

            $unit = $entry->get_text();
            $value = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('statHash', $unit, $value);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub statusTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'Stat_us',
            ['Status commands'],
        );

        # Status commands
        $self->addLabel($grid, '<b>Status commands</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of commands sent to the world to update the Status task\'s variables</i>',
            1, 12, 1, 2);
        $self->addCheckButton(
            $grid,
            'Send commands as soon as the Status task is initialised',
            'statusCmdFlag',
            TRUE,
            1, 12, 2, 3);

        # Add a simple list
        @columnList = (
            'Command', 'text',
            'How often', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 3, 10);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statusCmdHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Command',
            1, 3, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 10, 11);

        $self->addLabel($grid, 'Sent how often (in seconds):',
            6, 9, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'statusCmdHash',
            11,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($cmd, $time);

            $cmd = $entry->get_text();
            $time = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('statusCmdHash', $cmd, $time);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'statusCmdHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub inventoryTab {

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

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

        # Local variables
        my @columnList;

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

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

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            'In_ventory',
            ['Inventory commands'],
        );

        # Inventory commands
        $self->addLabel($grid, '<b>Inventory commands</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of commands sent to the world to update the Inventory task\'s variables</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Command', 'text',
            'Sent how often', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'inventoryCmdHash');

        # Add entries/comboboxes for adding new patterns
        $self->addLabel($grid, 'Command',
            1, 3, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 10, 11);

        $self->addLabel($grid, 'Sent how often (in seconds):',
            6, 9, 10, 11);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 10, 11);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'inventoryCmdHash',
            11,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($cmd, $time);

            $cmd = $entry->get_text();
            $time = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('inventoryCmdHash', $cmd, $time);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2), 'inventoryCmdHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub objectsTab {

        # Objects tab - called by $self->setupNotebook
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

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

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

        $self->addEntry($grid, 'stage', FALSE,
            3, 6, 9, 10);

        # Start/stop settings
        $self->addLabel($grid, '<b>Start/stop settings</b>',
            7, 13, 0, 1);
        $self->addLabel($grid, 'Start time',
            8, 11, 1, 2);
        $self->addEntry($grid, 'startTime', $editFlag,
            11, 13, 1, 2);
        $self->addLabel($grid, 'Next check time',
            8, 11, 2, 3);
        $self->addEntry($grid, 'checkTime', $editFlag,
            11, 13, 2, 3);
        $self->addLabel($grid, 'End status',
            8, 11, 3, 4);
        if ($editFlag) {

            # These are all the acceptable values for ->endStatus
            @comboList2 = (
                'unlimited',
                'run_for',
                'run_until',
            );

            $self->addComboBox($grid, 'endStatus', \@comboList2, '',
                TRUE,               # No 'undef' value used
                11, 13, 3, 4);

        } else {

            $self->addEntry($grid, 'endStatus', FALSE,
                11, 13, 3, 4);
        }

        $self->addLabel($grid, 'End time',
            8, 11, 4, 5);
        $self->addEntry($grid, 'endTime', $editFlag,
            11, 13, 4, 5);
        $self->addLabel($grid, 'Dependent task',
            8, 11, 5, 6);
        $self->addEntry($grid, 'waitForTask', $editFlag,
            11, 13, 5, 6);

        # Task loop settings
        $self->addLabel($grid, '<b>Task loop settings</b>',
            7, 12, 6, 7);
        $self->addLabel($grid, 'Call interval (secs)',
            8, 11, 7, 8);
        $self->addEntry($grid, 'delayTime', FALSE,
            11, 13, 7, 8);

        # Text-to-speech (TTS) settings
        $self->addLabel($grid, '<b>Text-to-speech settings</b> <i>(see also pages 3-5)</i>',
            7, 13, 8, 9);
        $self->addLabel($grid, 'TTS configuration used',
            8, 11, 9, 10);

        if ($self->editObj->ttsFlag) {

            # Use an editable combobox if TTS allowed in this task...
            @comboList3 = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('ttsObjHash'));
            my $combo = $self->addComboBox($grid, 'ttsConfig', \@comboList3, '',
                FALSE,               # 'undef' value used
                11, 13, 9, 10);

        } else {

            # ...otherwise, use a normal entry
            $self->addEntry($grid, 'ttsConfig', FALSE,
                11, 13, 9, 10);
        }

        # 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) = @_;

        # Local variables
        my (
            $editFlag,
            @comboList,
        );

        # 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',
            [
                'Flags',
                'Window settings - startup',
                'Window settings - general',
                'Window settings - colour',
            ],
        );

        # Flag set to FALSE for current tasks, TRUE otherwise
        $editFlag = $self->ivShow('editConfigHash', 'edit_flag');

        # Flags
        $self->addLabel($grid, '<b>Flags</b>',
            0, 6, 0, 1);
        $self->addCheckButton($grid, 'Jealous (only 1 copy can run)', 'jealousyFlag', FALSE,

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

        # 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'],
        );

        # Status task commands
        $self->addLabel($grid, '<b>Status task commands</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>List of world commands sent by the task periodically</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Command', 'text',
            'Interval (secs)', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'cmdHash');

        # Add entries/comboboxes for adding new commands
        $self->addLabel($grid, 'Command',
            1, 2, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            2, 8, 8, 9);

        $self->addLabel($grid, 'Interval',
            8, 9, 8, 9);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
            9, 12, 8, 9, 4, 4);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'cmdHash',
            9,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($cmd, $value);

            if ($self->checkEntryIcon($entry, $entry2)) {

                $cmd = $entry->get_text();
                $value = $entry2->get_text();

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('cmdHash', $cmd, $value);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'cmdHash');
                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub parametersSystem1Tab {

        # Parameters System1 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 . '->parametersSystem1Tab', @_);
        }

        # Tab setup

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

                    FALSE,
                    $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13,
                );
            }
        });

        # 'Reverse'
        $button7->signal_connect('clicked' => sub {

            my (@ivList, @modList);

            @ivList = $self->getEditHash_listIV('stripInitList');

            if (@ivList) {

                do {

                    my ($package, $hashRef);

                    $package = shift @ivList;
                    $hashRef = shift @ivList;

                    unshift(@modList, $hashRef);
                    unshift(@modList, $package);

                } until (! @ivList);

                $self->ivAdd('editHash', 'stripInitList', \@modList);

                # Refresh the list of strip objects
                $self->stripsTab_refreshList($slWidget, scalar (@columnList / 2), %tempObjHash);
            }
        });

        # 'Reset list'
        $button8->signal_connect('clicked' => sub {

            $self->ivDelete('editHash', 'stripInitList');

            # Refresh the list of strip objects
            $self->stripsTab_refreshList($slWidget, scalar (@columnList / 2), %tempObjHash);

            # Sensitise/desensitise the add buttons, depending on whether the strip object
            #   specified in $comboBox2 is jealous and already in the list
            $self->stripsTab_updateCombo2(
                $comboBox2,
                $button,
                $button2,
                \%comboHash,
                \%tempObjHash,
            );

            # No strip object is selected in the simple list, so reset initialisation widgets
            $self->stripsTab_resetInitWidgets(
                $noStripString, $noneString,
                FALSE,
                $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13,
            );
        });

        # Key/value combobox
        $comboBox3->signal_connect('changed' => sub {

            my $key = $comboBox3->get_active_text();
            if ($key && $key ne $noStripString && $key ne $noneString) {

                # Sensitise/desensitise widgets, depending on whether this key is a flag, or not
                if ($key =~ m/_flag$/) {

                    $self->desensitiseWidgets($entry, $button9, $button11);
                    $self->sensitiseWidgets($button12, $button13);

                } else {

                    $self->sensitiseWidgets($entry, $button9, $button11);
                    $self->desensitiseWidgets($button12, $button13);
                }
            }
        });

        # 'Use value'
        $button9->signal_connect('clicked' => sub {

            my ($number, $key, $value);

            ($number) = $self->getSimpleListData($slWidget, 0);
            $key = $comboBox3->get_active_text();
            $value = $entry->get_text();

            if (defined $number && $key) {

                $self->stripsTab_updateStripList($number, $key, $value);

                # Refresh the list of strip objects, retaining the same selected row
                $self->stripsTab_refreshList($slWidget, scalar (@columnList / 2), %tempObjHash);
                $slWidget->select($number);

                # Reset the entry/combo boxes for visual confirmation that the key/value pair was
                #   added
                $comboBox3->set_active(0);
                $entry->set_text('');
            }
        });

        # 'Use the default setting instead'
        $button10->signal_connect('clicked' => sub {

            my (
                $number, $key, $hashRef,
                @ivList,
            );

            ($number) = $self->getSimpleListData($slWidget, 0);
            $key = $comboBox3->get_active_text();

            if (defined $number && $key) {

                @ivList = $self->getEditHash_listIV('stripInitList');
                $hashRef = $ivList[($number * 2) + 1];
                if (defined $hashRef) {

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


            do {

                my ($package, $hashRef, $string, $tempObj);

                $package = shift @ivList;
                $hashRef = shift @ivList;
                $string = '';
                $tempObj = $tempObjHash{$package};

                if (defined $hashRef) {

                    foreach my $key (sort {lc($a) cmp lc($b)} (keys %$hashRef)) {

                        my $value = $$hashRef{$key};

                        if ($string) {

                            $string .= ', ';
                        }

                        if (! defined $value) {

                            $string .= $key . ':<undef>';

                        } elsif ($key =~ m/_flag$/) {

                            if (! $value) {
                                $string .= $key . ':FALSE';
                            } else {
                                $string .= $key . ':TRUE';
                            }

                        } else {

                            $string .= $key . ':' . $value;
                        }
                    }
                }

                push (@dataList,
                    $count,
                    $axmud::CLIENT->ivShow('customStripHash', $package),
                    $tempObj->jealousyFlag,
                    $string,
                );

                $count++;

            } until (! @ivList);
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub stripsTab_getComboList {

        # Called by $self->stripsTab to populate a combobox
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   An empty list on improper arguments
        #   A list of combobox items otherwise

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

        # Local variables
        my (
            @emptyList, @returnList,
            %constHash, %customHash,
        );

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

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

            return @emptyList;
        }

        # Import the IVs (for convenience)
        %constHash = $axmud::CLIENT->constStripHash;
        %customHash = $axmud::CLIENT->customStripHash;

        # Use everything in GA::Client->customStripHash, but use the built-in strip objects first
        push (@returnList, (sort {lc($a) cmp lc($b)} (values %constHash)));

        foreach my $package (
            sort {lc($customHash{$a}) cmp lc($customHash{$b})} (keys %customHash)
        ) {
            if (! exists $constHash{$package}) {

                push (@returnList, $package, $customHash{$package});
            }
        }

        return @returnList;
    }

    sub stripsTab_updateStripList {

        # Called by $self->stripsTab
        # The ->stripInitList IV is in the form
        #   (package_name, hash_reference, package_name, hash_reference...)
        # This functions modifies an existing hash reference
        #
        # Expected arguments
        #   $number     - The number of the hash reference in the list (first one, $number = 0,
        #                   second one, $number = 1, etc)
        #   $key        - The key to add to the hash reference
        #
        # Optional arguments
        #   $value      - The value to add to the hash reference (can be 'undef')
        #
        # Return values
        #   'undef' improper arguments
        #   1 otherwise

        my ($self, $number, $key, $value, $check) = @_;

        # Local variables
        my (
            $hashRef,
            @ivList,
        );

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

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

        @ivList = $self->getEditHash_listIV('stripInitList');
        $hashRef = $ivList[($number * 2) + 1];

        if (! defined $hashRef || ! %$hashRef) {

            %$hashRef = ($key, $value);

        } else {

            $$hashRef{$key} = $value;
        }

        splice(@ivList, (($number * 2) + 1), 1, $hashRef);

        $self->ivAdd('editHash', 'stripInitList', \@ivList);

        return 1;
    }

    sub stripsTab_updateCombo2 {

        # Called by $self->stripsTab
        # Sensitise/desensitise the add buttons, depending on whether the strip object specified in
        #   the combobox is jealous and is already in the list IV
        #
        # Expected arguments
        #   $comboBox2, $button, $button2
        #                   - The affected widgets
        #   $comboHashRef   - $axmud::CLIENT->customStripHash, reversed and referenced
        #   $tempObjHashRef - Reference to a hash of temporary strip objects (so we can access their
        #                       initialisation settings, etc)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $comboBox2, $button, $button2, $comboHashRef, $tempObjHashRef, $check) = @_;

        # Local variables
        my ($descrip, $package, $tempObj);

        # Check for improper arguments
        if (
            ! defined $comboBox2 || ! defined $button || ! defined $button2
            || ! defined $comboHashRef || ! defined $tempObjHashRef || defined $check
        ) {
            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->stripsTab_updateStripList',
                @_,
            );
        }

        $descrip = $comboBox2->get_active_text();
        if ($descrip) {

            $package = $$comboHashRef{$descrip};
            if ($package) {

                $tempObj = $$tempObjHashRef{$package};
                if ($tempObj) {

                    # Sensitise/desensitise the add buttons, depending on whether the strip object
                    #   is jealous and is already in the list
                    if (! $tempObj->jealousyFlag || ! $self->stripsTab_checkPackage($package)) {
                        $self->sensitiseWidgets($button, $button2)
                    } else {
                        $self->desensitiseWidgets($button, $button2)
                    }
                }
            }
        }

        return 1;
    }

    sub stripsTab_setInitWidgets {

        # Called by $self->stripsTab
        # Sets and sensitises/desensitises the initialisation widgets when a strip object in the
        #   simple list is selected
        #
        # Expected arguments
        #   $number         - The number of the selected (matches the position of a two-element
        #                       group in $self->editObj->stripInitList)
        #   $noStripString, $noneString
        #                   - Text to use in the comboboxes
        #   $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13
        #                   - List of widgets to desensitise
        #   %tempObjHash    - A hash of temporary strip objects, one for each package name, so we
        #                       can access their IVs
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my (
            $self, $number, $noStripString, $noneString, $entry, $comboBox3, $button9, $button10,
            $button11, $button12, $button13, %tempObjHash,
        ) = @_;

        # Local variables
        my (
            $package, $tempObj,
            @ivList,
        );

        # Check for improper arguments
        if (
            ! defined $number || ! defined $noStripString || ! defined $noneString
            || ! defined $entry || ! defined $comboBox3 || ! defined $button9
            || ! defined $button10 || ! defined $button11 || ! defined $button12
            || ! defined $button13 || ! %tempObjHash
        ) {
            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->stripsTab_setInitWidgets',
                @_,
            );
        }

        @ivList = $self->getEditHash_listIV('stripInitList');
        $package = $ivList[($number * 2)];
        $tempObj = $tempObjHash{$package};

        if (! $tempObj || ! $tempObj->initHash) {

            # Reset widgets
            if (! $tempObj) {

                $self->stripsTab_resetInitWidgets(
                    $noStripString, $noneString,
                    FALSE,
                    $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13,
                );

            } else {

                $self->stripsTab_resetInitWidgets(
                    $noStripString, $noneString,
                    TRUE,
                    $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13,
                );
            }

        } else {

            # Set widgets
            $entry->set_text('');

            $self->sensitiseWidgets(
                $comboBox3, $entry,
                $button9, $button10, $button11, $button12, $button13,
            );

            $self->resetComboBox(
                $comboBox3,
                (sort {lc($a) cmp lc($b)} ($tempObj->ivKeys('initHash'))),
            );
        }

        return 1;
    }

    sub stripsTab_resetInitWidgets {

        # Called by $self->stripsTab
        # Resets and desensitises the initialisation widgets when a strip object in the simple list
        #   is unselected, or when a strip object with an empty initialisation hash is selected
        #
        # Expected arguments
        #   $noStripString, $noneString
        #                   - Text to use in the comboboxes
        #   $flag           - Flag set to TRUE if a strip object is selected in the simple list,
        #                       FALSE if not
        #   $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13
        #                   - List of widgets to desensitise
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my (
            $self, $noStripString, $noneString, $flag, $entry, $comboBox3, $button9, $button10,
            $button11, $button12, $button13, $check,
        ) = @_;

        # Check for improper arguments
        if (
            ! defined $noStripString || ! defined $noneString || ! defined $flag || ! defined $entry
            || ! defined $comboBox3 || ! defined $button9 || ! defined $button10
            || ! defined $button11 || ! defined $button12 || ! defined $button13
            || defined $check
        ) {
            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->stripsTab_resetInitWidgets',
                @_,
            );
        }

        # Reset widgets. Using some text in the combo, rather than nothing, reduces widget re-sizing
        $entry->set_text('');

        $self->desensitiseWidgets(
            $entry, $comboBox3, $button9, $button10, $button11, $button12, $button13,
        );

        # (Reset combo last, otherwise the ->signal_connect for the combo desensitises widgets,
        #   which are re-sensitised by this ->signal_connect)
        if (! $flag) {
            $self->resetComboBox($comboBox3, $noStripString);
        } else {
            $self->resetComboBox($comboBox3, $noneString);
        }

        return 1;
    }

    sub stripsTab_checkPackage {

        # Called by $self->stripsTab_updateCombo2
        # Checks whether a strip object package name exists in the ->stripInitList IV, or not
        #
        # Expected arguments
        #   $package    - The package name to check, e.g. 'Games::Axmud::Strip::MenuBar'
        #
        # Return values
        #   'undef' on improper arguments or if the package name is not in ->stripInitList
        #   1 if the package name is found in ->stripInitList

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

        # Local variables

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

        # Resets the simple list displayed by $self->file2Tab
        #
        # Expected arguments
        #   $slWidget       - The GA::Obj::SimpleList
        #   $columns        - The number of columns
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

        # Local variables
        my (
            @dataList,
            %ivHash,
        );

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

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

        # Import the hash
        %ivHash = $self->getEditHash_hashIV('initHash');

        # Compile the simple list data
        foreach my $key (sort {lc($a) cmp lc($b)} (keys %ivHash)) {

            my $value = $ivHash{$key};

            if ($key =~ m/_flag$/) {

                if (! $value) {
                    $value = 'FALSE';
                } else {
                    $value = 'TRUE';
                }

            } elsif (! defined $value) {

                $value = '<undef>';
            }

            push (@dataList,
                $key,
                $value,
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub initTab_updateWidgets {

        # Called by $self->stripsTab
        # Sensitises/desensitises widgets depending on which item is the active one in the combobox
        #
        # Expected arguments
        #   $key        - The active item in the combobox
        #   $entry, $button, $button2, $button3, $button4, $button5
        #               - The widgets to update
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $key, $entry, $button, $button2, $button3, $button4, $button5, $check) = @_;

        # Check for improper arguments
        if (
            ! defined $key || ! defined $entry || ! defined $button || ! defined $button2
            || ! defined $button3 || ! defined $button4 || ! defined $button5 || defined $check
        ) {
            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->initTab_updateWidgets',
                @_,
            );
        }

        if ($key =~ m/_flag$/) {

            $self->sensitiseWidgets($button4, $button5);
            $self->desensitiseWidgets($entry, $button, $button2, $button3);

        } else {

            $self->sensitiseWidgets($entry, $button, $button2, $button3);
            $self->desensitiseWidgets($button4, $button5);
        }

        return 1;
    }

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

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

    # (Non-standard IVs for this 'edit' window)
}

{ package Games::Axmud::EditWin::Workspace;

    use strict;
    use warnings;
#   use diagnostics;

    use Glib qw(TRUE FALSE);

    our @ISA = qw(
        Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
        Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
    );

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

#   sub new {}                  # Inherited from GA::Generic::ConfigWin

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

            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub model6Tab {

        # model6 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 . '->model6Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _6',
            ['List of teleport destinations'],
        );

        # List of teleport destinations
        $self->addLabel($grid, '<b>List of teleport destinations</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>List of world commands that are used by the \';teleport\' client command (see'
            . ' \';help teleport\')</i>',
            1, 12, 1, 2,
        );

        # Add a simple list
        @columnList = (
            'Room name', 'text',
            'World command used to get there', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'teleportHash');

        # Add entries/comboboxes for adding new variables
        $self->addLabel($grid, 'Room name',
            1, 3, 8, 9);
        my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 6, 8, 9);

        $self->addLabel($grid, 'Equivalent world command',
            1, 3, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            3, 12, 9, 10);

        # Add standard editing buttons to the simple list
        my $button = $self->addSimpleListButtons_hashIV(
            $grid,
            $slWidget,
            'teleportHash',
            10,
            $entry, $entry2,
        );
        $button->signal_connect('clicked' => sub {

            my ($room, $cmd);

            $room = $entry->get_text();
            $cmd = $entry2->get_text();

            if ($self->checkEntryIcon($entry, $entry2)) {

                # Add a new key-value pair
                $self->modifyEditHash_hashIV('teleportHash', $room, $cmd);

                # Refresh the simple list and reset entry boxes
                $self->refreshList_hashIV(
                    $slWidget,
                    scalar (@columnList / 2),
                    'teleportHash',
                );

                $self->resetEntryBoxes($entry, $entry2);
            }
        });

        # Tab complete
        return 1;
    }

    sub settingsTab {

        # Settings tab - called by $self->setupNotebook
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

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

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

        my $button6 = $self->addButton(
            $grid,
            'Move to bottom',
            'Move this flag down the priority list',
            undef,
            9, 12, 10, 11,
            TRUE,               # Irreversible
        );

        my $button7 = $self->addButton(
            $grid,
            'Sort by priority',
            'Sort room flags by priority',
            undef,
            1, 4, 11, 12,
        );

        my $button8 = $self->addButton(
            $grid,
            'Sort by filter',
            'Sort room flags by filter',
            undef,
            4, 8, 11, 12,
        );

        my $button11 = $self->addButton(
            $grid,
            'Sort alphabetically',
            'Sort room flags alphabetically',
            undef,
            8, 12, 11, 12,
        );

        my $button9 = $self->addButton(
            $grid,
            'Add custom flag',
            'Add a custom room flag',
            undef,
            1, 4, 12, 13,
        );

        my $button10 = $self->addButton(
            $grid,
            'Delete custom flag',
            'Delete a custom room flag',
            undef,
            4, 8, 12, 13,
        );
        $button10->set_sensitive(FALSE);


        my $button12 = $self->addButton(
            $grid,
            'Restore defaults',
            'Restore default flag colours/priorities',
            undef,
            8, 12, 12, 13,
            TRUE,               # Irreversible
        );

        # Signal connect - combobox
        $combo->signal_connect('changed' => sub {

            my $descrip = $combo->get_active_text();

            # (Set the IV immediately, so ->roomFlags1Tab_refreshList can use it)
            $self->editObj->set_roomFlagShowMode($descripHash{$descrip});

            # Reset widgets
            $self->roomFlags1Tab_refreshList($slWidget, scalar (@columnList / 2), $sortMode);
            $entry->set_text('');
            $entry2->set_text('');
            $entry3->set_text('');
            $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, undef);
            $canvasObj2 = $self->fillSimpleCanvas($canvas2, $canvasObj2, undef);
        });

        # Signal connect - 'Change' button
        $button->signal_connect('clicked' => sub {

            my ($posn, $name, $flagObj, $rgb);

            ($posn) = $slWidget->get_selected_indices();
            $name = $entry->get_text();
            if ($name) {

                $flagObj = $self->editObj->ivShow('roomFlagHash', $name);
            }

            if ($flagObj) {

                # Prompt the user to select a new colour
                $rgb = $self->showColourSelectionDialogue(
                    'Set \'' . $name . '\' flag colour',
                    $flagObj->colour,
                );
            }

            if ($rgb) {

                # Update the room flag object
                $flagObj->ivPoke('colour', $rgb);
                # Update widgets to show the change
                $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $rgb);
                $entry2->set_text($rgb);

                # Update the simple list
                $self->roomFlags1Tab_refreshList(
                    $slWidget,
                    scalar (@columnList / 2),
                    $sortMode,
                );

                # Re-select the same line (for visual clarity)
                $slWidget->select($posn);
            }
        });

        # Signal connect - 'Use default' button
        $button2->signal_connect('clicked' => sub {

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

            $entry2->set_sensitive(FALSE);
            $entry3->set_sensitive(FALSE);
            $entry4->set_sensitive(FALSE);
            $entry5->set_sensitive(FALSE);
        }

        # Tab complete
        return 1;
    }

    sub reservedTab {

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

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

        # Local variables
        my (
            $comboTitle,
            @columnList, @comboList, @comboList2,
        );

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

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

        # Tab setup
        # N.B. No sub-headings
        my $grid = $self->addTab($self->notebook, '_Reserved windows');

        # Set a combo title now so we don't accidentally use it
        $comboTitle = 'Select a task:';

        # Reserved windows
        $self->addLabel($grid, '<b>Reserved windows</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Types of window for which this zone is reserved</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Window/task name', 'text',
            'Window type', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 8);

        # Initialise the list
        $self->refreshList_hashIV($slWidget, scalar (@columnList / 2), 'reservedHash');

        # Add entries/comboboxes for adding windows (zonemodels can't be edited if the parent
        #   zonemap is a current zonemap in any workspace grid)
        if (! $axmud::CLIENT->checkCurrentZonemap($self->editObj->zonemapObj->name)) {

            $self->addLabel($grid, 'Window type',
                1, 3, 8, 9);

            @comboList = ('main', 'map', 'protocol', 'fixed', 'custom', 'external');
            my $combo = $self->addComboBox($grid, undef, \@comboList, '',
                TRUE,               # No 'undef' value used
                3, 6, 8, 9);

            $self->addLabel($grid, 'Window name',
                1, 3, 9, 10);
            my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
                3, 6, 9, 10);
            $self->addLabel($grid, '(or) task name',
                6, 9, 9, 10);

            @comboList2 = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('taskPackageHash'));
            my $combo2 = $self->addComboBox($grid, undef, \@comboList2, $comboTitle,
                FALSE,              # 'undef' value allowed
                9, 12, 9, 10);

            # Add standard editing buttons to the simple list
            my $button = $self->addSimpleListButtons_hashIV(
                $grid,
                $slWidget,
                'reservedHash',
                10,
                $entry,
            );
            $button->signal_connect('clicked' => sub {

                my ($type, $text, $text2, $name);

                $type = $combo->get_active_text();
                if ($type eq 'main' || $type eq 'map') {

                    # Name is the same as the type
                    $name = $type;

                } else {

                    $text = $entry->get_text();
                    $text2 = $combo2->get_active_text();

                    if ($text2 && $text2 ne $comboTitle) {
                        $name = $text2;
                    } elsif ($self->checkEntryIcon($entry)) {
                        $name = $text;
                    }
                }

                if (defined $name) {

                    # Add a new key-value pair
                    $self->modifyEditHash_hashIV('reservedHash', $name, $type);

                    # Refresh the simple list and reset entry boxes
                    $self->refreshList_hashIV(



( run in 1.277 second using v1.01-cache-2.11-cpan-8dfa8b56332 )