Games-Axmud

 view release on metacpan or  search on metacpan

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

            # Auto-backup file type: 'tar' to use a .tgz file, 'zip' to use a .zip file, 'default'
            #   to use a convenient file type for the system (.tgz for Linux/*BSD, .zip for MS
            #   Windows)
            autoBackupFileType          => 'default',   # [config]
            # Flag set to TRUE if the time should be appended to auto-backups and to manual backups
            #   using the ';backupdata' command
            autoBackupAppendFlag        => FALSE,       # [config]
            #
            # Axmud retains information about the config and data files it has loaded/saved since
            #   the script started. Each file that can be loaded or saved is handled by a
            #   GA::Obj::File
            # There are eleven types of file object. Each file object has a name that is the same as
            #   its type (except for 'worldprof' file objects, whose name is the same as the world
            #   profile to which it corresponds)
            # The types of data files Axmud uses are:
            #   File type    Standard directory                              Unique name     Stored
            #   'config'     <SCRIPT_DIR>/axmud.conf                         config          Client
            #   'worldprof'  <SCRIPT_DIR>/data/worlds/<WORLD>/worldprof.axm  WORLD           Both
            #   'otherprof'  <SCRIPT_DIR>/data/worlds/<WORLD>/otherprof.axm  otherprof       Session
            #   'worldmodel' <SCRIPT_DIR>/data/worlds/<WORLD>/worldmodel.axm worldmodel      Session
            #   'tasks'      <SCRIPT_DIR>/data/tasks.axm                     tasks           Client
            #   'scripts'    <SCRIPT_DIR>/data/scripts.axm                   scripts         Client
            #   'contacts'   <SCRIPT_DIR>/data/contacts.axm                  contacts        Client
            #   'dicts'      <SCRIPT_DIR>/data/dicts.axm                     dicts           Client
            #   'toolbar'    <SCRIPT_DIR>/data/toolbar.axm                   toolbar         Client
            #   'usercmds'   <SCRIPT_DIR>/data/usercmds.axm                  usercmds        Client
            #   'zonemaps'   <SCRIPT_DIR>/data/zonemaps.axm                  zonemaps        Client
            #   'winmaps'    <SCRIPT_DIR>/data/winmaps.axm                   winmaps         Client
            #   'tts'        <SCRIPT_DIR>/data/tts.axm                       tts             Client
            # (WORLD is replaced by the name of the associated world profile)
            #
            # This GA::Client has a registry of file objects; each GA::Session also has its own one
            # The only overlap is for 'worldprof' files. The GA::Client stores all 'worldprof' file
            #   objects; the GA::Session stores only the 'worldprof' file object for its current
            #   world profile (if any)
            # In GA::Client's registry, there are any number of 'worldprof' file objects, but only
            #   one instance of the other types of file object. In GA::Session's registry, there is
            #   one 'worldprof' file object, any number of 'otherprof' file objects, and one
            #   'worldmodel file object
            #
            # NB Every file object has a ->modifyFlag which is set to TRUE whenever its data in
            #   memory has changed, which means the file needs to be saved. The flag is set back to
            #   FALSE when the file is saved (or loaded, overwritng the data in memory)
            # It's possible to call the GA::Obj::File->set_modifyFlag method directly, but the
            #   easier way to do it, is to call GA::Client->setModifyFlag() - for file objects
            #   stored here - or GA::Session->setModifyFlag() - for file objects stored in the
            #   session's file object registry
            #
            # Registry hash of file objects, in the form
            #   $fileObjHash{unique_name} = blessed_reference_to_file_object
            fileObjHash                 => {},
            # A shortcut to the blessed reference of the 'config' file object (very useful for all
            #   the parts of the code that need to set the file object's ->modifyFlag)
            configFileObj               => undef,
            # Every time the 'config' file is loaded, the list of world profiles it contains is
            #   copied into this list (empty if the 'config' file doesn't list any world
            #   profile). This list will become obsolete as soon as profiles are created/destroyed/
            #   loaded, so it shouldn't be used for any other purpose
            configWorldProfList         => [],

            # GA::Session->setupProfiles can optionally create a 'Loading...' popup window by
            #   calling GA::Generic::Win->showBusyWin, if the file(s) it's loading are above a
            #   certain size. It's up to the calling function to close the popup window when all
            #   load operations are complete
            # The standard file size above which a 'Loading...' popup can be shown, if some part of
            #   the Axmud code wants it
            constLargeFileSize          => 5_000_000,   # (roughly 5MB)

            # Large world models can cause 'out of memory' errors on low-spec machines. The
            #   problem is not that the world model takes up too much memory, but that the Perl
            #   Storable module struggles to load very large files into memory
            # Since v1.1.529, the world model is saved either as a monolithic file (as previously),
            #   or as multiple files, all of which are handled by a single file object
            # Flag set to TRUE if we should allow large world models to be saved as multiple files,
            #   FALSE if world models should always be saved as a single monolithic file
            allowModelSplitFlag         => TRUE,        # [config]
            # If multiple files are allowed, this value sets the maximum size of the world model
            #   for which a monolithic file is still used. It also sets the size of multiple files,
            #   when they are used. The value corresponds to a number of model objects (regions,
            #   rooms etc) or exit model objects
            # The constant (default) value
            constModelSplitSize         => 5000,
            # The value actually used (must be an integer, minimum value is 1000)
            modelSplitSize              => 5000,

            # Plugins
            # -------

            # Registry list of plugins (.pm files) that should be loaded as plugins at startup. Each
            #   item in the list is the full file path
            initPluginList              => [],          # [config]
            # Registry hash of plugins (.pm files) that have been loaded, in the form
            #   $pluginHash{plugin_name} = blessed_reference_to_plugin_object
            pluginHash                  => {},
            # Registry hash of client commands that are created when a plugin is loaded, in the form
            #   $pluginCmdHash{command_name} = plugin_name
            # ...where 'command_name' matches a key in $self->clientCmdHash (e.g. 'about') and
            #   'plugin_name' matches a key in $self->pluginHash
            # NB If a (built-in) client command of the same name already exists, it is replaced. If
            #   the plugin is later disabled, the original command is restored. If the plugin is
            #   then re-enabled, the original command is again replaced, and so on. This works very
            #   well as long as the plugins you load don't themselves have client commands of the
            #   same name, so try to avoid that
            pluginCmdHash               => {},
            # Registry hash of tasks that are added when a plugin is loaded, in the form
            #   $pluginTaskHash{task_name} = plugin_name
            # ...where 'task_name' matches the task's standard name (a key in
            #   $self->taskPackageHash) and 'plugin_name' matches a key in $self->pluginHash
            # NB Tasks with the same name as existing tasks (built-in, or from a plugin that's
            #   already been loaded) will not be added
            pluginTaskHash              => {},
            # Registry hash of 'grid' windows added by the plugin. If the plugin is disabled, the
            #   windows are closed (and, for 'main' windows, all sessions in the 'main' windows are
            #   terminated). Hash in the form
            #   $pluginGridWinHash{package_name} = plugin_name
            pluginGridWinHash           => {},
            # Registry hash of 'free' windows added by the plugin (not including 'dialogue'
            #   windows). If the plugin is disabled, the windows are closed. Hash in the form
            #   $pluginFreeWinHash{package_name} = plugin_name
            pluginFreeWinHash           => {},
            # Registry hash of strip objects added by the plugin. Strip objects are always
            #   available, even if their parent plugin is disabled. Hash in the form
            #   $pluginStripObjHash{package_name} = plugin_name
            pluginStripObjHash          => {},
            # Registry hash of table objects added by the plugin. Table objects are always

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


            # Constant list of IP lookup servers that provide the user's IP address (tested
            #   September 2020)
            constIPLookupList           => [
                'http://ifconfig.me/ip',
                'https://ifconfig.co/ip',
                'https://api.ipify.org',
                'http://icanhazip.com/',
                'https://ip.protenus.com/ip',
            ],
            # Customisable list (in case, in the far future, none of them are available)
            ipLookupList                => [],          # [config] Set below
            # The user's current IP address. To prevent unnecessary delays, the user's IP address is
            #   only detected when required (for example, by the Chat task, or by
            #   GA::Session->processNewEnvironData). When $self->ipv4Get is called and the user's
            #   IP address is successfully retrieved, it is stored here. Subsequent calls to to
            #   ->ipv4Get return this value
            # The value is not stored in the config file, so if the user switches to a different IP
            #   address while Axmud is running, the old IP address continues to be used (unless the
            #   user invokes the ;forcelookup command)
            currentIP                   => undef,

            # Lines in help files should be longer than 80 characters long
            constHelpCharLimit          => 80,          # [config]

            # The system time, in seconds, at which the client started
            startTime                   => undef,
            # The date/time at which the client started
            startClock                  => undef,
            startDate                   => undef,
            startClockString            => undef,
            startDateString             => undef,

            # When text is received from the world that doesn't end in a newline character, we wait
            #   a short time before treating it as a prompt. If nothing else is received in that
            #   time, it's a prompt.
            # Constant default time to wait
            constPromptWaitTime         => 0.5,
            # The time to wait (in seconds, minimum value 0.1, maximum value 5)
            promptWaitTime              => undef,       # [config] Set below
            # At the start of a session, how long to wait for the character to login before showing
            #   a reminder message
            # Constant default time to wait
            constLoginWarningTime       => 60,
            # The time to wait (in seconds, minimum value 0 for 'immediately')
            loginWarningTime            => undef,       # [config] Set below

            # Toolbar buttons in the 'main' and automapper windows are created with labels. On most
            #   Linux systems, the labels are only visible in a drop-down menu if there are too
            #   many buttons in the toolbar, but on other systems (including MS Windows), the
            #   labels are displayed beneath the buttons (which we don't want). Users can toggle
            #   this flag to suit their own system
            # Flag set to TRUE if toolbar buttons should have labels, FALSE otherwise
            toolbarLabelFlag            => undef,       # [config] Set below
            # Some 'edit'/'pref' windows use the irreversible icon (stored as the file
            #   /icons/system/irreversible.png) on buttons to show that stored data will be
            #   modified immediately. However, on some (Linux) systems the icon isn't currently
            #   visible. Flag set to TRUE if an icon should be drawn, FALSE if an asterisk should be
            #   drawn instead
            irreversibleIconFlag        => FALSE,       # [config]
            # Flag set to TRUE if the popup window created by GA::Generic::Win->showBusyWin should
            #   not be shown at all; FALSE if it can be shown (when required)
            allowBusyWinFlag            => TRUE,        # [config]
            # Flag set to FALSE if system messages should never be displayed in a session's 'main'
            #   window, but redirected to the Session Console window; TRUE if the session should
            #   decide for itself which of those to do
            mainWinSystemMsgFlag        => TRUE,       # [config]
            # Flag set to TRUE if a session's 'main' window urgency hint should be set, when text
            #   is received from the world
            mainWinUrgencyFlag          => FALSE,       # [config]
            # Flag set to TRUE if tooltips should be shown in session's default tab
            mainWinTooltipFlag          => TRUE,        # [config]

            # Calls to $self->commify can modify a long number like 1000000 into something more
            #   readable, like 1,000,000 (currently, only used by the Status task, but it's
            #   available to any code)
            # The default mode to use when converting numbers with a call to $self->commify
            #   'none' - don't use commas (1000000)
            #   'comma' - use commas (1,000,000)
            #   'europe' - use European-style full stops/periods (1.000.000)
            #   'brit' - use British-style spaces (1 000 000)
            #   'underline' - use underlines (1_000_000)
            commifyMode                 => 'none',      # [config]

            # Flag set to TRUE if the session's 'main' window urgency hint should be set once, when
            #   the next text is received from the world; as soon as text is received, the flag is
            #   set back to FALSE.
            tempUrgencyFlag             => FALSE,
            # Flag set to TRUE if a sound effect should be played, when the next text is received
            #   from the world; as soon as text is received, the flag is set back to FALSE
            tempSoundFlag               => FALSE,

            # Regexes used to recognise valid web links
            constUrlRegex               => $urlRegex,
            constShortUrlRegex          => $shortRegex,
            # Flag set to TRUE if GA::Session->extractClickLinks should use both
            #   $self->constUrlRegex and ->constShortUrlRegex, set to FALSE if it should only use
            #   ->constUrlRegex
            shortUrlFlag                => TRUE,
            # Regex used to recognise valid email addresses
            constEmailRegex             => $emailRegex,

            # IV set briefly by private code (not included in the public release) which creates a
            #   set of pre-configured worlds in the /items/worlds directory. When set,
            #   ';exportfiles' and ';exportdata' save a file to a specific sub-directory, not to a
            #   directory specified by the user. Set to 'undef' at all other times
            privConfigAllWorld          => undef,

            # Benchmarking IVs
            # ----------------

            # Provides on-the-fly benchmarking of Axmud processes
            # Call $self->benchMark to set a start time, and $self->stopBenchMark to set a stop
            #   time. The difference between the two is used to set the list IVs
            # The start time (matches the system time); set by $self->benchMark and reset by
            #   ->stopBenchMark
            benchMarkTime               => undef,
            # The last 10 and 100 benchmark times, used to provide an average (in microseconds),
            #   which is written to the terminal
            benchMarkShortList          => [],
            benchMarkLongList           => [],



( run in 1.149 second using v1.01-cache-2.11-cpan-364913b4093 )